@pie-element/mc-populated-blank 0.2.13 → 0.3.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/configure.js +2 -0
  3. package/dist/author/index.d.ts +0 -1
  4. package/dist/author/index.js +1235 -1092
  5. package/dist/author/index.js.map +1 -1
  6. package/dist/browser/author/index.js +50 -0
  7. package/dist/browser/author/index.js.map +1 -0
  8. package/dist/browser/client-BAfWqkS6.js +2358 -0
  9. package/dist/browser/client-BAfWqkS6.js.map +1 -0
  10. package/dist/browser/controller/index.js +219 -0
  11. package/dist/browser/controller/index.js.map +1 -0
  12. package/dist/browser/delivery/index.js +1059 -0
  13. package/dist/browser/delivery/index.js.map +1 -0
  14. package/dist/browser/layoutLimits-ATKOwLHb.js +42 -0
  15. package/dist/browser/layoutLimits-ATKOwLHb.js.map +1 -0
  16. package/dist/browser/print/index.js +125 -0
  17. package/dist/browser/print/index.js.map +1 -0
  18. package/dist/controller/defaults.d.ts +0 -2
  19. package/dist/controller/index.d.ts +0 -3
  20. package/dist/controller/index.js +0 -2
  21. package/dist/controller/index.js.map +1 -1
  22. package/dist/delivery/computeAudioMode.d.ts +0 -1
  23. package/dist/delivery/computeChoiceCorrectness.d.ts +0 -1
  24. package/dist/delivery/computeDisplayState.d.ts +0 -1
  25. package/dist/delivery/computeLayoutProfile.d.ts +0 -1
  26. package/dist/delivery/computeLayoutStyle.d.ts +0 -2
  27. package/dist/delivery/index.d.ts +0 -1
  28. package/dist/delivery/index.js +1527 -1584
  29. package/dist/delivery/index.js.map +1 -1
  30. package/dist/delivery/variant-css-map.d.ts +0 -1
  31. package/dist/index.d.ts +0 -1
  32. package/dist/index.iife.d.ts +0 -3
  33. package/dist/index.iife.js +14 -15
  34. package/dist/index.js +1527 -1584
  35. package/dist/index.js.map +1 -1
  36. package/dist/print/index.d.ts +0 -1
  37. package/dist/print/index.js +1414 -1270
  38. package/dist/print/index.js.map +1 -1
  39. package/dist/runtime-support.d.ts +12 -0
  40. package/dist/runtime-support.js +14 -0
  41. package/dist/runtime-support.js.map +1 -0
  42. package/dist/shared/layoutLimits.d.ts +0 -1
  43. package/dist/shared/types.d.ts +9 -2
  44. package/module/print.js +2312 -0
  45. package/module/print.js.map +1 -0
  46. package/package.json +40 -8
  47. package/dist/author/index.d.ts.map +0 -1
  48. package/dist/controller/defaults.d.ts.map +0 -1
  49. package/dist/controller/index.d.ts.map +0 -1
  50. package/dist/delivery/computeAudioMode.d.ts.map +0 -1
  51. package/dist/delivery/computeChoiceCorrectness.d.ts.map +0 -1
  52. package/dist/delivery/computeDisplayState.d.ts.map +0 -1
  53. package/dist/delivery/computeLayoutProfile.d.ts.map +0 -1
  54. package/dist/delivery/computeLayoutStyle.d.ts.map +0 -1
  55. package/dist/delivery/index.d.ts.map +0 -1
  56. package/dist/delivery/variant-css-map.d.ts.map +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/index.iife.d.ts.map +0 -1
  59. package/dist/print/index.d.ts.map +0 -1
  60. package/dist/shared/layoutLimits.d.ts.map +0 -1
  61. package/dist/shared/types.d.ts.map +0 -1
@@ -1,16 +1,16 @@
1
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.56.8/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.5/node_modules/svelte/src/constants.js
7
+ //#region ../../../node_modules/.bun/svelte@5.56.8/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.5/node_modules/svelte/src/internal/shared/utils.js
13
+ //#region ../../../node_modules/.bun/svelte@5.56.8/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.129.0/helpers/typeof.js
50
+ //#region \0@oxc-project+runtime@0.139.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.129.0/helpers/toPrimitive.js
60
+ //#region \0@oxc-project+runtime@0.139.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.129.0/helpers/toPropertyKey.js
72
+ //#region \0@oxc-project+runtime@0.139.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.129.0/helpers/defineProperty.js
78
+ //#region \0@oxc-project+runtime@0.139.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,
@@ -114,6 +114,10 @@ var ERROR_VALUE = 1 << 23;
114
114
  var STATE_SYMBOL = Symbol("$state");
115
115
  var LEGACY_PROPS = Symbol("legacy props");
116
116
  var LOADING_ATTR_SYMBOL = Symbol("");
117
+ var ATTRIBUTES_CACHE = Symbol("attributes");
118
+ var CLASS_CACHE = Symbol("class");
119
+ var STYLE_CACHE = Symbol("style");
120
+ var TEXT_CACHE = Symbol("text");
117
121
  /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
