@pie-element/mc-populated-blank 0.2.13-next.3 → 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.
@@ -1,16 +1,16 @@
1
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.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.56.1/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
9
  var UNINITIALIZED = Symbol("uninitialized");
10
10
  var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
11
11
  var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
12
12
  //#endregion
13
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/shared/utils.js
13
+ //#region ../../../node_modules/.bun/svelte@5.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.133.0/helpers/esm/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.133.0/helpers/esm/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.133.0/helpers/esm/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.133.0/helpers/esm/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,
@@ -128,7 +128,7 @@ var STALE_REACTION = new class StaleReactionError extends Error {
128
128
  }();
129
129
  var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
130
130
  //#endregion
131
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
132
132
  /**
133
133
  * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
134
134
  * @returns {never}
@@ -239,7 +239,7 @@ function svelte_boundary_reset_noop() {
239
239
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
240
240
  }
241
241
  //#endregion
242
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
243
243
  /** @import { TemplateNode } from '#client' */
244
244
  /**
245
245
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -318,7 +318,7 @@ function read_hydration_instruction(node) {
318
318
  return node.data;
319
319
  }
320
320
  //#endregion
321
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
322
322
  /** @import { Equals } from '#client' */
323
323
  /** @type {Equals} */
324
324
  function equals(value) {
@@ -337,13 +337,13 @@ function safe_equals(value) {
337
337
  return !safe_not_equal(value, this.v);
338
338
  }
339
339
  //#endregion
340
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
341
341
  /** True if experimental.async=true */
342
342
  var async_mode_flag = false;
343
343
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
344
344
  var legacy_mode_flag = false;
345
345
  //#endregion
346
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
347
347
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
348
348
  /** @type {ComponentContext | null} */
349
349
  var component_context = null;
@@ -395,7 +395,7 @@ function is_runes() {
395
395
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
396
396
  }
397
397
  //#endregion
398
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
399
399
  /** @type {Array<() => void>} */
400
400
  var micro_tasks = [];
401
401
  function run_micro_tasks() {
@@ -438,6 +438,7 @@ function handle_error(error) {
438
438
  * @param {Effect | null} effect
439
439
  */
440
440
  function invoke_error_boundary(error, effect) {
441
+ if (effect !== null && (effect.f & 16384) !== 0) return;
441
442
  while (effect !== null) {
442
443
  if ((effect.f & 128) !== 0) {
443
444
  if ((effect.f & 32768) === 0) throw error;
@@ -453,7 +454,7 @@ function invoke_error_boundary(error, effect) {
453
454
  throw error;
454
455
  }
455
456
  //#endregion
456
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
457
458
  /** @import { Derived, Signal } from '#client' */
458
459
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
459
460
  /**
@@ -472,7 +473,7 @@ function update_derived_status(derived) {
472
473
  else set_signal_status(derived, MAYBE_DIRTY);
473
474
  }
474
475
  //#endregion
475
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
476
477
  /** @import { Derived, Effect, Value } from '#client' */
477
478
  /**
478
479
  * @param {Value[] | null} deps
@@ -500,7 +501,7 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
500
501
  set_signal_status(effect, CLEAN);
501
502
  }
502
503
  //#endregion
503
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
504
505
  /**
505
506
  * We set this to `true` when updating a store so that we correctly
506
507
  * schedule effects if the update takes place inside a `$:` effect
@@ -530,1460 +531,1501 @@ function capture_store_binding(fn) {
530
531
  }
531
532
  }
532
533
  //#endregion
533
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/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
534
626
  function _checkPrivateRedeclaration(e, t) {
535
627
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
536
628
  }
537
629
  //#endregion
538
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateMethodInitSpec.js
630
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateMethodInitSpec.js
539
631
  function _classPrivateMethodInitSpec(e, a) {
540
632
  _checkPrivateRedeclaration(e, a), a.add(e);
541
633
  }
542
634
  //#endregion
543
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldInitSpec.js
635
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldInitSpec.js
544
636
  function _classPrivateFieldInitSpec(e, t, a) {
545
637
  _checkPrivateRedeclaration(e, t), t.set(e, a);
546
638
  }
547
639
  //#endregion
548
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/assertClassBrand.js
640
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/assertClassBrand.js
549
641
  function _assertClassBrand(e, t, n) {
550
642
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
551
643
  throw new TypeError("Private element is not present on this object");
552
644
  }
553
645
  //#endregion
554
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldSet2.js
646
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldSet2.js
555
647
  function _classPrivateFieldSet2(s, a, r) {
556
648
  return s.set(_assertClassBrand(s, a), r), r;
557
649
  }
558
650
  //#endregion
559
- //#region \0@oxc-project+runtime@0.133.0/helpers/esm/classPrivateFieldGet2.js
651
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldGet2.js
560
652
  function _classPrivateFieldGet2(s, a) {
561
653
  return s.get(_assertClassBrand(s, a));
562
654
  }
563
655
  //#endregion
564
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/batch.js
565
- /** @import { Fork } from 'svelte' */
566
- /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
567
- var _Batch;
568
- /** @type {Batch | null} */
569
- var first_batch = null;
570
- /** @type {Batch | null} */
571
- var last_batch = null;
572
- /** @type {Batch | null} */
573
- var current_batch = null;
574
- /**
575
- * This is needed to avoid overwriting inputs
576
- * @type {Batch | null}
577
- */
578
- var previous_batch = null;
579
- /**
580
- * When time travelling (i.e. working in one batch, while other batches
581
- * still have ongoing work), we ignore the real values of affected
582
- * signals in favour of their values within the batch
583
- * @type {Map<Value, any> | null}
584
- */
585
- var batch_values = null;
586
- /** @type {Effect | null} */
587
- var last_scheduled_effect = null;
588
- var is_flushing_sync = false;
589
- var is_processing = false;
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' */
590
658
  /**
591
- * During traversal, this is an array. Newly created effects are (if not immediately
592
- * executed) pushed to this array, rather than going through the scheduling
593
- * rigamarole that would cause another turn of the flush loop.
594
- * @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
595
664
  */
596
- var collected_effects = null;
665
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
597
666
  /**
598
- * An array of effects that are marked during traversal as a result of a `set`
599
- * (not `internal_set`) call. These will be added to the next batch and
600
- * trigger another `batch.process()`
601
- * @type {Effect[] | null}
602
- * @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}
603
672
  */
604
- var legacy_updates = null;
605
- var flush_count = 0;
606
- var uid = 1;
607
- var _started = /* @__PURE__ */ new WeakMap();
608
- var _prev = /* @__PURE__ */ new WeakMap();
609
- var _next = /* @__PURE__ */ new WeakMap();
610
- var _commit_callbacks = /* @__PURE__ */ new WeakMap();
611
- var _discard_callbacks = /* @__PURE__ */ new WeakMap();
612
- var _pending = /* @__PURE__ */ new WeakMap();
613
- var _blocking_pending = /* @__PURE__ */ new WeakMap();
614
- var _deferred = /* @__PURE__ */ new WeakMap();
615
- var _roots = /* @__PURE__ */ new WeakMap();
616
- 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();
617
688
  var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
618
689
  var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
619
- var _skipped_branches = /* @__PURE__ */ new WeakMap();
620
- var _unskipped_branches = /* @__PURE__ */ new WeakMap();
621
- var _decrement_queued = /* @__PURE__ */ new WeakMap();
622
- var _Batch_brand = /* @__PURE__ */ new WeakSet();
623
- var Batch = class Batch {
624
- constructor() {
625
- _classPrivateMethodInitSpec(this, _Batch_brand);
626
- _defineProperty(this, "id", uid++);
627
- _classPrivateFieldInitSpec(this, _started, false);
628
- _defineProperty(this, "linked", true);
629
- _classPrivateFieldInitSpec(this, _prev, null);
630
- _classPrivateFieldInitSpec(this, _next, null);
631
- _defineProperty(
632
- this,
633
- /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
634
- "async_deriveds",
635
- /* @__PURE__ */ new Map()
636
- );
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);
637
702
  _defineProperty(
638
703
  this,
639
- /**
640
- * The current values of any signals that are updated in this batch.
641
- * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
642
- * They keys of this map are identical to `this.#previous`
643
- * @type {Map<Value, [any, boolean]>}
644
- */
645
- "current",
646
- /* @__PURE__ */ new Map()
704
+ /** @type {Boundary | null} */
705
+ "parent",
706
+ void 0
647
707
  );
708
+ _defineProperty(this, "is_pending", false);
648
709
  _defineProperty(
649
710
  this,
650
711
  /**
651
- * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
652
- * They keys of this map are identical to `this.#current`
653
- * @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}
654
715
  */
655
- "previous",
656
- /* @__PURE__ */ new Map()
716
+ "transform_error",
717
+ void 0
657
718
  );
658
- _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
659
- _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
660
- _classPrivateFieldInitSpec(this, _pending, 0);
661
- _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
662
- _classPrivateFieldInitSpec(this, _deferred, null);
663
- _classPrivateFieldInitSpec(this, _roots, []);
664
- _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);
665
731
  _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
666
732
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
667
- _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
668
- _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
669
- _defineProperty(this, "is_fork", false);
670
- _classPrivateFieldInitSpec(this, _decrement_queued, false);
671
- if (last_batch === null) first_batch = last_batch = this;
672
- else {
673
- _classPrivateFieldSet2(_next, last_batch, this);
674
- _classPrivateFieldSet2(_prev, this, last_batch);
675
- }
676
- last_batch = this;
677
- }
678
- /**
679
- * Add an effect to the #skipped_branches map and reset its children
680
- * @param {Effect} effect
681
- */
682
- skip_effect(effect) {
683
- if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
684
- d: [],
685
- m: []
686
- });
687
- _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
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);
688
763
  }
689
764
  /**
690
- * Remove an effect from the #skipped_branches map and reschedule
691
- * any tracked dirty/maybe_dirty child effects
765
+ * Defer an effect inside a pending boundary until the boundary resolves
692
766
  * @param {Effect} effect
693
- * @param {(e: Effect) => void} callback
694
- */
695
- unskip_effect(effect, callback = (e) => this.schedule(e)) {
696
- var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
697
- if (tracked) {
698
- _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
699
- for (var e of tracked.d) {
700
- set_signal_status(e, DIRTY);
701
- callback(e);
702
- }
703
- for (e of tracked.m) {
704
- set_signal_status(e, MAYBE_DIRTY);
705
- callback(e);
706
- }
707
- }
708
- _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
709
- }
710
- /**
711
- * Associate a change to a given source with the current
712
- * batch, noting its previous and current values
713
- * @param {Value} source
714
- * @param {any} value
715
- * @param {boolean} [is_derived]
716
767
  */
717
- capture(source, value, is_derived = false) {
718
- if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
719
- if ((source.f & 8388608) === 0) {
720
- this.current.set(source, [value, is_derived]);
721
- batch_values?.set(source, value);
722
- }
723
- if (!this.is_fork) source.v = value;
724
- }
725
- activate() {
726
- current_batch = this;
727
- }
728
- deactivate() {
729
- current_batch = null;
730
- batch_values = null;
731
- }
732
- flush() {
733
- try {
734
- is_processing = true;
735
- current_batch = this;
736
- _assertClassBrand(_Batch_brand, this, _process).call(this);
737
- } finally {
738
- flush_count = 0;
739
- last_scheduled_effect = null;
740
- collected_effects = null;
741
- legacy_updates = null;
742
- is_processing = false;
743
- current_batch = null;
744
- batch_values = null;
745
- old_values.clear();
746
- }
747
- }
748
- discard() {
749
- for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
750
- _classPrivateFieldGet2(_discard_callbacks, this).clear();
751
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
752
- _classPrivateFieldGet2(_deferred, this)?.resolve();
768
+ defer_effect(effect) {
769
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
753
770
  }
754
771
  /**
755
- * @param {Effect} effect
772
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
773
+ * @returns {boolean}
756
774
  */
757
- register_created_effect(effect) {
758
- _classPrivateFieldGet2(_new_effects, this).push(effect);
775
+ is_rendered() {
776
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
759
777
  }
760
- /**
761
- * @param {boolean} blocking
762
- * @param {Effect} effect
763
- */
764
- increment(blocking, effect) {
765
- _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
766
- if (blocking) {
767
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
768
- _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
769
- }
778
+ has_pending_snippet() {
779
+ return !!_classPrivateFieldGet2(_props, this).pending;
770
780
  }
771
781
  /**
772
- * @param {boolean} blocking
773
- * @param {Effect} effect
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
774
787
  */
775
- decrement(blocking, effect) {
776
- _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
777
- if (blocking) {
778
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
779
- if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
780
- else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
781
- }
782
- if (_classPrivateFieldGet2(_decrement_queued, this)) return;
783
- _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);
784
793
  queue_micro_task(() => {
785
- _classPrivateFieldSet2(_decrement_queued, this, false);
786
- if (this.linked) 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));
787
796
  });
788
797
  }
789
- /**
790
- * @param {Set<Effect>} dirty_effects
791
- * @param {Set<Effect>} maybe_dirty_effects
792
- */
793
- transfer_effects(dirty_effects, maybe_dirty_effects) {
794
- for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
795
- for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
796
- dirty_effects.clear();
797
- maybe_dirty_effects.clear();
798
- }
799
- /** @param {(batch: Batch) => void} fn */
800
- oncommit(fn) {
801
- _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
802
- }
803
- /** @param {(batch: Batch) => void} fn */
804
- ondiscard(fn) {
805
- _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
806
- }
807
- settled() {
808
- return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
798
+ get_effect_pending() {
799
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
800
+ return get(_classPrivateFieldGet2(_effect_pending, this));
809
801
  }
810
- static ensure() {
811
- if (current_batch === null) {
812
- const batch = current_batch = new Batch();
813
- if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
814
- if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
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);
815
811
  });
816
- }
817
- return current_batch;
812
+ } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
818
813
  }
