@tempots/dom 31.6.1 → 32.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,56 +1,33 @@
1
- const ke = (t, e, s) => t + (e - t) * s;
2
- const $e = (t, e, s) => {
3
- const r = Math.max(t.length, e.length);
4
- let n = "";
5
- for (let i = 0; i < r; i++) {
6
- let o = t.charCodeAt(i);
7
- isNaN(o) && (o = 97);
8
- let l = e.charCodeAt(i);
9
- isNaN(l) && (l = 97), n += String.fromCharCode(o + (l - o) * s);
1
+ const _ = [], qe = (t) => {
2
+ _.push(t);
3
+ }, Fe = () => {
4
+ if (_.length === 0)
5
+ throw new Error("Cannot pop from empty scope stack");
6
+ _.pop();
7
+ }, ge = () => _[_.length - 1] ?? null, Bt = () => _, Wt = () => _[_.length - 2] ?? null, L = (t, e) => {
8
+ qe(t);
9
+ try {
10
+ return e();
11
+ } finally {
12
+ Fe();
10
13
  }
11
- return n;
12
- }, Ne = (t, e, s) => new Date(t.getTime() + (e.getTime() - t.getTime()) * s), Re = (t, e) => e, Ve = (t) => typeof t == "number" ? ke : typeof t == "string" ? $e : t instanceof Date ? Ne : Re;
13
- class se {
14
- /**
15
- * Creates a new instance of `ElementPosition`.
16
- * @param index - The index of the element.
17
- * @param total - The total number of elements in the collection.
18
- */
19
- constructor(e, s) {
20
- this.index = e, this.total = s, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
14
+ }, Ut = (t) => {
15
+ const e = new q();
16
+ try {
17
+ return L(e, () => t(e));
18
+ } finally {
19
+ e.dispose();
21
20
  }
22
- /**
23
- * The counter of the element starting from 1.
24
- */
25
- counter;
26
- /**
27
- * Checks if the element is the first element in the collection.
28
- * @returns `true` if the element is the first element, `false` otherwise.
29
- */
30
- isFirst;
31
- /**
32
- * Checks if the counter of the element is even.
33
- * @returns `true` if the counter is even, `false` otherwise.
34
- */
35
- isEven;
36
- /**
37
- * Checks if the counter of the element is odd.
38
- * @returns `true` if the counter is odd, `false` otherwise.
39
- */
40
- isOdd;
41
- #e;
42
- /**
43
- * Checks if the element is the last element in the collection.
44
- * @returns `true` if the element is the last element, `false` otherwise.
45
- */
46
- get isLast() {
47
- return this.#e == null && (this.#e = this.total.map((e) => this.counter === e)), this.#e;
21
+ }, oe = (t) => {
22
+ const e = _.slice();
23
+ _.length = 0;
24
+ try {
25
+ return t();
26
+ } finally {
27
+ _.length = 0, _.push(...e);
48
28
  }
49
- dispose = () => {
50
- this.#e?.dispose(), this.#e = void 0;
51
- };
52
- }
53
- class m {
29
+ };
30
+ class g {
54
31
  /**
55
32
  * Represents a signal with a value of type T.
56
33
  *
@@ -103,7 +80,7 @@ class m {
103
80
  * @returns A Signal that represents the result of the Promise
104
81
  */
105
82
  static ofPromise = (e, s, r, n = (i, o) => i === o) => {
106
- const i = new m(s, n);
83
+ const i = new g(s, n);
107
84
  return e.then((o) => i._setAndNotify(o)).catch((o) => {
108
85
  r != null ? i._setAndNotify(r(o)) : console.error(
109
86
  "Unhandled promise rejection in Signal.ofPromise:",
@@ -180,6 +157,21 @@ class m {
180
157
  };
181
158
  return s.abortSignal != null && s.abortSignal.addEventListener("abort", n), n;
182
159
  };
160
+ /**
161
+ * Registers a listener function to be called whenever the value of the signal changes.
162
+ * The listener function will not be called with the current value of the signal.
163
+ * Returns a function that can be called to unregister the listener.
164
+ *
165
+ * @param listener - The listener function to be called when the value of the signal changes.
166
+ * @param options - Options for the listener.
167
+ */
168
+ onChange = (e, s = {}) => {
169
+ let r = 0;
170
+ const n = (i, o) => {
171
+ r++ > 0 && e(i, o);
172
+ };
173
+ return this.on(n, s);
174
+ };
183
175
  /**
184
176
  * @internal
185
177
  */
@@ -256,13 +248,25 @@ class m {
256
248
  * )
257
249
  * ```
258
250
  *
251
+ * **Auto-Disposal:** The returned computed signal is automatically registered with the current
252
+ * disposal scope (if one exists). When used within a renderable or `WithScope()`, the signal
253
+ * will be automatically disposed when the component unmounts. No manual `OnDispose()` needed!
254
+ *
255
+ * ```typescript
256
+ * const MyComponent: Renderable = (ctx) => {
257
+ * const count = prop(0);
258
+ * const doubled = count.map(x => x * 2); // ✅ Auto-disposed
259
+ * return html.div(doubled);
260
+ * };
261
+ * ```
262
+ *
259
263
  * @typeParam O - The type of the transformed value
260
264
  * @param fn - Function that transforms the signal's value to a new value
261
265
  * @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
262
- * @returns A new computed signal with the transformed value
266
+ * @returns A new computed signal with the transformed value (auto-registered with current scope)
263
267
  */
264
268
  map = (e, s = (r, n) => r === n) => {
265
- const r = new H(() => {
269
+ const r = new $(() => {
266
270
  try {
267
271
  return e(this.get());
268
272
  } catch (n) {
@@ -282,7 +286,7 @@ class m {
282
286
  * @returns A new Signal that emits the values of the resulting Signal.
283
287
  */
284
288
  flatMap = (e, s = (r, n) => r === n) => {
285
- const r = new H(() => {
289
+ const r = new $(() => {
286
290
  try {
287
291
  return e(this.get()).get();
288
292
  } catch (n) {
@@ -320,7 +324,7 @@ class m {
320
324
  }
321
325
  filter = (e, s) => {
322
326
  let r = s ?? this.get();
323
- const n = new H(() => {
327
+ const n = new $(() => {
324
328
  try {
325
329
  const i = this.get();
326
330
  return r = e(i) ? i : r;
@@ -342,7 +346,7 @@ class m {
342
346
  */
343
347
  filterMap = (e, s, r = (n, i) => n === i) => {
344
348
  let n = s;
345
- const i = new H(() => {
349
+ const i = new $(() => {
346
350
  try {
347
351
  const o = this.get(), l = e(o);
348
352
  return n = l ?? n;
@@ -366,7 +370,7 @@ class m {
366
370
  * @returns A property that holds the mapped value and can be observed for changes.
367
371
  */
368
372
  mapAsync = (e, s, r, n = (i, o) => i === o) => {
369
- const i = _(s, n);
373
+ const i = T(s, n);
370
374
  let o = 0, l = new AbortController();
371
375
  return i.onDispose(
372
376
  this.on(async (c) => {
@@ -416,7 +420,7 @@ class m {
416
420
  deriveProp = ({
417
421
  autoDisposeProp: e = !0,
418
422
  equals: s
419
- } = {}) => this.feedProp(_(this.get(), s), e);
423
+ } = {}) => this.feedProp(T(this.get(), s), e);
420
424
  /**
421
425
  * Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
422
426
  * @returns A new signal that emits the same values as the current signal.
@@ -445,15 +449,36 @@ class m {
445
449
  }), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
446
450
  };
447
451
  }
448
- const je = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
449
- class H extends m {
452
+ const Be = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
453
+ class $ extends g {
450
454
  /**
451
- * Represents a Signal object.
452
- * @param _fn - The function that returns the value of the signal.
455
+ * Creates a new Computed signal.
456
+ *
457
+ * **Auto-Registration:** This constructor automatically registers the signal with the current
458
+ * disposal scope (if one exists). This ensures that computed signals created by methods like
459
+ * `.map()`, `.flatMap()`, `.filter()`, etc. are automatically tracked and disposed.
460
+ *
461
+ * When a computed signal is created within a renderable or `WithScope()`, it will be
462
+ * automatically disposed when the component unmounts or the scope is disposed.
463
+ *
464
+ * To create a computed signal that outlives the current scope, use `untracked()`:
465
+ * ```typescript
466
+ * const globalSignal = untracked(() => mySignal.map(x => x * 2));
467
+ * // Remember to dispose manually: globalSignal.dispose()
468
+ * ```
469
+ *
470
+ * @param _fn - The function that computes the value of the signal.
453
471
  * @param equals - The function used to compare two values of type T for equality.
472
+ *
473
+ * @see {@link computed} - Factory function for creating computed signals with explicit dependencies
474
+ * @see {@link Signal.map} - Creates a computed signal by transforming values
475
+ * @see {@link getCurrentScope} - Get the current disposal scope
476
+ * @see {@link untracked} - Create signals outside of scope tracking
454
477
  */
455
478
  constructor(e, s) {
456
479
  super(void 0, s), this._fn = e, this.setDirty();
480
+ const r = ge();
481
+ r?.track(this);
457
482
  }
458
483
  /**
459
484
  * Checks if a value is an instance of `Computed`.
@@ -491,7 +516,7 @@ class H extends m {
491
516
  */
492
517
  _scheduleNotify = () => {
493
518
  const e = ++this._scheduleCount;
494
- je(() => {
519
+ Be(() => {
495
520
  this._scheduleCount !== e || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
496
521
  });
497
522
  };
@@ -501,8 +526,16 @@ class H extends m {
501
526
  get value() {
502
527
  return this.get();
503
528
  }
529
+ /**
530
+ * Disposes the computed signal and cancels any pending recomputations.
531
+ * This override increments the schedule count to invalidate all pending
532
+ * microtasks before disposing the signal.
533
+ */
534
+ dispose = () => {
535
+ this._disposed || (this._scheduleCount++, this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
536
+ };
504
537
  }
505
- class Y extends m {
538
+ class Z extends g {
506
539
  /**
507
540
  * Checks if a value is a Prop.
508
541
  * @param value - The value to check.
@@ -563,7 +596,7 @@ class Y extends m {
563
596
  * @returns A Prop object representing the isomorphism.
564
597
  */
565
598
  iso = (e, s, r = (n, i) => n === i) => {
566
- const n = new Y(e(this.get()), r);
599
+ const n = new Z(e(this.get()), r);
567
600
  return n.onDispose(this.on((i) => n.set(e(i)))), n.on((i) => this._setAndNotify(s(i))), n;
568
601
  };
569
602
  /**
@@ -586,10 +619,10 @@ class Y extends m {
586
619
  this._setAndNotify(e);
587
620
  }
588
621
  }
589
- const re = (t, e, s = (r, n) => r === n) => {
590
- const r = new H(t, s);
622
+ const z = (t, e, s = (r, n) => r === n) => {
623
+ const r = new $(t, s);
591
624
  return e.forEach((n) => n.setDerivative(r)), r;
592
- }, qe = (t, e, s = {}) => {
625
+ }, me = (t, e, s = {}) => {
593
626
  let r = s.once ? () => {
594
627
  i(), t();
595
628
  } : t;
@@ -600,24 +633,24 @@ const re = (t, e, s = (r, n) => r === n) => {
600
633
  o ? l() : o = !0;
601
634
  };
602
635
  }
603
- const n = re(r, e), i = () => {
636
+ const n = z(r, e), i = () => {
604
637
  n.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", i);
605
638
  };
606
639
  return s.abortSignal != null && s.abortSignal.addEventListener("abort", i), i;
607
- }, _ = (t, e = (s, r) => s === r) => new Y(t, e), Q = (t, e = (s, r) => s === r) => new m(t, e), ne = () => (
608
- /* c8 ignore next */
609
- typeof window < "u" ? window : void 0
610
- );
611
- function he(t) {
640
+ }, T = (t, e = (s, r) => s === r) => {
641
+ const s = new Z(t, e), r = ge();
642
+ return r?.track(s), s;
643
+ }, K = (t, e = (s, r) => s === r) => new g(t, e);
644
+ function ye(t) {
612
645
  return t != null && t !== !1 && t !== 0 && t !== "";
613
646
  }
614
- function Fe(t) {
615
- return !he(t);
647
+ function We(t) {
648
+ return !ye(t);
616
649
  }
617
- function Be(t) {
650
+ function Ue(t) {
618
651
  return t == null;
619
652
  }
620
- function We(t) {
653
+ function Je(t) {
621
654
  return t != null;
622
655
  }
623
656
  const y = {
@@ -632,7 +665,7 @@ const y = {
632
665
  * @param fn - The function to map the value.
633
666
  * @returns The mapped value.
634
667
  */
635
- map: (t, e) => m.is(t) ? t.map(e) : e(t),
668
+ map: (t, e) => g.is(t) ? t.map(e) : e(t),
636
669
  /**
637
670
  * Wraps a value or a Signal instance into a Signal.
638
671
  * If the value is already a Signal, it returns the value itself.
@@ -643,7 +676,7 @@ const y = {
643
676
  * @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
644
677
  * @returns A Signal instance.
645
678
  */
646
- toSignal: (t, e) => m.is(t) ? t.derive() : Q(t, e),
679
+ toSignal: (t, e) => g.is(t) ? t.derive() : K(t, e),
647
680
  /**
648
681
  * Wraps a value in a `Signal` if it is not already a `Signal`.
649
682
  * If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
@@ -659,14 +692,14 @@ const y = {
659
692
  * @param value - The value or Signal instance to get the value from.
660
693
  * @returns The value.
661
694
  */
662
- get: (t) => m.is(t) ? t.get() : t,
695
+ get: (t) => g.is(t) ? t.get() : t,
663
696
  /**
664
697
  * Adds a listener to a `Signal` or calls the listener immediately if it is not a `Signal`.
665
698
  * @param value - The value or Signal instance to add the listener to.
666
699
  * @param listener - The listener to call when the value changes.
667
700
  * @returns A function to remove the listener.
668
701
  */
669
- on: (t, e) => m.is(t) ? t.on(e) : (e(t), () => {
702
+ on: (t, e) => g.is(t) ? t.on(e) : (e(t), () => {
670
703
  }),
671
704
  /**
672
705
  * Disposes of a value or a Signal.
@@ -675,8 +708,16 @@ const y = {
675
708
  * @param value - The value or Signal instance to dispose of.
676
709
  */
677
710
  dispose: (t) => {
678
- m.is(t) && t.dispose();
711
+ g.is(t) && t.dispose();
679
712
  },
713
+ /**
714
+ * Returns a function that disposes of a value or a Signal.
715
+ * If the value is a Signal, it returns a function that disposes of the Signal.
716
+ * If the value is not a Signal, it returns a function that does nothing.
717
+ * @param value - The value or Signal instance to dispose of.
718
+ * @returns A function to dispose of the value or Signal.
719
+ */
720
+ disposeFn: (t) => () => y.dispose(t),
680
721
  /**
681
722
  * Derives a Prop from a Signal.
682
723
  * If the value is a Signal, it returns a new Prop with the derived value.
@@ -690,54 +731,246 @@ const y = {
690
731
  deriveProp: (t, {
691
732
  autoDisposeProp: e = !0,
692
733
  equals: s
693
- } = {}) => m.is(t) ? t.deriveProp({ autoDisposeProp: e, equals: s }) : _(t, s),
734
+ } = {}) => g.is(t) ? t.deriveProp({ autoDisposeProp: e, equals: s }) : T(t, s),
694
735
  /**
695
736
  * Creates a new signal that emits `true` if the value is truthy, `false` otherwise.
696
737
  * @param value - The value or signal to check.
697
738
  * @returns A signal that emits `true` if the value is truthy, `false` otherwise.
698
739
  */
699
- truthy: (t) => y.map(t, he),
740
+ truthy: (t) => y.map(t, ye),
700
741
  /**
701
742
  * Creates a new signal that emits `true` if the value is falsy, `false` otherwise.
702
743
  * @param value - The value or signal to check.
703
744
  * @returns A signal that emits `true` if the value is falsy, `false` otherwise.
704
745
  */
705
- falsy: (t) => y.map(t, Fe),
746
+ falsy: (t) => y.map(t, We),
706
747
  /**
707
748
  * Creates a new signal that emits `true` if the value is null or undefined, `false` otherwise.
708
749
  * @param value - The value or signal to check.
709
750
  * @returns A signal that emits `true` if the value is null or undefined, `false` otherwise.
710
751
  */
711
- nil: (t) => y.map(t, Be),
752
+ nil: (t) => y.map(t, Ue),
712
753
  /**
713
754
  * Creates a new signal that emits `true` if the value is not null or undefined, `false` otherwise.
714
755
  * @param value - The value or signal to check.
715
756
  * @returns A signal that emits `true` if the value is not null or undefined, `false` otherwise.
716
757
  */
717
- defined: (t) => y.map(t, We)
718
- }, ie = (...t) => (e, s) => {
758
+ defined: (t) => y.map(t, Je)
759
+ }, ee = (...t) => (e, s) => {
719
760
  if (t.length === 1)
720
761
  return y.toSignal(t[0]).map(e);
721
- const r = t.filter((n) => m.is(n));
722
- return re(
762
+ const r = t.filter((n) => g.is(n));
763
+ return z(
723
764
  () => e(...t.map((n) => y.get(n))),
724
765
  r,
725
766
  s
726
767
  );
727
- }, Ht = (t) => {
768
+ }, Jt = (t) => {
728
769
  const e = Object.keys(t);
729
- return ie(...Object.values(t))(
770
+ return ee(...Object.values(t))(
730
771
  (...s) => Object.fromEntries(e.map((r, n) => [r, s[n]]))
731
772
  );
732
- }, kt = (...t) => (e, s = {}) => {
733
- const r = t.filter((n) => m.is(n));
734
- return qe(
773
+ }, Ge = (...t) => (e, s = {}) => {
774
+ const r = t.filter((n) => g.is(n));
775
+ return me(
735
776
  () => e(...t.map(y.get)),
736
777
  r,
737
778
  s
738
779
  );
739
780
  };
740
- class fe {
781
+ class q {
782
+ _signals = /* @__PURE__ */ new Set();
783
+ _callbacks = [];
784
+ _disposed = !1;
785
+ /**
786
+ * Register a signal with this scope for automatic disposal.
787
+ *
788
+ * @param signal - The signal to track
789
+ * @throws Error if the scope has already been disposed
790
+ * @throws Error if the signal has already been disposed
791
+ * @public
792
+ */
793
+ track(e) {
794
+ if (this._disposed)
795
+ throw new Error("Cannot track signal in disposed scope");
796
+ if (e.isDisposed())
797
+ throw new Error("Cannot track already disposed signal");
798
+ this._signals.add(e);
799
+ }
800
+ /**
801
+ * Register a disposal callback to be called when this scope is disposed.
802
+ * Callbacks are called before signals are disposed.
803
+ * Use this for cleanup that doesn't need the `removeTree` parameter.
804
+ *
805
+ * @param callback - The callback to call on disposal
806
+ * @throws Error if the scope has already been disposed
807
+ * @public
808
+ */
809
+ onDispose(e) {
810
+ if (this._disposed)
811
+ throw new Error("Cannot register callback in disposed scope");
812
+ this._callbacks.push(e);
813
+ }
814
+ /**
815
+ * Dispose all signals tracked by this scope.
816
+ * This method is idempotent - calling it multiple times is safe.
817
+ *
818
+ * @public
819
+ */
820
+ dispose() {
821
+ if (!this._disposed) {
822
+ this._disposed = !0;
823
+ for (const e of this._callbacks)
824
+ try {
825
+ e();
826
+ } catch (s) {
827
+ console.error("Error in disposal callback:", s);
828
+ }
829
+ this._callbacks.length = 0;
830
+ for (const e of this._signals)
831
+ e.dispose();
832
+ this._signals.clear();
833
+ }
834
+ }
835
+ /**
836
+ * Check if this scope has been disposed.
837
+ *
838
+ * @returns true if the scope has been disposed
839
+ * @public
840
+ */
841
+ get disposed() {
842
+ return this._disposed;
843
+ }
844
+ /**
845
+ * Creates a prop signal and tracks it in this scope.
846
+ * Use this method in async contexts where automatic tracking doesn't work.
847
+ *
848
+ * @param value - The initial value
849
+ * @param equals - Optional equality function
850
+ * @returns A tracked Prop signal
851
+ * @public
852
+ */
853
+ prop(e, s) {
854
+ const r = oe(() => T(e, s));
855
+ return this.track(r), r;
856
+ }
857
+ /**
858
+ * Creates a computed signal and tracks it in this scope.
859
+ * Use this method in async contexts where automatic tracking doesn't work.
860
+ *
861
+ * @param fn - The computation function
862
+ * @param dependencies - Array of signals this computed depends on
863
+ * @param equals - Optional equality function
864
+ * @returns A tracked Computed signal
865
+ * @public
866
+ */
867
+ computed(e, s, r) {
868
+ const n = oe(() => z(e, s, r));
869
+ return this.track(n), n;
870
+ }
871
+ /**
872
+ * Creates an effect and tracks it in this scope.
873
+ * Use this method in async contexts where automatic tracking doesn't work.
874
+ *
875
+ * @param fn - The effect function
876
+ * @param signals - Array of signals to listen to
877
+ * @param options - Optional listener options
878
+ * @returns A clear function (the effect itself is tracked in the scope)
879
+ * @public
880
+ */
881
+ effect(e, s, r) {
882
+ return L(this, () => me(e, s, r));
883
+ }
884
+ /**
885
+ * Creates a computed signal with curried signature and tracks it in this scope.
886
+ * Use this method in async contexts where automatic tracking doesn't work.
887
+ *
888
+ * @param args - Values or signals to compute from
889
+ * @returns A function that takes the computation function and returns a tracked Computed signal
890
+ * @public
891
+ */
892
+ computedOf(...e) {
893
+ return (s, r) => {
894
+ const n = oe(() => ee(...e)(s, r));
895
+ return this.track(n), n;
896
+ };
897
+ }
898
+ /**
899
+ * Creates an effect with curried signature and tracks it in this scope.
900
+ * Use this method in async contexts where automatic tracking doesn't work.
901
+ *
902
+ * @param args - Values or signals to listen to
903
+ * @returns A function that takes the effect function and returns a clear function
904
+ * @public
905
+ */
906
+ effectOf(...e) {
907
+ return (s, r) => L(this, () => Ge(...e)(s, r));
908
+ }
909
+ }
910
+ const Xe = (t, e, s) => t + (e - t) * s, de = 97, Ye = (t, e, s) => {
911
+ const r = Math.max(t.length, e.length);
912
+ let n = "";
913
+ for (let i = 0; i < r; i++) {
914
+ let o = t.charCodeAt(i);
915
+ isNaN(o) && (o = de);
916
+ let l = e.charCodeAt(i);
917
+ isNaN(l) && (l = de), n += String.fromCharCode(o + (l - o) * s);
918
+ }
919
+ return n;
920
+ }, Qe = (t, e, s) => new Date(t.getTime() + (e.getTime() - t.getTime()) * s), Ze = (t, e) => e, ze = (t) => typeof t == "number" ? Xe : typeof t == "string" ? Ye : t instanceof Date ? Qe : Ze;
921
+ class le {
922
+ /**
923
+ * Creates a new instance of `ElementPosition`.
924
+ * @param index - The index of the element.
925
+ * @param total - The total number of elements in the collection.
926
+ */
927
+ constructor(e, s) {
928
+ this.index = e, this.total = s, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
929
+ }
930
+ /**
931
+ * The counter of the element starting from 1.
932
+ */
933
+ counter;
934
+ /**
935
+ * Checks if the element is the first element in the collection.
936
+ * @returns `true` if the element is the first element, `false` otherwise.
937
+ */
938
+ isFirst;
939
+ /**
940
+ * Checks if the counter of the element is even.
941
+ * @returns `true` if the counter is even, `false` otherwise.
942
+ */
943
+ isEven;
944
+ /**
945
+ * Checks if the counter of the element is odd.
946
+ * @returns `true` if the counter is odd, `false` otherwise.
947
+ */
948
+ isOdd;
949
+ #e;
950
+ /**
951
+ * Checks if the element is the last element in the collection.
952
+ * @returns `true` if the element is the last element, `false` otherwise.
953
+ */
954
+ get isLast() {
955
+ return this.#e == null && (this.#e = this.total.map((e) => this.counter === e)), this.#e;
956
+ }
957
+ /**
958
+ * Disposes the internal signal created by `isLast`.
959
+ *
960
+ * **Note:** With automatic signal disposal, this method is now a no-op when used within
961
+ * a disposal scope (e.g., inside a renderable). The signal created by `isLast` is
962
+ * automatically tracked and disposed when the scope ends. This method is kept for
963
+ * backward compatibility and for cases where ElementPosition is used outside a scope.
964
+ */
965
+ dispose = () => {
966
+ this.#e?.dispose(), this.#e = void 0;
967
+ };
968
+ }
969
+ const ce = () => (
970
+ /* c8 ignore next */
971
+ typeof window < "u" ? window : void 0
972
+ );
973
+ class be {
741
974
  _store = /* @__PURE__ */ new Map();
742
975
  /**
743
976
  * Retrieves the value associated with the specified key from the memory store.
@@ -754,7 +987,7 @@ class fe {
754
987
  this._store.set(e, s);
755
988
  };
756
989
  }
757
- const de = ({
990
+ const Se = ({
758
991
  key: t,
759
992
  defaultValue: e,
760
993
  store: s,
@@ -766,44 +999,44 @@ const de = ({
766
999
  onKeyChange: c = "load"
767
1000
  }) => {
768
1001
  let a = y.get(t);
769
- const u = s.getItem(a), p = new Y(
1002
+ const u = s.getItem(a), h = new Z(
770
1003
  u != null ? o(n(u)) : typeof e == "function" ? e() : e,
771
1004
  i
772
- ), d = ne(), f = l && typeof d?.BroadcastChannel == "function";
773
- let g = !1, w = null, C = null;
774
- const S = (b) => {
1005
+ ), p = ce(), f = l && typeof p?.BroadcastChannel == "function";
1006
+ let m = !1, S = null, D = null;
1007
+ const w = (b) => {
775
1008
  if (!f) return null;
776
- const D = `tempo:storedProp:${b}`, A = new d.BroadcastChannel(D), O = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, x = (j) => {
777
- const v = j.data;
778
- if (!(v == null || typeof v != "object" || v.key !== b || typeof v.value != "string" || v.sourceId != null && v.sourceId === O))
1009
+ const k = `tempo:storedProp:${b}`, A = new p.BroadcastChannel(k), M = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, x = (F) => {
1010
+ const v = F.data;
1011
+ if (!(v == null || typeof v != "object" || v.key !== b || typeof v.value != "string" || v.sourceId != null && v.sourceId === M))
779
1012
  try {
780
- g = !0;
781
- const te = o(n(v.value));
782
- p.set(te);
783
- } catch (te) {
1013
+ m = !0;
1014
+ const ie = o(n(v.value));
1015
+ h.set(ie);
1016
+ } catch (ie) {
784
1017
  console.warn(
785
1018
  `Failed to sync storedProp for key "${b}" via BroadcastChannel`,
786
- te
1019
+ ie
787
1020
  );
788
1021
  } finally {
789
- g = !1;
1022
+ m = !1;
790
1023
  }
791
1024
  };
792
- return A.addEventListener("message", x), p.onDispose(() => {
1025
+ return A.addEventListener("message", x), h.onDispose(() => {
793
1026
  A?.removeEventListener("message", x), A?.close();
794
- }), { channel: A, instanceId: O, handleMessage: x };
795
- }, P = S(a);
796
- P && (w = P.channel, C = P.instanceId);
797
- const ee = (b) => {
798
- const D = a;
799
- if (D === b) return;
800
- const A = p.get(), O = r(A);
801
- if (s.setItem(D, O), w != null && (w.close(), w = null, C = null), a = b, c === "load") {
802
- const j = s.getItem(b);
803
- if (j != null)
1027
+ }), { channel: A, instanceId: M, handleMessage: x };
1028
+ }, P = w(a);
1029
+ P && (S = P.channel, D = P.instanceId);
1030
+ const ne = (b) => {
1031
+ const k = a;
1032
+ if (k === b) return;
1033
+ const A = h.get(), M = r(A);
1034
+ if (s.setItem(k, M), S != null && (S.close(), S = null, D = null), a = b, c === "load") {
1035
+ const F = s.getItem(b);
1036
+ if (F != null)
804
1037
  try {
805
- const v = o(n(j));
806
- p.set(v);
1038
+ const v = o(n(F));
1039
+ h.set(v);
807
1040
  } catch (v) {
808
1041
  console.warn(
809
1042
  `Failed to load storedProp from new key "${b}"`,
@@ -811,68 +1044,68 @@ const de = ({
811
1044
  );
812
1045
  }
813
1046
  else
814
- s.setItem(b, O);
815
- } else c === "migrate" && s.setItem(b, O);
816
- const x = S(b);
817
- x && (w = x.channel, C = x.instanceId);
1047
+ s.setItem(b, M);
1048
+ } else c === "migrate" && s.setItem(b, M);
1049
+ const x = w(b);
1050
+ x && (S = x.channel, D = x.instanceId);
818
1051
  };
819
- return m.is(t) && p.onDispose(t.on(ee)), p.on((b, D) => {
1052
+ return g.is(t) && h.onDispose(t.on(ne)), h.on((b, k) => {
820
1053
  const A = r(b);
821
- s.setItem(a, A), w != null && !g && D !== void 0 && C != null && w.postMessage({
1054
+ s.setItem(a, A), S != null && !m && k !== void 0 && D != null && S.postMessage({
822
1055
  key: a,
823
1056
  value: A,
824
- sourceId: C
1057
+ sourceId: D
825
1058
  });
826
- }), p;
827
- }, $t = (t) => de({
1059
+ }), h;
1060
+ }, Gt = (t) => Se({
828
1061
  ...t,
829
1062
  /* c8 ignore next 3 */
830
- store: ne()?.localStorage ?? new fe()
831
- }), Nt = (t) => de({
1063
+ store: ce()?.localStorage ?? new be()
1064
+ }), Xt = (t) => Se({
832
1065
  ...t,
833
1066
  /* c8 ignore next 3 */
834
- store: ne()?.sessionStorage ?? new fe()
1067
+ store: ce()?.sessionStorage ?? new be()
835
1068
  });
836
- function ae(t) {
1069
+ function fe(t) {
837
1070
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 0);
838
1071
  }
839
- const Ue = (t, e, s, r) => {
840
- const n = r?.duration ?? 300, i = r?.easing ?? ((S) => S), o = r?.equals ?? ((S, P) => S === P);
841
- let l = r?.interpolate, c = t, a = e(), u = performance.now(), p = null, d = !0;
842
- const f = new H(e, o), g = _(t, o);
843
- g.onDispose(() => {
844
- p !== null && cancelAnimationFrame(p);
845
- }), g.onDispose(f.dispose), s.forEach((S) => {
846
- S.setDerivative(f), S.onDispose(g.dispose);
1072
+ const Ke = (t, e, s, r) => {
1073
+ const n = r?.duration ?? 300, i = r?.easing ?? ((w) => w), o = r?.equals ?? ((w, P) => w === P);
1074
+ let l = r?.interpolate, c = t, a = e(), u = performance.now(), h = null, p = !0;
1075
+ const f = new $(e, o), m = T(t, o);
1076
+ m.onDispose(() => {
1077
+ h !== null && cancelAnimationFrame(h);
1078
+ }), m.onDispose(f.dispose), s.forEach((w) => {
1079
+ w.setDerivative(f), w.onDispose(m.dispose);
847
1080
  });
848
- const w = (S) => {
849
- a = S, u = performance.now(), c = g.value, d && (d = !1, p = ae(C));
850
- }, C = () => {
851
- const P = (performance.now() - u) / y.get(n), ee = i(P);
852
- l == null && (l = Ve(c));
853
- let b = l(c, a, ee);
854
- P >= 1 ? (d = !0, b = a) : p = ae(C), g.set(b);
855
- };
856
- return f.on(w), g;
857
- }, Rt = (t, e) => {
1081
+ const S = (w) => {
1082
+ a = w, u = performance.now(), c = m.value, p && (p = !1, h = fe(D));
1083
+ }, D = () => {
1084
+ const P = (performance.now() - u) / y.get(n), ne = i(P);
1085
+ l == null && (l = ze(c));
1086
+ let b = l(c, a, ne);
1087
+ P >= 1 ? (p = !0, b = a) : h = fe(D), m.set(b);
1088
+ };
1089
+ return f.on(S), m;
1090
+ }, Yt = (t, e) => {
858
1091
  const { initialValue: s, ...r } = e ?? {};
859
- return Ue(
1092
+ return Ke(
860
1093
  /* c8 ignore next 2 */
861
1094
  s ?? t.get(),
862
1095
  t.get,
863
1096
  [t],
864
1097
  r
865
1098
  );
866
- }, Je = (t, e) => {
867
- const s = Object.values(t).filter(m.is), r = Object.keys(t);
868
- return re(() => {
1099
+ }, et = (t, e) => {
1100
+ const s = Object.values(t).filter(g.is), r = Object.keys(t);
1101
+ return z(() => {
869
1102
  const n = {};
870
1103
  for (const i of r)
871
1104
  n[i] = y.get(t[i]);
872
1105
  return e(n);
873
1106
  }, s);
874
- }, Vt = (t) => Je(t, (e) => e), jt = (t, e) => {
875
- const s = _(t.get());
1107
+ }, Qt = (t) => et(t, (e) => e), Zt = (t, e) => {
1108
+ const s = T(t.get());
876
1109
  let r = null;
877
1110
  const n = t.on((i) => {
878
1111
  r != null && clearTimeout(r), r = setTimeout(
@@ -885,33 +1118,33 @@ const Ue = (t, e, s, r) => {
885
1118
  return s.onDispose(() => {
886
1119
  n(), r != null && clearTimeout(r);
887
1120
  }), s;
888
- }, qt = (t) => {
1121
+ }, zt = (t) => {
889
1122
  let e;
890
1123
  return t.map((s) => {
891
1124
  const r = e;
892
1125
  return e = s, r;
893
1126
  });
894
- }, Ft = ({
1127
+ }, Kt = ({
895
1128
  size: t = void 0,
896
1129
  signal: e
897
1130
  }) => {
898
1131
  const s = [];
899
1132
  return e.map((r) => (s.push(r), t != null && s.length > t && s.shift(), s.slice()));
900
- }, Bt = (t) => (...e) => ie(
1133
+ }, es = (t) => (...e) => ee(
901
1134
  t,
902
1135
  ...e
903
1136
  )((s, ...r) => s(...r));
904
- function Wt(...t) {
905
- return ie(...t)((...e) => {
1137
+ function ts(...t) {
1138
+ return ee(...t)((...e) => {
906
1139
  for (const s of e) if (s != null) return s;
907
1140
  });
908
1141
  }
909
- const pe = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), me = /* @__PURE__ */ new Set(["selected"]), ge = /* @__PURE__ */ new Set([
1142
+ const we = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), _e = /* @__PURE__ */ new Set(["selected"]), ve = /* @__PURE__ */ new Set([
910
1143
  "rowSpan",
911
1144
  "colSpan",
912
1145
  "tabIndex",
913
1146
  "valueAsNumber"
914
- ]), ye = /* @__PURE__ */ new Set(["valueAsDate"]), be = /* @__PURE__ */ new Set([
1147
+ ]), Te = /* @__PURE__ */ new Set(["valueAsDate"]), Ae = /* @__PURE__ */ new Set([
915
1148
  "value",
916
1149
  "textContent",
917
1150
  "innerText",
@@ -919,28 +1152,28 @@ const pe = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), me = /* @
919
1152
  "outerHTML",
920
1153
  "className",
921
1154
  "classList"
922
- ]), Ge = (t, e) => me.has(t) ? (s) => {
1155
+ ]), tt = (t, e) => _e.has(t) ? (s) => {
923
1156
  s == null || s !== !0 ? e.removeAttribute(t) : e.setAttribute(t, "");
924
- } : pe.has(t) ? (s) => {
1157
+ } : we.has(t) ? (s) => {
925
1158
  s == null ? e[t] = null : e[t] = !!s;
926
- } : ge.has(t) ? (s) => {
1159
+ } : ve.has(t) ? (s) => {
927
1160
  s == null ? e[t] = null : e[t] = Number(s);
928
- } : ye.has(t) ? (s) => {
1161
+ } : Te.has(t) ? (s) => {
929
1162
  s == null ? e[t] = null : e[t] = s;
930
- } : be.has(t) ? (s) => {
1163
+ } : Ae.has(t) ? (s) => {
931
1164
  s == null ? e[t] = null : e[t] = String(s);
932
1165
  } : (s) => {
933
1166
  s == null ? e.removeAttribute(t) : e.setAttribute(t, s);
934
- }, Xe = (t, e) => me.has(t) ? () => e.hasAttribute(t) : pe.has(t) ? () => !!e[t] : ge.has(t) ? () => Number(e[t]) : ye.has(t) ? () => e[t] : be.has(t) ? () => String(e[t]) : () => e.getAttribute(t), B = (t) => {
1167
+ }, st = (t, e) => _e.has(t) ? () => e.hasAttribute(t) : we.has(t) ? () => !!e[t] : ve.has(t) ? () => Number(e[t]) : Te.has(t) ? () => e[t] : Ae.has(t) ? () => String(e[t]) : () => e.getAttribute(t), U = (t) => {
935
1168
  const e = t;
936
1169
  e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
937
- }, Ye = (t) => we(t) ? t : t.parentElement, we = (t) => t.nodeType === 1;
938
- class Se extends Error {
1170
+ }, rt = (t) => Ee(t) ? t : t.parentElement, Ee = (t) => t.nodeType === 1;
1171
+ class Ce extends Error {
939
1172
  constructor(e) {
940
1173
  super(`Provider not found: ${e.description}`);
941
1174
  }
942
1175
  }
943
- class k {
1176
+ class N {
944
1177
  /**
945
1178
  * Constructs a new `DOMContext` instance.
946
1179
  *
@@ -962,7 +1195,7 @@ class k {
962
1195
  * @returns A new `DOMContext` instance.
963
1196
  */
964
1197
  static of(e, s, r) {
965
- return new k(e.ownerDocument, e, s, r);
1198
+ return new N(e.ownerDocument, e, s, r);
966
1199
  }
967
1200
  /**
968
1201
  * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace.
@@ -1047,7 +1280,7 @@ class k {
1047
1280
  * @param element - The DOM element to use in the new `DOMContext` instance.
1048
1281
  * @returns A new `DOMContext` instance with the provided `element`.
1049
1282
  */
1050
- withElement = (e) => new k(this.document, e, void 0, this.providers);
1283
+ withElement = (e) => new N(this.document, e, void 0, this.providers);
1051
1284
  /**
1052
1285
  * Creates a portal to render content in a different part of the DOM tree.
1053
1286
  *
@@ -1104,7 +1337,7 @@ class k {
1104
1337
  * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
1105
1338
  * @returns A new `DOMContext` instance with the specified reference.
1106
1339
  */
1107
- withReference = (e) => new k(this.document, this.element, e, this.providers);
1340
+ withReference = (e) => new N(this.document, this.element, e, this.providers);
1108
1341
  /**
1109
1342
  * Sets a provider for the given provider mark.
1110
1343
  *
@@ -1112,7 +1345,7 @@ class k {
1112
1345
  * @param value - The provider to set for the given mark.
1113
1346
  * @returns A new `DOMContext` instance with the specified provider.
1114
1347
  */
1115
- setProvider = (e, s, r) => new k(this.document, this.element, this.reference, {
1348
+ setProvider = (e, s, r) => new N(this.document, this.element, this.reference, {
1116
1349
  ...this.providers,
1117
1350
  [e]: [s, r]
1118
1351
  });
@@ -1125,12 +1358,12 @@ class k {
1125
1358
  */
1126
1359
  getProvider = (e) => {
1127
1360
  if (this.providers[e] === void 0)
1128
- throw new Se(e);
1361
+ throw new Ce(e);
1129
1362
  const [s, r] = this.providers[e];
1130
1363
  return { value: s, onUse: r };
1131
1364
  };
1132
1365
  clear = (e) => {
1133
- e && (this.reference !== void 0 ? B(this.reference) : B(this.element));
1366
+ e && (this.reference !== void 0 ? U(this.reference) : U(this.element));
1134
1367
  };
1135
1368
  /**
1136
1369
  * Adds classes to the element.
@@ -1200,55 +1433,57 @@ class k {
1200
1433
  */
1201
1434
  getStyle = (e) => this.element.style[e];
1202
1435
  makeAccessors = (e) => ({
1203
- get: Xe(e, this.element),
1204
- set: Ge(e, this.element)
1436
+ get: st(e, this.element),
1437
+ set: tt(e, this.element)
1205
1438
  });
1206
1439
  getWindow = () => this.document.defaultView;
1207
1440
  }
1208
- const Qe = (t) => Symbol(t), oe = (t, e) => {
1209
- const s = t(e);
1210
- return (r = !0) => s(r);
1211
- }, Ut = (t, e, { doc: s, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
1441
+ const nt = (t) => Symbol(t), ae = (t, e) => {
1442
+ const s = new q(), r = L(s, () => t(e));
1443
+ return (n = !0) => {
1444
+ s.dispose(), r(n);
1445
+ };
1446
+ }, ss = (t, e, { doc: s, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
1212
1447
  const o = typeof e == "string" ? (s ?? document).querySelector(e) : e;
1213
1448
  if (o === null)
1214
- throw new Ze(
1449
+ throw new it(
1215
1450
  `Cannot find element by selector for render: ${e}`
1216
1451
  );
1217
1452
  r !== !1 && (s ?? o.ownerDocument) != null && o.nodeType === 1 && (o.innerHTML = "");
1218
- const l = Ye(o), c = we(o) ? void 0 : o, a = k.of(l, c, i), u = oe(t, a);
1219
- let p;
1220
- return n && (p = new MutationObserver((d) => {
1221
- d[0]?.removedNodes.forEach((f) => {
1222
- f === o && (p?.disconnect(), u(o.nodeType !== 1));
1453
+ const l = rt(o), c = Ee(o) ? void 0 : o, a = N.of(l, c, i), u = ae(t, a);
1454
+ let h;
1455
+ return n && (h = new MutationObserver((p) => {
1456
+ p[0]?.removedNodes.forEach((f) => {
1457
+ f === o && (h?.disconnect(), u(o.nodeType !== 1));
1223
1458
  });
1224
- }), p.observe(o.parentElement, {
1459
+ }), h.observe(o.parentElement, {
1225
1460
  childList: !0,
1226
1461
  subtree: !1,
1227
1462
  attributes: !1
1228
1463
  })), () => {
1229
- p?.disconnect(), u(!0);
1464
+ h?.disconnect(), u(!0);
1230
1465
  };
1231
- }, Jt = (t, {
1466
+ }, rs = (t, {
1232
1467
  startUrl: e = "https://example.com",
1233
1468
  selector: s,
1234
1469
  providers: r = {}
1235
1470
  } = {
1236
1471
  selector: "body"
1237
1472
  }) => {
1238
- const n = y.toSignal(e).deriveProp(), i = new Ee(s, void 0), o = new $(i, void 0, { currentURL: n }, r);
1473
+ const n = y.toSignal(e).deriveProp(), i = new Oe(s, void 0), o = new R(i, void 0, { currentURL: n }, r);
1239
1474
  return {
1240
- clear: oe(t(), o),
1475
+ clear: ae(t(), o),
1241
1476
  root: i,
1242
1477
  currentURL: n
1243
1478
  };
1244
1479
  };
1245
- class Ze extends Error {
1480
+ class it extends Error {
1246
1481
  constructor(e) {
1247
1482
  super(e);
1248
1483
  }
1249
1484
  }
1250
- const Te = "data-tts-node", W = "data-tts-class", U = "data-tts-style", J = "data-tts-html", G = "data-tts-text", X = "data-tts-attrs";
1251
- class Gt {
1485
+ const De = "data-tts-node", J = "data-tts-class", G = "data-tts-style", X = "data-tts-html", Y = "data-tts-text", Q = "data-tts-attrs";
1486
+ class ns {
1252
1487
  /**
1253
1488
  * Selects elements from the headless environment.
1254
1489
  * @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
@@ -1333,10 +1568,10 @@ class Gt {
1333
1568
  appendHTML: c,
1334
1569
  getInnerHTML: a,
1335
1570
  setInnerHTML: u,
1336
- getInnerText: p,
1337
- setInnerText: d
1571
+ getInnerText: h,
1572
+ setInnerText: p
1338
1573
  }) {
1339
- this.select = e, this.getAttribute = s, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = o, this.setStyles = l, this.appendHTML = c, this.getInnerHTML = a, this.setInnerHTML = u, this.getInnerText = p, this.setInnerText = d;
1574
+ this.select = e, this.getAttribute = s, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = o, this.setStyles = l, this.appendHTML = c, this.getInnerHTML = a, this.setInnerHTML = u, this.getInnerText = h, this.setInnerText = p;
1340
1575
  }
1341
1576
  /**
1342
1577
  * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
@@ -1357,21 +1592,21 @@ class Gt {
1357
1592
  if (n.hasChildren() && this.appendHTML(o, n.contentToHTML(s)), n.hasInnerHTML()) {
1358
1593
  if (s) {
1359
1594
  const l = this.getInnerHTML(o);
1360
- l != null && this.setAttribute(o, J, l);
1595
+ l != null && this.setAttribute(o, X, l);
1361
1596
  }
1362
1597
  this.setInnerHTML(o, n.getInnerHTML());
1363
1598
  }
1364
1599
  if (n.hasInnerText()) {
1365
1600
  if (s) {
1366
1601
  const l = this.getInnerText(o);
1367
- l != null && this.setAttribute(o, G, l);
1602
+ l != null && this.setAttribute(o, Y, l);
1368
1603
  }
1369
1604
  this.setInnerText(o, n.getInnerText());
1370
1605
  }
1371
1606
  if (n.hasClasses()) {
1372
1607
  if (s) {
1373
1608
  const l = this.getClass(o);
1374
- l != null && this.setAttribute(o, W, l);
1609
+ l != null && this.setAttribute(o, J, l);
1375
1610
  }
1376
1611
  this.setClass(o, n.getClasses().join(" "));
1377
1612
  }
@@ -1380,7 +1615,7 @@ class Gt {
1380
1615
  const l = this.getStyles(o);
1381
1616
  Object.keys(l).length > 0 && this.setAttribute(
1382
1617
  o,
1383
- U,
1618
+ G,
1384
1619
  JSON.stringify(l)
1385
1620
  );
1386
1621
  }
@@ -1395,7 +1630,7 @@ class Gt {
1395
1630
  u != null && c.push([a, u]);
1396
1631
  }), c.length > 0 && this.setAttribute(
1397
1632
  o,
1398
- X,
1633
+ Q,
1399
1634
  JSON.stringify(Object.fromEntries(c))
1400
1635
  );
1401
1636
  }
@@ -1407,56 +1642,56 @@ class Gt {
1407
1642
  });
1408
1643
  };
1409
1644
  }
1410
- const ze = () => {
1411
- document.querySelectorAll(`[${Te}]`).forEach(B);
1412
- }, Ke = (t) => {
1413
- const e = t.getAttribute(W);
1414
- t.removeAttribute(W), e != null && t.setAttribute("class", e);
1415
- }, et = () => {
1416
- document.querySelectorAll(`[${W}]`).forEach((e) => Ke(e));
1417
- }, tt = (t) => {
1645
+ const ot = () => {
1646
+ document.querySelectorAll(`[${De}]`).forEach(U);
1647
+ }, lt = (t) => {
1418
1648
  const e = t.getAttribute(J);
1419
- t.removeAttribute(J), e != null && (t.innerHTML = e);
1420
- }, st = () => {
1421
- document.querySelectorAll(`[${J}]`).forEach((e) => tt(e));
1422
- }, rt = (t) => {
1649
+ t.removeAttribute(J), e != null && t.setAttribute("class", e);
1650
+ }, ct = () => {
1651
+ document.querySelectorAll(`[${J}]`).forEach((e) => lt(e));
1652
+ }, at = (t) => {
1653
+ const e = t.getAttribute(X);
1654
+ t.removeAttribute(X), e != null && (t.innerHTML = e);
1655
+ }, ut = () => {
1656
+ document.querySelectorAll(`[${X}]`).forEach((e) => at(e));
1657
+ }, ht = (t) => {
1658
+ const e = t.getAttribute(Y);
1659
+ t.removeAttribute(Y), e != null && (t.innerText = e);
1660
+ }, dt = () => {
1661
+ document.querySelectorAll(`[${Y}]`).forEach((e) => ht(e));
1662
+ }, Pe = (t) => JSON.parse(t.replace(/&quot;/g, '"')), ft = (t) => {
1423
1663
  const e = t.getAttribute(G);
1424
- t.removeAttribute(G), e != null && (t.innerText = e);
1425
- }, nt = () => {
1426
- document.querySelectorAll(`[${G}]`).forEach((e) => rt(e));
1427
- }, ve = (t) => JSON.parse(t.replace(/&quot;/g, '"')), it = (t) => {
1428
- const e = t.getAttribute(U);
1429
- if (t.removeAttribute(U), e != null) {
1430
- const s = ve(e);
1664
+ if (t.removeAttribute(G), e != null) {
1665
+ const s = Pe(e);
1431
1666
  Object.entries(s).forEach(([r, n]) => {
1432
1667
  t.style.setProperty(r, n);
1433
1668
  });
1434
1669
  }
1435
- }, ot = () => {
1436
- document.querySelectorAll(`[${U}]`).forEach((e) => it(e));
1437
- }, lt = (t) => {
1438
- const e = t.getAttribute(X);
1439
- if (t.removeAttribute(X), e != null) {
1440
- const s = ve(e);
1670
+ }, pt = () => {
1671
+ document.querySelectorAll(`[${G}]`).forEach((e) => ft(e));
1672
+ }, gt = (t) => {
1673
+ const e = t.getAttribute(Q);
1674
+ if (t.removeAttribute(Q), e != null) {
1675
+ const s = Pe(e);
1441
1676
  Object.entries(s).forEach(([r, n]) => {
1442
1677
  n == null ? t.removeAttribute(r) : t.setAttribute(r, n);
1443
1678
  });
1444
1679
  }
1445
- }, ct = () => {
1446
- document.querySelectorAll(`[${X}]`).forEach((e) => lt(e));
1447
- }, Xt = () => {
1448
- ze(), et(), nt(), st(), ot(), ct();
1449
- }, M = Symbol("class"), I = Symbol("style"), q = Symbol("handler"), Ae = () => Math.random().toString(36).substring(2, 15), at = (t) => t.replace(/<[^>]*>?/g, "");
1450
- class _e {
1680
+ }, mt = () => {
1681
+ document.querySelectorAll(`[${Q}]`).forEach((e) => gt(e));
1682
+ }, is = () => {
1683
+ ot(), ct(), dt(), ut(), pt(), mt();
1684
+ }, I = Symbol("class"), H = Symbol("style"), B = Symbol("handler"), xe = () => Math.random().toString(36).substring(2, 15), yt = (t) => t.replace(/<[^>]*>?/g, "");
1685
+ class Le {
1451
1686
  constructor(e) {
1452
1687
  this.parent = e;
1453
1688
  }
1454
- id = Ae();
1689
+ id = xe();
1455
1690
  properties = {};
1456
1691
  children = [];
1457
1692
  isElement = () => !0;
1458
1693
  isText = () => !1;
1459
- getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? at(this.properties.innerHTML) : this.children.map((e) => e.getText()).join("");
1694
+ getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? yt(this.properties.innerHTML) : this.children.map((e) => e.getText()).join("");
1460
1695
  removeChild = (e) => {
1461
1696
  const s = this.children.indexOf(e);
1462
1697
  s !== -1 && this.children.splice(s, 1);
@@ -1477,10 +1712,10 @@ class _e {
1477
1712
  getInnerText = () => this.properties.innerText ?? "";
1478
1713
  hasInnerText = () => this.properties.innerText != null;
1479
1714
  hasChildren = () => this.children.length > 0;
1480
- hasClasses = () => this.properties[M] != null;
1481
- hasStyles = () => this.properties[I] != null;
1715
+ hasClasses = () => this.properties[I] != null;
1716
+ hasStyles = () => this.properties[H] != null;
1482
1717
  hasAttributes = () => Object.keys(this.properties).length > 0;
1483
- hasHandlers = () => this.properties[q] != null;
1718
+ hasHandlers = () => this.properties[B] != null;
1484
1719
  hasRenderableProperties = () => this.hasClasses() || this.hasAttributes() || this.hasStyles();
1485
1720
  getById = (e) => {
1486
1721
  if (this.properties.id === e)
@@ -1492,26 +1727,26 @@ class _e {
1492
1727
  }
1493
1728
  };
1494
1729
  trigger = (e, s) => {
1495
- ((this.properties[q] ?? {})[e] ?? []).forEach((n) => n(s));
1730
+ ((this.properties[B] ?? {})[e] ?? []).forEach((n) => n(s));
1496
1731
  };
1497
1732
  click = () => {
1498
1733
  this.trigger("click", {});
1499
1734
  };
1500
1735
  on = (e, s, r, n) => {
1501
- const i = this.properties[q] ??= {}, o = n?.once ? (c) => {
1736
+ const i = this.properties[B] ??= {}, o = n?.once ? (c) => {
1502
1737
  l(), s(c, r);
1503
1738
  } : (c) => s(c, r);
1504
1739
  i[e] = [...i[e] ?? [], o];
1505
1740
  const l = () => {
1506
1741
  const c = i[e] ?? [], a = c.indexOf(o);
1507
- a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[q]) : i[e] = c, n?.signal != null && n.signal.removeEventListener("abort", l));
1742
+ a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[B]) : i[e] = c, n?.signal != null && n.signal.removeEventListener("abort", l));
1508
1743
  };
1509
1744
  return n?.signal != null && n.signal.addEventListener("abort", l), l;
1510
1745
  };
1511
1746
  addClasses = (e) => {
1512
1747
  if (e.length === 0)
1513
1748
  return;
1514
- const s = this.properties[M] ??= [];
1749
+ const s = this.properties[I] ??= [];
1515
1750
  e.forEach((r) => {
1516
1751
  s.includes(r) || s.push(r);
1517
1752
  });
@@ -1519,25 +1754,25 @@ class _e {
1519
1754
  removeClasses = (e) => {
1520
1755
  if (e.length === 0)
1521
1756
  return;
1522
- const s = this.properties[M] ??= [];
1757
+ const s = this.properties[I] ??= [];
1523
1758
  e.forEach((r) => {
1524
1759
  const n = s.indexOf(r);
1525
1760
  n !== -1 && s.splice(n, 1);
1526
- }), s.length === 0 && delete this.properties[M];
1761
+ }), s.length === 0 && delete this.properties[I];
1527
1762
  };
1528
- getClasses = () => this.properties[M] ?? [];
1763
+ getClasses = () => this.properties[I] ?? [];
1529
1764
  getAttributes = () => Object.entries(this.properties).filter(
1530
1765
  ([e]) => !["innerText", "innerHTML"].includes(e)
1531
1766
  );
1532
1767
  getVisibleAttributes = () => Reflect.ownKeys(this.properties).flatMap(
1533
- (e) => e === M ? [["class", this.getClasses()]] : e === I ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1768
+ (e) => e === I ? [["class", this.getClasses()]] : e === H ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1534
1769
  );
1535
1770
  setStyle = (e, s) => {
1536
- const r = this.properties[I] ??= {};
1537
- r[e] = s, s === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[I]);
1771
+ const r = this.properties[H] ??= {};
1772
+ r[e] = s, s === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[H]);
1538
1773
  };
1539
- getStyle = (e) => this.properties[I]?.[e] ?? "";
1540
- getStyles = () => this.properties[I] ?? {};
1774
+ getStyle = (e) => this.properties[H]?.[e] ?? "";
1775
+ getStyles = () => this.properties[H] ?? {};
1541
1776
  makeAccessors = (e) => {
1542
1777
  const s = this.properties;
1543
1778
  return {
@@ -1546,8 +1781,8 @@ class _e {
1546
1781
  };
1547
1782
  };
1548
1783
  }
1549
- const ut = (t) => t.replace(/"/g, "&quot;"), ht = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1550
- class ft extends _e {
1784
+ const bt = (t) => t.replace(/"/g, "&quot;"), St = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1785
+ class wt extends Le {
1551
1786
  constructor(e, s, r) {
1552
1787
  super(r), this.tagName = e, this.namespace = s;
1553
1788
  }
@@ -1555,11 +1790,11 @@ class ft extends _e {
1555
1790
  toHTML = (e = !1) => {
1556
1791
  const s = this.children.map((l) => l.toHTML()).join(""), r = this.namespace ? ` xmlns="${this.namespace}"` : "";
1557
1792
  let n = null;
1558
- const i = this.getVisibleAttributes().map(([l, c]) => l === "class" ? ` class="${c.join(" ")}"` : l === "style" ? typeof c == "string" ? ` style="${c}"` : ` style="${Object.entries(c).map(([a, u]) => `${a}: ${u};`).join(" ")}"` : pt.has(l) ? ` ${l}` : l === "innerHTML" ? (n = c, "") : l === "innerText" ? (n = ht(c), "") : ` ${l}="${ut(c)}"`).join(""), o = e ? ` ${Te}` : "";
1559
- return mt.has(this.tagName) && s === "" ? `<${this.tagName}${r}${i}${o} />` : `<${this.tagName}${r}${i}${o}>${n ?? s}</${this.tagName}>`;
1793
+ const i = this.getVisibleAttributes().map(([l, c]) => l === "class" ? ` class="${c.join(" ")}"` : l === "style" ? typeof c == "string" ? ` style="${c}"` : ` style="${Object.entries(c).map(([a, u]) => `${a}: ${u};`).join(" ")}"` : vt.has(l) ? ` ${l}` : l === "innerHTML" ? (n = c, "") : l === "innerText" ? (n = St(c), "") : ` ${l}="${bt(c)}"`).join(""), o = e ? ` ${De}` : "";
1794
+ return Tt.has(this.tagName) && s === "" ? `<${this.tagName}${r}${i}${o} />` : `<${this.tagName}${r}${i}${o}>${n ?? s}</${this.tagName}>`;
1560
1795
  };
1561
1796
  }
1562
- class Ee extends _e {
1797
+ class Oe extends Le {
1563
1798
  constructor(e, s) {
1564
1799
  super(s), this.selector = e;
1565
1800
  }
@@ -1567,17 +1802,17 @@ class Ee extends _e {
1567
1802
  toHTML = () => "";
1568
1803
  contentToHTML = (e = !1) => this.children.map((s) => s.toHTML(e)).join("");
1569
1804
  }
1570
- class dt {
1805
+ class _t {
1571
1806
  constructor(e) {
1572
1807
  this.text = e;
1573
1808
  }
1574
- id = Ae();
1809
+ id = xe();
1575
1810
  isElement = () => !1;
1576
1811
  isText = () => !0;
1577
1812
  getText = () => this.text;
1578
1813
  toHTML = () => this.text;
1579
1814
  }
1580
- class $ {
1815
+ class R {
1581
1816
  constructor(e, s, r, n) {
1582
1817
  this.element = e, this.reference = s, this.container = r, this.providers = n;
1583
1818
  }
@@ -1589,8 +1824,8 @@ class $ {
1589
1824
  this.element.children.push(e);
1590
1825
  };
1591
1826
  makeChildElement = (e, s) => {
1592
- const r = new ft(e, s, this.element);
1593
- return this.appendOrInsert(r), new $(
1827
+ const r = new wt(e, s, this.element);
1828
+ return this.appendOrInsert(r), new R(
1594
1829
  r,
1595
1830
  void 0,
1596
1831
  this.container,
@@ -1598,8 +1833,8 @@ class $ {
1598
1833
  );
1599
1834
  };
1600
1835
  makeChildText = (e) => {
1601
- const s = new dt(e);
1602
- return this.appendOrInsert(s), new $(
1836
+ const s = new _t(e);
1837
+ return this.appendOrInsert(s), new R(
1603
1838
  this.element,
1604
1839
  s,
1605
1840
  this.container,
@@ -1612,8 +1847,8 @@ class $ {
1612
1847
  getText = () => this.reference?.getText() ?? this.element.getText();
1613
1848
  makeRef = () => this.makeChildText("");
1614
1849
  makePortal = (e) => {
1615
- const s = new Ee(e, this.element);
1616
- return this.appendOrInsert(s), new $(
1850
+ const s = new Oe(e, this.element);
1851
+ return this.appendOrInsert(s), new R(
1617
1852
  s,
1618
1853
  void 0,
1619
1854
  this.container,
@@ -1627,13 +1862,13 @@ class $ {
1627
1862
  * @param value - The provider to set for the given mark.
1628
1863
  * @returns A new `DOMContext` instance with the specified provider.
1629
1864
  */
1630
- setProvider = (e, s, r) => new $(this.element, this.reference, this.container, {
1865
+ setProvider = (e, s, r) => new R(this.element, this.reference, this.container, {
1631
1866
  ...this.providers,
1632
1867
  [e]: [s, r]
1633
1868
  });
1634
1869
  getProvider = (e) => {
1635
1870
  if (this.providers[e] === void 0)
1636
- throw new Se(e);
1871
+ throw new Ce(e);
1637
1872
  const [s, r] = this.providers[e];
1638
1873
  return { value: s, onUse: r };
1639
1874
  };
@@ -1652,27 +1887,27 @@ class $ {
1652
1887
  getStyle = (e) => this.element.getStyle(e);
1653
1888
  makeAccessors = (e) => this.element.makeAccessors(e);
1654
1889
  }
1655
- const pt = /* @__PURE__ */ new Set([
1890
+ const vt = /* @__PURE__ */ new Set([
1656
1891
  "checked",
1657
1892
  "disabled",
1658
1893
  "multiple",
1659
1894
  "readonly",
1660
1895
  "required",
1661
1896
  "selected"
1662
- ]), mt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), Ce = (t) => (e) => e.makeChildText(t).clear, Pe = (t) => (e) => {
1897
+ ]), Tt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), ke = (t) => (e) => e.makeChildText(t).clear, Me = (t) => (e) => {
1663
1898
  const s = e.makeChildText(t.value), r = t.on(s.setText);
1664
1899
  return (n) => {
1665
1900
  r(), s.clear(n);
1666
1901
  };
1667
- }, Yt = (t) => m.is(t) ? Pe(t) : Ce(t), T = (...t) => (e) => {
1668
- const s = t.map((r) => h(r)(e));
1902
+ }, os = (t) => g.is(t) ? Me(t) : ke(t), E = (...t) => (e) => {
1903
+ const s = t.map((r) => d(r)(e));
1669
1904
  return (r) => {
1670
1905
  s.forEach((n) => n(r));
1671
1906
  };
1672
- }, E = () => () => {
1673
- }, gt = (t) => (e) => (e.addClasses(t), (s) => {
1907
+ }, C = () => () => {
1908
+ }, At = (t) => (e) => (e.addClasses(t), (s) => {
1674
1909
  s && e.removeClasses(t);
1675
- }), yt = (t) => (e) => {
1910
+ }), Et = (t) => (e) => {
1676
1911
  let s = [];
1677
1912
  const r = t.on((n) => {
1678
1913
  e.removeClasses(s), s = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(s);
@@ -1680,20 +1915,20 @@ const pt = /* @__PURE__ */ new Set([
1680
1915
  return (n) => {
1681
1916
  r(), n && e.removeClasses(s), s.length = 0;
1682
1917
  };
1683
- }, bt = (t, e) => (s) => {
1918
+ }, Ct = (t, e) => (s) => {
1684
1919
  const { get: r, set: n } = s.makeAccessors(t), i = r();
1685
1920
  return n(e), (o) => {
1686
1921
  o && n(i);
1687
1922
  };
1688
- }, wt = (t, e) => (s) => {
1923
+ }, Dt = (t, e) => (s) => {
1689
1924
  const { get: r, set: n } = s.makeAccessors(t), i = r(), o = e.on(n);
1690
1925
  return (l) => {
1691
1926
  o(), l && n(i);
1692
1927
  };
1693
- }, N = (t, e) => m.is(e) ? wt(t, e) : bt(t, e), Z = (t = "") => (e, s) => {
1928
+ }, V = (t, e) => g.is(e) ? Dt(t, e) : Ct(t, e), te = (t = "") => (e, s) => {
1694
1929
  const r = t ? `${t}${e}` : e;
1695
- return N(r, s);
1696
- }, R = new Proxy(
1930
+ return V(r, s);
1931
+ }, j = new Proxy(
1697
1932
  {},
1698
1933
  {
1699
1934
  /**
@@ -1707,12 +1942,12 @@ const pt = /* @__PURE__ */ new Set([
1707
1942
  * @returns The renderable component for the specified attribute.
1708
1943
  *
1709
1944
  */
1710
- get: (t, e) => e === "class" ? (s) => m.is(s) ? yt(s) : gt(
1945
+ get: (t, e) => e === "class" ? (s) => g.is(s) ? Et(s) : At(
1711
1946
  /* c8 ignore next */
1712
1947
  (s ?? "").split(" ").filter((r) => r.length > 0)
1713
- ) : e === "set" ? Z() : (s) => N(e, s)
1948
+ ) : e === "set" ? te() : (s) => V(e, s)
1714
1949
  }
1715
- ), Qt = new Proxy(
1950
+ ), ls = new Proxy(
1716
1951
  {},
1717
1952
  {
1718
1953
  /**
@@ -1723,9 +1958,9 @@ const pt = /* @__PURE__ */ new Set([
1723
1958
  * @returns The renderable component for the specified attribute.
1724
1959
  *
1725
1960
  */
1726
- get: (t, e) => e === "set" ? Z("data-") : (s) => N(`data-${e}`, s)
1961
+ get: (t, e) => e === "set" ? te("data-") : (s) => V(`data-${e}`, s)
1727
1962
  }
1728
- ), Zt = new Proxy(
1963
+ ), cs = new Proxy(
1729
1964
  {},
1730
1965
  {
1731
1966
  /**
@@ -1736,9 +1971,9 @@ const pt = /* @__PURE__ */ new Set([
1736
1971
  * @returns The renderable component for the specified attribute.
1737
1972
  *
1738
1973
  */
1739
- get: (t, e) => e === "set" ? Z("aria-") : (s) => N(`aria-${e}`, s)
1974
+ get: (t, e) => e === "set" ? te("aria-") : (s) => V(`aria-${e}`, s)
1740
1975
  }
1741
- ), zt = new Proxy(
1976
+ ), as = new Proxy(
1742
1977
  {},
1743
1978
  {
1744
1979
  /**
@@ -1749,9 +1984,9 @@ const pt = /* @__PURE__ */ new Set([
1749
1984
  * @returns The renderable component for the specified attribute.
1750
1985
  *
1751
1986
  */
1752
- get: (t, e) => e === "set" ? Z() : (s) => N(e, s)
1987
+ get: (t, e) => e === "set" ? te() : (s) => V(e, s)
1753
1988
  }
1754
- ), Kt = new Proxy(
1989
+ ), us = new Proxy(
1755
1990
  {},
1756
1991
  {
1757
1992
  /**
@@ -1761,31 +1996,31 @@ const pt = /* @__PURE__ */ new Set([
1761
1996
  * @returns The renderable component for the specified attribute.
1762
1997
  *
1763
1998
  */
1764
- get: (t, e) => (s) => N(e, s)
1999
+ get: (t, e) => (s) => V(e, s)
1765
2000
  }
1766
- ), h = (t) => {
2001
+ ), d = (t) => {
1767
2002
  if (t == null)
1768
- return E;
2003
+ return C;
1769
2004
  if (Array.isArray(t))
1770
- return T(...t.map(h));
2005
+ return E(...t.map(d));
1771
2006
  if (typeof t == "string")
1772
- return Ce(t);
1773
- if (m.is(t))
1774
- return Pe(t);
2007
+ return ke(t);
2008
+ if (g.is(t))
2009
+ return Me(t);
1775
2010
  if (typeof t == "function")
1776
2011
  return t;
1777
2012
  throw new Error(`Unknown type: '${typeof t}' for child: ${t}`);
1778
- }, xe = (t, ...e) => (s) => {
1779
- const r = s.makeChildElement(t, void 0), n = e.map((i) => h(i)(r));
2013
+ }, Ie = (t, ...e) => (s) => {
2014
+ const r = s.makeChildElement(t, void 0), n = e.map((i) => d(i)(r));
1780
2015
  return (i) => {
1781
2016
  n.forEach((o) => o(!1)), r.clear(i);
1782
2017
  };
1783
- }, Le = (t, e, ...s) => (r) => {
1784
- const n = r.makeChildElement(t, e), i = s.map((o) => h(o)(n));
2018
+ }, He = (t, e, ...s) => (r) => {
2019
+ const n = r.makeChildElement(t, e), i = s.map((o) => d(o)(n));
1785
2020
  return (o) => {
1786
2021
  i.forEach((l) => l(!1)), n.clear(o);
1787
2022
  };
1788
- }, es = new Proxy(
2023
+ }, hs = new Proxy(
1789
2024
  {},
1790
2025
  {
1791
2026
  /**
@@ -1793,9 +2028,9 @@ const pt = /* @__PURE__ */ new Set([
1793
2028
  * @param tagName - The HTML tag name.
1794
2029
  * @returns A renderable function that creates and appends the HTML element to the DOM.
1795
2030
  */
1796
- get: (t, e) => (...s) => xe(e, s.flatMap(h))
2031
+ get: (t, e) => (...s) => Ie(e, s.flatMap(d))
1797
2032
  }
1798
- ), ts = new Proxy(
2033
+ ), ds = new Proxy(
1799
2034
  {},
1800
2035
  {
1801
2036
  /**
@@ -1803,9 +2038,9 @@ const pt = /* @__PURE__ */ new Set([
1803
2038
  * @param type - The input type name.
1804
2039
  * @returns A renderable function that creates and appends the HTMLInput element to the DOM.
1805
2040
  */
1806
- get: (t, e) => (...s) => xe("input", R.type(e), ...s)
2041
+ get: (t, e) => (...s) => Ie("input", j.type(e), ...s)
1807
2042
  }
1808
- ), St = "http://www.w3.org/2000/svg", ss = new Proxy(
2043
+ ), Pt = "http://www.w3.org/2000/svg", fs = new Proxy(
1809
2044
  {},
1810
2045
  {
1811
2046
  /**
@@ -1813,9 +2048,9 @@ const pt = /* @__PURE__ */ new Set([
1813
2048
  * @param tagName - The SVG tag name.
1814
2049
  * @returns A renderable function that creates and appends the SVG element to the DOM.
1815
2050
  */
1816
- get: (t, e) => (...s) => Le(e, St, s.flatMap(h))
2051
+ get: (t, e) => (...s) => He(e, Pt, s.flatMap(d))
1817
2052
  }
1818
- ), Tt = "http://www.w3.org/1998/Math/MathML", rs = new Proxy(
2053
+ ), xt = "http://www.w3.org/1998/Math/MathML", ps = new Proxy(
1819
2054
  {},
1820
2055
  {
1821
2056
  /**
@@ -1823,35 +2058,35 @@ const pt = /* @__PURE__ */ new Set([
1823
2058
  * @param tagName - The Math tag name.
1824
2059
  * @returns A renderable function that creates and appends the Math element to the DOM.
1825
2060
  */
1826
- get: (t, e) => (...s) => Le(e, Tt, s.flatMap(h))
2061
+ get: (t, e) => (...s) => He(e, xt, s.flatMap(d))
1827
2062
  }
1828
- ), De = (t, e) => {
2063
+ ), $e = (t, e) => {
1829
2064
  if (typeof e == "function")
1830
- return De(t, { then: e });
1831
- const s = e.pending != null ? h(e.pending()) : E, r = e.then, n = e.error != null ? (i) => h(e.error(i)) : () => E;
2065
+ return $e(t, { then: e });
2066
+ const s = e.pending != null ? d(e.pending()) : C, r = e.then, n = e.error != null ? (i) => d(e.error(i)) : () => C;
1832
2067
  return (i) => {
1833
2068
  let o = !0;
1834
2069
  const l = t(), c = i.makeRef();
1835
- let a = h(s)(c);
2070
+ let a = d(s)(c);
1836
2071
  return l.then(
1837
2072
  (u) => {
1838
- o && (a(!0), a = h(r(u))(c));
2073
+ o && (a(!0), a = d(r(u))(c));
1839
2074
  },
1840
2075
  (u) => {
1841
- o && (a(!0), a = h(n(u))(c));
2076
+ o && (a(!0), a = d(n(u))(c));
1842
2077
  }
1843
2078
  ), (u) => {
1844
2079
  o = !1, a(u), c.clear(u);
1845
2080
  };
1846
2081
  };
1847
- }, ns = (t, e) => De(() => t, e), Oe = (t, e, s) => (r) => r.on(t, e, s), vt = (t) => Oe("click", (e, s) => {
2082
+ }, gs = (t, e) => $e(() => t, e), Ne = (t, e, s) => (r) => r.on(t, e, s), Lt = (t) => Ne("click", (e, s) => {
1848
2083
  e.preventDefault();
1849
2084
  const r = e.target;
1850
2085
  setTimeout(() => {
1851
2086
  const n = r.ownerDocument != null ? r?.checked : void 0;
1852
2087
  n != null && t(!n, s);
1853
2088
  }, 0);
1854
- }), z = new Proxy(
2089
+ }), se = new Proxy(
1855
2090
  {},
1856
2091
  {
1857
2092
  /**
@@ -1859,20 +2094,20 @@ const pt = /* @__PURE__ */ new Set([
1859
2094
  * @param fn - The function to call when the event is triggered.
1860
2095
  * @returns A `Renderable` function that adds the event listener to the element.
1861
2096
  */
1862
- get: (t, e) => (s) => Oe(e, s)
2097
+ get: (t, e) => (s) => Ne(e, s)
1863
2098
  }
1864
- ), At = (t, e) => (s) => {
2099
+ ), Ot = (t, e) => (s) => {
1865
2100
  e?.preventDefault === !0 && s.preventDefault(), e?.stopPropagation === !0 && s.stopPropagation(), e?.stopImmediatePropagation === !0 && s.stopImmediatePropagation(), t(s);
1866
- }, L = (t, e) => At((s) => {
2101
+ }, O = (t, e) => Ot((s) => {
1867
2102
  const r = s.target;
1868
2103
  t(r, s);
1869
- }, e), _t = (t, e) => L(
2104
+ }, e), kt = (t, e) => O(
1870
2105
  (s, r) => t(s.value, r),
1871
2106
  e
1872
- ), Et = (t, e) => L(
2107
+ ), Mt = (t, e) => O(
1873
2108
  (s, r) => t(s.valueAsNumber, r),
1874
2109
  e
1875
- ), Ct = (t, e) => L((s, r) => {
2110
+ ), It = (t, e) => O((s, r) => {
1876
2111
  if (s.value === "")
1877
2112
  return;
1878
2113
  const n = s.value.split("-"), i = new Date(
@@ -1881,7 +2116,7 @@ const pt = /* @__PURE__ */ new Set([
1881
2116
  Number(n[2].substring(0, 2))
1882
2117
  );
1883
2118
  t(i, r);
1884
- }, e), is = (t, e) => L((s, r) => {
2119
+ }, e), ms = (t, e) => O((s, r) => {
1885
2120
  if (s.value === "") {
1886
2121
  t(null, r);
1887
2122
  return;
@@ -1892,7 +2127,7 @@ const pt = /* @__PURE__ */ new Set([
1892
2127
  Number(n[2].substring(0, 2))
1893
2128
  );
1894
2129
  t(i, r);
1895
- }, e), Pt = (t, e) => L((s, r) => {
2130
+ }, e), Ht = (t, e) => O((s, r) => {
1896
2131
  if (s.value === "")
1897
2132
  return;
1898
2133
  const n = s.value.split("T"), i = n[0].split("-"), o = new Date(
@@ -1901,7 +2136,7 @@ const pt = /* @__PURE__ */ new Set([
1901
2136
  Number(i[2])
1902
2137
  ), l = n[1].split(":");
1903
2138
  o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), t(o, r);
1904
- }, e), os = (t, e) => L((s, r) => {
2139
+ }, e), ys = (t, e) => O((s, r) => {
1905
2140
  if (s.value === "") {
1906
2141
  t(null, r);
1907
2142
  return;
@@ -1917,55 +2152,58 @@ const pt = /* @__PURE__ */ new Set([
1917
2152
  Number(i[2])
1918
2153
  ), l = n[1].split(":");
1919
2154
  o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), t(o, r);
1920
- }, e), ls = (t, e) => L((s, r) => {
2155
+ }, e), bs = (t, e) => O((s, r) => {
1921
2156
  t(s.checked, r);
1922
- }, e), cs = (t, e = "input") => T(R.valueAsDate(t), z[e](Ct(t.set))), as = (t, e = "input") => T(R.valueAsDate(t), z[e](Pt(t.set))), us = (t, e = "input") => T(R.valueAsNumber(t), z[e](Et(t.set))), hs = (t, e = "input") => T(R.value(t), z[e](_t(t.set))), fs = (t) => T(R.checked(t), vt(t.set)), le = (t, e, s) => m.is(t) ? e(t) : s(t), xt = (t, e, s) => {
2157
+ }, e), Ss = (t, e = "input") => E(j.valueAsDate(t), se[e](It(t.set))), ws = (t, e = "input") => E(j.valueAsDate(t), se[e](Ht(t.set))), _s = (t, e = "input") => E(j.valueAsNumber(t), se[e](Mt(t.set))), vs = (t, e = "input") => E(j.value(t), se[e](kt(t.set))), Ts = (t) => E(j.checked(t), Lt(t.set)), ue = (t, e, s) => g.is(t) ? e(t) : s(t), $t = (t, e, s) => {
1923
2158
  const r = t.makeRef();
1924
2159
  let n = () => {
1925
- };
1926
- const i = e.on((o) => {
1927
- n(!0), n = h(s(o))(r);
2160
+ }, i = null;
2161
+ const o = e.on((l) => {
2162
+ i?.dispose(), n(!0), i = new q(), n = L(
2163
+ i,
2164
+ () => d(s(l))(r)
2165
+ );
1928
2166
  });
1929
- return (o) => {
1930
- n(o), i(), r.clear(o);
2167
+ return (l) => {
2168
+ i?.dispose(), n(l), o(), r.clear(l);
1931
2169
  };
1932
- }, K = (t, e) => {
2170
+ }, re = (t, e) => {
1933
2171
  function s(n) {
1934
2172
  return (i) => {
1935
2173
  const o = i.makeRef();
1936
2174
  let l, c;
1937
- const a = n.map((d) => Object.keys(d)[0]);
2175
+ const a = n.map((p) => Object.keys(p)[0]);
1938
2176
  let u;
1939
- const p = a.on((d) => {
1940
- if (d !== u) {
1941
- u = d, c?.dispose(), l?.(!0), c = n.map((g) => g[d]);
1942
- const f = e[d](c);
1943
- l = h(f)(o);
2177
+ const h = a.on((p) => {
2178
+ if (p !== u) {
2179
+ u = p, c?.dispose(), l?.(!0), c = n.map((m) => m[p]);
2180
+ const f = e[p](c);
2181
+ l = d(f)(o);
1944
2182
  }
1945
2183
  });
1946
- return (d) => {
1947
- c?.dispose(), p(), o.clear(d), l?.(d);
2184
+ return (p) => {
2185
+ c?.dispose(), h(), o.clear(p), l?.(p);
1948
2186
  };
1949
2187
  };
1950
2188
  }
1951
2189
  function r(n) {
1952
2190
  const i = Object.keys(n)[0];
1953
- return h(e[i](Q(n[i])));
2191
+ return d(e[i](K(n[i])));
1954
2192
  }
1955
- return le(t, s, r);
1956
- }, Me = (t, e, s) => K(
2193
+ return ue(t, s, r);
2194
+ }, Re = (t, e, s) => re(
1957
2195
  y.map(t, (r) => ({ [r[e]]: r })),
1958
2196
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1959
2197
  s
1960
- ), ds = (t, e) => Me(t, "kind", e), ps = (t, e) => {
2198
+ ), As = (t, e) => Re(t, "kind", e), Es = (t, e) => {
1961
2199
  const s = y.map(t, ([r, n]) => ({ [r]: n }));
1962
- return K(s, e);
1963
- }, ms = (t, e) => Me(t, "type", e), Lt = (t, e) => K(
2200
+ return re(s, e);
2201
+ }, Cs = (t, e) => Re(t, "type", e), Nt = (t, e) => re(
1964
2202
  y.map(t, (s) => ({ [s]: !0 })),
1965
2203
  e
1966
- ), gs = (t, e = {}) => (s) => {
2204
+ ), Ds = (t, e = {}) => (s) => {
1967
2205
  const r = e?.firstSeparator ?? t, n = e?.lastSeparator ?? t;
1968
- return Lt(
2206
+ return Nt(
1969
2207
  s.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
1970
2208
  {
1971
2209
  first: r,
@@ -1973,80 +2211,78 @@ const pt = /* @__PURE__ */ new Set([
1973
2211
  other: t
1974
2212
  }
1975
2213
  );
1976
- }, ys = (t) => (e) => (e.appendOrInsert(t), (s) => {
1977
- s && B(t);
1978
- }), bs = (t, e, s) => {
2214
+ }, Ps = (t) => (e) => (e.appendOrInsert(t), (s) => {
2215
+ s && U(t);
2216
+ }), xs = (t, e, s) => {
1979
2217
  function r(i) {
1980
2218
  return (o) => {
1981
2219
  const l = o.makeRef();
1982
2220
  let c = () => {
1983
2221
  }, a = !1, u = null;
1984
- const p = i.on((d) => {
1985
- d == null ? (c(!0), c = h(s?.())(l), a = !1, u?.dispose(), u = null) : a ? u.set(d) : (u = _(d), c(!0), c = h(e(u))(
2222
+ const h = i.on((p) => {
2223
+ p == null ? (c(!0), c = d(s?.())(l), a = !1, u?.dispose(), u = null) : a ? u.set(p) : (u = T(p), c(!0), c = d(e(u))(
1986
2224
  l
1987
2225
  ), a = !0);
1988
2226
  });
1989
- return (d) => {
1990
- u?.dispose(), p(), c?.(d), l.clear(d);
2227
+ return (p) => {
2228
+ u?.dispose(), h(), c?.(p), l.clear(p);
1991
2229
  };
1992
2230
  };
1993
2231
  }
1994
2232
  function n(i) {
1995
2233
  if (i == null) {
1996
2234
  const o = s?.();
1997
- return o != null ? h(o) : E;
2235
+ return o != null ? d(o) : C;
1998
2236
  }
1999
- return h(e(Q(i)));
2237
+ return d(e(K(i)));
2000
2238
  }
2001
- return le(
2239
+ return ue(
2002
2240
  t,
2003
2241
  r,
2004
2242
  n
2005
2243
  );
2006
- }, ws = (...t) => (e, s) => (r) => {
2244
+ }, Ls = (...t) => (e, s) => (r) => {
2007
2245
  const n = r.makeRef();
2008
2246
  if (t.some(
2009
- (f) => !m.is(f) && f == null
2247
+ (f) => !g.is(f) && f == null
2010
2248
  ))
2011
- return (s != null ? h(s?.()) : E)(
2249
+ return (s != null ? d(s?.()) : C)(
2012
2250
  n
2013
2251
  );
2014
2252
  const o = t.map(() => null), l = t.map(
2015
- (f) => m.is(f) ? f.value != null : f != null
2253
+ (f) => g.is(f) ? f.value != null : f != null
2016
2254
  );
2017
2255
  let c = null;
2018
- const a = _(l.every((f) => f)), u = (f, g) => {
2256
+ const a = T(l.every((f) => f)), u = (f, m) => {
2019
2257
  if (f.value != null) {
2020
- if (o[g] == null) {
2021
- const w = _(f.value);
2022
- o[g] = w;
2258
+ if (o[m] == null) {
2259
+ const S = T(f.value);
2260
+ o[m] = S;
2023
2261
  } else
2024
- o[g].value = f.value;
2025
- l[g] = !0;
2262
+ o[m].value = f.value;
2263
+ l[m] = !0;
2026
2264
  } else
2027
- l[g] = !1;
2265
+ l[m] = !1;
2028
2266
  };
2029
- let p = t.length - 1;
2030
- const d = t.map((f, g) => {
2031
- if (!m.is(f)) {
2032
- const w = _(f);
2033
- return o[g] = w, () => {
2267
+ let h = t.length - 1;
2268
+ const p = t.map((f, m) => {
2269
+ if (!g.is(f)) {
2270
+ const S = T(f);
2271
+ return o[m] = S, () => {
2034
2272
  };
2035
2273
  }
2036
2274
  return f.on(() => {
2037
- u(f, g), p === 0 ? a.value = l.every((w) => w) : p--;
2275
+ u(f, m), h === 0 ? a.value = l.every((S) => S) : h--;
2038
2276
  });
2039
2277
  });
2040
2278
  return a.on((f) => {
2041
- c?.(!0), c = null, f ? c = h(e(...o))(n) : c = h(s?.() ?? E)(n);
2279
+ c?.(!0), c = null, f ? c = d(e(...o))(n) : c = d(s?.() ?? C)(n);
2042
2280
  }), (f) => {
2043
- o.forEach((g) => g?.dispose()), a.dispose(), d.forEach((g) => g()), c?.(f), n.clear(f);
2281
+ o.forEach((m) => m?.dispose()), a.dispose(), p.forEach((m) => m()), c?.(f), n.clear(f);
2044
2282
  };
2045
- }, V = (...t) => (e) => (s) => t.forEach((r) => {
2046
- typeof r == "function" ? r(s, e) : r.dispose(s, e);
2047
- }), Ie = (t, e, s) => le(
2283
+ }, Ve = (t, e, s) => ue(
2048
2284
  t,
2049
- (r) => (n) => xt(
2285
+ (r) => (n) => $t(
2050
2286
  n,
2051
2287
  r,
2052
2288
  (i) => i ? e() : s?.()
@@ -2054,85 +2290,81 @@ const pt = /* @__PURE__ */ new Set([
2054
2290
  (r) => {
2055
2291
  if (r) {
2056
2292
  const n = e();
2057
- return n != null ? h(n) : E;
2293
+ return n != null ? d(n) : C;
2058
2294
  }
2059
- return h(s?.());
2295
+ return d(s?.());
2060
2296
  }
2061
- ), Ss = (t, e, s) => Ie(
2297
+ ), Os = (t, e, s) => Ve(
2062
2298
  y.map(t, (r) => !r),
2063
2299
  e,
2064
2300
  s
2065
- ), He = (t, e, s) => {
2301
+ ), je = (t, e, s) => {
2066
2302
  if (s != null)
2067
- return He(t, (r) => {
2068
- const n = new se(
2303
+ return je(t, (r) => {
2304
+ const n = new le(
2069
2305
  r.index,
2070
2306
  r.total.map((i) => i - 1)
2071
2307
  );
2072
- return T(
2073
- V(n.dispose),
2074
- h(e(r)),
2075
- Ie(
2308
+ return E(
2309
+ d(e(r)),
2310
+ Ve(
2076
2311
  r.isLast,
2077
- () => E,
2312
+ () => C,
2078
2313
  () => s(n)
2079
2314
  )
2080
2315
  );
2081
2316
  });
2082
- if (m.is(t))
2317
+ if (g.is(t))
2083
2318
  return (r) => {
2084
- const n = t.derive(), i = r.makeRef(), o = [];
2085
- return n.on((l) => {
2086
- const c = o.splice(l);
2087
- for (const a of c)
2088
- a(!0);
2089
- for (let a = o.length; a < l; a++) {
2090
- const u = new se(a, n);
2091
- o.push(
2092
- T(
2093
- V(u.dispose),
2094
- h(e(u))
2095
- )(i)
2319
+ const n = t.derive(), i = r.makeRef(), o = [], l = [];
2320
+ return n.on((c) => {
2321
+ const a = o.splice(c), u = l.splice(c);
2322
+ for (const h of u)
2323
+ h.dispose();
2324
+ for (const h of a)
2325
+ h(!0);
2326
+ for (let h = o.length; h < c; h++) {
2327
+ const p = new le(h, n), f = new q();
2328
+ l.push(f), o.push(
2329
+ L(f, () => d(e(p))(i))
2096
2330
  );
2097
2331
  }
2098
- }), (l) => {
2099
- n.dispose();
2100
- for (const c of o)
2101
- c(l);
2102
- o.length = 0, i.clear(l);
2332
+ }), (c) => {
2333
+ for (const a of l)
2334
+ a.dispose();
2335
+ l.length = 0, n.dispose();
2336
+ for (const a of o)
2337
+ a(c);
2338
+ o.length = 0, i.clear(c);
2103
2339
  };
2104
2340
  };
2105
2341
  {
2106
- const r = Q(t);
2107
- return T(
2342
+ const r = K(t);
2343
+ return E(
2108
2344
  ...Array.from({ length: t }, (n, i) => i).map((n) => {
2109
- const i = new se(n, r);
2110
- return T(
2111
- V(i.dispose),
2112
- h(e(i))
2113
- );
2345
+ const i = new le(n, r);
2346
+ return d(e(i));
2114
2347
  })
2115
2348
  );
2116
2349
  }
2117
- }, Ts = (t, e, s) => {
2350
+ }, ks = (t, e, s) => {
2118
2351
  const r = y.map(t, (i) => i.length), n = y.toSignal(t);
2119
- return He(
2352
+ return je(
2120
2353
  r,
2121
2354
  (i) => {
2122
2355
  const o = n.map((l) => l[i.index]);
2123
- return T(
2124
- V(o.dispose),
2125
- h(e(o, i))
2126
- );
2356
+ return d(e(o, i));
2127
2357
  },
2128
2358
  s
2129
2359
  );
2130
- }, vs = (t, e) => {
2131
- if (m.is(t)) {
2360
+ }, Rt = (...t) => (e) => (s) => t.forEach((r) => {
2361
+ typeof r == "function" ? r(s, e) : r.dispose(s, e);
2362
+ }), Ms = (t, e) => {
2363
+ if (g.is(t)) {
2132
2364
  const s = t;
2133
2365
  return (r) => {
2134
2366
  r = r.makeRef();
2135
- const n = s.map((l) => h(e(l)));
2367
+ const n = s.map((l) => d(e(l)));
2136
2368
  let i = () => {
2137
2369
  };
2138
2370
  const o = n.on((l) => {
@@ -2143,8 +2375,8 @@ const pt = /* @__PURE__ */ new Set([
2143
2375
  };
2144
2376
  };
2145
2377
  }
2146
- return h(e(t));
2147
- }, As = (t, e, s = () => E) => K(
2378
+ return d(e(t));
2379
+ }, Is = (t, e, s = () => C) => re(
2148
2380
  y.map(
2149
2381
  t,
2150
2382
  (r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
@@ -2153,40 +2385,40 @@ const pt = /* @__PURE__ */ new Set([
2153
2385
  notEmpty: (r) => e(r),
2154
2386
  whenEmpty: () => s()
2155
2387
  }
2156
- ), _s = (t, e) => (s) => {
2157
- const r = s.makePortal(t), n = oe(h(e), r);
2388
+ ), Hs = (t, e) => (s) => {
2389
+ const r = s.makePortal(t), n = ae(d(e), r);
2158
2390
  return () => n(!0);
2159
- }, F = /* @__PURE__ */ new Map(), Dt = (t) => ({
2160
- mark: Qe(`Probe(${t.description})`),
2391
+ }, W = /* @__PURE__ */ new Map(), Vt = (t) => ({
2392
+ mark: nt(`Probe(${t.description})`),
2161
2393
  create: ({ callback: e = () => {
2162
2394
  }, timeout: s = 10 } = {}) => {
2163
2395
  const r = (l) => {
2164
- clearTimeout(n), F.delete(t), e(l);
2396
+ clearTimeout(n), W.delete(t), e(l);
2165
2397
  };
2166
- if (F.has(t))
2398
+ if (W.has(t))
2167
2399
  throw new Error(`Probe already exists: ${t.description}`);
2168
2400
  const n = setTimeout(() => r("timeout"), s), i = { counter: 0, timeoutId: n };
2169
- return F.set(t, i), {
2401
+ return W.set(t, i), {
2170
2402
  value: () => {
2171
2403
  clearTimeout(n);
2172
- const l = F.get(t);
2404
+ const l = W.get(t);
2173
2405
  l != null && --l.counter === 0 && r("resolved");
2174
2406
  },
2175
2407
  dispose: () => r("disposed"),
2176
2408
  onUse: () => i.counter++
2177
2409
  };
2178
2410
  }
2179
- }), Es = Dt(Symbol("GlobalProbe")), Ot = (t, e) => (s) => {
2411
+ }), $s = Vt(Symbol("GlobalProbe")), jt = (t, e) => (s) => {
2180
2412
  const r = s.getStyle(t);
2181
2413
  return s.setStyle(t, e), (n) => {
2182
2414
  n && s.setStyle(t, r);
2183
2415
  };
2184
- }, Mt = (t, e) => (s) => {
2416
+ }, qt = (t, e) => (s) => {
2185
2417
  const r = s.getStyle(t), n = e.on((i) => s.setStyle(t, i));
2186
2418
  return (i) => {
2187
2419
  n(), i && s.setStyle(t, r);
2188
2420
  };
2189
- }, ue = (t, e) => m.is(e) ? Mt(t, e) : Ot(t, e), Cs = new Proxy({}, {
2421
+ }, pe = (t, e) => g.is(e) ? qt(t, e) : jt(t, e), Ns = new Proxy({}, {
2190
2422
  /**
2191
2423
  * Creates a renderable component for the specified `style` property.
2192
2424
  *
@@ -2195,28 +2427,33 @@ const pt = /* @__PURE__ */ new Set([
2195
2427
  * @returns The renderable component for the specified attribute.
2196
2428
  *
2197
2429
  */
2198
- get: (t, e) => e === "variable" ? (s, r) => ue(s, r) : (s) => ue(e, s)
2199
- }), It = (t) => (e) => {
2430
+ get: (t, e) => e === "variable" ? (s, r) => pe(s, r) : (s) => pe(e, s)
2431
+ }), Ft = (t) => (e) => {
2200
2432
  if (e.isBrowser()) {
2201
2433
  const s = t(e);
2202
2434
  if (s != null)
2203
- return h(s)(e);
2435
+ return d(s)(e);
2204
2436
  }
2205
2437
  return () => {
2206
2438
  };
2207
- }, Ps = (t) => (e) => {
2439
+ }, Rs = (t) => (e) => {
2208
2440
  const s = t(e);
2209
2441
  return s == null ? () => {
2210
- } : h(s)(e);
2211
- }, xs = (t) => It((e) => t(e.element)), Ls = (t) => (e) => {
2442
+ } : d(s)(e);
2443
+ }, Vs = (t) => Ft((e) => t(e.element)), js = (t) => (e) => {
2212
2444
  if (e.isHeadlessDOM()) {
2213
2445
  const s = t(e);
2214
2446
  if (s)
2215
- return h(s)(e);
2447
+ return d(s)(e);
2216
2448
  }
2217
2449
  return () => {
2218
2450
  };
2219
- }, ce = (t) => (e) => {
2451
+ }, qs = (t) => (e) => {
2452
+ const s = new q(), r = L(s, () => d(t(s))(e));
2453
+ return (n) => {
2454
+ s.dispose(), r(n);
2455
+ };
2456
+ }, he = (t) => (e) => {
2220
2457
  let s = e;
2221
2458
  function r() {
2222
2459
  return s;
@@ -2230,133 +2467,144 @@ const pt = /* @__PURE__ */ new Set([
2230
2467
  return a?.(), c;
2231
2468
  },
2232
2469
  set: ({ mark: l, create: c }, a) => {
2233
- const { value: u, dispose: p, onUse: d } = c(a, r());
2234
- i.push(p), n(r().setProvider(l, u, d));
2470
+ const { value: u, dispose: h, onUse: p } = c(a, r());
2471
+ i.push(h), n(r().setProvider(l, u, p));
2235
2472
  }
2236
2473
  });
2237
2474
  return o == null ? () => {
2238
- } : T(
2239
- h(o),
2240
- V(() => i.forEach((l) => l()))
2475
+ } : E(
2476
+ d(o),
2477
+ Rt(() => i.forEach((l) => l()))
2241
2478
  )(r());
2242
- }, Ds = (t, e, s) => ce(({ set: r }) => (r(t, e), s())), Os = (t, e) => ce(({ use: s }) => e(s(t))), Ms = (...t) => (e) => ce(({ use: s }) => {
2479
+ }, Fs = (t, e, s) => he(({ set: r }) => (r(t, e), s())), Bs = (t, e) => he(({ use: s }) => e(s(t))), Ws = (...t) => (e) => he(({ use: s }) => {
2243
2480
  const r = t.map(s);
2244
2481
  return e(...r);
2245
2482
  });
2246
2483
  export {
2247
- ns as Async,
2248
- fs as BindChecked,
2249
- cs as BindDate,
2250
- as as BindDateTime,
2251
- us as BindNumber,
2252
- hs as BindText,
2253
- k as BrowserContext,
2254
- W as CLASS_PLACEHOLDER_ATTR,
2255
- H as Computed,
2256
- gs as Conjunction,
2257
- ys as DOMNode,
2258
- xe as El,
2259
- Le as ElNS,
2260
- se as ElementPosition,
2261
- E as Empty,
2262
- bs as Ensure,
2263
- ws as EnsureAll,
2264
- Ts as ForEach,
2265
- T as Fragment,
2266
- Es as GlobalProbe,
2267
- Gt as HeadlessAdapter,
2268
- $ as HeadlessContext,
2269
- ft as HeadlessElement,
2270
- Ee as HeadlessPortal,
2271
- dt as HeadlessText,
2272
- vs as MapSignal,
2273
- fe as MemoryStore,
2274
- As as NotEmpty,
2275
- vt as OnChecked,
2276
- V as OnDispose,
2277
- K as OneOf,
2278
- Me as OneOfField,
2279
- ds as OneOfKind,
2280
- ps as OneOfTuple,
2281
- ms as OneOfType,
2282
- Lt as OneOfValue,
2283
- _s as Portal,
2284
- Y as Prop,
2285
- Ds as Provide,
2286
- Se as ProviderNotFoundError,
2287
- Ze as RenderingError,
2288
- He as Repeat,
2289
- m as Signal,
2290
- De as Task,
2291
- Yt as TextNode,
2292
- Ss as Unless,
2293
- Os as Use,
2294
- Ms as UseMany,
2484
+ gs as Async,
2485
+ Ts as BindChecked,
2486
+ Ss as BindDate,
2487
+ ws as BindDateTime,
2488
+ _s as BindNumber,
2489
+ vs as BindText,
2490
+ N as BrowserContext,
2491
+ J as CLASS_PLACEHOLDER_ATTR,
2492
+ $ as Computed,
2493
+ Ds as Conjunction,
2494
+ Ps as DOMNode,
2495
+ q as DisposalScope,
2496
+ Ie as El,
2497
+ He as ElNS,
2498
+ le as ElementPosition,
2499
+ C as Empty,
2500
+ xs as Ensure,
2501
+ Ls as EnsureAll,
2502
+ ks as ForEach,
2503
+ E as Fragment,
2504
+ $s as GlobalProbe,
2505
+ ns as HeadlessAdapter,
2506
+ R as HeadlessContext,
2507
+ wt as HeadlessElement,
2508
+ Oe as HeadlessPortal,
2509
+ _t as HeadlessText,
2510
+ Ms as MapSignal,
2511
+ be as MemoryStore,
2512
+ Is as NotEmpty,
2513
+ Lt as OnChecked,
2514
+ Rt as OnDispose,
2515
+ re as OneOf,
2516
+ Re as OneOfField,
2517
+ As as OneOfKind,
2518
+ Es as OneOfTuple,
2519
+ Cs as OneOfType,
2520
+ Nt as OneOfValue,
2521
+ Hs as Portal,
2522
+ Z as Prop,
2523
+ Fs as Provide,
2524
+ Ce as ProviderNotFoundError,
2525
+ it as RenderingError,
2526
+ je as Repeat,
2527
+ g as Signal,
2528
+ $e as Task,
2529
+ os as TextNode,
2530
+ Os as Unless,
2531
+ Bs as Use,
2532
+ Ws as UseMany,
2295
2533
  y as Value,
2296
- Ie as When,
2297
- It as WithBrowserCtx,
2298
- Ps as WithCtx,
2299
- xs as WithElement,
2300
- Ls as WithHeadlessCtx,
2301
- ce as WithProvider,
2302
- Te as _NODE_PLACEHOLDER_ATTR,
2303
- Ye as _getSelfOrParentElement,
2304
- we as _isElement,
2305
- Xe as _makeGetter,
2306
- Ge as _makeSetter,
2307
- B as _removeDOMNode,
2308
- Pe as _signalText,
2309
- Ce as _staticText,
2310
- Rt as animateSignal,
2311
- Ue as animateSignals,
2312
- Zt as aria,
2313
- R as attr,
2314
- Bt as bind,
2315
- Wt as coalesce,
2316
- re as computed,
2317
- ie as computedOf,
2318
- Je as computedRecord,
2319
- Qt as dataAttr,
2320
- jt as delaySignal,
2321
- qe as effect,
2322
- kt as effectOf,
2323
- At as emit,
2324
- ls as emitChecked,
2325
- L as emitTarget,
2326
- _t as emitValue,
2327
- Ct as emitValueAsDate,
2328
- Pt as emitValueAsDateTime,
2329
- is as emitValueAsNullableDate,
2330
- os as emitValueAsNullableDateTime,
2331
- Et as emitValueAsNumber,
2332
- Re as endInterpolate,
2333
- ne as getWindow,
2334
- Ve as guessInterpolate,
2335
- es as html,
2336
- ts as input,
2337
- Ne as interpolateDate,
2338
- ke as interpolateNumber,
2339
- $e as interpolateString,
2340
- Ht as joinSignals,
2341
- $t as localStorageProp,
2342
- Dt as makeProbe,
2343
- Qe as makeProviderMark,
2344
- rs as math,
2345
- Kt as mathAttr,
2346
- Vt as merge,
2347
- z as on,
2348
- qt as previousSignal,
2349
- _ as prop,
2350
- Ut as render,
2351
- oe as renderWithContext,
2352
- h as renderableOfTNode,
2353
- Xt as restoreTempoPlaceholders,
2354
- Jt as runHeadless,
2355
- Nt as sessionStorageProp,
2356
- Q as signal,
2357
- Ft as slidingWindowSignal,
2358
- de as storedProp,
2359
- Cs as style,
2360
- ss as svg,
2361
- zt as svgAttr
2534
+ Ve as When,
2535
+ Ft as WithBrowserCtx,
2536
+ Rs as WithCtx,
2537
+ Vs as WithElement,
2538
+ js as WithHeadlessCtx,
2539
+ he as WithProvider,
2540
+ qs as WithScope,
2541
+ De as _NODE_PLACEHOLDER_ATTR,
2542
+ rt as _getSelfOrParentElement,
2543
+ Ee as _isElement,
2544
+ st as _makeGetter,
2545
+ tt as _makeSetter,
2546
+ U as _removeDOMNode,
2547
+ Me as _signalText,
2548
+ ke as _staticText,
2549
+ Yt as animateSignal,
2550
+ Ke as animateSignals,
2551
+ cs as aria,
2552
+ j as attr,
2553
+ es as bind,
2554
+ ts as coalesce,
2555
+ z as computed,
2556
+ ee as computedOf,
2557
+ et as computedRecord,
2558
+ ls as dataAttr,
2559
+ Zt as delaySignal,
2560
+ me as effect,
2561
+ Ge as effectOf,
2562
+ Ot as emit,
2563
+ bs as emitChecked,
2564
+ O as emitTarget,
2565
+ kt as emitValue,
2566
+ It as emitValueAsDate,
2567
+ Ht as emitValueAsDateTime,
2568
+ ms as emitValueAsNullableDate,
2569
+ ys as emitValueAsNullableDateTime,
2570
+ Mt as emitValueAsNumber,
2571
+ Ze as endInterpolate,
2572
+ ge as getCurrentScope,
2573
+ Wt as getParentScope,
2574
+ Bt as getScopeStack,
2575
+ ce as getWindow,
2576
+ ze as guessInterpolate,
2577
+ hs as html,
2578
+ ds as input,
2579
+ Qe as interpolateDate,
2580
+ Xe as interpolateNumber,
2581
+ Ye as interpolateString,
2582
+ Jt as joinSignals,
2583
+ Gt as localStorageProp,
2584
+ Vt as makeProbe,
2585
+ nt as makeProviderMark,
2586
+ ps as math,
2587
+ us as mathAttr,
2588
+ Qt as merge,
2589
+ se as on,
2590
+ Fe as popScope,
2591
+ zt as previousSignal,
2592
+ T as prop,
2593
+ qe as pushScope,
2594
+ ss as render,
2595
+ ae as renderWithContext,
2596
+ d as renderableOfTNode,
2597
+ is as restoreTempoPlaceholders,
2598
+ rs as runHeadless,
2599
+ _ as scopeStack,
2600
+ Ut as scoped,
2601
+ Xt as sessionStorageProp,
2602
+ K as signal,
2603
+ Kt as slidingWindowSignal,
2604
+ Se as storedProp,
2605
+ Ns as style,
2606
+ fs as svg,
2607
+ as as svgAttr,
2608
+ oe as untracked,
2609
+ L as withScope
2362
2610
  };