118
122
  var STALE_REACTION = new class StaleReactionError extends Error {
119
123
  constructor(..._args) {
@@ -124,7 +128,7 @@ var STALE_REACTION = new class StaleReactionError extends Error {
124
128
  }();
125
129
  var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
126
130
  //#endregion
127
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/errors.js
131
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/errors.js
128
132
  /**
129
133
  * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
130
134
  * @returns {never}
@@ -235,7 +239,7 @@ function svelte_boundary_reset_noop() {
235
239
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
236
240
  }
237
241
  //#endregion
238
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/hydration.js
242
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/hydration.js
239
243
  /** @import { TemplateNode } from '#client' */
240
244
  /**
241
245
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -314,7 +318,7 @@ function read_hydration_instruction(node) {
314
318
  return node.data;
315
319
  }
316
320
  //#endregion
317
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/equality.js
321
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/equality.js
318
322
  /** @import { Equals } from '#client' */
319
323
  /** @type {Equals} */
320
324
  function equals(value) {
@@ -333,13 +337,13 @@ function safe_equals(value) {
333
337
  return !safe_not_equal(value, this.v);
334
338
  }
335
339
  //#endregion
336
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/flags/index.js
340
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/flags/index.js
337
341
  /** True if experimental.async=true */
338
342
  var async_mode_flag = false;
339
343
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
340
344
  var legacy_mode_flag = false;
341
345
  //#endregion
342
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/context.js
346
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/context.js
343
347
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
344
348
  /** @type {ComponentContext | null} */
345
349
  var component_context = null;
@@ -391,7 +395,7 @@ function is_runes() {
391
395
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
392
396
  }
393
397
  //#endregion
394
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/task.js
398
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/task.js
395
399
  /** @type {Array<() => void>} */
396
400
  var micro_tasks = [];
397
401
  function run_micro_tasks() {
@@ -434,6 +438,7 @@ function handle_error(error) {
434
438
  * @param {Effect | null} effect
435
439
  */
436
440
  function invoke_error_boundary(error, effect) {
441
+ if (effect !== null && (effect.f & 16384) !== 0) return;
437
442
  while (effect !== null) {
438
443
  if ((effect.f & 128) !== 0) {
439
444
  if ((effect.f & 32768) === 0) throw error;
@@ -449,7 +454,7 @@ function invoke_error_boundary(error, effect) {
449
454
  throw error;
450
455
  }
451
456
  //#endregion
452
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/status.js
457
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/status.js
453
458
  /** @import { Derived, Signal } from '#client' */
454
459
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
455
460
  /**
@@ -468,7 +473,7 @@ function update_derived_status(derived) {
468
473
  else set_signal_status(derived, MAYBE_DIRTY);
469
474
  }
470
475
  //#endregion
471
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/utils.js
476
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/utils.js
472
477
  /** @import { Derived, Effect, Value } from '#client' */
473
478
  /**
474
479
  * @param {Value[] | null} deps
@@ -496,7 +501,7 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
496
501
  set_signal_status(effect, CLEAN);
497
502
  }
498
503
  //#endregion
499
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/store.js
504
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/store.js
500
505
  /**
501
506
  * We set this to `true` when updating a store so that we correctly
502
507
  * schedule effects if the update takes place inside a `$:` effect
@@ -526,1375 +531,1503 @@ function capture_store_binding(fn) {
526
531
  }
527
532
  }
528
533
  //#endregion
529
- //#region \0@oxc-project+runtime@0.129.0/helpers/checkPrivateRedeclaration.js
534
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
535
+ /**
536
+ * @template T
537
+ * @param {() => T} fn
538
+ */
539
+ function without_reactive_context(fn) {
540
+ var previous_reaction = active_reaction;
541
+ var previous_effect = active_effect;
542
+ set_active_reaction(null);
543
+ set_active_effect(null);
544
+ try {
545
+ return fn();
546
+ } finally {
547
+ set_active_reaction(previous_reaction);
548
+ set_active_effect(previous_effect);
549
+ }
550
+ }
551
+ //#endregion
552
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/reactivity/create-subscriber.js
553
+ /**
554
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
555
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
556
+ *
557
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
558
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
559
+ *
560
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
561
+ *
562
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
563
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
564
+ *
565
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
566
+ *
567
+ * ```js
568
+ * import { createSubscriber } from 'svelte/reactivity';
569
+ * import { on } from 'svelte/events';
570
+ *
571
+ * export class MediaQuery {
572
+ * #query;
573
+ * #subscribe;
574
+ *
575
+ * constructor(query) {
576
+ * this.#query = window.matchMedia(`(${query})`);
577
+ *
578
+ * this.#subscribe = createSubscriber((update) => {
579
+ * // when the `change` event occurs, re-run any effects that read `this.current`
580
+ * const off = on(this.#query, 'change', update);
581
+ *
582
+ * // stop listening when all the effects are destroyed
583
+ * return () => off();
584
+ * });
585
+ * }
586
+ *
587
+ * get current() {
588
+ * // This makes the getter reactive, if read in an effect
589
+ * this.#subscribe();
590
+ *
591
+ * // Return the current state of the query, whether or not we're in an effect
592
+ * return this.#query.matches;
593
+ * }
594
+ * }
595
+ * ```
596
+ * @param {(update: () => void) => (() => void) | void} start
597
+ * @since 5.7.0
598
+ */
599
+ function createSubscriber(start) {
600
+ let subscribers = 0;
601
+ let version = source(0);
602
+ /** @type {(() => void) | void} */
603
+ let stop;
604
+ return () => {
605
+ if (effect_tracking()) {
606
+ get(version);
607
+ render_effect(() => {
608
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
609
+ subscribers += 1;
610
+ return () => {
611
+ queue_micro_task(() => {
612
+ subscribers -= 1;
613
+ if (subscribers === 0) {
614
+ stop?.();
615
+ stop = void 0;
616
+ increment(version);
617
+ }
618
+ });
619
+ };
620
+ });
621
+ }
622
+ };
623
+ }
624
+ //#endregion
625
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/checkPrivateRedeclaration.js
530
626
  function _checkPrivateRedeclaration(e, t) {
531
627
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
532
628
  }
533
629
  //#endregion
534
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateMethodInitSpec.js
630
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateMethodInitSpec.js
535
631
  function _classPrivateMethodInitSpec(e, a) {
536
632
  _checkPrivateRedeclaration(e, a), a.add(e);
537
633
  }
538
634
  //#endregion
539
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldInitSpec.js
635
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldInitSpec.js
540
636
  function _classPrivateFieldInitSpec(e, t, a) {
541
637
  _checkPrivateRedeclaration(e, t), t.set(e, a);
542
638
  }
543
639
  //#endregion
544
- //#region \0@oxc-project+runtime@0.129.0/helpers/assertClassBrand.js
640
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/assertClassBrand.js
545
641
  function _assertClassBrand(e, t, n) {
546
642
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
547
643
  throw new TypeError("Private element is not present on this object");
548
644
  }
549
645
  //#endregion
550
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldGet2.js
551
- function _classPrivateFieldGet2(s, a) {
552
- return s.get(_assertClassBrand(s, a));
553
- }
554
- //#endregion
555
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldSet2.js
646
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldSet2.js
556
647
  function _classPrivateFieldSet2(s, a, r) {
557
648
  return s.set(_assertClassBrand(s, a), r), r;
558
649
  }
559
650
  //#endregion
560
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/batch.js
561
- /** @import { Fork } from 'svelte' */
562
- /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
563
- var _Batch;
564
- /** @type {Set<Batch>} */
565
- var batches = /* @__PURE__ */ new Set();
566
- /** @type {Batch | null} */
567
- var current_batch = null;
568
- /**
569
- * When time travelling (i.e. working in one batch, while other batches
570
- * still have ongoing work), we ignore the real values of affected
571
- * signals in favour of their values within the batch
572
- * @type {Map<Value, any> | null}
573
- */
574
- var batch_values = null;
575
- /** @type {Effect | null} */
576
- var last_scheduled_effect = null;
577
- var is_flushing_sync = false;
578
- var is_processing = false;
651
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldGet2.js
652
+ function _classPrivateFieldGet2(s, a) {
653
+ return s.get(_assertClassBrand(s, a));
654
+ }
655
+ //#endregion
656
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
657
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
579
658
  /**
580
- * During traversal, this is an array. Newly created effects are (if not immediately
581
- * executed) pushed to this array, rather than going through the scheduling
582
- * rigamarole that would cause another turn of the flush loop.
583
- * @type {Effect[] | null}
659
+ * @typedef {{
660
+ * onerror?: ((error: unknown, reset: () => void) => void) | null;
661
+ * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
662
+ * pending?: ((anchor: Node) => void) | null;
663
+ * }} BoundaryProps
584
664
  */
585
- var collected_effects = null;
665
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
586
666
  /**
587
- * An array of effects that are marked during traversal as a result of a `set`
588
- * (not `internal_set`) call. These will be added to the next batch and
589
- * trigger another `batch.process()`
590
- * @type {Effect[] | null}
591
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
667
+ * @param {TemplateNode} node
668
+ * @param {BoundaryProps} props
669
+ * @param {((anchor: Node) => void)} children
670
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
671
+ * @returns {void}
592
672
  */
593
- var legacy_updates = null;
594
- var flush_count = 0;
595
- var uid = 1;
596
- var _commit_callbacks = /* @__PURE__ */ new WeakMap();
597
- var _discard_callbacks = /* @__PURE__ */ new WeakMap();
598
- var _fork_commit_callbacks = /* @__PURE__ */ new WeakMap();
599
- var _pending = /* @__PURE__ */ new WeakMap();
600
- var _blocking_pending = /* @__PURE__ */ new WeakMap();
601
- var _deferred = /* @__PURE__ */ new WeakMap();
602
- var _roots = /* @__PURE__ */ new WeakMap();
603
- var _new_effects = /* @__PURE__ */ new WeakMap();
673
+ function boundary(node, props, children, transform_error) {
674
+ new Boundary(node, props, children, transform_error);
675
+ }
676
+ var _anchor = /* @__PURE__ */ new WeakMap();
677
+ var _hydrate_open = /* @__PURE__ */ new WeakMap();
678
+ var _props = /* @__PURE__ */ new WeakMap();
679
+ var _children = /* @__PURE__ */ new WeakMap();
680
+ var _effect = /* @__PURE__ */ new WeakMap();
681
+ var _main_effect = /* @__PURE__ */ new WeakMap();
682
+ var _pending_effect = /* @__PURE__ */ new WeakMap();
683
+ var _failed_effect = /* @__PURE__ */ new WeakMap();
684
+ var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
685
+ var _local_pending_count = /* @__PURE__ */ new WeakMap();
686
+ var _pending_count = /* @__PURE__ */ new WeakMap();
687
+ var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
604
688
  var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
605
689
  var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
606
- var _skipped_branches = /* @__PURE__ */ new WeakMap();
607
- var _unskipped_branches = /* @__PURE__ */ new WeakMap();
608
- var _decrement_queued = /* @__PURE__ */ new WeakMap();
609
- var _blockers = /* @__PURE__ */ new WeakMap();
610
- var _Batch_brand = /* @__PURE__ */ new WeakSet();
611
- var Batch = class Batch {
612
- constructor() {
613
- _classPrivateMethodInitSpec(this, _Batch_brand);
614
- _defineProperty(this, "id", uid++);
690
+ var _effect_pending = /* @__PURE__ */ new WeakMap();
691
+ var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
692
+ var _Boundary_brand = /* @__PURE__ */ new WeakSet();
693
+ var Boundary = class {
694
+ /**
695
+ * @param {TemplateNode} node
696
+ * @param {BoundaryProps} props
697
+ * @param {((anchor: Node) => void)} children
698
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
699
+ */
700
+ constructor(node, props, children, transform_error) {
701
+ _classPrivateMethodInitSpec(this, _Boundary_brand);
615
702
  _defineProperty(
616
703
  this,
617
- /**
618
- * The current values of any signals that are updated in this batch.
619
- * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
620
- * They keys of this map are identical to `this.#previous`
621
- * @type {Map<Value, [any, boolean]>}
622
- */
623
- "current",
624
- /* @__PURE__ */ new Map()
704
+ /** @type {Boundary | null} */
705
+ "parent",
706
+ void 0
625
707
  );
708
+ _defineProperty(this, "is_pending", false);
626
709
  _defineProperty(
627
710
  this,
628
711
  /**
629
- * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
630
- * They keys of this map are identical to `this.#current`
631
- * @type {Map<Value, any>}
712
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
713
+ * Inherited from parent boundary, or defaults to identity.
714
+ * @type {(error: unknown) => unknown}
632
715
  */
633
- "previous",
634
- /* @__PURE__ */ new Map()
716
+ "transform_error",
717
+ void 0
635
718
  );
636
- _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
637
- _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
638
- _classPrivateFieldInitSpec(this, _fork_commit_callbacks, /* @__PURE__ */ new Set());
639
- _classPrivateFieldInitSpec(this, _pending, /* @__PURE__ */ new Map());
640
- _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
641
- _classPrivateFieldInitSpec(this, _deferred, null);
642
- _classPrivateFieldInitSpec(this, _roots, []);
643
- _classPrivateFieldInitSpec(this, _new_effects, []);
719
+ _classPrivateFieldInitSpec(this, _anchor, void 0);
720
+ _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
721
+ _classPrivateFieldInitSpec(this, _props, void 0);
722
+ _classPrivateFieldInitSpec(this, _children, void 0);
723
+ _classPrivateFieldInitSpec(this, _effect, void 0);
724
+ _classPrivateFieldInitSpec(this, _main_effect, null);
725
+ _classPrivateFieldInitSpec(this, _pending_effect, null);
726
+ _classPrivateFieldInitSpec(this, _failed_effect, null);
727
+ _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
728
+ _classPrivateFieldInitSpec(this, _local_pending_count, 0);
729
+ _classPrivateFieldInitSpec(this, _pending_count, 0);
730
+ _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
644
731
  _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
645
732
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
646
- _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
647
- _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
648
- _defineProperty(this, "is_fork", false);
649
- _classPrivateFieldInitSpec(this, _decrement_queued, false);
650
- _classPrivateFieldInitSpec(this, _blockers, /* @__PURE__ */ new Set());
733
+ _classPrivateFieldInitSpec(this, _effect_pending, null);
734
+ _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
735
+ _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
736
+ return () => {
737
+ _classPrivateFieldSet2(_effect_pending, this, null);
738
+ };
739
+ }));
740
+ _classPrivateFieldSet2(_anchor, this, node);
741
+ _classPrivateFieldSet2(_props, this, props);
742
+ _classPrivateFieldSet2(_children, this, (anchor) => {
743
+ var effect = active_effect;
744
+ effect.b = this;
745
+ effect.f |= 128;
746
+ children(anchor);
747
+ });
748
+ this.parent = active_effect.b;
749
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
750
+ _classPrivateFieldSet2(_effect, this, block(() => {
751
+ if (hydrating) {
752
+ const comment = _classPrivateFieldGet2(_hydrate_open, this);
753
+ hydrate_next();
754
+ const server_rendered_pending = comment.data === "[!";
755
+ if (comment.data.startsWith("[?")) {
756
+ const serialized_error = JSON.parse(comment.data.slice(2));
757
+ _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
758
+ } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
759
+ else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
760
+ } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
761
+ }, flags));
762
+ if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
651
763
  }
652
764
  /**
653
- * Add an effect to the #skipped_branches map and reset its children
765
+ * Defer an effect inside a pending boundary until the boundary resolves
654
766
  * @param {Effect} effect
655
767
  */
656
- skip_effect(effect) {
657
- if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
658
- d: [],
659
- m: []
660
- });
661
- _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
662
- }
663
- /**
664
- * Remove an effect from the #skipped_branches map and reschedule
665
- * any tracked dirty/maybe_dirty child effects
666
- * @param {Effect} effect
667
- * @param {(e: Effect) => void} callback
668
- */
669
- unskip_effect(effect, callback = (e) => this.schedule(e)) {
670
- var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
671
- if (tracked) {
672
- _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
673
- for (var e of tracked.d) {
674
- set_signal_status(e, DIRTY);
675
- callback(e);
676
- }
677
- for (e of tracked.m) {
678
- set_signal_status(e, MAYBE_DIRTY);
679
- callback(e);
680
- }
681
- }
682
- _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
683
- }
684
- /**
685
- * Associate a change to a given source with the current
686
- * batch, noting its previous and current values
687
- * @param {Value} source
688
- * @param {any} value
689
- * @param {boolean} [is_derived]
690
- */
691
- capture(source, value, is_derived = false) {
692
- if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
693
- if ((source.f & 8388608) === 0) {
694
- this.current.set(source, [value, is_derived]);
695
- batch_values?.set(source, value);
696
- }
697
- if (!this.is_fork) source.v = value;
698
- }
699
- activate() {
700
- current_batch = this;
701
- }
702
- deactivate() {
703
- current_batch = null;
704
- batch_values = null;
705
- }
706
- flush() {
707
- try {
708
- is_processing = true;
709
- current_batch = this;
710
- _assertClassBrand(_Batch_brand, this, _process).call(this);
711
- } finally {
712
- flush_count = 0;
713
- last_scheduled_effect = null;
714
- collected_effects = null;
715
- legacy_updates = null;
716
- is_processing = false;
717
- current_batch = null;
718
- batch_values = null;
719
- old_values.clear();
720
- }
721
- }
722
- discard() {
723
- for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
724
- _classPrivateFieldGet2(_discard_callbacks, this).clear();
725
- _classPrivateFieldGet2(_fork_commit_callbacks, this).clear();
726
- batches.delete(this);
768
+ defer_effect(effect) {
769
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
727
770
  }
728
771
  /**
729
- * @param {Effect} effect
772
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
773
+ * @returns {boolean}
730
774
  */
731
- register_created_effect(effect) {
732
- _classPrivateFieldGet2(_new_effects, this).push(effect);
775
+ is_rendered() {
776
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
733
777
  }
734
- /**
735
- * @param {boolean} blocking
736
- * @param {Effect} effect
737
- */
738
- increment(blocking, effect) {
739
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
740
- _classPrivateFieldGet2(_pending, this).set(effect, pending_count + 1);
741
- if (blocking) {
742
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
743
- _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
744
- }
778
+ has_pending_snippet() {
779
+ return !!_classPrivateFieldGet2(_props, this).pending;
745
780
  }
746
781
  /**
747
- * @param {boolean} blocking
748
- * @param {Effect} effect
749
- * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
782
+ * Update the source that powers `$effect.pending()` inside this boundary,
783
+ * and controls when the current `pending` snippet (if any) is removed.
784
+ * Do not call from inside the class
785
+ * @param {1 | -1} d
786
+ * @param {Batch} batch
750
787
  */
751
- decrement(blocking, effect, skip) {
752
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
753
- if (pending_count === 1) _classPrivateFieldGet2(_pending, this).delete(effect);
754
- else _classPrivateFieldGet2(_pending, this).set(effect, pending_count - 1);
755
- if (blocking) {
756
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
757
- if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
758
- else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
759
- }
760
- if (_classPrivateFieldGet2(_decrement_queued, this) || skip) return;
761
- _classPrivateFieldSet2(_decrement_queued, this, true);
788
+ update_pending_count(d, batch) {
789
+ _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
790
+ _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
791
+ if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
792
+ _classPrivateFieldSet2(_pending_count_update_queued, this, true);
762
793
  queue_micro_task(() => {
763
- _classPrivateFieldSet2(_decrement_queued, this, false);
764
- this.flush();
794
+ _classPrivateFieldSet2(_pending_count_update_queued, this, false);
795
+ if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
765
796
  });
766
797
  }
767
- /**
768
- * @param {Set<Effect>} dirty_effects
769
- * @param {Set<Effect>} maybe_dirty_effects
770
- */
771
- transfer_effects(dirty_effects, maybe_dirty_effects) {
772
- for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
773
- for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
774
- dirty_effects.clear();
775
- maybe_dirty_effects.clear();
776
- }
777
- /** @param {(batch: Batch) => void} fn */
778
- oncommit(fn) {
779
- _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
780
- }
781
- /** @param {(batch: Batch) => void} fn */
782
- ondiscard(fn) {
783
- _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
784
- }
785
- /** @param {(batch: Batch) => void} fn */
786
- on_fork_commit(fn) {
787
- _classPrivateFieldGet2(_fork_commit_callbacks, this).add(fn);
788
- }
789
- run_fork_commit_callbacks() {
790
- for (const fn of _classPrivateFieldGet2(_fork_commit_callbacks, this)) fn(this);
791
- _classPrivateFieldGet2(_fork_commit_callbacks, this).clear();
798
+ get_effect_pending() {
799
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
800
+ return get(_classPrivateFieldGet2(_effect_pending, this));
792
801
  }
793
- settled() {
794
- return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
802
+ /** @param {unknown} error */
803
+ error(error) {
804
+ if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
805
+ if (current_batch?.is_fork) {
806
+ if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
807
+ if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
808
+ if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
809
+ current_batch.oncommit(() => {
810
+ _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
811
+ });
812
+ } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
795
813
  }
796
- static ensure() {
797
- if (current_batch === null) {
798
- const batch = current_batch = new Batch();
799
- if (!is_processing) {
800
- batches.add(current_batch);
801
- if (!is_flushing_sync) queue_micro_task(() => {
802
- if (current_batch !== batch) return;
803
- batch.flush();
804
- });
805
- }
806
- }
807
- return current_batch;
814
+ };
815
+ function _hydrate_resolved_content() {
816
+ try {
817
+ _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
818
+ } catch (error) {
819
+ this.error(error);
808
820
  }
809
- apply() {
810
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
811
- batch_values = null;
821
+ }
822
+ /**
823
+ * @param {unknown} error The deserialized error from the server's hydration comment
824
+ */
825
+ function _hydrate_failed_content(error) {
826
+ const failed = _classPrivateFieldGet2(_props, this).failed;
827
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, error);
828
+ queue_micro_task(invoke_onerror);
829
+ if (!failed) return;
830
+ _classPrivateFieldSet2(_failed_effect, this, branch(() => {
831
+ failed(_classPrivateFieldGet2(_anchor, this), () => error, () => reset);
832
+ }));
833
+ }
834
+ /**
835
+ * Creates the `reset` function for a failed boundary, along with a function
836
+ * that invokes `onerror` with it (if provided)
837
+ * @param {unknown} error
838
+ * @returns {{ reset: () => void, invoke_onerror: () => void }}
839
+ */
840
+ function _create_reset(error) {
841
+ var did_reset = false;
842
+ var calling_on_error = false;
843
+ const reset = () => {
844
+ if (did_reset) {
845
+ svelte_boundary_reset_noop();
812
846
  return;
813
847
  }
814
- batch_values = /* @__PURE__ */ new Map();
815
- for (const [source, [value]] of this.current) batch_values.set(source, value);
816
- for (const batch of batches) {
817
- if (batch === this || batch.is_fork) continue;
818
- var intersects = false;
819
- var differs = false;
820
- if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
821
- if (is_derived) continue;
822
- intersects || (intersects = this.current.has(source));
823
- differs || (differs = !this.current.has(source));
824
- }
825
- if (intersects && differs) _classPrivateFieldGet2(_blockers, this).add(batch);
826
- else for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
848
+ did_reset = true;
849
+ if (calling_on_error) svelte_boundary_reset_onerror();
850
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
851
+ _classPrivateFieldSet2(_failed_effect, this, null);
852
+ });
853
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
854
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
855
+ });
856
+ };
857
+ const invoke_onerror = () => {
858
+ try {
859
+ calling_on_error = true;
860
+ _classPrivateFieldGet2(_props, this).onerror?.(error, reset);
861
+ calling_on_error = false;
862
+ } catch (err) {
863
+ invoke_error_boundary(err, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
864
+ }
865
+ };
866
+ return {
867
+ reset,
868
+ invoke_onerror
869
+ };
870
+ }
871
+ function _hydrate_pending_content() {
872
+ const pending = _classPrivateFieldGet2(_props, this).pending;
873
+ if (!pending) return;
874
+ this.is_pending = true;
875
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
876
+ queue_micro_task(() => {
877
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
878
+ var anchor = create_text();
879
+ fragment.append(anchor);
880
+ _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
881
+ return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
882
+ }));
883
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
884
+ _classPrivateFieldGet2(_anchor, this).before(fragment);
885
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
886
+ pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
887
+ _classPrivateFieldSet2(_pending_effect, this, null);
888
+ });
889
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
827
890
  }
891
+ });
892
+ }
893
+ function _render() {
894
+ try {
895
+ this.is_pending = this.has_pending_snippet();
896
+ _classPrivateFieldSet2(_pending_count, this, 0);
897
+ _classPrivateFieldSet2(_local_pending_count, this, 0);
898
+ _classPrivateFieldSet2(_main_effect, this, branch(() => {
899
+ _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
900
+ }));
901
+ if (_classPrivateFieldGet2(_pending_count, this) > 0) {
902
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
903
+ move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
904
+ const pending = _classPrivateFieldGet2(_props, this).pending;
905
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
906
+ } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
907
+ } catch (error) {
908
+ this.error(error);
828
909
  }
829
- /**
830
- *
831
- * @param {Effect} effect
832
- */
833
- schedule(effect) {
834
- last_scheduled_effect = effect;
835
- if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
836
- effect.b.defer_effect(effect);
837
- return;
910
+ }
911
+ /**
912
+ * @param {Batch} batch
913
+ */
914
+ function _resolve(batch) {
915
+ this.is_pending = false;
916
+ batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
917
+ }
918
+ /**
919
+ * @template T
920
+ * @param {() => T} fn
921
+ */
922
+ function _run(fn) {
923
+ var previous_effect = active_effect;
924
+ var previous_reaction = active_reaction;
925
+ var previous_ctx = component_context;
926
+ set_active_effect(_classPrivateFieldGet2(_effect, this));
927
+ set_active_reaction(_classPrivateFieldGet2(_effect, this));
928
+ set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
929
+ try {
930
+ Batch.ensure();
931
+ return fn();
932
+ } catch (e) {
933
+ handle_error(e);
934
+ return null;
935
+ } finally {
936
+ set_active_effect(previous_effect);
937
+ set_active_reaction(previous_reaction);
938
+ set_component_context(previous_ctx);
939
+ }
940
+ }
941
+ /**
942
+ * Updates the pending count associated with the currently visible pending snippet,
943
+ * if any, such that we can replace the snippet with content once work is done
944
+ * @param {1 | -1} d
945
+ * @param {Batch} batch
946
+ */
947
+ function _update_pending_count(d, batch) {
948
+ if (!this.has_pending_snippet()) {
949
+ if (this.parent) {
950
+ var _this$parent;
951
+ _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
838
952
  }
839
- var e = effect;
840
- while (e.parent !== null) {
841
- e = e.parent;
842
- var flags = e.f;
843
- if (collected_effects !== null && e === active_effect) {
844
- if (async_mode_flag) return;
845
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
846
- }
847
- if ((flags & 96) !== 0) {
848
- if ((flags & 1024) === 0) return;
849
- e.f ^= CLEAN;
850
- }
953
+ return;
954
+ }
955
+ _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
956
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
957
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
958
+ if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
959
+ _classPrivateFieldSet2(_pending_effect, this, null);
960
+ });
961
+ if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
962
+ _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
963
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
851
964
  }
852
- _classPrivateFieldGet2(_roots, this).push(e);
853
965
  }
854
- };
855
- _Batch = Batch;
856
- function _is_deferred() {
857
- return this.is_fork || _classPrivateFieldGet2(_blocking_pending, this).size > 0;
858
966
  }
859
- function _is_blocked() {
860
- for (const batch of _classPrivateFieldGet2(_blockers, this)) for (const effect of _classPrivateFieldGet2(_blocking_pending, batch).keys()) {
861
- var skipped = false;
862
- var e = effect;
863
- while (e.parent !== null) {
864
- if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
865
- skipped = true;
866
- break;
967
+ /**
968
+ * @param {unknown} error
969
+ */
970
+ function _handle_error(error) {
971
+ if (_classPrivateFieldGet2(_main_effect, this)) {
972
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
973
+ _classPrivateFieldSet2(_main_effect, this, null);
974
+ }
975
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
976
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
977
+ _classPrivateFieldSet2(_pending_effect, this, null);
978
+ }
979
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
980
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
981
+ _classPrivateFieldSet2(_failed_effect, this, null);
982
+ }
983
+ if (hydrating) {
984
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
985
+ next();
986
+ set_hydrate_node(skip_nodes());
987
+ }
988
+ let failed = _classPrivateFieldGet2(_props, this).failed;
989
+ /** @param {unknown} transformed_error */
990
+ const handle_error_result = (transformed_error) => {
991
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, transformed_error);
992
+ invoke_onerror();
993
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
994
+ try {
995
+ return branch(() => {
996
+ var effect = active_effect;
997
+ effect.b = this;
998
+ effect.f |= 128;
999
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1000
+ });
1001
+ } catch (error) {
1002
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1003
+ return null;
867
1004
  }
868
- e = e.parent;
1005
+ }));
1006
+ };
1007
+ queue_micro_task(() => {
1008
+ /** @type {unknown} */
1009
+ var result;
1010
+ try {
1011
+ result = this.transform_error(error);
1012
+ } catch (e) {
1013
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1014
+ return;
869
1015
  }
870
- if (!skipped) return true;
871
- }
872
- return false;
1016
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
1017
+ /** @type {any} */ result.then(
1018
+ handle_error_result,
1019
+ /** @param {unknown} e */
1020
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1021
+ );
1022
+ else handle_error_result(result);
1023
+ });
873
1024
  }