819
- apply() {
820
- if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
821
- batch_values = null;
822
- return;
823
- }
824
- batch_values = /* @__PURE__ */ new Map();
825
- for (const [source, [value]] of this.current) batch_values.set(source, value);
826
- for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
827
- if (batch === this || batch.is_fork) continue;
828
- var intersects = false;
829
- if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
830
- if (is_derived) continue;
831
- if (this.current.has(source)) {
832
- intersects = true;
833
- break;
834
- }
835
- }
836
- if (!intersects) {
837
- for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
838
- }
839
- }
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);
840
820
  }
841
- /**
842
- *
843
- * @param {Effect} effect
844
- */
845
- schedule(effect) {
846
- last_scheduled_effect = effect;
847
- if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
848
- effect.b.defer_effect(effect);
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();
849
846
  return;
850
847
  }
851
- var e = effect;
852
- while (e.parent !== null) {
853
- e = e.parent;
854
- var flags = e.f;
855
- if (collected_effects !== null && e === active_effect) {
856
- if (async_mode_flag) return;
857
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
858
- }
859
- if ((flags & 96) !== 0) {
860
- if ((flags & 1024) === 0) return;
861
- e.f ^= CLEAN;
862
- }
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);
863
864
  }
864
- _classPrivateFieldGet2(_roots, this).push(e);
865
- }
866
- };
867
- _Batch = Batch;
868
- function _is_deferred() {
869
- if (this.is_fork) return true;
870
- for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
871
- var e = effect;
872
- var skipped = false;
873
- while (e.parent !== null) {
874
- if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
875
- skipped = true;
876
- break;
877
- }
878
- e = e.parent;
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);
879
890
  }
880
- if (!skipped) return true;
881
- }
882
- return false;
891
+ });
883
892
  }
884
- function _process() {
885
- _classPrivateFieldSet2(_started, this, true);
886
- if (flush_count++ > 1e3) {
887
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
888
- infinite_loop_guard();
889
- }
890
- for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
891
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
892
- set_signal_status(e, DIRTY);
893
- this.schedule(e);
894
- }
895
- for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
896
- set_signal_status(e, MAYBE_DIRTY);
897
- this.schedule(e);
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);
898
909
  }
899
- const roots = _classPrivateFieldGet2(_roots, this);
900
- _classPrivateFieldSet2(_roots, this, []);
901
- this.apply();
902
- /** @type {Effect[]} */
903
- var effects = collected_effects = [];
904
- /** @type {Effect[]} */
905
- var render_effects = [];
906
- /**
907
- * @type {Effect[]}
908
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
909
- */
910
- var updates = legacy_updates = [];
911
- for (const root of roots) try {
912
- _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
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();
913
932
  } catch (e) {
914
- reset_all(root);
915
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
916
- throw e;
917
- }
918
- current_batch = null;
919
- if (updates.length > 0) {
920
- var batch = _Batch.ensure();
921
- for (const e of updates) batch.schedule(e);
922
- }
923
- collected_effects = null;
924
- legacy_updates = null;
925
- if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
926
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
927
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
928
- for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
929
- if (updates.length > 0)
930
- /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
931
- return;
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);
932
939
  }
933
- const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
934
- if (earlier_batch) {
935
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
936
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
937
- _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
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);
952
+ }
938
953
  return;
939
954
  }
940
- _classPrivateFieldGet2(_dirty_effects$1, this).clear();
941
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
942
- for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
943
- _classPrivateFieldGet2(_commit_callbacks, this).clear();
944
- previous_batch = this;
945
- flush_queued_effects(render_effects);
946
- flush_queued_effects(effects);
947
- previous_batch = null;
948
- _classPrivateFieldGet2(_deferred, this)?.resolve();
949
- var next_batch = current_batch;
950
- if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
951
- _assertClassBrand(_Batch_brand, this, _unlink).call(this);
952
- if (async_mode_flag) {
953
- _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
954
- current_batch = next_batch;
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);
955
964
  }
956
965
  }
957
- if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
958
- const batch = next_batch;
959
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
960
- } else next_batch = this;
961
- if (next_batch !== null) _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
962
966
  }
963
967
  /**
964
- * Traverse the effect tree, executing effects or stashing
965
- * them for later execution as appropriate
966
- * @param {Effect} root
967
- * @param {Effect[]} effects
968
- * @param {Effect[]} render_effects
968
+ * @param {unknown} error
969
969
  */
970
- function _traverse(root, effects, render_effects) {
971
- root.f ^= CLEAN;
972
- var effect = root.first;
973
- while (effect !== null) {
974
- var flags = effect.f;
975
- var is_branch = (flags & 96) !== 0;
976
- if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
977
- if (is_branch) effect.f ^= CLEAN;
978
- else if ((flags & 4) !== 0) effects.push(effect);
979
- else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
980
- else if (is_dirty(effect)) {
981
- if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
982
- update_effect(effect);
983
- }
984
- var child = effect.first;
985
- if (child !== null) {
986
- effect = child;
987
- continue;
988
- }
989
- }
990
- while (effect !== null) {
991
- var next = effect.next;
992
- if (next !== null) {
993
- effect = next;
994
- break;
995
- }
996
- effect = effect.parent;
997
- }
970
+ function _handle_error(error) {
971
+ if (_classPrivateFieldGet2(_main_effect, this)) {
972
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
973
+ _classPrivateFieldSet2(_main_effect, this, null);
998
974
  }
999
- }
1000
- function _find_earlier_batch() {
1001
- var batch = _classPrivateFieldGet2(_prev, this);
1002
- while (batch !== null) {
1003
- if (!batch.is_fork) {
1004
- for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
1005
- }
1006
- batch = _classPrivateFieldGet2(_prev, batch);
975
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
976
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
977
+ _classPrivateFieldSet2(_pending_effect, this, null);
1007
978
  }
1008
- return null;
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;
1004
+ }
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;
1015
+ }
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
+ });
1009
1024
  }
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' */
1010
1028
  /**
1011
- * @param {Batch} batch
1029
+ * @param {Blocker[]} blockers
1030
+ * @param {Array<() => any>} sync
1031
+ * @param {Array<() => Promise<any>>} async
1032
+ * @param {(values: Value[]) => any} fn
1012
1033
  */
1013
- function _merge(batch) {
1014
- for (const [source, value] of batch.current) {
1015
- if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1016
- this.current.set(source, value);
1017
- }
1018
- for (const [effect, deferred] of batch.async_deriveds) {
1019
- const d = this.async_deriveds.get(effect);
1020
- if (d) deferred.promise.then(d.resolve).catch(d.reject);
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;
1021
1041
  }
1022
- this.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, batch), _classPrivateFieldGet2(_maybe_dirty_effects$1, batch));
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;
1023
1045
  /**
1024
- * mark all effects that depend on `batch.current`, except the
1025
- * async effects that we just resolved (TODO unless they depend
1026
- * on values in this batch that are NOT in the later batch?).
1027
- * Through this we also will populate the correct #skipped_branches,
1028
- * oncommit callbacks etc, so we don't need to merge them separately.
1029
- * @param {Value} value
1046
+ * @param {Source[]} async
1030
1047
  */
1031
- const mark = (value) => {
1032
- var reactions = value.reactions;
1033
- if (reactions === null) return;
1034
- for (const reaction of reactions) {
1035
- var flags = reaction.f;
1036
- if ((flags & 2) !== 0) mark(reaction);
1037
- else {
1038
- var effect = reaction;
1039
- if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1040
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(effect);
1041
- set_signal_status(effect, DIRTY);
1042
- this.schedule(effect);
1043
- }
1044
- }
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();
1057
+ }
1058
+ var decrement_pending = increment_pending();
1059
+ if (async.length === 0) {
1060
+ /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).finally(decrement_pending);
1061
+ return;
1062
+ }
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);
1065
+ }
1066
+ if (blocker_promise) blocker_promise.then(() => {
1067
+ restore();
1068
+ run();
1069
+ unset_context();
1070
+ });
1071
+ else run();
1072
+ }
1073
+ /**
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).
1077
+ */
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();
1045
1090
  }
1046
1091
  };
1047
- for (const source of this.current.keys()) mark(source);
1048
- this.oncommit(() => batch.discard());
1049
- _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1050
- current_batch = this;
1051
- _assertClassBrand(_Batch_brand, this, _process).call(this);
1052
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();
1098
+ }
1099
+ /**
1100
+ * @returns {(skip?: boolean) => void}
1101
+ */
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
+ };
1113
+ }
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
+ };
1137
+ }
1138
+ var OBSOLETE = Symbol("obsolete");
1053
1139
  /**
1054
- * @param {Effect[]} effects
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>>}
1055
1145
  */
1056
- function _defer_effects(effects) {
1057
- for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
1058
- }
1059
- function _commit$1() {
1060
- for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1061
- var is_earlier = batch.id < this.id;
1062
- /** @type {Source[]} */
1063
- var sources = [];
1064
- for (const [source, [value, is_derived]] of this.current) {
1065
- if (batch.current.has(source)) {
1066
- var batch_value = batch.current.get(source)[0];
1067
- if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1068
- else continue;
1069
- }
1070
- sources.push(source);
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();
1071
1167
  }
1072
- if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1073
- const d = batch.async_deriveds.get(effect);
1074
- if (d) deferred.promise.then(d.resolve).catch(d.reject);
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);
1075
1175
  }
1076
- if (!_classPrivateFieldGet2(_started, batch)) continue;
1077
- var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
1078
- if (others.length === 0) {
1079
- if (is_earlier) batch.discard();
1080
- } else if (sources.length > 0) {
1081
- if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1082
- if ((e.f & 4194320) !== 0) batch.schedule(e);
1083
- else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1084
- });
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;
1085
1184
  batch.activate();
1086
- /** @type {Set<Value>} */
1087
- var marked = /* @__PURE__ */ new Set();
1088
- /** @type {Map<Reaction, boolean>} */
1089
- var checked = /* @__PURE__ */ new Map();
1090
- for (var source of sources) mark_effects(source, others, marked, checked);
1091
- checked = /* @__PURE__ */ new Map();
1092
- var current_unequal = [...batch.current].filter(([c, v1]) => {
1093
- const v2 = this.current.get(c);
1094
- if (!v2) return true;
1095
- return v2[0] !== v1[0] || v2[1] !== v1[1];
1096
- }).map(([c]) => c);
1097
- if (current_unequal.length > 0) {
1098
- for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1099
- set_signal_status(effect, DIRTY);
1100
- batch.schedule(effect);
1101
- } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
1102
- }
1103
- if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1104
- batch.apply();
1105
- for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1106
- _classPrivateFieldSet2(_roots, batch, []);
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);
1107
1191
  }
1108
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);
1205
+ }
1206
+ p.then(go, go);
1109
1207
  }
1110
- }
1111
- }
1112
- function _unlink() {
1113
- if (!this.linked) return;
1114
- var prev = _classPrivateFieldGet2(_prev, this);
1115
- var next = _classPrivateFieldGet2(_next, this);
1116
- if (prev === null) first_batch = next;
1117
- else _classPrivateFieldSet2(_next, prev, next);
1118
- if (next === null) last_batch = prev;
1119
- else _classPrivateFieldSet2(_prev, next, prev);
1120
- this.linked = false;
1208
+ next(promise);
1209
+ });
1121
1210
  }