874
- function _process() {
875
- if (flush_count++ > 1e3) {
876
- batches.delete(this);
877
- infinite_loop_guard();
878
- }
879
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
880
- for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
881
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
882
- set_signal_status(e, DIRTY);
883
- this.schedule(e);
884
- }
885
- for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
886
- set_signal_status(e, MAYBE_DIRTY);
887
- this.schedule(e);
888
- }
1025
+ //#endregion
1026
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/async.js
1027
+ /** @import { Blocker, Effect, Source, Value } from '#client' */
1028
+ /**
1029
+ * @param {Blocker[]} blockers
1030
+ * @param {Array<() => any>} sync
1031
+ * @param {Array<() => Promise<any>>} async
1032
+ * @param {(values: Value[]) => any} fn
1033
+ */
1034
+ function flatten(blockers, sync, async, fn) {
1035
+ const d = is_runes() ? derived : derived_safe_equal;
1036
+ var pending = blockers.filter((b) => !b.settled);
1037
+ var deriveds = sync.map(d);
1038
+ if (async.length === 0 && pending.length === 0) {
1039
+ fn(deriveds);
1040
+ return;
889
1041
  }
890
- const roots = _classPrivateFieldGet2(_roots, this);
891
- _classPrivateFieldSet2(_roots, this, []);
892
- this.apply();
893
- /** @type {Effect[]} */
894
- var effects = collected_effects = [];
895
- /** @type {Effect[]} */
896
- var render_effects = [];
1042
+ var parent = active_effect;
1043
+ var restore = capture();
1044
+ var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
897
1045
  /**
898
- * @type {Effect[]}
899
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1046
+ * @param {Source[]} async
900
1047
  */
901
- var updates = legacy_updates = [];
902
- for (const root of roots) try {
903
- _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
904
- } catch (e) {
905
- reset_all(root);
906
- throw e;
907
- }
908
- current_batch = null;
909
- if (updates.length > 0) {
910
- var batch = _Batch.ensure();
911
- for (const e of updates) batch.schedule(e);
912
- }
913
- collected_effects = null;
914
- legacy_updates = null;
915
- if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this) || _assertClassBrand(_Batch_brand, this, _is_blocked).call(this)) {
916
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
917
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
918
- for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
919
- } else {
920
- if (_classPrivateFieldGet2(_pending, this).size === 0) batches.delete(this);
921
- _classPrivateFieldGet2(_dirty_effects$1, this).clear();
922
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
923
- for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
924
- _classPrivateFieldGet2(_commit_callbacks, this).clear();
925
- flush_queued_effects(render_effects);
926
- flush_queued_effects(effects);
927
- _classPrivateFieldGet2(_deferred, this)?.resolve();
1048
+ function finish(async) {
1049
+ if ((parent.f & 16384) !== 0) return;
1050
+ restore();
1051
+ try {
1052
+ fn([...deriveds, ...async]);
1053
+ } catch (error) {
1054
+ invoke_error_boundary(error, parent);
1055
+ }
1056
+ unset_context();
928
1057
  }
929
- var next_batch = current_batch;
930
- if (_classPrivateFieldGet2(_roots, this).length > 0) {
931
- const batch = next_batch ?? (next_batch = this);
932
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
1058
+ var decrement_pending = increment_pending();
1059
+ if (async.length === 0) {
1060
+ /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
1061
+ return;
933
1062
  }
934
- if (next_batch !== null) {
935
- batches.add(next_batch);
936
- _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
1063
+ function run() {
1064
+ Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
937
1065
  }
938
- if (async_mode_flag && !batches.has(this)) _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
1066
+ if (blocker_promise) blocker_promise.then(() => {
1067
+ restore();
1068
+ run();
1069
+ unset_context();
1070
+ });
1071
+ else run();
939
1072
  }
940
1073
  /**
941
- * Traverse the effect tree, executing effects or stashing
942
- * them for later execution as appropriate
943
- * @param {Effect} root
944
- * @param {Effect[]} effects
945
- * @param {Effect[]} render_effects
1074
+ * Captures the current effect context so that we can restore it after
1075
+ * some asynchronous work has happened (so that e.g. `await a + b`
1076
+ * causes `b` to be registered as a dependency).
946
1077
  */
947
- function _traverse(root, effects, render_effects) {
948
- root.f ^= CLEAN;
949
- var effect = root.first;
950
- while (effect !== null) {
951
- var flags = effect.f;
952
- var is_branch = (flags & 96) !== 0;
953
- if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
954
- if (is_branch) effect.f ^= CLEAN;
955
- else if ((flags & 4) !== 0) effects.push(effect);
956
- else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
957
- else if (is_dirty(effect)) {
958
- if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
959
- update_effect(effect);
960
- }
961
- var child = effect.first;
962
- if (child !== null) {
963
- effect = child;
964
- continue;
965
- }
966
- }
967
- while (effect !== null) {
968
- var next = effect.next;
969
- if (next !== null) {
970
- effect = next;
971
- break;
972
- }
973
- effect = effect.parent;
1078
+ function capture() {
1079
+ var previous_effect = active_effect;
1080
+ var previous_reaction = active_reaction;
1081
+ var previous_component_context = component_context;
1082
+ var previous_batch = current_batch;
1083
+ return function restore(activate_batch = true) {
1084
+ set_active_effect(previous_effect);
1085
+ set_active_reaction(previous_reaction);
1086
+ set_component_context(previous_component_context);
1087
+ if (activate_batch && (previous_effect.f & 16384) === 0) {
1088
+ previous_batch?.activate();
1089
+ previous_batch?.apply();
974
1090
  }
975
- }
1091
+ };
1092
+ }
1093
+ function unset_context(deactivate_batch = true) {
1094
+ set_active_effect(null);
1095
+ set_active_reaction(null);
1096
+ set_component_context(null);
1097
+ if (deactivate_batch) current_batch?.deactivate();
976
1098
  }
977
1099
  /**
978
- * @param {Effect[]} effects
1100
+ * @returns {(skip?: boolean) => void}
979
1101
  */
980
- function _defer_effects(effects) {
981
- for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
1102
+ function increment_pending() {
1103
+ var effect = active_effect;
1104
+ var boundary = effect.b;
1105
+ var batch = current_batch;
1106
+ var blocking = !!boundary?.is_rendered();
1107
+ boundary?.update_pending_count(1, batch);
1108
+ batch.increment(blocking, effect);
1109
+ return () => {
1110
+ boundary?.update_pending_count(-1, batch);
1111
+ batch.decrement(blocking, effect);
1112
+ };
982
1113
  }
983
- function _commit$1() {
984
- for (const batch of batches) {
985
- var is_earlier = batch.id < this.id;
986
- /** @type {Source[]} */
987
- var sources = [];
988
- for (const [source, [value, is_derived]] of this.current) {
989
- if (batch.current.has(source)) {
990
- var batch_value = batch.current.get(source)[0];
991
- if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
992
- else continue;
993
- }
994
- sources.push(source);
995
- }
996
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
997
- if (others.length === 0) {
998
- if (is_earlier) batch.discard();
999
- } else if (sources.length > 0) {
1000
- if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1001
- if ((e.f & 4194320) !== 0) batch.schedule(e);
1002
- else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1003
- });
1004
- batch.activate();
1005
- /** @type {Set<Value>} */
1006
- var marked = /* @__PURE__ */ new Set();
1007
- /** @type {Map<Reaction, boolean>} */
1008
- var checked = /* @__PURE__ */ new Map();
1009
- for (var source of sources) mark_effects(source, others, marked, checked);
1010
- checked = /* @__PURE__ */ new Map();
1011
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
1012
- for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1013
- set_signal_status(effect, DIRTY);
1014
- batch.schedule(effect);
1015
- } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1016
- if (_classPrivateFieldGet2(_roots, batch).length > 0) {
1017
- batch.apply();
1018
- for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1019
- _classPrivateFieldSet2(_roots, batch, []);
1020
- }
1021
- batch.deactivate();
1022
- }
1023
- }
1024
- for (const batch of batches) if (_classPrivateFieldGet2(_blockers, batch).has(this)) {
1025
- _classPrivateFieldGet2(_blockers, batch).delete(this);
1026
- if (_classPrivateFieldGet2(_blockers, batch).size === 0 && !_assertClassBrand(_Batch_brand, batch, _is_deferred).call(batch)) {
1027
- batch.activate();
1028
- _assertClassBrand(_Batch_brand, batch, _process).call(batch);
1029
- }
1030
- }
1114
+ /**
1115
+ * @template V
1116
+ * @param {() => V} fn
1117
+ * @returns {Derived<V>}
1118
+ */
1119
+ /*#__NO_SIDE_EFFECTS__*/
1120
+ function derived(fn) {
1121
+ var flags = 2 | DIRTY;
1122
+ if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1123
+ return {
1124
+ ctx: component_context,
1125
+ deps: null,
1126
+ effects: null,
1127
+ equals,
1128
+ f: flags,
1129
+ fn,
1130
+ reactions: null,
1131
+ rv: 0,
1132
+ v: UNINITIALIZED,
1133
+ wv: 0,
1134
+ parent: active_effect,
1135
+ ac: null
1136
+ };
1031
1137
  }
1138
+ var OBSOLETE = Symbol("obsolete");
1032
1139
  /**
1033
- * Synchronously flush any pending updates.
1034
- * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1035
- * @template [T=void]
1036
- * @param {(() => T) | undefined} [fn]
1037
- * @returns {T}
1140
+ * @template V
1141
+ * @param {() => V | Promise<V>} fn
1142
+ * @param {string} [label]
1143
+ * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1144
+ * @returns {Promise<Source<V>>}
1038
1145
  */
1039
- function flushSync(fn) {
1040
- var was_flushing_sync = is_flushing_sync;
1041
- is_flushing_sync = true;
1042
- try {
1043
- var result;
1044
- if (fn) {
1045
- if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1046
- result = fn();
1146
+ /*#__NO_SIDE_EFFECTS__*/
1147
+ function async_derived(fn, label, location) {
1148
+ let parent = active_effect;
1149
+ if (parent === null) async_derived_orphan();
1150
+ var promise = void 0;
1151
+ var signal = source(UNINITIALIZED);
1152
+ var should_suspend = !active_reaction;
1153
+ /** @type {Set<ReturnType<typeof deferred<V>>>} */
1154
+ var deferreds = /* @__PURE__ */ new Set();
1155
+ async_effect(() => {
1156
+ var effect = active_effect;
1157
+ /** @type {ReturnType<typeof deferred<V>>} */
1158
+ var d = deferred();
1159
+ promise = d.promise;
1160
+ try {
1161
+ Promise.resolve(fn()).then(d.resolve, (e) => {
1162
+ if (e !== STALE_REACTION) d.reject(e);
1163
+ }).finally(unset_context);
1164
+ } catch (error) {
1165
+ d.reject(error);
1166
+ unset_context();
1047
1167
  }
1048
- while (true) {
1049
- flush_tasks();
1050
- if (current_batch === null) return result;
1051
- current_batch.flush();
1168
+ var batch = current_batch;
1169
+ if (should_suspend) {
1170
+ if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1171
+ if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
1172
+ else for (const d of deferreds.values()) d.reject(OBSOLETE);
1173
+ deferreds.add(d);
1174
+ batch.async_deriveds.set(effect, d);
1052
1175
  }
1053
- } finally {
1054
- is_flushing_sync = was_flushing_sync;
1055
- }
1056
- }
1057
- function infinite_loop_guard() {
1058
- try {
1059
- effect_update_depth_exceeded();
1060
- } catch (error) {
1061
- invoke_error_boundary(error, last_scheduled_effect);
1062
- }
1063
- }
1064
- /** @type {Set<Effect> | null} */
1065
- var eager_block_effects = null;
1066
- /**
1067
- * @param {Array<Effect>} effects
1068
- * @returns {void}
1069
- */
1070
- function flush_queued_effects(effects) {
1071
- var length = effects.length;
1072
- if (length === 0) return;
1073
- var i = 0;
1074
- while (i < length) {
1075
- var effect = effects[i++];
1076
- if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1077
- eager_block_effects = /* @__PURE__ */ new Set();
1078
- update_effect(effect);
1079
- if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1080
- if (eager_block_effects?.size > 0) {
1081
- old_values.clear();
1082
- for (const e of eager_block_effects) {
1083
- if ((e.f & 24576) !== 0) continue;
1084
- /** @type {Effect[]} */
1085
- const ordered_effects = [e];
1086
- let ancestor = e.parent;
1087
- while (ancestor !== null) {
1088
- if (eager_block_effects.has(ancestor)) {
1089
- eager_block_effects.delete(ancestor);
1090
- ordered_effects.push(ancestor);
1091
- }
1092
- ancestor = ancestor.parent;
1093
- }
1094
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
1095
- const e = ordered_effects[j];
1096
- if ((e.f & 24576) !== 0) continue;
1097
- update_effect(e);
1098
- }
1099
- }
1100
- eager_block_effects.clear();
1176
+ /**
1177
+ * @param {any} value
1178
+ * @param {unknown} error
1179
+ */
1180
+ const handler = (value, error = void 0) => {
1181
+ decrement_pending?.();
1182
+ deferreds.delete(d);
1183
+ if (error === OBSOLETE) return;
1184
+ batch.activate();
1185
+ if (error) {
1186
+ signal.f |= ERROR_VALUE;
1187
+ internal_set(signal, error);
1188
+ } else {
1189
+ if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1190
+ internal_set(signal, value);
1191
+ }
1192
+ batch.deactivate();
1193
+ };
1194
+ d.promise.then(handler, (e) => handler(null, e || "unknown"));
1195
+ });
1196
+ teardown(() => {
1197
+ for (const d of deferreds) d.reject(OBSOLETE);
1198
+ });
1199
+ return new Promise((fulfil) => {
1200
+ /** @param {Promise<V>} p */
1201
+ function next(p) {
1202
+ function go() {
1203
+ if (p === promise) fulfil(signal);
1204
+ else next(promise);
1101
1205
  }
1206
+ p.then(go, go);
1102
1207
  }
1103
- }
1104
- eager_block_effects = null;
1208
+ next(promise);
1209
+ });
1105
1210
  }
1106
1211
  /**
1107
- * This is similar to `mark_reactions`, but it only marks async/block effects
1108
- * depending on `value` and at least one of the other `sources`, so that
1109
- * these effects can re-run after another batch has been committed
1110
- * @param {Value} value
1111
- * @param {Source[]} sources
1112
- * @param {Set<Value>} marked
1113
- * @param {Map<Reaction, boolean>} checked
1212
+ * @template V
1213
+ * @param {() => V} fn
1214
+ * @returns {Derived<V>}
1114
1215
  */
1115
- function mark_effects(value, sources, marked, checked) {
1116
- if (marked.has(value)) return;
1117
- marked.add(value);
1118
- if (value.reactions !== null) for (const reaction of value.reactions) {
1119
- const flags = reaction.f;
1120
- if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1121
- else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1122
- set_signal_status(reaction, DIRTY);
1123
- schedule_effect(reaction);
1124
- }
1125
- }
1216
+ /*#__NO_SIDE_EFFECTS__*/
1217
+ function user_derived(fn) {
1218
+ const d = /* @__PURE__ */ derived(fn);
1219
+ if (!async_mode_flag) push_reaction_value(d);
1220
+ return d;
1126
1221
  }
1127
1222
  /**
1128
- * @param {Reaction} reaction
1129
- * @param {Source[]} sources
1130
- * @param {Map<Reaction, boolean>} checked
1223
+ * @template V
1224
+ * @param {() => V} fn
1225
+ * @returns {Derived<V>}
1131
1226
  */
1132
- function depends_on(reaction, sources, checked) {
1133
- const depends = checked.get(reaction);
1134
- if (depends !== void 0) return depends;
1135
- if (reaction.deps !== null) for (const dep of reaction.deps) {
1136
- if (includes.call(sources, dep)) return true;
1137
- if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1138
- checked.set(dep, true);
1139
- return true;
1140
- }
1141
- }
1142
- checked.set(reaction, false);
1143
- return false;
1227
+ /*#__NO_SIDE_EFFECTS__*/
1228
+ function derived_safe_equal(fn) {
1229
+ const signal = /* @__PURE__ */ derived(fn);
1230
+ signal.equals = safe_equals;
1231
+ return signal;
1144
1232
  }
1145
1233
  /**
1146
- * @param {Effect} effect
1234
+ * @param {Derived} derived
1147
1235
  * @returns {void}
1148
1236
  */
1149
- function schedule_effect(effect) {
1150
- /** @type {Batch} */ current_batch.schedule(effect);
1151
- }
1152
- /**
1153
- * Mark all the effects inside a skipped branch CLEAN, so that
1154
- * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1155
- * effects so they can be rescheduled if the branch survives.
1156
- * @param {Effect} effect
1157
- * @param {{ d: Effect[], m: Effect[] }} tracked
1158
- */
1159
- function reset_branch(effect, tracked) {
1160
- if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1161
- if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1162
- else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1163
- set_signal_status(effect, CLEAN);
1164
- var e = effect.first;
1165
- while (e !== null) {
1166
- reset_branch(e, tracked);
1167
- e = e.next;
1237
+ function destroy_derived_effects(derived) {
1238
+ var effects = derived.effects;
1239
+ if (effects !== null) {
1240
+ derived.effects = null;
1241
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1168
1242
  }
1169
1243
  }
1170
1244
  /**
1171
- * Mark an entire effect tree clean following an error
1172
- * @param {Effect} effect
1245
+ * @template T
1246
+ * @param {Derived} derived
1247
+ * @returns {T}
1173
1248
  */
1174
- function reset_all(effect) {
1175
- set_signal_status(effect, CLEAN);
1176
- var e = effect.first;
1177
- while (e !== null) {
1178
- reset_all(e);
1179
- e = e.next;
1249
+ function execute_derived(derived) {
1250
+ var value;
1251
+ var prev_active_effect = active_effect;
1252
+ var parent = derived.parent;
1253
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
1254
+ derived_inert();
1255
+ return derived.v;
1256
+ }
1257
+ set_active_effect(parent);
1258
+ try {
1259
+ derived.f &= ~WAS_MARKED;
1260
+ destroy_derived_effects(derived);
1261
+ value = update_reaction(derived);
1262
+ } finally {
1263
+ set_active_effect(prev_active_effect);
1180
1264
  }
1265
+ return value;
1181
1266
  }
1182
- //#endregion
1183
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/reactivity/create-subscriber.js
1184
1267
  /**
1185
- * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1186
- * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1187
- *
1188
- * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1189
- * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1190
- *
1191
- * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1192
- *
1193
- * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1194
- * are active, and the returned teardown function will only be called when all effects are destroyed.
1195
- *
1196
- * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1197
- *
1198
- * ```js
1199
- * import { createSubscriber } from 'svelte/reactivity';
1200
- * import { on } from 'svelte/events';
1201
- *
1202
- * export class MediaQuery {
1203
- * #query;
1204
- * #subscribe;
1205
- *
1206
- * constructor(query) {
1207
- * this.#query = window.matchMedia(`(${query})`);
1208
- *
1209
- * this.#subscribe = createSubscriber((update) => {
1210
- * // when the `change` event occurs, re-run any effects that read `this.current`
1211
- * const off = on(this.#query, 'change', update);
1212
- *
1213
- * // stop listening when all the effects are destroyed
1214
- * return () => off();
1215
- * });
1216
- * }
1217
- *
1218
- * get current() {
1219
- * // This makes the getter reactive, if read in an effect
1220
- * this.#subscribe();
1221
- *
1222
- * // Return the current state of the query, whether or not we're in an effect
1223
- * return this.#query.matches;
1224
- * }
1225
- * }
1226
- * ```
1227
- * @param {(update: () => void) => (() => void) | void} start
1228
- * @since 5.7.0
1268
+ * @param {Derived} derived
1269
+ * @returns {void}
1229
1270
  */
1230
- function createSubscriber(start) {
1231
- let subscribers = 0;
1232
- let version = source(0);
1233
- /** @type {(() => void) | void} */
1234
- let stop;
1235
- return () => {
1236
- if (effect_tracking()) {
1237
- get(version);
1238
- render_effect(() => {
1239
- if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1240
- subscribers += 1;
1241
- return () => {
1242
- queue_micro_task(() => {
1243
- subscribers -= 1;
1244
- if (subscribers === 0) {
1245
- stop?.();
1246
- stop = void 0;
1247
- increment(version);
1248
- }
1249
- });
1250
- };
1251
- });
1271
+ function update_derived(derived) {
1272
+ var value = execute_derived(derived);
1273
+ if (!derived.equals(value)) {
1274
+ derived.wv = increment_write_version();
1275
+ if (!current_batch?.is_fork || derived.deps === null) {
1276
+ if (current_batch !== null) {
1277
+ current_batch.capture(derived, value, true);
1278
+ previous_batch?.capture(derived, value, true);
1279
+ } else derived.v = value;
1280
+ if (derived.deps === null) {
1281
+ set_signal_status(derived, CLEAN);
1282
+ return;
1283
+ }
1252
1284
  }
1253
- };
1285
+ }
1286
+ if (is_destroying_effect) return;
1287
+ if (batch_values !== null) {
1288
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1289
+ } else update_derived_status(derived);
1254
1290
  }
1255
- //#endregion
1256
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1257
- /** @import { Effect, Source, TemplateNode, } from '#client' */
1258
1291
  /**
1259
- * @typedef {{
1260
- * onerror?: (error: unknown, reset: () => void) => void;
1261
- * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
1262
- * pending?: (anchor: Node) => void;
1263
- * }} BoundaryProps
1292
+ * @param {Derived} derived
1264
1293
  */
1265
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1294
+ function freeze_derived_effects(derived) {
1295
+ if (derived.effects === null) return;
1296
+ for (const e of derived.effects) if (e.teardown || e.ac) {
1297
+ e.teardown?.();
1298
+ if (e.ac !== null) without_reactive_context(() => {
1299
+ /** @type {AbortController} */ e.ac.abort(STALE_REACTION);
1300
+ e.ac = null;
1301
+ });
1302
+ if (e.fn !== null) e.teardown = noop;
1303
+ remove_reactions(e, 0);
1304
+ destroy_effect_children(e);
1305
+ }
1306
+ }
1266
1307
  /**
1267
- * @param {TemplateNode} node
1268
- * @param {BoundaryProps} props
1269
- * @param {((anchor: Node) => void)} children
1270
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1271
- * @returns {void}
1308
+ * @param {Derived} derived
1272
1309
  */
1273
- function boundary(node, props, children, transform_error) {
1274
- new Boundary(node, props, children, transform_error);
1310
+ function unfreeze_derived_effects(derived) {
1311
+ if (derived.effects === null) return;
1312
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
1275
1313
  }
1276
- var _anchor = /* @__PURE__ */ new WeakMap();
1277
- var _hydrate_open = /* @__PURE__ */ new WeakMap();
1278
- var _props = /* @__PURE__ */ new WeakMap();
1279
- var _children = /* @__PURE__ */ new WeakMap();
1280
- var _effect = /* @__PURE__ */ new WeakMap();
1281
- var _main_effect = /* @__PURE__ */ new WeakMap();
1282
- var _pending_effect = /* @__PURE__ */ new WeakMap();
1283
- var _failed_effect = /* @__PURE__ */ new WeakMap();
1284
- var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1285
- var _local_pending_count = /* @__PURE__ */ new WeakMap();
1286
- var _pending_count = /* @__PURE__ */ new WeakMap();
1287
- var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1314
+ //#endregion
1315
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/batch.js
1316
+ /** @import { Fork } from 'svelte' */
1317
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
1318
+ var _Batch;
1319
+ /** @type {Batch | null} */
1320
+ var first_batch = null;
1321
+ /** @type {Batch | null} */
1322
+ var last_batch = null;
1323
+ /** @type {Batch | null} */
1324
+ var current_batch = null;
1325
+ /**
1326
+ * This is needed to avoid overwriting inputs
1327
+ * @type {Batch | null}
1328
+ */
1329
+ var previous_batch = null;
1330
+ /**
1331
+ * When time travelling (i.e. working in one batch, while other batches
1332
+ * still have ongoing work), we ignore the real values of affected
1333
+ * signals in favour of their values within the batch
1334
+ * @type {Map<Value, any> | null}
1335
+ */
1336
+ var batch_values = null;
1337
+ /** @type {Effect | null} */
1338
+ var last_scheduled_effect = null;
1339
+ var is_flushing_sync = false;
1340
+ var is_processing = false;
1341
+ /**
1342
+ * During traversal, this is an array. Newly created effects are (if not immediately
1343
+ * executed) pushed to this array, rather than going through the scheduling
1344
+ * rigamarole that would cause another turn of the flush loop.
1345
+ * @type {Effect[] | null}
1346
+ */
1347
+ var collected_effects = null;
1348
+ /**
1349
+ * An array of effects that are marked during traversal as a result of a `set`
1350
+ * (not `internal_set`) call. These will be added to the next batch and
1351
+ * trigger another `batch.process()`
1352
+ * @type {Effect[] | null}
1353
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1354
+ */
1355
+ var legacy_updates = null;
1356
+ var flush_count = 0;
1357
+ var uid = 1;
1358
+ var _started = /* @__PURE__ */ new WeakMap();
1359
+ var _prev = /* @__PURE__ */ new WeakMap();
1360
+ var _next = /* @__PURE__ */ new WeakMap();
1361
+ var _commit_callbacks = /* @__PURE__ */ new WeakMap();
1362
+ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
1363
+ var _pending = /* @__PURE__ */ new WeakMap();
1364
+ var _blocking_pending = /* @__PURE__ */ new WeakMap();
1365
+ var _deferred = /* @__PURE__ */ new WeakMap();
1366
+ var _roots = /* @__PURE__ */ new WeakMap();
1367
+ var _new_effects = /* @__PURE__ */ new WeakMap();
1288
1368
  var _dirty_effects = /* @__PURE__ */ new WeakMap();
1289
1369
  var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1290
- var _effect_pending = /* @__PURE__ */ new WeakMap();
1291
- var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1292
- var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1293
- var Boundary = class {
1294
- /**
1295
- * @param {TemplateNode} node
1296
- * @param {BoundaryProps} props
1297
- * @param {((anchor: Node) => void)} children
1298
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1299
- */
1300
- constructor(node, props, children, transform_error) {
1301
- _classPrivateMethodInitSpec(this, _Boundary_brand);
1370
+ var _skipped_branches = /* @__PURE__ */ new WeakMap();
1371
+ var _unskipped_branches = /* @__PURE__ */ new WeakMap();
1372
+ var _decrement_queued = /* @__PURE__ */ new WeakMap();
1373
+ var _Batch_brand = /* @__PURE__ */ new WeakSet();
1374
+ var Batch = class Batch {
1375
+ constructor() {
1376
+ _classPrivateMethodInitSpec(this, _Batch_brand);
1377
+ _defineProperty(this, "id", uid++);
1378
+ _classPrivateFieldInitSpec(this, _started, false);
1379
+ _defineProperty(this, "linked", true);
1380
+ _classPrivateFieldInitSpec(this, _prev, null);
1381
+ _classPrivateFieldInitSpec(this, _next, null);
1302
1382
  _defineProperty(
1303
1383
  this,
1304
- /** @type {Boundary | null} */
1305
- "parent",
1306
- void 0
1384
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
1385
+ "async_deriveds",
1386
+ /* @__PURE__ */ new Map()
1307
1387
  );
1308
- _defineProperty(this, "is_pending", false);
1309
1388
  _defineProperty(
1310
1389
  this,
1311
1390
  /**
1312
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1313
- * Inherited from parent boundary, or defaults to identity.
1314
- * @type {(error: unknown) => unknown}
1391
+ * The current values of any signals that are updated in this batch.
1392
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
1393
+ * They keys of this map are identical to `this.#previous`
1394
+ * @type {Map<Value, [any, boolean]>}
1315
1395
  */
1316
- "transform_error",
1317
- void 0
1396
+ "current",
1397
+ /* @__PURE__ */ new Map()
1318
1398
  );
1319
- _classPrivateFieldInitSpec(this, _anchor, void 0);
1320
- _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1321
- _classPrivateFieldInitSpec(this, _props, void 0);
1322
- _classPrivateFieldInitSpec(this, _children, void 0);
1323
- _classPrivateFieldInitSpec(this, _effect, void 0);
1324
- _classPrivateFieldInitSpec(this, _main_effect, null);
1325
- _classPrivateFieldInitSpec(this, _pending_effect, null);
1326
- _classPrivateFieldInitSpec(this, _failed_effect, null);
1327
- _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1328
- _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1329
- _classPrivateFieldInitSpec(this, _pending_count, 0);
1330
- _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
1399
+ _defineProperty(
1400
+ this,
1401
+ /**
1402
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
1403
+ * They keys of this map are identical to `this.#current`
1404
+ * @type {Map<Value, any>}
1405
+ */
1406
+ "previous",
1407
+ /* @__PURE__ */ new Map()
1408
+ );
1409
+ _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
1410
+ _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
1411
+ _classPrivateFieldInitSpec(this, _pending, 0);
1412
+ _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
1413
+ _classPrivateFieldInitSpec(this, _deferred, null);
1414
+ _classPrivateFieldInitSpec(this, _roots, []);
1415
+ _classPrivateFieldInitSpec(this, _new_effects, []);
1331
1416
  _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1332
1417
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1333
- _classPrivateFieldInitSpec(this, _effect_pending, null);
1334
- _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1335
- _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1336
- return () => {
1337
- _classPrivateFieldSet2(_effect_pending, this, null);
1338
- };
1339
- }));
1340
- _classPrivateFieldSet2(_anchor, this, node);
1341
- _classPrivateFieldSet2(_props, this, props);
1342
- _classPrivateFieldSet2(_children, this, (anchor) => {
1343
- var effect = active_effect;
1344
- effect.b = this;
1345
- effect.f |= 128;
1346
- children(anchor);
1418
+ _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
1419
+ _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
1420
+ _defineProperty(this, "is_fork", false);
1421
+ _classPrivateFieldInitSpec(this, _decrement_queued, false);
1422
+ if (last_batch === null) first_batch = last_batch = this;
1423
+ else {
1424
+ _classPrivateFieldSet2(_next, last_batch, this);
1425
+ _classPrivateFieldSet2(_prev, this, last_batch);
1426
+ }
1427
+ last_batch = this;
1428
+ }
1429
+ /**
1430
+ * Add an effect to the #skipped_branches map and reset its children
1431
+ * @param {Effect} effect
1432
+ */
1433
+ skip_effect(effect) {
1434
+ if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
1435
+ d: [],
1436
+ m: []
1347
1437
  });
1348
- this.parent = active_effect.b;
1349
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1350
- _classPrivateFieldSet2(_effect, this, block(() => {
1351
- if (hydrating) {
1352
- const comment = _classPrivateFieldGet2(_hydrate_open, this);
1353
- hydrate_next();
1354
- const server_rendered_pending = comment.data === "[!";
1355
- if (comment.data.startsWith("[?")) {
1356
- const serialized_error = JSON.parse(comment.data.slice(2));
1357
- _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1358
- } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1359
- else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1360
- } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1361
- }, flags));
1362
- if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
1438
+ _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
1439
+ }
1440
+ /**
1441
+ * Remove an effect from the #skipped_branches map and reschedule
1442
+ * any tracked dirty/maybe_dirty child effects
1443
+ * @param {Effect} effect
1444
+ * @param {(e: Effect) => void} callback
1445
+ */
1446
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
1447
+ var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
1448
+ if (tracked) {
1449
+ _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
1450
+ for (var e of tracked.d) {
1451
+ set_signal_status(e, DIRTY);
1452
+ callback(e);
1453
+ }
1454
+ for (e of tracked.m) {
1455
+ set_signal_status(e, MAYBE_DIRTY);
1456
+ callback(e);
1457
+ }
1458
+ }
1459
+ _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
1460
+ }
1461
+ /**
1462
+ * Associate a change to a given source with the current
1463
+ * batch, noting its previous and current values
1464
+ * @param {Value} source
1465
+ * @param {any} value
1466
+ * @param {boolean} [is_derived]
1467
+ */
1468
+ capture(source, value, is_derived = false) {
1469
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
1470
+ if ((source.f & 8388608) === 0) {
1471
+ this.current.set(source, [value, is_derived]);
1472
+ batch_values?.set(source, value);
1473
+ }
1474
+ if (!this.is_fork) source.v = value;
1475
+ }
1476
+ activate() {
1477
+ current_batch = this;
1478
+ }
1479
+ deactivate() {
1480
+ current_batch = null;
1481
+ batch_values = null;
1482
+ }
1483
+ flush() {
1484
+ try {
1485
+ is_processing = true;
1486
+ current_batch = this;
1487
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1488
+ } finally {
1489
+ flush_count = 0;
1490
+ last_scheduled_effect = null;
1491
+ collected_effects = null;
1492
+ legacy_updates = null;
1493
+ is_processing = false;
1494
+ current_batch = null;
1495
+ batch_values = null;
1496
+ old_values.clear();
1497
+ }
1498
+ }
1499
+ discard() {
1500
+ for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
1501
+ _classPrivateFieldGet2(_discard_callbacks, this).clear();
1502
+ for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
1503
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1504
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
1363
1505
  }
1364
1506
  /**
1365
- * Defer an effect inside a pending boundary until the boundary resolves
1366
1507
  * @param {Effect} effect
1367
1508
  */
1368
- defer_effect(effect) {
1369
- defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1509
+ register_created_effect(effect) {
1510
+ _classPrivateFieldGet2(_new_effects, this).push(effect);
1370
1511
  }
1371
1512
  /**
1372
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1373
- * @returns {boolean}
1513
+ * @param {boolean} blocking
1514
+ * @param {Effect} effect
1374
1515
  */
1375
- is_rendered() {
1376
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1377
- }
1378
- has_pending_snippet() {
1379
- return !!_classPrivateFieldGet2(_props, this).pending;
1516
+ increment(blocking, effect) {
1517
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
1518
+ if (blocking) {
1519
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
1520
+ _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
1521
+ }
1380
1522
  }
1381
1523
  /**
1382
- * Update the source that powers `$effect.pending()` inside this boundary,
1383
- * and controls when the current `pending` snippet (if any) is removed.
1384
- * Do not call from inside the class
1385
- * @param {1 | -1} d
1386
- * @param {Batch} batch
1524
+ * @param {boolean} blocking
1525
+ * @param {Effect} effect
1387
1526
  */
1388
- update_pending_count(d, batch) {
1389
- _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1390
- _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1391
- if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1392
- _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1527
+ decrement(blocking, effect) {
1528
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
1529
+ if (blocking) {
1530
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
1531
+ if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
1532
+ else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
1533
+ }
1534
+ if (_classPrivateFieldGet2(_decrement_queued, this)) return;
1535
+ _classPrivateFieldSet2(_decrement_queued, this, true);
1393
1536
  queue_micro_task(() => {
1394
- _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1395
- if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1537
+ _classPrivateFieldSet2(_decrement_queued, this, false);
1538
+ if (this.linked) this.flush();
1396
1539
  });
1397
1540
  }
1398
- get_effect_pending() {
1399
- _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1400
- return get(_classPrivateFieldGet2(_effect_pending, this));
1541
+ /**
1542
+ * @param {Set<Effect>} dirty_effects
1543
+ * @param {Set<Effect>} maybe_dirty_effects
1544
+ */
1545
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
1546
+ for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects, this).add(e);
1547
+ for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects, this).add(e);
1548
+ dirty_effects.clear();
1549
+ maybe_dirty_effects.clear();
1401
1550
  }
1402
- /** @param {unknown} error */
1403
- error(error) {
1404
- if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
1405
- if (current_batch?.is_fork) {
1406
- if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
1407
- if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
1408
- if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
1409
- current_batch.on_fork_commit(() => {
1410
- _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1411
- });
1412
- } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1551
+ /** @param {(batch: Batch) => void} fn */
1552
+ oncommit(fn) {
1553
+ _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
1413
1554
  }
1414
- };
1415
- function _hydrate_resolved_content() {
1416
- try {
1417
- _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1418
- } catch (error) {
1419
- this.error(error);
1555
+ /** @param {(batch: Batch) => void} fn */
1556
+ ondiscard(fn) {
1557
+ _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
1420
1558
  }
1421
- }
1422
- /**
1423
- * @param {unknown} error The deserialized error from the server's hydration comment
1424
- */
1425
- function _hydrate_failed_content(error) {
1426
- const failed = _classPrivateFieldGet2(_props, this).failed;
1427
- if (!failed) return;
1428
- _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1429
- failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1430
- }));
1431
- }
1432
- function _hydrate_pending_content() {
1433
- const pending = _classPrivateFieldGet2(_props, this).pending;
1434
- if (!pending) return;
1435
- this.is_pending = true;
1436
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1437
- queue_micro_task(() => {
1438
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1439
- var anchor = create_text();
1440
- fragment.append(anchor);
1441
- _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1442
- return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1443
- }));
1444
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1445
- _classPrivateFieldGet2(_anchor, this).before(fragment);
1446
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1447
- pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1448
- _classPrivateFieldSet2(_pending_effect, this, null);
1559
+ settled() {
1560
+ return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
1561
+ }
1562
+ static ensure() {
1563
+ if (current_batch === null) {
1564
+ const batch = current_batch = new Batch();
1565
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
1566
+ if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
1449
1567
  });
1450
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1451
1568
  }
1452
- });
1453
- }
1454
- function _render() {
1455
- try {
1456
- this.is_pending = this.has_pending_snippet();
1457
- _classPrivateFieldSet2(_pending_count, this, 0);
1458
- _classPrivateFieldSet2(_local_pending_count, this, 0);
1459
- _classPrivateFieldSet2(_main_effect, this, branch(() => {
1460
- _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1461
- }));
1462
- if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1463
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1464
- move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1465
- const pending = _classPrivateFieldGet2(_props, this).pending;
1466
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1467
- } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1468
- } catch (error) {
1469
- this.error(error);
1470
- }
1471
- }
1472
- /**
1473
- * @param {Batch} batch
1474
- */
1475
- function _resolve(batch) {
1476
- this.is_pending = false;
1477
- batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1478
- }
1479
- /**
1480
- * @template T
1481
- * @param {() => T} fn
1482
- */
1483
- function _run(fn) {
1484
- var previous_effect = active_effect;
1485
- var previous_reaction = active_reaction;
1486
- var previous_ctx = component_context;
1487
- set_active_effect(_classPrivateFieldGet2(_effect, this));
1488
- set_active_reaction(_classPrivateFieldGet2(_effect, this));
1489
- set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1490
- try {
1491
- Batch.ensure();
1492
- return fn();
1493
- } catch (e) {
1494
- handle_error(e);
1495
- return null;
1496
- } finally {
1497
- set_active_effect(previous_effect);
1498
- set_active_reaction(previous_reaction);
1499
- set_component_context(previous_ctx);
1569
+ return current_batch;
1500
1570
  }
1501
- }
1502
- /**
1503
- * Updates the pending count associated with the currently visible pending snippet,
1504
- * if any, such that we can replace the snippet with content once work is done
1505
- * @param {1 | -1} d
1506
- * @param {Batch} batch
1507
- */
1508
- function _update_pending_count(d, batch) {
1509
- if (!this.has_pending_snippet()) {
1510
- if (this.parent) {
1511
- var _this$parent;
1512
- _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1571
+ apply() {
1572
+ if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
1573
+ batch_values = null;
1574
+ return;
1513
1575
  }
1514
- return;
1515
- }
1516
- _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1517
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1518
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1519
- if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1520
- _classPrivateFieldSet2(_pending_effect, this, null);
1521
- });
1522
- if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1523
- _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1524
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1576
+ batch_values = /* @__PURE__ */ new Map();
1577
+ for (const [source, [value]] of this.current) batch_values.set(source, value);
1578
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1579
+ if (batch === this || batch.is_fork) continue;
1580
+ var intersects = false;
1581
+ if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
1582
+ if (is_derived) continue;
1583
+ if (this.current.has(source)) {
1584
+ intersects = true;
1585
+ break;
1586
+ }
1587
+ }
1588
+ if (!intersects) {
1589
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
1590
+ }
1525
1591
  }
1526
1592
  }
1527
- }
1528
- /**
1529
- * @param {unknown} error
1530
- */
1531
- function _handle_error(error) {
1532
- if (_classPrivateFieldGet2(_main_effect, this)) {
1533
- destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1534
- _classPrivateFieldSet2(_main_effect, this, null);
1535
- }
1536
- if (_classPrivateFieldGet2(_pending_effect, this)) {
1537
- destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1538
- _classPrivateFieldSet2(_pending_effect, this, null);
1539
- }
1540
- if (_classPrivateFieldGet2(_failed_effect, this)) {
1541
- destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1542
- _classPrivateFieldSet2(_failed_effect, this, null);
1543
- }
1544
- if (hydrating) {
1545
- set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1546
- next();
1547
- set_hydrate_node(skip_nodes());
1548
- }
1549
- var onerror = _classPrivateFieldGet2(_props, this).onerror;
1550
- let failed = _classPrivateFieldGet2(_props, this).failed;
1551
- var did_reset = false;
1552
- var calling_on_error = false;
1553
- const reset = () => {
1554
- if (did_reset) {
1555
- svelte_boundary_reset_noop();
1593
+ /**
1594
+ *
1595
+ * @param {Effect} effect
1596
+ */
1597
+ schedule(effect) {
1598
+ last_scheduled_effect = effect;
1599
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
1600
+ effect.b.defer_effect(effect);
1556
1601
  return;
1557
1602
  }
1558
- did_reset = true;
1559
- if (calling_on_error) svelte_boundary_reset_onerror();
1560
- if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1561
- _classPrivateFieldSet2(_failed_effect, this, null);
1562
- });
1563
- _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1564
- _assertClassBrand(_Boundary_brand, this, _render).call(this);
1565
- });
1566
- };
1567
- /** @param {unknown} transformed_error */
1568
- const handle_error_result = (transformed_error) => {
1569
- try {
1570
- calling_on_error = true;
1571
- onerror?.(transformed_error, reset);
1572
- calling_on_error = false;
1573
- } catch (error) {
1574
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1603
+ var e = effect;
1604
+ while (e.parent !== null) {
1605
+ e = e.parent;
1606
+ var flags = e.f;
1607
+ if (collected_effects !== null && e === active_effect) {
1608
+ if (async_mode_flag) return;
1609
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
1610
+ }
1611
+ if ((flags & 96) !== 0) {
1612
+ if ((flags & 1024) === 0) return;
1613
+ e.f ^= CLEAN;
1614
+ }
1575
1615
  }
1576
- if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1577
- try {
1578
- return branch(() => {
1579
- var effect = active_effect;
1580
- effect.b = this;
1581
- effect.f |= 128;
1582
- failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1583
- });
1584
- } catch (error) {
1585
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1586
- return null;
1616
+ _classPrivateFieldGet2(_roots, this).push(e);
1617
+ }
1618
+ };
1619
+ _Batch = Batch;
1620
+ function _is_deferred() {
1621
+ if (this.is_fork) return true;
1622
+ for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
1623
+ var e = effect;
1624
+ var skipped = false;
1625
+ while (e.parent !== null) {
1626
+ if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
1627
+ skipped = true;
1628
+ break;
1587
1629
  }
1588
- }));
1589
- };
1590
- queue_micro_task(() => {
1591
- /** @type {unknown} */
1592
- var result;
1593
- try {
1594
- result = this.transform_error(error);
1595
- } catch (e) {
1596
- invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1597
- return;
1630
+ e = e.parent;
1598
1631
  }
1599
- if (result !== null && typeof result === "object" && typeof result.then === "function")
1600
- /** @type {any} */ result.then(
1601
- handle_error_result,
1602
- /** @param {unknown} e */
1603
- (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1604
- );
1605
- else handle_error_result(result);
1606
- });
1632
+ if (!skipped) return true;
1633
+ }
1634
+ return false;
1607
1635
  }