1122
1211
  /**
1123
- * Synchronously flush any pending updates.
1124
- * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1125
- * @template [T=void]
1126
- * @param {(() => T) | undefined} [fn]
1127
- * @returns {T}
1212
+ * @template V
1213
+ * @param {() => V} fn
1214
+ * @returns {Derived<V>}
1128
1215
  */
1129
- function flushSync(fn) {
1130
- var was_flushing_sync = is_flushing_sync;
1131
- is_flushing_sync = true;
1132
- try {
1133
- var result;
1134
- if (fn) {
1135
- if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1136
- result = fn();
1137
- }
1138
- while (true) {
1139
- flush_tasks();
1140
- if (current_batch === null) return result;
1141
- current_batch.flush();
1142
- }
1143
- } finally {
1144
- is_flushing_sync = was_flushing_sync;
1145
- }
1146
- }
1147
- function infinite_loop_guard() {
1148
- try {
1149
- effect_update_depth_exceeded();
1150
- } catch (error) {
1151
- invoke_error_boundary(error, last_scheduled_effect);
1152
- }
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;
1153
1221
  }
1154
- /** @type {Set<Effect> | null} */
1155
- var eager_block_effects = null;
1156
1222
  /**
1157
- * @param {Array<Effect>} effects
1158
- * @returns {void}
1223
+ * @template V
1224
+ * @param {() => V} fn
1225
+ * @returns {Derived<V>}
1159
1226
  */
1160
- function flush_queued_effects(effects) {
1161
- var length = effects.length;
1162
- if (length === 0) return;
1163
- var i = 0;
1164
- while (i < length) {
1165
- var effect = effects[i++];
1166
- if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1167
- eager_block_effects = /* @__PURE__ */ new Set();
1168
- update_effect(effect);
1169
- if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1170
- if (eager_block_effects?.size > 0) {
1171
- old_values.clear();
1172
- for (const e of eager_block_effects) {
1173
- if ((e.f & 24576) !== 0) continue;
1174
- /** @type {Effect[]} */
1175
- const ordered_effects = [e];
1176
- let ancestor = e.parent;
1177
- while (ancestor !== null) {
1178
- if (eager_block_effects.has(ancestor)) {
1179
- eager_block_effects.delete(ancestor);
1180
- ordered_effects.push(ancestor);
1181
- }
1182
- ancestor = ancestor.parent;
1183
- }
1184
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
1185
- const e = ordered_effects[j];
1186
- if ((e.f & 24576) !== 0) continue;
1187
- update_effect(e);
1188
- }
1189
- }
1190
- eager_block_effects.clear();
1191
- }
1192
- }
1193
- }
1194
- eager_block_effects = null;
1227
+ /*#__NO_SIDE_EFFECTS__*/
1228
+ function derived_safe_equal(fn) {
1229
+ const signal = /* @__PURE__ */ derived(fn);
1230
+ signal.equals = safe_equals;
1231
+ return signal;
1195
1232
  }
1196
1233
  /**
1197
- * This is similar to `mark_reactions`, but it only marks async/block effects
1198
- * depending on `value` and at least one of the other `sources`, so that
1199
- * these effects can re-run after another batch has been committed
1200
- * @param {Value} value
1201
- * @param {Source[]} sources
1202
- * @param {Set<Value>} marked
1203
- * @param {Map<Reaction, boolean>} checked
1234
+ * @param {Derived} derived
1235
+ * @returns {void}
1204
1236
  */
1205
- function mark_effects(value, sources, marked, checked) {
1206
- if (marked.has(value)) return;
1207
- marked.add(value);
1208
- if (value.reactions !== null) for (const reaction of value.reactions) {
1209
- const flags = reaction.f;
1210
- if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1211
- else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1212
- set_signal_status(reaction, DIRTY);
1213
- schedule_effect(reaction);
1214
- }
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]);
1215
1242
  }
1216
1243
  }
1217
1244
  /**
1218
- * @param {Reaction} reaction
1219
- * @param {Source[]} sources
1220
- * @param {Map<Reaction, boolean>} checked
1245
+ * @template T
1246
+ * @param {Derived} derived
1247
+ * @returns {T}
1221
1248
  */
1222
- function depends_on(reaction, sources, checked) {
1223
- const depends = checked.get(reaction);
1224
- if (depends !== void 0) return depends;
1225
- if (reaction.deps !== null) for (const dep of reaction.deps) {
1226
- if (includes.call(sources, dep)) return true;
1227
- if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1228
- checked.set(dep, true);
1229
- return true;
1230
- }
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);
1231
1264
  }
1232
- checked.set(reaction, false);
1233
- return false;
1265
+ return value;
1234
1266
  }
1235
1267
  /**
1236
- * @param {Effect} effect
1268
+ * @param {Derived} derived
1237
1269
  * @returns {void}
1238
1270
  */
1239
- function schedule_effect(effect) {
1240
- /** @type {Batch} */ current_batch.schedule(effect);
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
+ }
1284
+ }
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);
1241
1290
  }
1242
1291
  /**
1243
- * Mark all the effects inside a skipped branch CLEAN, so that
1244
- * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1245
- * effects so they can be rescheduled if the branch survives.
1246
- * @param {Effect} effect
1247
- * @param {{ d: Effect[], m: Effect[] }} tracked
1292
+ * @param {Derived} derived
1248
1293
  */
1249
- function reset_branch(effect, tracked) {
1250
- if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1251
- if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1252
- else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1253
- set_signal_status(effect, CLEAN);
1254
- var e = effect.first;
1255
- while (e !== null) {
1256
- reset_branch(e, tracked);
1257
- e = e.next;
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);
1258
1305
  }
1259
1306
  }
1260
1307
  /**
1261
- * Mark an entire effect tree clean following an error
1262
- * @param {Effect} effect
1308
+ * @param {Derived} derived
1263
1309
  */
1264
- function reset_all(effect) {
1265
- set_signal_status(effect, CLEAN);
1266
- var e = effect.first;
1267
- while (e !== null) {
1268
- reset_all(e);
1269
- e = e.next;
1270
- }
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);
1271
1313
  }
1272
1314
  //#endregion
1273
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/reactivity/create-subscriber.js
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;
1274
1325
  /**
1275
- * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1276
- * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1277
- *
1278
- * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1279
- * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1280
- *
1281
- * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1282
- *
1283
- * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1284
- * are active, and the returned teardown function will only be called when all effects are destroyed.
1285
- *
1286
- * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1287
- *
1288
- * ```js
1289
- * import { createSubscriber } from 'svelte/reactivity';
1290
- * import { on } from 'svelte/events';
1291
- *
1292
- * export class MediaQuery {
1293
- * #query;
1294
- * #subscribe;
1295
- *
1296
- * constructor(query) {
1297
- * this.#query = window.matchMedia(`(${query})`);
1298
- *
1299
- * this.#subscribe = createSubscriber((update) => {
1300
- * // when the `change` event occurs, re-run any effects that read `this.current`
1301
- * const off = on(this.#query, 'change', update);
1302
- *
1303
- * // stop listening when all the effects are destroyed
1304
- * return () => off();
1305
- * });
1306
- * }
1307
- *
1308
- * get current() {
1309
- * // This makes the getter reactive, if read in an effect
1310
- * this.#subscribe();
1311
- *
1312
- * // Return the current state of the query, whether or not we're in an effect
1313
- * return this.#query.matches;
1314
- * }
1315
- * }
1316
- * ```
1317
- * @param {(update: () => void) => (() => void) | void} start
1318
- * @since 5.7.0
1326
+ * This is needed to avoid overwriting inputs
1327
+ * @type {Batch | null}
1319
1328
  */
1320
- function createSubscriber(start) {
1321
- let subscribers = 0;
1322
- let version = source(0);
1323
- /** @type {(() => void) | void} */
1324
- let stop;
1325
- return () => {
1326
- if (effect_tracking()) {
1327
- get(version);
1328
- render_effect(() => {
1329
- if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1330
- subscribers += 1;
1331
- return () => {
1332
- queue_micro_task(() => {
1333
- subscribers -= 1;
1334
- if (subscribers === 0) {
1335
- stop?.();
1336
- stop = void 0;
1337
- increment(version);
1338
- }
1339
- });
1340
- };
1341
- });
1342
- }
1343
- };
1344
- }
1345
- //#endregion
1346
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1347
- /** @import { Effect, Source, TemplateNode, } from '#client' */
1329
+ var previous_batch = null;
1348
1330
  /**
1349
- * @typedef {{
1350
- * onerror?: ((error: unknown, reset: () => void) => void) | null;
1351
- * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
1352
- * pending?: ((anchor: Node) => void) | null;
1353
- * }} BoundaryProps
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}
1354
1335
  */
1355
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
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;
1356
1341
  /**
1357
- * @param {TemplateNode} node
1358
- * @param {BoundaryProps} props
1359
- * @param {((anchor: Node) => void)} children
1360
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1361
- * @returns {void}
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}
1362
1346
  */
1363
- function boundary(node, props, children, transform_error) {
1364
- new Boundary(node, props, children, transform_error);
1365
- }
1366
- var _anchor = /* @__PURE__ */ new WeakMap();
1367
- var _hydrate_open = /* @__PURE__ */ new WeakMap();
1368
- var _props = /* @__PURE__ */ new WeakMap();
1369
- var _children = /* @__PURE__ */ new WeakMap();
1370
- var _effect = /* @__PURE__ */ new WeakMap();
1371
- var _main_effect = /* @__PURE__ */ new WeakMap();
1372
- var _pending_effect = /* @__PURE__ */ new WeakMap();
1373
- var _failed_effect = /* @__PURE__ */ new WeakMap();
1374
- var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1375
- var _local_pending_count = /* @__PURE__ */ new WeakMap();
1376
- var _pending_count = /* @__PURE__ */ new WeakMap();
1377
- var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
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();
1378
1368
  var _dirty_effects = /* @__PURE__ */ new WeakMap();
1379
1369
  var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1380
- var _effect_pending = /* @__PURE__ */ new WeakMap();
1381
- var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1382
- var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1383
- var Boundary = class {
1384
- /**
1385
- * @param {TemplateNode} node
1386
- * @param {BoundaryProps} props
1387
- * @param {((anchor: Node) => void)} children
1388
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1389
- */
1390
- constructor(node, props, children, transform_error) {
1391
- _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);
1392
1382
  _defineProperty(
1393
1383
  this,
1394
- /** @type {Boundary | null} */
1395
- "parent",
1396
- void 0
1384
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
1385
+ "async_deriveds",
1386
+ /* @__PURE__ */ new Map()
1397
1387
  );
1398
- _defineProperty(this, "is_pending", false);
1399
1388
  _defineProperty(
1400
1389
  this,
1401
1390
  /**
1402
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1403
- * Inherited from parent boundary, or defaults to identity.
1404
- * @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]>}
1395
+ */
1396
+ "current",
1397
+ /* @__PURE__ */ new Map()
1398
+ );
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
1405
  */
1406
- "transform_error",
1407
- void 0
1406
+ "previous",
1407
+ /* @__PURE__ */ new Map()
1408
1408
  );
1409
- _classPrivateFieldInitSpec(this, _anchor, void 0);
1410
- _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1411
- _classPrivateFieldInitSpec(this, _props, void 0);
1412
- _classPrivateFieldInitSpec(this, _children, void 0);
1413
- _classPrivateFieldInitSpec(this, _effect, void 0);
1414
- _classPrivateFieldInitSpec(this, _main_effect, null);
1415
- _classPrivateFieldInitSpec(this, _pending_effect, null);
1416
- _classPrivateFieldInitSpec(this, _failed_effect, null);
1417
- _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1418
- _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1419
- _classPrivateFieldInitSpec(this, _pending_count, 0);
1420
- _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
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, []);
1421
1416
  _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1422
1417
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1423
- _classPrivateFieldInitSpec(this, _effect_pending, null);
1424
- _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1425
- _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1426
- return () => {
1427
- _classPrivateFieldSet2(_effect_pending, this, null);
1428
- };
1429
- }));
1430
- _classPrivateFieldSet2(_anchor, this, node);
1431
- _classPrivateFieldSet2(_props, this, props);
1432
- _classPrivateFieldSet2(_children, this, (anchor) => {
1433
- var effect = active_effect;
1434
- effect.b = this;
1435
- effect.f |= 128;
1436
- children(anchor);
1437
- });
1438
- this.parent = active_effect.b;
1439
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1440
- _classPrivateFieldSet2(_effect, this, block(() => {
1441
- if (hydrating) {
1442
- const comment = _classPrivateFieldGet2(_hydrate_open, this);
1443
- hydrate_next();
1444
- const server_rendered_pending = comment.data === "[!";
1445
- if (comment.data.startsWith("[?")) {
1446
- const serialized_error = JSON.parse(comment.data.slice(2));
1447
- _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1448
- } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1449
- else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1450
- } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1451
- }, flags));
1452
- if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
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;
1453
1428
  }
1454
1429
  /**
1455
- * Defer an effect inside a pending boundary until the boundary resolves
1430
+ * Add an effect to the #skipped_branches map and reset its children
1456
1431
  * @param {Effect} effect
1457
1432
  */
1458
- defer_effect(effect) {
1459
- defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1433
+ skip_effect(effect) {
1434
+ if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
1435
+ d: [],
1436
+ m: []
1437
+ });
1438
+ _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
1460
1439
  }
1461
1440
  /**
1462
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1463
- * @returns {boolean}
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
1464
1445
  */
1465
- is_rendered() {
1466
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1467
- }
1468
- has_pending_snippet() {
1469
- return !!_classPrivateFieldGet2(_props, this).pending;
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);
1470
1460
  }
1471
1461
  /**
1472
- * Update the source that powers `$effect.pending()` inside this boundary,
1473
- * and controls when the current `pending` snippet (if any) is removed.
1474
- * Do not call from inside the class
1475
- * @param {1 | -1} d
1476
- * @param {Batch} batch
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]
1477
1467
  */
1478
- update_pending_count(d, batch) {
1479
- _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1480
- _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1481
- if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1482
- _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1483
- queue_micro_task(() => {
1484
- _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1485
- if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1486
- });
1487
- }
1488
- get_effect_pending() {
1489
- _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1490
- return get(_classPrivateFieldGet2(_effect_pending, this));
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;
1491
1475
  }
1492
- /** @param {unknown} error */
1493
- error(error) {
1494
- if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
1495
- if (current_batch?.is_fork) {
1496
- if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
1497
- if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
1498
- if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
1499
- current_batch.oncommit(() => {
1500
- _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1501
- });
1502
- } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1476
+ activate() {
1477
+ current_batch = this;
1503
1478
  }
1504
- };
1505
- function _hydrate_resolved_content() {
1506
- try {
1507
- _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1508
- } catch (error) {
1509
- this.error(error);
1479
+ deactivate() {
1480
+ current_batch = null;
1481
+ batch_values = null;
1510
1482
  }
1511
- }
1512
- /**
1513
- * @param {unknown} error The deserialized error from the server's hydration comment
1514
- */
1515
- function _hydrate_failed_content(error) {
1516
- const failed = _classPrivateFieldGet2(_props, this).failed;
1517
- if (!failed) return;
1518
- _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1519
- failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1520
- }));
1521
- }
1522
- function _hydrate_pending_content() {
1523
- const pending = _classPrivateFieldGet2(_props, this).pending;
1524
- if (!pending) return;
1525
- this.is_pending = true;
1526
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1527
- queue_micro_task(() => {
1528
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1529
- var anchor = create_text();
1530
- fragment.append(anchor);
1531
- _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1532
- return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1533
- }));
1534
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1535
- _classPrivateFieldGet2(_anchor, this).before(fragment);
1536
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1537
- pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1538
- _classPrivateFieldSet2(_pending_effect, this, null);
1539
- });
1540
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
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();
1541
1497
  }
1542
- });
1543
- }
1544
- function _render() {
1545
- try {
1546
- this.is_pending = this.has_pending_snippet();
1547
- _classPrivateFieldSet2(_pending_count, this, 0);
1548
- _classPrivateFieldSet2(_local_pending_count, this, 0);
1549
- _classPrivateFieldSet2(_main_effect, this, branch(() => {
1550
- _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1551
- }));
1552
- if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1553
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1554
- move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1555
- const pending = _classPrivateFieldGet2(_props, this).pending;
1556
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1557
- } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1558
- } catch (error) {
1559
- this.error(error);
1560
1498
  }