1608
- //#endregion
1609
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/async.js
1610
- /** @import { Blocker, Effect, Value } from '#client' */
1611
- /**
1612
- * @param {Blocker[]} blockers
1613
- * @param {Array<() => any>} sync
1614
- * @param {Array<() => Promise<any>>} async
1615
- * @param {(values: Value[]) => any} fn
1616
- */
1617
- function flatten(blockers, sync, async, fn) {
1618
- const d = is_runes() ? derived : derived_safe_equal;
1619
- var pending = blockers.filter((b) => !b.settled);
1620
- if (async.length === 0 && pending.length === 0) {
1621
- fn(sync.map(d));
1622
- return;
1636
+ function _process() {
1637
+ _classPrivateFieldSet2(_started, this, true);
1638
+ if (flush_count++ > 1e3) {
1639
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1640
+ infinite_loop_guard();
1623
1641
  }
1624
- var parent = active_effect;
1625
- var restore = capture();
1626
- var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1627
- /** @param {Value[]} values */
1628
- function finish(values) {
1629
- restore();
1630
- try {
1631
- fn(values);
1632
- } catch (error) {
1633
- if ((parent.f & 16384) === 0) invoke_error_boundary(error, parent);
1634
- }
1635
- unset_context();
1642
+ for (const e of _classPrivateFieldGet2(_dirty_effects, this)) {
1643
+ _classPrivateFieldGet2(_maybe_dirty_effects, this).delete(e);
1644
+ set_signal_status(e, DIRTY);
1645
+ this.schedule(e);
1636
1646
  }
1637
- if (async.length === 0) {
1638
- /** @type {Promise<any>} */ blocker_promise.then(() => finish(sync.map(d)));
1647
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects, this)) {
1648
+ set_signal_status(e, MAYBE_DIRTY);
1649
+ this.schedule(e);
1650
+ }
1651
+ const roots = _classPrivateFieldGet2(_roots, this);
1652
+ _classPrivateFieldSet2(_roots, this, []);
1653
+ this.apply();
1654
+ /** @type {Effect[]} */
1655
+ var effects = collected_effects = [];
1656
+ /** @type {Effect[]} */
1657
+ var render_effects = [];
1658
+ /**
1659
+ * @type {Effect[]}
1660
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1661
+ */
1662
+ var updates = legacy_updates = [];
1663
+ for (const root of roots) try {
1664
+ _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
1665
+ } catch (e) {
1666
+ reset_all(root);
1667
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
1668
+ throw e;
1669
+ }
1670
+ current_batch = null;
1671
+ if (updates.length > 0) {
1672
+ var batch = _Batch.ensure();
1673
+ for (const e of updates) batch.schedule(e);
1674
+ }
1675
+ collected_effects = null;
1676
+ legacy_updates = null;
1677
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
1678
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
1679
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
1680
+ for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
1681
+ if (updates.length > 0)
1682
+ /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
1639
1683
  return;
1640
1684
  }
1641
- var decrement_pending = increment_pending();
1642
- function run() {
1643
- 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());
1685
+ const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
1686
+ if (earlier_batch) {
1687
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
1688
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
1689
+ _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
1690
+ return;
1644
1691
  }
1645
- if (blocker_promise) blocker_promise.then(() => {
1646
- restore();
1647
- run();
1648
- unset_context();
1649
- });
1650
- else run();
1692
+ _classPrivateFieldGet2(_dirty_effects, this).clear();
1693
+ _classPrivateFieldGet2(_maybe_dirty_effects, this).clear();
1694
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
1695
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
1696
+ previous_batch = this;
1697
+ flush_queued_effects(render_effects);
1698
+ flush_queued_effects(effects);
1699
+ previous_batch = null;
1700
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
1701
+ var next_batch = current_batch;
1702
+ if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
1703
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1704
+ if (async_mode_flag) {
1705
+ _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
1706
+ current_batch = next_batch;
1707
+ }
1708
+ }
1709
+ if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
1710
+ const batch = next_batch;
1711
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
1712
+ } else next_batch = this;
1713
+ if (next_batch !== null) _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
1651
1714
  }