1561
- }
1562
- /**
1563
- * @param {Batch} batch
1564
- */
1565
- function _resolve(batch) {
1566
- this.is_pending = false;
1567
- batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1568
- }
1569
- /**
1570
- * @template T
1571
- * @param {() => T} fn
1572
- */
1573
- function _run(fn) {
1574
- var previous_effect = active_effect;
1575
- var previous_reaction = active_reaction;
1576
- var previous_ctx = component_context;
1577
- set_active_effect(_classPrivateFieldGet2(_effect, this));
1578
- set_active_reaction(_classPrivateFieldGet2(_effect, this));
1579
- set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1580
- try {
1581
- Batch.ensure();
1582
- return fn();
1583
- } catch (e) {
1584
- handle_error(e);
1585
- return null;
1586
- } finally {
1587
- set_active_effect(previous_effect);
1588
- set_active_reaction(previous_reaction);
1589
- set_component_context(previous_ctx);
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();
1590
1505
  }
1591
- }
1592
- /**
1593
- * Updates the pending count associated with the currently visible pending snippet,
1594
- * if any, such that we can replace the snippet with content once work is done
1595
- * @param {1 | -1} d
1596
- * @param {Batch} batch
1597
- */
1598
- function _update_pending_count(d, batch) {
1599
- if (!this.has_pending_snippet()) {
1600
- if (this.parent) {
1601
- var _this$parent;
1602
- _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1506
+ /**
1507
+ * @param {Effect} effect
1508
+ */
1509
+ register_created_effect(effect) {
1510
+ _classPrivateFieldGet2(_new_effects, this).push(effect);
1511
+ }
1512
+ /**
1513
+ * @param {boolean} blocking
1514
+ * @param {Effect} effect
1515
+ */
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);
1603
1521
  }
1604
- return;
1605
1522
  }
1606
- _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1607
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1608
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1609
- if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1610
- _classPrivateFieldSet2(_pending_effect, this, null);
1611
- });
1612
- if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1613
- _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1614
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1523
+ /**
1524
+ * @param {boolean} blocking
1525
+ * @param {Effect} effect
1526
+ */
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);
1615
1533
  }
1534
+ if (_classPrivateFieldGet2(_decrement_queued, this)) return;
1535
+ _classPrivateFieldSet2(_decrement_queued, this, true);
1536
+ queue_micro_task(() => {
1537
+ _classPrivateFieldSet2(_decrement_queued, this, false);
1538
+ if (this.linked) this.flush();
1539
+ });
1616
1540
  }
1617
- }
1618
- /**
1619
- * @param {unknown} error
1620
- */
1621
- function _handle_error(error) {
1622
- if (_classPrivateFieldGet2(_main_effect, this)) {
1623
- destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1624
- _classPrivateFieldSet2(_main_effect, this, null);
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();
1625
1550
  }
1626
- if (_classPrivateFieldGet2(_pending_effect, this)) {
1627
- destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1628
- _classPrivateFieldSet2(_pending_effect, this, null);
1551
+ /** @param {(batch: Batch) => void} fn */
1552
+ oncommit(fn) {
1553
+ _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
1629
1554
  }
1630
- if (_classPrivateFieldGet2(_failed_effect, this)) {
1631
- destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1632
- _classPrivateFieldSet2(_failed_effect, this, null);
1555
+ /** @param {(batch: Batch) => void} fn */
1556
+ ondiscard(fn) {
1557
+ _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
1633
1558
  }
1634
- if (hydrating) {
1635
- set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1636
- next();
1637
- set_hydrate_node(skip_nodes());
1559
+ settled() {
1560
+ return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
1638
1561
  }
1639
- var onerror = _classPrivateFieldGet2(_props, this).onerror;
1640
- let failed = _classPrivateFieldGet2(_props, this).failed;
1641
- var did_reset = false;
1642
- var calling_on_error = false;
1643
- const reset = () => {
1644
- if (did_reset) {
1645
- svelte_boundary_reset_noop();
1646
- return;
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();
1567
+ });
1647
1568
  }
1648
- did_reset = true;
1649
- if (calling_on_error) svelte_boundary_reset_onerror();
1650
- if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1651
- _classPrivateFieldSet2(_failed_effect, this, null);
1652
- });
1653
- _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1654
- _assertClassBrand(_Boundary_brand, this, _render).call(this);
1655
- });
1656
- };
1657
- /** @param {unknown} transformed_error */
1658
- const handle_error_result = (transformed_error) => {
1659
- try {
1660
- calling_on_error = true;
1661
- onerror?.(transformed_error, reset);
1662
- calling_on_error = false;
1663
- } catch (error) {
1664
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1569
+ return current_batch;
1570
+ }
1571
+ apply() {
1572
+ if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
1573
+ batch_values = null;
1574
+ return;
1665
1575
  }
1666
- if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1667
- try {
1668
- return branch(() => {
1669
- var effect = active_effect;
1670
- effect.b = this;
1671
- effect.f |= 128;
1672
- failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1673
- });
1674
- } catch (error) {
1675
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1676
- return 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
+ }
1677
1587
  }
1678
- }));
1679
- };
1680
- queue_micro_task(() => {
1681
- /** @type {unknown} */
1682
- var result;
1683
- try {
1684
- result = this.transform_error(error);
1685
- } catch (e) {
1686
- invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1588
+ if (!intersects) {
1589
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
1590
+ }
1591
+ }
1592
+ }
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);
1687
1601
  return;
1688
1602
  }
1689
- if (result !== null && typeof result === "object" && typeof result.then === "function")
1690
- /** @type {any} */ result.then(
1691
- handle_error_result,
1692
- /** @param {unknown} e */
1693
- (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1694
- );
1695
- else handle_error_result(result);
1696
- });
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
+ }
1615
+ }
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;
1629
+ }
1630
+ e = e.parent;
1631
+ }
1632
+ if (!skipped) return true;
1633
+ }
1634
+ return false;
1697
1635
  }
1698
- //#endregion
1699
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/async.js
1700
- /** @import { Blocker, Effect, Source, Value } from '#client' */
1701
- /**
1702
- * @param {Blocker[]} blockers
1703
- * @param {Array<() => any>} sync
1704
- * @param {Array<() => Promise<any>>} async
1705
- * @param {(values: Value[]) => any} fn
1706
- */
1707
- function flatten(blockers, sync, async, fn) {
1708
- const d = is_runes() ? derived : derived_safe_equal;
1709
- var pending = blockers.filter((b) => !b.settled);
1710
- var deriveds = sync.map(d);
1711
- if (async.length === 0 && pending.length === 0) {
1712
- fn(deriveds);
1713
- 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();
1714
1641
  }
1715
- var parent = active_effect;
1716
- var restore = capture();
1717
- var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
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);
1646
+ }
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 = [];
1718
1658
  /**
1719
- * @param {Source[]} async
1659
+ * @type {Effect[]}
1660
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1720
1661
  */
1721
- function finish(async) {
1722
- if ((parent.f & 16384) !== 0) return;
1723
- restore();
1724
- try {
1725
- fn([...deriveds, ...async]);
1726
- } catch (error) {
1727
- invoke_error_boundary(error, parent);
1728
- }
1729
- unset_context();
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);
1683
+ return;
1730
1684
  }
1731
- var decrement_pending = increment_pending();
1732
- if (async.length === 0) {
1733
- /** @type {Promise<any>} */ blocker_promise.then(() => finish([])).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);
1734
1690
  return;
1735
1691
  }
1736
- function run() {
1737
- Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then(finish).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
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
+ }
1738
1708
  }
1739
- if (blocker_promise) blocker_promise.then(() => {
1740
- restore();
1741
- run();
1742
- unset_context();
1743
- });
1744
- else run();
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);
1745
1714
  }
1746
1715
  /**
1747
- * Captures the current effect context so that we can restore it after
1748
- * some asynchronous work has happened (so that e.g. `await a + b`
1749
- * 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
1750
1721
  */
1751
- function capture() {
1752
- var previous_effect = active_effect;
1753
- var previous_reaction = active_reaction;
1754
- var previous_component_context = component_context;
1755
- var previous_batch = current_batch;
1756
- return function restore(activate_batch = true) {
1757
- set_active_effect(previous_effect);
1758
- set_active_reaction(previous_reaction);
1759
- set_component_context(previous_component_context);
1760
- if (activate_batch && (previous_effect.f & 16384) === 0) {
1761
- previous_batch?.activate();
1762
- 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
+ }
1763
1741
  }
1764
- };
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
+ }
1765
1751
  }
1766
- function unset_context(deactivate_batch = true) {
1767
- set_active_effect(null);
1768
- set_active_reaction(null);
1769
- set_component_context(null);
1770
- 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;
1771
1761
  }
1772
1762
  /**
1773
- * @returns {(skip?: boolean) => void}
1763
+ * @param {Batch} batch
1774
1764
  */
1775
- function increment_pending() {
1776
- var effect = active_effect;
1777
- var boundary = effect.b;
1778
- var batch = current_batch;
1779
- var blocking = !!boundary?.is_rendered();
1780
- boundary?.update_pending_count(1, batch);
1781
- batch.increment(blocking, effect);
1782
- return () => {
1783
- boundary?.update_pending_count(-1, batch);
1784
- batch.decrement(blocking, effect);
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
+ }
1785
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);
1786
1806
  }
1787
1807
  /**
1788
- * @template V
1789
- * @param {() => V} fn
1790
- * @returns {Derived<V>}
1808
+ * @param {Effect[]} effects
1791
1809
  */
1792
- /*#__NO_SIDE_EFFECTS__*/
1793
- function derived(fn) {
1794
- var flags = 2 | DIRTY;
1795
- if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1796
- return {
1797
- ctx: component_context,
1798
- deps: null,
1799
- effects: null,
1800
- equals,
1801
- f: flags,
1802
- fn,
1803
- reactions: null,
1804
- rv: 0,
1805
- v: UNINITIALIZED,
1806
- wv: 0,
1807
- parent: active_effect,
1808
- ac: null
1809
- };
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));
1810
1812
  }
1811
- var OBSOLETE = Symbol("obsolete");
1812
- /**
1813
- * @template V
1814
- * @param {() => V | Promise<V>} fn
1815
- * @param {string} [label]
1816
- * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1817
- * @returns {Promise<Source<V>>}
1818
- */
1819
- /*#__NO_SIDE_EFFECTS__*/
1820
- function async_derived(fn, label, location) {
1821
- let parent = active_effect;
1822
- if (parent === null) async_derived_orphan();
1823
- var promise = void 0;
1824
- var signal = source(UNINITIALIZED);
1825
- var should_suspend = !active_reaction;
1826
- /** @type {Set<ReturnType<typeof deferred<V>>>} */
1827
- var deferreds = /* @__PURE__ */ new Set();
1828
- async_effect(() => {
1829
- var effect = active_effect;
1830
- /** @type {ReturnType<typeof deferred<V>>} */
1831
- var d = deferred();
1832
- promise = d.promise;
1833
- try {
1834
- Promise.resolve(fn()).then(d.resolve, (e) => {
1835
- if (e !== STALE_REACTION) d.reject(e);
1836
- }).finally(unset_context);
1837
- } catch (error) {
1838
- d.reject(error);
1839
- unset_context();
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;
1823
+ }
1824
+ sources.push(source);
1840
1825
  }
1841
- var batch = current_batch;
1842
- if (should_suspend) {
1843
- if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1844
- if (parent.b?.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
1845
- else for (const d of deferreds.values()) d.reject(OBSOLETE);
1846
- deferreds.add(d);
1847
- batch.async_deriveds.set(effect, d);
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);
1848
1829
  }
1849
- /**
1850
- * @param {any} value
1851
- * @param {unknown} error
1852
- */
1853
- const handler = (value, error = void 0) => {
1854
- decrement_pending?.();
1855
- deferreds.delete(d);
1856
- if (error === OBSOLETE) return;
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
+ });
1857
1840
  batch.activate();
1858
- if (error) {
1859
- signal.f |= ERROR_VALUE;
1860
- internal_set(signal, error);
1861
- } else {
1862
- if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1863
- internal_set(signal, value);
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);
1864
1857
  }
1865
- batch.deactivate();
1866
- };
1867
- d.promise.then(handler, (e) => handler(null, e || "unknown"));
1868
- });
1869
- teardown(() => {
1870
- for (const d of deferreds) d.reject(OBSOLETE);
1871
- });
1872
- return new Promise((fulfil) => {
1873
- /** @param {Promise<V>} p */
1874
- function next(p) {
1875
- function go() {
1876
- if (p === promise) fulfil(signal);
1877
- 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, []);
1878
1862
  }
1879
- p.then(go, go);
1863
+ batch.deactivate();
1880
1864
  }
1881
- next(promise);
1882
- });
1865
+ }
1883
1866
  }
1884
- /**
1885
- * @template V
1886
- * @param {() => V} fn
1887
- * @returns {Derived<V>}
1888
- */
1889
- /*#__NO_SIDE_EFFECTS__*/
1890
- function user_derived(fn) {
1891
- const d = /* @__PURE__ */ derived(fn);
1892
- if (!async_mode_flag) push_reaction_value(d);
1893
- 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;
1894
1876
  }
1895
1877
  /**
1896
- * @template V
1897
- * @param {() => V} fn
1898
- * @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}
1899
1883
  */
1900
- /*#__NO_SIDE_EFFECTS__*/
1901
- function derived_safe_equal(fn) {
1902
- const signal = /* @__PURE__ */ derived(fn);
1903
- signal.equals = safe_equals;
1904
- 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
+ }
1905
1908
  }
1909
+ /** @type {Set<Effect> | null} */
1910
+ var eager_block_effects = null;
1906
1911
  /**
1907
- * @param {Derived} derived
1912
+ * @param {Array<Effect>} effects
1908
1913
  * @returns {void}
1909
1914
  */
1910
- function destroy_derived_effects(derived) {
1911
- var effects = derived.effects;
1912
- if (effects !== null) {
1913
- derived.effects = null;
1914
- 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
+ }
1915
1948
  }
1949
+ eager_block_effects = null;
1916
1950
  }
1917
1951
  /**
1918
- * @template T
1919
- * @param {Derived} derived
1920
- * @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
1921
1959
  */
1922
- function execute_derived(derived) {
1923
- var value;
1924
- var prev_active_effect = active_effect;
1925
- var parent = derived.parent;
1926
- if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
1927
- derived_inert();
1928
- return derived.v;
1929
- }
1930
- set_active_effect(parent);
1931
- try {
1932
- derived.f &= ~WAS_MARKED;
1933
- destroy_derived_effects(derived);
1934
- value = update_reaction(derived);
1935
- } finally {
1936
- 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
+ }
1937
1970
  }
1938
- return value;
1939
1971
  }
1940
1972
  /**
1941
- * @param {Derived} derived
1942
- * @returns {void}
1973
+ * @param {Reaction} reaction
1974
+ * @param {Source[]} sources
1975
+ * @param {Map<Reaction, boolean>} checked
1943
1976
  */
1944
- function update_derived(derived) {
1945
- var value = execute_derived(derived);
1946
- if (!derived.equals(value)) {
1947
- derived.wv = increment_write_version();
1948
- if (!current_batch?.is_fork || derived.deps === null) {
1949
- if (current_batch !== null) {
1950
- current_batch.capture(derived, value, true);
1951
- previous_batch?.capture(derived, value, true);
1952
- } else derived.v = value;
1953
- if (derived.deps === null) {
1954
- set_signal_status(derived, CLEAN);
1955
- return;
1956
- }
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;
1957
1985
  }
1958
1986
  }
1959
- if (is_destroying_effect) return;
1960
- if (batch_values !== null) {
1961
- if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1962
- } else update_derived_status(derived);
1987
+ checked.set(reaction, false);
1988
+ return false;
1963
1989
  }
1964
1990
  /**
1965
- * @param {Derived} derived
1991
+ * @param {Effect} effect
1992
+ * @returns {void}
1966
1993
  */
1967
- function freeze_derived_effects(derived) {
1968
- if (derived.effects === null) return;
1969
- for (const e of derived.effects) if (e.teardown || e.ac) {
1970
- e.teardown?.();
1971
- e.ac?.abort(STALE_REACTION);
1972
- if (e.fn !== null) e.teardown = noop;
1973
- e.ac = null;
1974
- remove_reactions(e, 0);
1975
- 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;
1976
2013
  }
1977
2014
  }
1978
2015
  /**
1979
- * @param {Derived} derived
2016
+ * Mark an entire effect tree clean following an error
2017
+ * @param {Effect} effect
1980
2018
  */