1652
1715
  /**
1653
- * Captures the current effect context so that we can restore it after
1654
- * some asynchronous work has happened (so that e.g. `await a + b`
1655
- * causes `b` to be registered as a dependency).
1716
+ * Traverse the effect tree, executing effects or stashing
1717
+ * them for later execution as appropriate
1718
+ * @param {Effect} root
1719
+ * @param {Effect[]} effects
1720
+ * @param {Effect[]} render_effects
1656
1721
  */
1657
- function capture() {
1658
- var previous_effect = active_effect;
1659
- var previous_reaction = active_reaction;
1660
- var previous_component_context = component_context;
1661
- var previous_batch = current_batch;
1662
- return function restore(activate_batch = true) {
1663
- set_active_effect(previous_effect);
1664
- set_active_reaction(previous_reaction);
1665
- set_component_context(previous_component_context);
1666
- if (activate_batch && (previous_effect.f & 16384) === 0) {
1667
- previous_batch?.activate();
1668
- previous_batch?.apply();
1722
+ function _traverse(root, effects, render_effects) {
1723
+ root.f ^= CLEAN;
1724
+ var effect = root.first;
1725
+ while (effect !== null) {
1726
+ var flags = effect.f;
1727
+ var is_branch = (flags & 96) !== 0;
1728
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
1729
+ if (is_branch) effect.f ^= CLEAN;
1730
+ else if ((flags & 4) !== 0) effects.push(effect);
1731
+ else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
1732
+ else if (is_dirty(effect)) {
1733
+ if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects, this).add(effect);
1734
+ update_effect(effect);
1735
+ }
1736
+ var child = effect.first;
1737
+ if (child !== null) {
1738
+ effect = child;
1739
+ continue;
1740
+ }
1669
1741
  }
1670
- };
1742
+ while (effect !== null) {
1743
+ var next = effect.next;
1744
+ if (next !== null) {
1745
+ effect = next;
1746
+ break;
1747
+ }
1748
+ effect = effect.parent;
1749
+ }
1750
+ }
1671
1751
  }