1981
- function unfreeze_derived_effects(derived) {
1982
- if (derived.effects === null) return;
1983
- for (const e of derived.effects) if (e.teardown && e.fn !== null) 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
+ }
1984
2026
  }
1985
2027
  //#endregion
1986
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
1987
2029
  /** @import { Derived, Effect, Source, Value } from '#client' */
1988
2030
  /** @type {Set<Effect>} */
1989
2031
  var eager_effects = /* @__PURE__ */ new Set();
@@ -2281,19 +2323,8 @@ function proxy(value) {
2281
2323
  }
2282
2324
  });
2283
2325
  }
2284
- new Set([
2285
- "copyWithin",
2286
- "fill",
2287
- "pop",
2288
- "push",
2289
- "reverse",
2290
- "shift",
2291
- "sort",
2292
- "splice",
2293
- "unshift"
2294
- ]);
2295
2326
  //#endregion
2296
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
2297
2328
  /** @import { Effect, TemplateNode } from '#client' */
2298
2329
  /** @type {Window} */
2299
2330
  var $window;
@@ -2471,25 +2502,7 @@ function merge_text_nodes(text) {
2471
2502
  }
2472
2503
  }
2473
2504
  //#endregion
2474
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2475
- /**
2476
- * @template T
2477
- * @param {() => T} fn
2478
- */
2479
- function without_reactive_context(fn) {
2480
- var previous_reaction = active_reaction;
2481
- var previous_effect = active_effect;
2482
- set_active_reaction(null);
2483
- set_active_effect(null);
2484
- try {
2485
- return fn();
2486
- } finally {
2487
- set_active_reaction(previous_reaction);
2488
- set_active_effect(previous_effect);
2489
- }
2490
- }
2491
- //#endregion
2492
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
2493
2506
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2494
2507
  /**
2495
2508
  * @param {'$effect' | '$effect.pre' | '$inspect'} rune
@@ -2875,15 +2888,18 @@ function move_effect(effect, fragment) {
2875
2888
  }
2876
2889
  }
2877
2890
  //#endregion
2878
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
2879
2892
  /**
2880
2893
  * @type {Set<Value> | null}
2881
2894
  * @deprecated
2882
2895
  */
2883
2896
  var captured_signals = null;
2884
2897
  //#endregion
2885
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
2886
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
+ */
2887
2903
  var is_updating_effect = false;
2888
2904
  var is_destroying_effect = false;
2889
2905
  /** @param {boolean} value */
@@ -3084,6 +3100,11 @@ function remove_reaction(signal, dependency) {
3084
3100
  derived.f &= ~WAS_MARKED;
3085
3101
  }
3086
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
+ });
3087
3108
  freeze_derived_effects(derived);
3088
3109
  remove_reactions(derived, 0);
3089
3110
  }
@@ -3109,7 +3130,7 @@ function update_effect(effect) {
3109
3130
  var previous_effect = active_effect;
3110
3131
  var was_updating_effect = is_updating_effect;
3111
3132
  active_effect = effect;
3112
- is_updating_effect = true;
3133
+ is_updating_effect = (flags & 96) === 0;
3113
3134
  try {
3114
3135
  if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
3115
3136
  else destroy_effect_children(effect);
@@ -3226,7 +3247,7 @@ function untrack(fn) {
3226
3247
  }
3227
3248
  }
3228
3249
  //#endregion
3229
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
3230
3251
  /**
3231
3252
  * Used on elements, as a map of event type -> event handler,
3232
3253
  * and on events themselves to track which element handled an event
@@ -3309,7 +3330,7 @@ function handle_event_propagation(event) {
3309
3330
  }
3310
3331
  }
3311
3332
  //#endregion
3312
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
3313
3334
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3314
3335
  /** @param {string} html */
3315
3336
  createHTML: (html) => {
@@ -3328,7 +3349,7 @@ function create_fragment_from_html(html) {
3328
3349
  return elem.content;
3329
3350
  }
3330
3351
  //#endregion
3331
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
3332
3353
  /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3333
3354
  /** @import { TemplateStructure } from './types' */
3334
3355
  /**
@@ -3450,9 +3471,8 @@ function is_passive_event(name) {
3450
3471
  * @returns {void}
3451
3472
  */
3452
3473
  function set_text(text, value) {
3453
- var _text;
3454
3474
  var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
3455
- if (str !== ((_text = text)[TEXT_CACHE] ?? (_text[TEXT_CACHE] = text.nodeValue))) {
3475
+ if (str !== (text[TEXT_CACHE] ?? (text[TEXT_CACHE] = text.nodeValue))) {
3456
3476
  /** @type {any} */ text[TEXT_CACHE] = str;
3457
3477
  text.nodeValue = `${str}`;
3458
3478
  }
@@ -3633,7 +3653,7 @@ function unmount(component, options) {
3633
3653
  return Promise.resolve();
3634
3654
  }
3635
3655
  //#endregion
3636
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
3637
3657
  /** @import { Effect, TemplateNode } from '#client' */
3638
3658
  var _batches = /* @__PURE__ */ new WeakMap();
3639
3659
  var _onscreen = /* @__PURE__ */ new WeakMap();
@@ -3756,7 +3776,7 @@ var BranchManager = class {
3756
3776
  }
3757
3777
  };
3758
3778
  //#endregion
3759
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
3760
3780
  /** @import { TemplateNode } from '#client' */
3761
3781
  /**
3762
3782
  * @param {TemplateNode} node
@@ -3802,7 +3822,7 @@ function if_block(node, fn, elseif = false) {
3802
3822
  }, flags);
3803
3823
  }
3804
3824
  //#endregion
3805
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
3806
3826
  /** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */
3807
3827
  /** @import { Batch } from '../../reactivity/batch.js'; */
3808
3828
  /**
@@ -4274,7 +4294,7 @@ function html(node, get_value, is_controlled = false, svg = false, mathml = fals
4274
4294
  });
4275
4295
  }
4276
4296
  //#endregion
4277
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
4278
4298
  /**
4279
4299
  * @param {Node} anchor
4280
4300
  * @param {{ hash: string, code: string }} css
@@ -4292,7 +4312,7 @@ function append_styles(anchor, css) {
4292
4312
  });
4293
4313
  }
4294
4314
  //#endregion
4295
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
4296
4316
  /** @import { Blocker, Effect } from '#client' */
4297
4317
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
4298
4318
  var IS_HTML = Symbol("is html");
@@ -4323,8 +4343,7 @@ function set_attribute(element, attribute, value, skip_warning) {
4323
4343
  * @param {Element} element
4324
4344
  */
4325
4345
  function get_attributes(element) {
4326
- var _element;
4327
- return (_element = element)[ATTRIBUTES_CACHE] ?? (_element[ATTRIBUTES_CACHE] = {
4346
+ return element[ATTRIBUTES_CACHE] ?? (element[ATTRIBUTES_CACHE] = {
4328
4347
  [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
4329
4348
  [IS_HTML]: element.namespaceURI === "http://www.w3.org/1999/xhtml"
4330
4349
  });
@@ -4348,7 +4367,7 @@ function get_setters(element) {
4348
4367
  return setters;
4349
4368
  }
4350
4369
  //#endregion
4351
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
4352
4371
  var _ResizeObserverSingleton;
4353
4372
  var _listeners = /* @__PURE__ */ new WeakMap();
4354
4373
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -4400,7 +4419,7 @@ function _getObserver() {
4400
4419
  }
4401
4420
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
4402
4421
  //#endregion
4403
- //#region ../../../node_modules/.bun/svelte@5.56.1/node_modules/svelte/src/internal/client/reactivity/props.js
4422
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/props.js
4404
4423
  /** @import { Derived, Effect, Source } from './types.js' */
4405
4424
  /**
4406
4425
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
@@ -4493,7 +4512,7 @@ function prop(props, key, flags, fallback) {
4493
4512
  });
4494
4513
  }
4495
4514
  //#endregion
4496
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
4497
4516
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
4498
4517
  /**
4499
4518
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -4612,7 +4631,7 @@ var Svelte4Component = class {
4612
4631
  }
4613
4632
  };
4614
4633
  //#endregion
4615
- //#region ../../../node_modules/.bun/svelte@5.56.1/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
4616
4635
  /**
4617
4636
  * @typedef {Object} CustomElementPropDefinition
4618
4637
  * @property {string} [attribute]