1672
- function unset_context(deactivate_batch = true) {
1673
- set_active_effect(null);
1674
- set_active_reaction(null);
1675
- set_component_context(null);
1676
- if (deactivate_batch) current_batch?.deactivate();
1752
+ function _find_earlier_batch() {
1753
+ var batch = _classPrivateFieldGet2(_prev, this);
1754
+ while (batch !== null) {
1755
+ if (!batch.is_fork) {
1756
+ for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
1757
+ }
1758
+ batch = _classPrivateFieldGet2(_prev, batch);
1759
+ }
1760
+ return null;
1677
1761
  }
1678
1762
  /**
1679
- * @returns {(skip?: boolean) => void}
1763
+ * @param {Batch} batch
1680
1764
  */
1681
- function increment_pending() {
1682
- var effect = active_effect;
1683
- var boundary = effect.b;
1684
- var batch = current_batch;
1685
- var blocking = boundary.is_rendered();
1686
- boundary.update_pending_count(1, batch);
1687
- batch.increment(blocking, effect);
1688
- return (skip = false) => {
1689
- boundary.update_pending_count(-1, batch);
1690
- batch.decrement(blocking, effect, skip);
1765
+ function _merge(batch) {
1766
+ for (const [source, value] of batch.current) {
1767
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1768
+ this.current.set(source, value);
1769
+ }
1770
+ for (const [effect, deferred] of batch.async_deriveds) {
1771
+ const d = this.async_deriveds.get(effect);
1772
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1773
+ }
1774
+ batch.async_deriveds.clear();
1775
+ this.transfer_effects(_classPrivateFieldGet2(_dirty_effects, batch), _classPrivateFieldGet2(_maybe_dirty_effects, batch));
1776
+ /**
1777
+ * mark all effects that depend on `batch.current`, except the
1778
+ * async effects that we just resolved (TODO unless they depend
1779
+ * on values in this batch that are NOT in the later batch?).
1780
+ * Through this we also will populate the correct #skipped_branches,
1781
+ * oncommit callbacks etc, so we don't need to merge them separately.
1782
+ * @param {Value} value
1783
+ */
1784
+ const mark = (value) => {
1785
+ var reactions = value.reactions;
1786
+ if (reactions === null) return;
1787
+ if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
1788
+ for (const reaction of reactions) {
1789
+ var flags = reaction.f;
1790
+ if ((flags & 2) !== 0) mark(reaction);
1791
+ else {
1792
+ var effect = reaction;
1793
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1794
+ _classPrivateFieldGet2(_maybe_dirty_effects, this).delete(effect);
1795
+ set_signal_status(effect, DIRTY);
1796
+ this.schedule(effect);
1797
+ }
1798
+ }
1799
+ }
1691
1800
  };
1801
+ for (const source of this.current.keys()) mark(source);
1802
+ this.oncommit(() => batch.discard());
1803
+ _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1804
+ current_batch = this;
1805
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1692
1806
  }
1693
1807
  /**
1694
- * @template V
1695
- * @param {() => V} fn
1696
- * @returns {Derived<V>}
1808
+ * @param {Effect[]} effects
1697
1809
  */
1698
- /* @__NO_SIDE_EFFECTS__ */
1699
- function derived(fn) {
1700
- var flags = 2 | DIRTY;
1701
- if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1702
- return {
1703
- ctx: component_context,
1704
- deps: null,
1705
- effects: null,
1706
- equals,
1707
- f: flags,
1708
- fn,
1709
- reactions: null,
1710
- rv: 0,
1711
- v: UNINITIALIZED,
1712
- wv: 0,
1713
- parent: active_effect,
1714
- ac: null
1715
- };
1810
+ function _defer_effects(effects) {
1811
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1716
1812
  }
1717
- /**
1718
- * @template V
1719
- * @param {() => V | Promise<V>} fn
1720
- * @param {string} [label]
1721
- * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1722
- * @returns {Promise<Source<V>>}
1723
- */
1724
- /* @__NO_SIDE_EFFECTS__ */
1725
- function async_derived(fn, label, location) {
1726
- let parent = active_effect;
1727
- if (parent === null) async_derived_orphan();
1728
- var promise = void 0;
1729
- var signal = source(UNINITIALIZED);
1730
- var should_suspend = !active_reaction;
1731
- /** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */
1732
- var deferreds = /* @__PURE__ */ new Map();
1733
- async_effect(() => {
1734
- var effect = active_effect;
1735
- /** @type {ReturnType<typeof deferred<V>>} */
1736
- var d = deferred();
1737
- promise = d.promise;
1738
- try {
1739
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1740
- } catch (error) {
1741
- d.reject(error);
1742
- unset_context();
1743
- }
1744
- var batch = current_batch;
1745
- if (should_suspend) {
1746
- if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1747
- if (parent.b.is_rendered()) {
1748
- deferreds.get(batch)?.reject(STALE_REACTION);
1749
- deferreds.delete(batch);
1750
- } else {
1751
- for (const d of deferreds.values()) d.reject(STALE_REACTION);
1752
- deferreds.clear();
1813
+ function _commit$1() {
1814
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1815
+ var is_earlier = batch.id < this.id;
1816
+ /** @type {Source[]} */
1817
+ var sources = [];
1818
+ for (const [source, [value, is_derived]] of this.current) {
1819
+ if (batch.current.has(source)) {
1820
+ var batch_value = batch.current.get(source)[0];
1821
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1822
+ else continue;
1753
1823
  }
1754
- deferreds.set(batch, d);
1824
+ sources.push(source);
1755
1825
  }
1756
- /**
1757
- * @param {any} value
1758
- * @param {unknown} error
1759
- */
1760
- const handler = (value, error = void 0) => {
1761
- if (decrement_pending) decrement_pending(error === STALE_REACTION);
1762
- if (error === STALE_REACTION || (effect.f & 16384) !== 0) return;
1826
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1827
+ const d = batch.async_deriveds.get(effect);
1828
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1829
+ }
1830
+ var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
1831
+ if (!_classPrivateFieldGet2(_started, batch) || current.length === 0) continue;
1832
+ var others = current.filter((source) => !this.current.has(source));
1833
+ if (others.length === 0) {
1834
+ if (is_earlier) batch.discard();
1835
+ } else if (sources.length > 0) {
1836
+ if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1837
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
1838
+ else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1839
+ });
1763
1840
  batch.activate();
1764
- if (error) {
1765
- signal.f |= ERROR_VALUE;
1766
- internal_set(signal, error);
1767
- } else {
1768
- if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1769
- internal_set(signal, value);
1770
- for (const [b, d] of deferreds) {
1771
- deferreds.delete(b);
1772
- if (b === batch) break;
1773
- d.reject(STALE_REACTION);
1774
- }
1841
+ /** @type {Set<Value>} */
1842
+ var marked = /* @__PURE__ */ new Set();
1843
+ /** @type {Map<Reaction, boolean>} */
1844
+ var checked = /* @__PURE__ */ new Map();
1845
+ for (var source of sources) mark_effects(source, others, marked, checked);
1846
+ checked = /* @__PURE__ */ new Map();
1847
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1848
+ const v2 = this.current.get(c);
1849
+ if (!v2) return true;
1850
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1851
+ }).map(([c]) => c);
1852
+ if (current_unequal.length > 0) {
1853
+ for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1854
+ set_signal_status(effect, DIRTY);
1855
+ batch.schedule(effect);
1856
+ } else _classPrivateFieldGet2(_dirty_effects, batch).add(effect);
1775
1857
  }
1776
- batch.deactivate();
1777
- };
1778
- d.promise.then(handler, (e) => handler(null, e || "unknown"));
1779
- });
1780
- teardown(() => {
1781
- for (const d of deferreds.values()) d.reject(STALE_REACTION);
1782
- });
1783
- return new Promise((fulfil) => {
1784
- /** @param {Promise<V>} p */
1785
- function next(p) {
1786
- function go() {
1787
- if (p === promise) fulfil(signal);
1788
- else next(promise);
1858
+ if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1859
+ batch.apply();
1860
+ for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1861
+ _classPrivateFieldSet2(_roots, batch, []);
1789
1862
  }
1790
- p.then(go, go);
1863
+ batch.deactivate();
1791
1864
  }
1792
- next(promise);
1793
- });
1865
+ }
1794
1866
  }
1795
- /**
1796
- * @template V
1797
- * @param {() => V} fn
1798
- * @returns {Derived<V>}
1799
- */
1800
- /* @__NO_SIDE_EFFECTS__ */
1801
- function user_derived(fn) {
1802
- const d = /* @__PURE__ */ derived(fn);
1803
- if (!async_mode_flag) push_reaction_value(d);
1804
- return d;
1867
+ function _unlink() {
1868
+ if (!this.linked) return;
1869
+ var prev = _classPrivateFieldGet2(_prev, this);
1870
+ var next = _classPrivateFieldGet2(_next, this);
1871
+ if (prev === null) first_batch = next;
1872
+ else _classPrivateFieldSet2(_next, prev, next);
1873
+ if (next === null) last_batch = prev;
1874
+ else _classPrivateFieldSet2(_prev, next, prev);
1875
+ this.linked = false;
1805
1876
  }
1806
1877
  /**
1807
- * @template V
1808
- * @param {() => V} fn
1809
- * @returns {Derived<V>}
1878
+ * Synchronously flush any pending updates.
1879
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1880
+ * @template [T=void]
1881
+ * @param {(() => T) | undefined} [fn]
1882
+ * @returns {T}
1810
1883
  */
1811
- /* @__NO_SIDE_EFFECTS__ */
1812
- function derived_safe_equal(fn) {
1813
- const signal = /* @__PURE__ */ derived(fn);
1814
- signal.equals = safe_equals;
1815
- return signal;
1884
+ function flushSync(fn) {
1885
+ var was_flushing_sync = is_flushing_sync;
1886
+ is_flushing_sync = true;
1887
+ try {
1888
+ var result;
1889
+ if (fn) {
1890
+ if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1891
+ result = fn();
1892
+ }
1893
+ while (true) {
1894
+ flush_tasks();
1895
+ if (current_batch === null) return result;
1896
+ current_batch.flush();
1897
+ }
1898
+ } finally {
1899
+ is_flushing_sync = was_flushing_sync;
1900
+ }
1901
+ }
1902
+ function infinite_loop_guard() {
1903
+ try {
1904
+ effect_update_depth_exceeded();
1905
+ } catch (error) {
1906
+ invoke_error_boundary(error, last_scheduled_effect);
1907
+ }
1816
1908
  }
1909
+ /** @type {Set<Effect> | null} */
1910
+ var eager_block_effects = null;
1817
1911
  /**
1818
- * @param {Derived} derived
1912
+ * @param {Array<Effect>} effects
1819
1913
  * @returns {void}
1820
1914
  */
1821
- function destroy_derived_effects(derived) {
1822
- var effects = derived.effects;
1823
- if (effects !== null) {
1824
- derived.effects = null;
1825
- for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1915
+ function flush_queued_effects(effects) {
1916
+ var length = effects.length;
1917
+ if (length === 0) return;
1918
+ var i = 0;
1919
+ while (i < length) {
1920
+ var effect = effects[i++];
1921
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1922
+ eager_block_effects = /* @__PURE__ */ new Set();
1923
+ update_effect(effect);
1924
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1925
+ if (eager_block_effects?.size > 0) {
1926
+ old_values.clear();
1927
+ for (const e of eager_block_effects) {
1928
+ if ((e.f & 24576) !== 0) continue;
1929
+ /** @type {Effect[]} */
1930
+ const ordered_effects = [e];
1931
+ let ancestor = e.parent;
1932
+ while (ancestor !== null) {
1933
+ if (eager_block_effects.has(ancestor)) {
1934
+ eager_block_effects.delete(ancestor);
1935
+ ordered_effects.push(ancestor);
1936
+ }
1937
+ ancestor = ancestor.parent;
1938
+ }
1939
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1940
+ const e = ordered_effects[j];
1941
+ if ((e.f & 24576) !== 0) continue;
1942
+ update_effect(e);
1943
+ }
1944
+ }
1945
+ eager_block_effects.clear();
1946
+ }
1947
+ }
1826
1948
  }
1949
+ eager_block_effects = null;
1827
1950
  }
1828
1951
  /**
1829
- * @template T
1830
- * @param {Derived} derived
1831
- * @returns {T}
1952
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1953
+ * depending on `value` and at least one of the other `sources`, so that
1954
+ * these effects can re-run after another batch has been committed
1955
+ * @param {Value} value
1956
+ * @param {Source[]} sources
1957
+ * @param {Set<Value>} marked
1958
+ * @param {Map<Reaction, boolean>} checked
1832
1959
  */
1833
- function execute_derived(derived) {
1834
- var value;
1835
- var prev_active_effect = active_effect;
1836
- var parent = derived.parent;
1837
- if (!is_destroying_effect && parent !== null && (parent.f & 24576) !== 0) {
1838
- derived_inert();
1839
- return derived.v;
1840
- }
1841
- set_active_effect(parent);
1842
- try {
1843
- derived.f &= ~WAS_MARKED;
1844
- destroy_derived_effects(derived);
1845
- value = update_reaction(derived);
1846
- } finally {
1847
- set_active_effect(prev_active_effect);
1960
+ function mark_effects(value, sources, marked, checked) {
1961
+ if (marked.has(value)) return;
1962
+ marked.add(value);
1963
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1964
+ const flags = reaction.f;
1965
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1966
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1967
+ set_signal_status(reaction, DIRTY);
1968
+ schedule_effect(reaction);
1969
+ }
1848
1970
  }
1849
- return value;
1850
1971
  }
1851
1972
  /**
1852
- * @param {Derived} derived
1853
- * @returns {void}
1973
+ * @param {Reaction} reaction
1974
+ * @param {Source[]} sources
1975
+ * @param {Map<Reaction, boolean>} checked
1854
1976
  */
1855
- function update_derived(derived) {
1856
- var value = execute_derived(derived);
1857
- if (!derived.equals(value)) {
1858
- derived.wv = increment_write_version();
1859
- if (!current_batch?.is_fork || derived.deps === null) {
1860
- if (current_batch !== null) current_batch.capture(derived, value, true);
1861
- else derived.v = value;
1862
- if (derived.deps === null) {
1863
- set_signal_status(derived, CLEAN);
1864
- return;
1865
- }
1977
+ function depends_on(reaction, sources, checked) {
1978
+ const depends = checked.get(reaction);
1979
+ if (depends !== void 0) return depends;
1980
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1981
+ if (includes.call(sources, dep)) return true;
1982
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1983
+ checked.set(dep, true);
1984
+ return true;
1866
1985
  }
1867
1986
  }
1868
- if (is_destroying_effect) return;
1869
- if (batch_values !== null) {
1870
- if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1871
- } else update_derived_status(derived);
1987
+ checked.set(reaction, false);
1988
+ return false;
1872
1989
  }
1873
1990
  /**
1874
- * @param {Derived} derived
1991
+ * @param {Effect} effect
1992
+ * @returns {void}
1875
1993
  */
1876
- function freeze_derived_effects(derived) {
1877
- if (derived.effects === null) return;
1878
- for (const e of derived.effects) if (e.teardown || e.ac) {
1879
- e.teardown?.();
1880
- e.ac?.abort(STALE_REACTION);
1881
- e.teardown = noop;
1882
- e.ac = null;
1883
- remove_reactions(e, 0);
1884
- destroy_effect_children(e);
1994
+ function schedule_effect(effect) {
1995
+ /** @type {Batch} */ current_batch.schedule(effect);
1996
+ }
1997
+ /**
1998
+ * Mark all the effects inside a skipped branch CLEAN, so that
1999
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
2000
+ * effects so they can be rescheduled if the branch survives.
2001
+ * @param {Effect} effect
2002
+ * @param {{ d: Effect[], m: Effect[] }} tracked
2003
+ */
2004
+ function reset_branch(effect, tracked) {
2005
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
2006
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
2007
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
2008
+ set_signal_status(effect, CLEAN);
2009
+ var e = effect.first;
2010
+ while (e !== null) {
2011
+ reset_branch(e, tracked);
2012
+ e = e.next;
1885
2013
  }
1886
2014
  }
1887
2015
  /**
1888
- * @param {Derived} derived
2016
+ * Mark an entire effect tree clean following an error
2017
+ * @param {Effect} effect
1889
2018
  */
1890
- function unfreeze_derived_effects(derived) {
1891
- if (derived.effects === null) return;
1892
- for (const e of derived.effects) if (e.teardown) update_effect(e);
2019
+ function reset_all(effect) {
2020
+ set_signal_status(effect, CLEAN);
2021
+ var e = effect.first;
2022
+ while (e !== null) {
2023
+ reset_all(e);
2024
+ e = e.next;
2025
+ }
1893
2026
  }
1894
2027
  //#endregion
1895
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/sources.js
2028
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/sources.js
1896
2029
  /** @import { Derived, Effect, Source, Value } from '#client' */
1897
- /** @type {Set<any>} */
2030
+ /** @type {Set<Effect>} */
1898
2031
  var eager_effects = /* @__PURE__ */ new Set();
1899
2032
  /** @type {Map<Source, any>} */
1900
2033
  var old_values = /* @__PURE__ */ new Map();
@@ -1920,7 +2053,7 @@ function source(v, stack) {
1920
2053
  * @param {V} v
1921
2054
  * @param {Error | null} [stack]
1922
2055
  */
1923
- /* @__NO_SIDE_EFFECTS__ */
2056
+ /*#__NO_SIDE_EFFECTS__*/
1924
2057
  function state(v, stack) {
1925
2058
  const s = source(v, stack);
1926
2059
  push_reaction_value(s);
@@ -1932,7 +2065,7 @@ function state(v, stack) {
1932
2065
  * @param {boolean} [immutable]
1933
2066
  * @returns {Source<V>}
1934
2067
  */
1935
- /* @__NO_SIDE_EFFECTS__ */
2068
+ /*#__NO_SIDE_EFFECTS__*/
1936
2069
  function mutable_source(initial_value, immutable = false, trackable = true) {
1937
2070
  const s = source(initial_value);
1938
2071
  if (!immutable) s.equals = safe_equals;
@@ -1950,7 +2083,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
1950
2083
  * @returns {V}
1951
2084
  */
1952
2085
  function set(source, value, should_proxy = false) {
1953
- 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();
2086
+ 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();
1954
2087
  return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1955
2088
  }
1956
2089
  /**
@@ -1982,7 +2115,13 @@ function flush_eager_effects() {
1982
2115
  eager_effects_deferred = false;
1983
2116
  for (const effect of eager_effects) {
1984
2117
  if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1985
- if (is_dirty(effect)) update_effect(effect);
2118
+ let dirty;
2119
+ try {
2120
+ dirty = is_dirty(effect);
2121
+ } catch {
2122
+ dirty = true;
2123
+ }
2124
+ if (dirty) update_effect(effect);
1986
2125
  }
1987
2126
  eager_effects.clear();
1988
2127
  }
@@ -2010,7 +2149,8 @@ function mark_reactions(signal, status, updated_during_traversal) {
2010
2149
  if (!runes && reaction === active_effect) continue;
2011
2150
  var not_dirty = (flags & DIRTY) === 0;
2012
2151
  if (not_dirty) set_signal_status(reaction, status);
2013
- if ((flags & 2) !== 0) {
2152
+ if ((flags & 131072) !== 0) eager_effects.add(reaction);
2153
+ else if ((flags & 2) !== 0) {
2014
2154
  var derived = reaction;
2015
2155
  batch_values?.delete(derived);
2016
2156
  if ((flags & 65536) === 0) {
@@ -2184,7 +2324,7 @@ function proxy(value) {
2184
2324
  });
2185
2325
  }
2186
2326
  //#endregion
2187
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/operations.js
2327
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/operations.js
2188
2328
  /** @import { Effect, TemplateNode } from '#client' */
2189
2329
  /** @type {Window} */
2190
2330
  var $window;
@@ -2208,13 +2348,13 @@ function init_operations() {
2208
2348
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2209
2349
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2210
2350
  if (is_extensible(element_prototype)) {
2211
- element_prototype.__click = void 0;
2212
- element_prototype.__className = void 0;
2213
- element_prototype.__attributes = null;
2214
- element_prototype.__style = void 0;
2351
+ /** @type {any} */ element_prototype[CLASS_CACHE] = void 0;
2352
+ /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null;
2353
+ /** @type {any} */ element_prototype[STYLE_CACHE] = void 0;
2215
2354
  element_prototype.__e = void 0;
2216
2355
  }
2217
- if (is_extensible(text_prototype)) text_prototype.__t = void 0;
2356
+ if (is_extensible(text_prototype))
2357
+ /** @type {any} */ text_prototype[TEXT_CACHE] = void 0;
2218
2358
  }
2219
2359
  /**
2220
2360
  * @param {string} value
@@ -2227,7 +2367,7 @@ function create_text(value = "") {
2227
2367
  * @template {Node} N
2228
2368
  * @param {N} node
2229
2369
  */
2230
- /* @__NO_SIDE_EFFECTS__ */
2370
+ /*@__NO_SIDE_EFFECTS__*/
2231
2371
  function get_first_child(node) {
2232
2372
  return first_child_getter.call(node);
2233
2373
  }
@@ -2235,7 +2375,7 @@ function get_first_child(node) {
2235
2375
  * @template {Node} N
2236
2376
  * @param {N} node
2237
2377
  */
2238
- /* @__NO_SIDE_EFFECTS__ */
2378
+ /*@__NO_SIDE_EFFECTS__*/
2239
2379
  function get_next_sibling(node) {
2240
2380
  return next_sibling_getter.call(node);
2241
2381
  }
@@ -2331,6 +2471,12 @@ function should_defer_append() {
2331
2471
  return (active_effect.f & REACTION_RAN) !== 0;
2332
2472
  }
2333
2473
  /**
2474
+ * Branching here is intentional and load-bearing for perf. `createElement(tag)`
2475
+ * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,
2476
+ * and passing an explicit `undefined` as the trailing options arg measurably
2477
+ * slows both APIs. Funnelling every case through a single `createElementNS(ns,
2478
+ * tag, options)` call would be smaller but slower on the HTML path.
2479
+ *
2334
2480
  * @template {keyof HTMLElementTagNameMap | string} T
2335
2481
  * @param {T} tag
2336
2482
  * @param {string} [namespace]
@@ -2338,8 +2484,8 @@ function should_defer_append() {
2338
2484
  * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
2339
2485
  */
2340
2486
  function create_element(tag, namespace, is) {
2341
- let options = is ? { is } : void 0;
2342
- return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
2487
+ if (namespace == null || namespace === "http://www.w3.org/1999/xhtml") return is ? document.createElement(tag, { is }) : document.createElement(tag);
2488
+ return is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag);
2343
2489
  }
2344
2490
  /**
2345
2491
  * Browsers split text nodes larger than 65536 bytes when parsing.
@@ -2356,25 +2502,7 @@ function merge_text_nodes(text) {
2356
2502
  }
2357
2503
  }
2358
2504
  //#endregion
2359
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2360
- /**
2361
- * @template T
2362
- * @param {() => T} fn
2363
- */
2364
- function without_reactive_context(fn) {
2365
- var previous_reaction = active_reaction;
2366
- var previous_effect = active_effect;
2367
- set_active_reaction(null);
2368
- set_active_effect(null);
2369
- try {
2370
- return fn();
2371
- } finally {
2372
- set_active_reaction(previous_reaction);
2373
- set_active_effect(previous_effect);
2374
- }
2375
- }
2376
- //#endregion
2377
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/effects.js
2505
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/effects.js
2378
2506
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2379
2507
  /**
2380
2508
  * @param {'$effect' | '$effect.pre' | '$inspect'} rune
@@ -2474,7 +2602,7 @@ function teardown(fn) {
2474
2602
  function user_effect(fn) {
2475
2603
  validate_effect("$effect");
2476
2604
  var flags = active_effect.f;
2477
- if (!active_reaction && (flags & 32) !== 0 && (flags & 32768) === 0) {
2605
+ if (!active_reaction && (flags & 32) !== 0 && component_context !== null && !component_context.i) {
2478
2606
  var context = component_context;
2479
2607
  (context.e ?? (context.e = [])).push(fn);
2480
2608
  } else return create_user_effect(fn);
@@ -2547,7 +2675,9 @@ function render_effect(fn, flags = 0) {
2547
2675
  */
2548
2676
  function template_effect(fn, sync = [], async = [], blockers = []) {
2549
2677
  flatten(blockers, sync, async, (values) => {
2550
- create_effect(8, () => fn(...values.map(get)));
2678
+ create_effect(8, () => {
2679
+ fn(...values.map(get));
2680
+ });
2551
2681
  });
2552
2682
  }
2553
2683
  /**
@@ -2623,7 +2753,7 @@ function destroy_effect(effect, remove_dom = true) {
2623
2753
  remove_effect_dom(effect.nodes.start, effect.nodes.end);
2624
2754
  removed = true;
2625
2755
  }
2626
- set_signal_status(effect, DESTROYING);
2756
+ effect.f |= DESTROYING;
2627
2757
  destroy_effect_children(effect, remove_dom && !removed);
2628
2758
  remove_reactions(effect, 0);
2629
2759
  var transitions = effect.nodes && effect.nodes.t;
@@ -2758,15 +2888,18 @@ function move_effect(effect, fragment) {
2758
2888
  }
2759
2889
  }
2760
2890
  //#endregion
2761
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/legacy.js
2891
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/legacy.js
2762
2892
  /**
2763
2893
  * @type {Set<Value> | null}
2764
2894
  * @deprecated
2765
2895
  */
2766
2896
  var captured_signals = null;
2767
2897
  //#endregion
2768
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/runtime.js
2898
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/runtime.js
2769
2899
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2900
+ /**
2901
+ * True if updating in an effect context that is reactive (i.e. not branch/root effects)
2902
+ */
2770
2903
  var is_updating_effect = false;
2771
2904
  var is_destroying_effect = false;
2772
2905
  /** @param {boolean} value */
@@ -2789,13 +2922,12 @@ function set_active_effect(effect) {
2789
2922
  /**
2790
2923
  * When sources are created within a reaction, reading and writing
2791
2924
  * them within that reaction should not cause a re-run
2792
- * @type {null | Source[]}
2925
+ * @type {null | Set<Source>}
2793
2926
  */
2794
2927
  var current_sources = null;
2795
2928
  /** @param {Value} value */
2796
2929
  function push_reaction_value(value) {
2797
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
2798
- else current_sources.push(value);
2930
+ if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2799
2931
  }
2800
2932
  /**
2801
2933
  * The dependencies of the reaction that is currently being executed. In many cases,
@@ -2860,7 +2992,7 @@ function is_dirty(reaction) {
2860
2992
  function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2861
2993
  var reactions = signal.reactions;
2862
2994
  if (reactions === null) return;
2863
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
2995
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return;
2864
2996
  for (var i = 0; i < reactions.length; i++) {
2865
2997
  var reaction = reactions[i];
2866
2998
  if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
@@ -2968,6 +3100,11 @@ function remove_reaction(signal, dependency) {
2968
3100
  derived.f &= ~WAS_MARKED;
2969
3101
  }
2970
3102
  if (derived.v !== UNINITIALIZED) update_derived_status(derived);
3103
+ if (derived.ac !== null) without_reactive_context(() => {
3104
+ /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
3105
+ derived.ac = null;
3106
+ set_signal_status(derived, DIRTY);
3107
+ });
2971
3108
  freeze_derived_effects(derived);
2972
3109
  remove_reactions(derived, 0);
2973
3110
  }
@@ -2993,7 +3130,7 @@ function update_effect(effect) {
2993
3130
  var previous_effect = active_effect;
2994
3131
  var was_updating_effect = is_updating_effect;
2995
3132
  active_effect = effect;
2996
- is_updating_effect = true;
3133
+ is_updating_effect = (flags & 96) === 0;
2997
3134
  try {
2998
3135
  if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2999
3136
  else destroy_effect_children(effect);
@@ -3015,7 +3152,7 @@ function get(signal) {
3015
3152
  var is_derived = (signal.f & 2) !== 0;
3016
3153
  captured_signals?.add(signal);
3017
3154
  if (active_reaction !== null && !untracking) {
3018
- if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
3155
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
3019
3156
  var deps = active_reaction.deps;
3020
3157
  if ((active_reaction.f & 2097152) !== 0) {
3021
3158
  if (signal.rv < read_version) {
@@ -3026,7 +3163,8 @@ function get(signal) {
3026
3163
  }
3027
3164
  } else {
3028
3165
  var _active_reaction;
3029
- ((_active_reaction = active_reaction).deps ?? (_active_reaction.deps = [])).push(signal);
3166
+ (_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
3167
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
3030
3168
  var reactions = signal.reactions;
3031
3169
  if (reactions === null) signal.reactions = [active_reaction];
3032
3170
  else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
@@ -3109,7 +3247,7 @@ function untrack(fn) {
3109
3247
  }
3110
3248
  }
3111
3249
  //#endregion
3112
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/events.js
3250
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/events.js
3113
3251
  /**
3114
3252
  * Used on elements, as a map of event type -> event handler,
3115
3253
  * and on events themselves to track which element handled an event
@@ -3166,8 +3304,7 @@ function handle_event_propagation(event) {
3166
3304
  */
3167
3305
  var other_errors = [];
3168
3306
  while (current_target !== null) {
3169
- /** @type {null | Element} */
3170
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
3307
+ if (current_target === handler_element) break;
3171
3308
  try {
3172
3309
  var delegated = current_target[event_symbol]?.[event_name];
3173
3310
  if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
@@ -3175,8 +3312,9 @@ function handle_event_propagation(event) {
3175
3312
  if (throw_error) other_errors.push(error);
3176
3313
  else throw_error = error;
3177
3314
  }
3178
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
3179
- current_target = parent_element;
3315
+ if (event.cancelBubble) break;
3316
+ path_idx++;
3317
+ current_target = path_idx < path.length ? path[path_idx] : null;
3180
3318
  }
3181
3319
  if (throw_error) {
3182
3320
  for (let error of other_errors) queueMicrotask(() => {
@@ -3192,7 +3330,7 @@ function handle_event_propagation(event) {
3192
3330
  }
3193
3331
  }
3194
3332
  //#endregion
3195
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/reconciler.js
3333
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/reconciler.js
3196
3334
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3197
3335
  /** @param {string} html */
3198
3336
  createHTML: (html) => {
@@ -3211,7 +3349,7 @@ function create_fragment_from_html(html) {
3211
3349
  return elem.content;
3212
3350
  }
3213
3351
  //#endregion
3214
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/template.js
3352
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/template.js
3215
3353
  /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3216
3354
  /** @import { TemplateStructure } from './types' */
3217
3355
  /**
@@ -3232,7 +3370,7 @@ function assign_nodes(start, end) {
3232
3370
  * @param {number} flags
3233
3371
  * @returns {() => Node | Node[]}
3234
3372
  */
3235
- /* @__NO_SIDE_EFFECTS__ */
3373
+ /*#__NO_SIDE_EFFECTS__*/
3236
3374
  function from_html(content, flags) {
3237
3375
  var is_fragment = (flags & 1) !== 0;
3238
3376
  var use_import_node = (flags & 2) !== 0;
@@ -3334,8 +3472,8 @@ function is_passive_event(name) {
3334
3472
  */
3335
3473
  function set_text(text, value) {
3336
3474
  var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
3337
- if (str !== (text.__t ?? (text.__t = text.nodeValue))) {
3338
- text.__t = str;
3475
+ if (str !== (text[TEXT_CACHE] ?? (text[TEXT_CACHE] = text.nodeValue))) {
3476
+ /** @type {any} */ text[TEXT_CACHE] = str;
3339
3477
  text.nodeValue = `${str}`;
3340
3478
  }
3341
3479
  }
@@ -3515,7 +3653,7 @@ function unmount(component, options) {
3515
3653
  return Promise.resolve();
3516
3654
  }
3517
3655
  //#endregion
3518
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3656
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3519
3657
  /** @import { Effect, TemplateNode } from '#client' */
3520
3658
  var _batches = /* @__PURE__ */ new WeakMap();
3521
3659
  var _onscreen = /* @__PURE__ */ new WeakMap();
@@ -3557,6 +3695,7 @@ var BranchManager = class {
3557
3695
  } else {
3558
3696
  var offscreen = _classPrivateFieldGet2(_offscreen, this).get(key);
3559
3697
  if (offscreen) {
3698
+ resume_effect(offscreen.effect);
3560
3699
  _classPrivateFieldGet2(_onscreen, this).set(key, offscreen.effect);
3561
3700
  _classPrivateFieldGet2(_offscreen, this).delete(key);
3562
3701
  /** @type {TemplateNode} */ offscreen.fragment.lastChild.remove();
@@ -3637,7 +3776,7 @@ var BranchManager = class {
3637
3776
  }
3638
3777
  };
3639
3778
  //#endregion
3640
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/blocks/if.js
3779
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/blocks/if.js
3641
3780
  /** @import { TemplateNode } from '#client' */
3642
3781
  /**
3643
3782
  * @param {TemplateNode} node
@@ -3683,7 +3822,7 @@ function if_block(node, fn, elseif = false) {
3683
3822
  }, flags);
3684
3823
  }
3685
3824
  //#endregion
3686
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/blocks/each.js
3825
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/blocks/each.js
3687
3826
  /** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */
3688
3827
  /** @import { Batch } from '../../reactivity/batch.js'; */
3689
3828
  /**
@@ -4155,7 +4294,7 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
4155
4294
  });
4156
4295
  }
4157
4296
  //#endregion
4158
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/css.js
4297
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/css.js
4159
4298
  /**
4160
4299
  * @param {Node} anchor
4161
4300
  * @param {{ hash: string, code: string }} css
@@ -4173,7 +4312,7 @@ function append_styles(anchor, css) {
4173
4312
  });
4174
4313
  }
4175
4314
  //#endregion
4176
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4315
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/attributes.js
4177
4316
  /** @import { Blocker, Effect } from '#client' */
4178
4317
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
4179
4318
  var IS_HTML = Symbol("is html");
@@ -4204,7 +4343,7 @@ function set_attribute(element, attribute, value, skip_warning) {
4204
4343
  * @param {Element} element
4205
4344
  */
4206
4345
  function get_attributes(element) {
4207
- return element.__attributes ?? (element.__attributes = {
4346
+ return element[ATTRIBUTES_CACHE] ?? (element[ATTRIBUTES_CACHE] = {
4208
4347
  [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
4209
4348
  [IS_HTML]: element.namespaceURI === "http://www.w3.org/1999/xhtml"
4210
4349
  });
@@ -4222,13 +4361,13 @@ function get_setters(element) {
4222
4361
  var element_proto = Element.prototype;
4223
4362
  while (element_proto !== proto) {
4224
4363
  descriptors = get_descriptors(proto);
4225
- for (var key in descriptors) if (descriptors[key].set) setters.push(key);
4364
+ for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.push(key);
4226
4365
  proto = get_prototype_of(proto);
4227
4366
  }
4228
4367
  return setters;
4229
4368
  }
4230
4369
  //#endregion
4231
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4370
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
4232
4371
  var _ResizeObserverSingleton;
4233
4372
  var _listeners = /* @__PURE__ */ new WeakMap();
4234
4373
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -4280,8 +4419,8 @@ function _getObserver() {
4280
4419
  }
4281
4420
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
4282
4421
  //#endregion
4283
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/props.js
4284
- /** @import { Effect, Source } from './types.js' */
4422
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/props.js
4423
+ /** @import { Derived, Effect, Source } from './types.js' */
4285
4424
  /**
4286
4425
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
4287
4426
  * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
@@ -4298,7 +4437,12 @@ function prop(props, key, flags, fallback) {
4298
4437
  var lazy = (flags & 16) !== 0;
4299
4438
  var fallback_value = fallback;
4300
4439
  var fallback_dirty = true;
4440
+ var fallback_signal = void 0;
4301
4441
  var get_fallback = () => {
4442
+ if (lazy && runes) {
4443
+ fallback_signal ?? (fallback_signal = /* @__PURE__ */ derived(fallback));
4444
+ return get(fallback_signal);
4445
+ }
4302
4446
  if (fallback_dirty) {
4303
4447
  fallback_dirty = false;
4304
4448
  fallback_value = lazy ? untrack(fallback) : fallback;
@@ -4368,7 +4512,7 @@ function prop(props, key, flags, fallback) {
4368
4512
  });
4369
4513
  }
4370
4514
  //#endregion
4371
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/legacy/legacy-client.js
4515
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/legacy/legacy-client.js
4372
4516
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
4373
4517
  /**
4374
4518
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -4487,7 +4631,7 @@ var Svelte4Component = class {
4487
4631
  }
4488
4632
  };
4489
4633
  //#endregion
4490
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4634
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4491
4635
  /**
4492
4636
  * @typedef {Object} CustomElementPropDefinition
4493
4637
  * @property {string} [attribute]
@@ -4773,18 +4917,18 @@ function create_custom_element(Component, props_definition, slots, exports, shad
4773
4917
  }
4774
4918
  //#endregion
4775
4919
  //#region src/print/Print.svelte
4776
- var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose prose-sm svelte-1fx5wwa"></div>`);
4777
- var root_2 = /* @__PURE__ */ from_html(`<div class="mb-2 prose prose-sm svelte-1fx5wwa"></div>`);
4778
- var root_4 = /* @__PURE__ */ from_html(`<img class="max-h-14 object-contain"/>`);
4920
+ var root = /* @__PURE__ */ from_html(`<div class="mb-4 prose prose-sm svelte-1fx5wwa"></div>`);
4921
+ var root_1 = /* @__PURE__ */ from_html(`<div class="mb-2 prose prose-sm svelte-1fx5wwa"></div>`);
4922
+ var root_2 = /* @__PURE__ */ from_html(`<img class="max-h-14 object-contain"/>`);
4779
4923
  var root_3 = /* @__PURE__ */ from_html(`<div class="mb-4 prose prose-sm svelte-1fx5wwa"><!> <span class="inline-block min-w-[6rem] border-b-2 border-gray-600 print:border-black px-1"><!></span> <!></div>`);
4780
- var root_8 = /* @__PURE__ */ from_html(`<div><strong>Audio:</strong> </div>`);
4781
- var root_9 = /* @__PURE__ */ from_html(`<div><strong>Transcript:</strong> </div>`);
4782
- var root_7 = /* @__PURE__ */ from_html(`<div class="text-sm mb-4"><!> <!></div>`);
4783
- var root_11 = /* @__PURE__ */ from_html(`<span class="font-medium"> </span> <!>`, 1);
4784
- var root_14 = /* @__PURE__ */ from_html(`<span class="font-medium">(key)</span>`);
4785
- var root_13 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
4924
+ var root_4 = /* @__PURE__ */ from_html(`<div><strong>Audio:</strong> </div>`);
4925
+ var root_5 = /* @__PURE__ */ from_html(`<div><strong>Transcript:</strong> </div>`);
4926
+ var root_6 = /* @__PURE__ */ from_html(`<div class="text-sm mb-4"><!> <!></div>`);
4927
+ var root_7 = /* @__PURE__ */ from_html(`<span class="font-medium"> </span> <!>`, 1);
4928
+ var root_8 = /* @__PURE__ */ from_html(`<span class="font-medium">(key)</span>`);
4929
+ var root_9 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
4786
4930
  var root_10 = /* @__PURE__ */ from_html(`<li><!></li>`);
4787
- var root = /* @__PURE__ */ from_html(`<div class="p-4 print:p-0"><!> <!> <!> <!> <ul class="text-sm list-disc pl-5"></ul></div>`);
4931
+ var root_11 = /* @__PURE__ */ from_html(`<div class="p-4 print:p-0"><!> <!> <!> <!> <ul class="text-sm list-disc pl-5"></ul></div>`);
4788
4932
  var $$css = {
4789
4933
  hash: "svelte-1fx5wwa",
4790
4934
  code: ".prose.svelte-1fx5wwa p {margin:0.5em 0;}.prose.svelte-1fx5wwa strong {font-weight:600;}"
@@ -4825,10 +4969,10 @@ function Print($$anchor, $$props) {
4825
4969
  flushSync();
4826
4970
  }
4827
4971
  };
4828
- var div = root();
4972
+ var div = root_11();
4829
4973
  var node = child(div);
4830
4974
  var consequent = ($$anchor) => {
4831
- var div_1 = root_1();
4975
+ var div_1 = root();
4832
4976
  html(div_1, () => get(prompt), true);
4833
4977
  reset(div_1);
4834
4978
  append($$anchor, div_1);
@@ -4838,7 +4982,7 @@ function Print($$anchor, $$props) {
4838
4982
  });
4839
4983
  var node_1 = sibling(node, 2);
4840
4984
  var consequent_1 = ($$anchor) => {
4841
- var div_2 = root_2();
4985
+ var div_2 = root_1();
4842
4986
  html(div_2, () => model().sentenceHtml, true);
4843
4987
  reset(div_2);
4844
4988
  append($$anchor, div_2);
@@ -4854,7 +4998,7 @@ function Print($$anchor, $$props) {
4854
4998
  var span = sibling(node_3, 2);
4855
4999
  var node_4 = child(span);
4856
5000
  var consequent_2 = ($$anchor) => {
4857
- var img = root_4();
5001
+ var img = root_2();
4858
5002
  template_effect(() => {
4859
5003
  set_attribute(img, "src", get(correct).imageUrl);
4860
5004
  set_attribute(img, "alt", get(correct).imageAlt || "");
@@ -4884,10 +5028,10 @@ function Print($$anchor, $$props) {
4884
5028
  });
4885
5029
  var node_7 = sibling(node_2, 2);
4886
5030
  var consequent_7 = ($$anchor) => {
4887
- var div_4 = root_7();
5031
+ var div_4 = root_6();
4888
5032
  var node_8 = child(div_4);
4889
5033
  var consequent_5 = ($$anchor) => {
4890
- var div_5 = root_8();
5034
+ var div_5 = root_4();
4891
5035
  var text_1 = sibling(child(div_5));
4892
5036
  reset(div_5);
4893
5037
  template_effect(() => set_text(text_1, ` ${model().audioUrl ?? ""}`));
@@ -4898,7 +5042,7 @@ function Print($$anchor, $$props) {
4898
5042
  });
4899
5043
  var node_9 = sibling(node_8, 2);
4900
5044
  var consequent_6 = ($$anchor) => {
4901
- var div_6 = root_9();
5045
+ var div_6 = root_5();
4902
5046
  var text_2 = sibling(child(div_6));
4903
5047
  reset(div_6);
4904
5048
  template_effect(() => set_text(text_2, ` ${model().audioTranscript ?? ""}`));
@@ -4918,7 +5062,7 @@ function Print($$anchor, $$props) {
4918
5062
  var li = root_10();
4919
5063
  var node_10 = child(li);
4920
5064
  var consequent_9 = ($$anchor) => {
4921
- var fragment_1 = root_11();
5065
+ var fragment_1 = root_7();
4922
5066
  var span_1 = first_child(fragment_1);
4923
5067
  var text_3 = child(span_1, true);
4924
5068
  reset(span_1);
@@ -4933,12 +5077,12 @@ function Print($$anchor, $$props) {
4933
5077
  append($$anchor, fragment_1);
4934
5078
  };
4935
5079
  var alternate_1 = ($$anchor) => {
4936
- var fragment_2 = root_13();
5080
+ var fragment_2 = root_9();
4937
5081
  var node_12 = first_child(fragment_2);
4938
5082
  html(node_12, () => get(c).labelHtml || "");
4939
5083
  var node_13 = sibling(node_12, 2);
4940
5084
  var consequent_10 = ($$anchor) => {
4941
- append($$anchor, root_14());
5085
+ append($$anchor, root_8());
4942
5086
  };
4943
5087
  if_block(node_13, ($$render) => {
4944
5088
  if (get(showAnswerKey) && get(c).id === model()?.correctChoiceId) $$render(consequent_10);