@tempots/dom 32.0.0 → 33.1.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,24 +1,24 @@
1
- const _ = [], qe = (t) => {
1
+ const _ = [], We = (t) => {
2
2
  _.push(t);
3
- }, Fe = () => {
3
+ }, Ue = () => {
4
4
  if (_.length === 0)
5
5
  throw new Error("Cannot pop from empty scope stack");
6
6
  _.pop();
7
- }, ge = () => _[_.length - 1] ?? null, Bt = () => _, Wt = () => _[_.length - 2] ?? null, L = (t, e) => {
8
- qe(t);
7
+ }, ue = () => _[_.length - 1] ?? null, Zt = () => _, zt = () => _[_.length - 2] ?? null, x = (t, e) => {
8
+ We(t);
9
9
  try {
10
10
  return e();
11
11
  } finally {
12
- Fe();
12
+ Ue();
13
13
  }
14
- }, Ut = (t) => {
15
- const e = new q();
14
+ }, Kt = (t) => {
15
+ const e = new j();
16
16
  try {
17
- return L(e, () => t(e));
17
+ return x(e, () => t(e));
18
18
  } finally {
19
19
  e.dispose();
20
20
  }
21
- }, oe = (t) => {
21
+ }, ie = (t) => {
22
22
  const e = _.slice();
23
23
  _.length = 0;
24
24
  try {
@@ -79,14 +79,14 @@ class g {
79
79
  * @param equals - Function to compare two values for equality (defaults to strict equality)
80
80
  * @returns A Signal that represents the result of the Promise
81
81
  */
82
- static ofPromise = (e, s, r, n = (i, o) => i === o) => {
83
- const i = new g(s, n);
84
- return e.then((o) => i._setAndNotify(o)).catch((o) => {
85
- r != null ? i._setAndNotify(r(o)) : console.error(
82
+ static ofPromise = (e, s, n, r = (o, i) => o === i) => {
83
+ const o = new g(s, r);
84
+ return e.then((i) => o._setAndNotify(i)).catch((i) => {
85
+ n != null ? o._setAndNotify(n(i)) : console.error(
86
86
  "Unhandled promise rejection in Signal.ofPromise:",
87
- o
87
+ i
88
88
  );
89
- }), i;
89
+ }), o;
90
90
  };
91
91
  /**
92
92
  * Checks if a value is a Signal.
@@ -140,22 +140,46 @@ class g {
140
140
  * The listener function will be immediately called with the current value of the signal.
141
141
  * Returns a function that can be called to unregister the listener.
142
142
  *
143
+ * When called within a DisposalScope (e.g., inside a renderable), the listener is
144
+ * automatically cleaned up when the scope is disposed. This prevents memory leaks
145
+ * when listening to outer-scope signals from inner scopes.
146
+ *
143
147
  * @param listener - The listener function to be called when the value of the signal changes.
144
148
  * @param options - Options for the listener.
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * // Automatic cleanup when scope disposes
153
+ * const MyComponent = () => {
154
+ * const outerSignal = prop(0)
155
+ *
156
+ * return html.div(
157
+ * When(someCondition, () => {
158
+ * // This listener is automatically cleaned up when the When() disposes
159
+ * outerSignal.on(value => console.log(value))
160
+ * return html.span('Inner content')
161
+ * })
162
+ * )
163
+ * }
164
+ * ```
145
165
  */
146
166
  on = (e, s = {}) => {
147
167
  s.skipInitial || e(this.get(), void 0);
148
- const r = s.once ? (i, o) => {
149
- n(), e(i, o);
168
+ const n = s.once ? (o, i) => {
169
+ r(), e(o, i);
150
170
  } : e;
151
- this._onValueListeners.push(r);
152
- const n = () => {
171
+ this._onValueListeners.push(n);
172
+ const r = () => {
153
173
  this._onValueListeners.splice(
154
- this._onValueListeners.indexOf(r),
174
+ this._onValueListeners.indexOf(n),
155
175
  1
156
- ), s.abortSignal != null && s.abortSignal.removeEventListener("abort", n);
176
+ ), s.abortSignal != null && s.abortSignal.removeEventListener("abort", r);
157
177
  };
158
- return s.abortSignal != null && s.abortSignal.addEventListener("abort", n), n;
178
+ if (s.abortSignal != null && s.abortSignal.addEventListener("abort", r), !s.noAutoDispose) {
179
+ const o = ue();
180
+ o?.onDispose(r);
181
+ }
182
+ return r;
159
183
  };
160
184
  /**
161
185
  * Registers a listener function to be called whenever the value of the signal changes.
@@ -166,11 +190,11 @@ class g {
166
190
  * @param options - Options for the listener.
167
191
  */
168
192
  onChange = (e, s = {}) => {
169
- let r = 0;
170
- const n = (i, o) => {
171
- r++ > 0 && e(i, o);
193
+ let n = 0;
194
+ const r = (o, i) => {
195
+ n++ > 0 && e(o, i);
172
196
  };
173
- return this.on(n, s);
197
+ return this.on(r, s);
174
198
  };
175
199
  /**
176
200
  * @internal
@@ -178,7 +202,7 @@ class g {
178
202
  _setAndNotify = (e) => {
179
203
  if (this._disposed) return;
180
204
  const s = this._value;
181
- this.equals(s, e) || (this._value = e, this._onValueListeners.forEach((n) => n(e, s)));
205
+ this.equals(s, e) || (this._value = e, this._onValueListeners.forEach((r) => r(e, s)));
182
206
  };
183
207
  /**
184
208
  * @internal
@@ -199,9 +223,10 @@ class g {
199
223
  };
200
224
  /**
201
225
  * Disposes the signal, releasing any resources associated with it.
226
+ * This clears all listeners, derivatives, and disposal callbacks.
202
227
  */
203
228
  dispose = () => {
204
- this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
229
+ this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0, this._onValueListeners.length = 0);
205
230
  };
206
231
  /**
207
232
  * Creates a new computed signal by applying a transformation function to this signal's value.
@@ -265,15 +290,15 @@ class g {
265
290
  * @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
266
291
  * @returns A new computed signal with the transformed value (auto-registered with current scope)
267
292
  */
268
- map = (e, s = (r, n) => r === n) => {
269
- const r = new $(() => {
293
+ map = (e, s = (n, r) => n === r) => {
294
+ const n = new N(() => {
270
295
  try {
271
296
  return e(this.get());
272
- } catch (n) {
273
- throw console.error("Error in Signal.map:", n), n;
297
+ } catch (r) {
298
+ throw console.error("Error in Signal.map:", r), r;
274
299
  }
275
300
  }, s);
276
- return this.setDerivative(r), r;
301
+ return this.setDerivative(n), n;
277
302
  };
278
303
  /**
279
304
  * Returns a new Signal that applies the given function to the value of the current Signal,
@@ -285,15 +310,15 @@ class g {
285
310
  * Defaults to a strict equality check (===).
286
311
  * @returns A new Signal that emits the values of the resulting Signal.
287
312
  */
288
- flatMap = (e, s = (r, n) => r === n) => {
289
- const r = new $(() => {
313
+ flatMap = (e, s = (n, r) => n === r) => {
314
+ const n = new N(() => {
290
315
  try {
291
316
  return e(this.get()).get();
292
- } catch (n) {
293
- throw console.error("Error in Signal.flatMap:", n), n;
317
+ } catch (r) {
318
+ throw console.error("Error in Signal.flatMap:", r), r;
294
319
  }
295
320
  }, s);
296
- return this.setDerivative(r), r;
321
+ return this.setDerivative(n), n;
297
322
  };
298
323
  /**
299
324
  * Invokes a callback function with the current value of the signal, without modifying the signal.
@@ -323,16 +348,16 @@ class g {
323
348
  });
324
349
  }
325
350
  filter = (e, s) => {
326
- let r = s ?? this.get();
327
- const n = new $(() => {
351
+ let n = s ?? this.get();
352
+ const r = new N(() => {
328
353
  try {
329
- const i = this.get();
330
- return r = e(i) ? i : r;
331
- } catch (i) {
332
- throw console.error("Error in Signal.filter:", i), i;
354
+ const o = this.get();
355
+ return n = e(o) ? o : n;
356
+ } catch (o) {
357
+ throw console.error("Error in Signal.filter:", o), o;
333
358
  }
334
359
  }, this.equals);
335
- return this.setDerivative(n), n;
360
+ return this.setDerivative(r), r;
336
361
  };
337
362
  /**
338
363
  * Returns a new Computed object that applies the provided mapping function to the value of this Signal,
@@ -344,17 +369,17 @@ class g {
344
369
  * @param equals - Optional equality function to determine if two values are equal.
345
370
  * @returns - A new Computed object with the mapped and filtered values.
346
371
  */
347
- filterMap = (e, s, r = (n, i) => n === i) => {
348
- let n = s;
349
- const i = new $(() => {
372
+ filterMap = (e, s, n = (r, o) => r === o) => {
373
+ let r = s;
374
+ const o = new N(() => {
350
375
  try {
351
- const o = this.get(), l = e(o);
352
- return n = l ?? n;
353
- } catch (o) {
354
- throw console.error("Error in Signal.filterMap:", o), o;
376
+ const i = this.get(), l = e(i);
377
+ return r = l ?? r;
378
+ } catch (i) {
379
+ throw console.error("Error in Signal.filterMap:", i), i;
355
380
  }
356
- }, r);
357
- return this.setDerivative(i), i;
381
+ }, n);
382
+ return this.setDerivative(o), o;
358
383
  };
359
384
  /**
360
385
  * Maps the values emitted by the signal to a new value asynchronously using the provided function.
@@ -369,25 +394,25 @@ class g {
369
394
  * @param equals - The equality function to compare the mapped values for equality.
370
395
  * @returns A property that holds the mapped value and can be observed for changes.
371
396
  */
372
- mapAsync = (e, s, r, n = (i, o) => i === o) => {
373
- const i = T(s, n);
374
- let o = 0, l = new AbortController();
375
- return i.onDispose(
397
+ mapAsync = (e, s, n, r = (o, i) => o === i) => {
398
+ const o = T(s, r);
399
+ let i = 0, l = new AbortController();
400
+ return o.onDispose(
376
401
  this.on(async (c) => {
377
- const a = ++o;
402
+ const a = ++i;
378
403
  l.abort(), l = new AbortController();
379
404
  try {
380
405
  const u = await e(c, { abortSignal: l.signal });
381
- a === o && i.set(u);
406
+ a === i && o.set(u);
382
407
  } catch (u) {
383
- if (a === o)
384
- if (r != null)
385
- i.set(r(u));
408
+ if (a === i)
409
+ if (n != null)
410
+ o.set(n(u));
386
411
  else
387
412
  throw u;
388
413
  }
389
414
  })
390
- ), i;
415
+ ), o;
391
416
  };
392
417
  /**
393
418
  * Maps the values of the signal using the provided function `fn`, and returns a new signal
@@ -399,7 +424,7 @@ class g {
399
424
  * @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
400
425
  * @returns A new signal containing the mapped values.
401
426
  */
402
- mapMaybe = (e, s) => this.map((r) => e(r) ?? s);
427
+ mapMaybe = (e, s) => this.map((n) => e(n) ?? s);
403
428
  /**
404
429
  * Feeds a property into the signal and sets up disposal behavior.
405
430
  * @param prop - The property to feed into the signal.
@@ -407,8 +432,8 @@ class g {
407
432
  * @returns The input property.
408
433
  */
409
434
  feedProp = (e, s = !1) => {
410
- const r = this.on(e.set);
411
- return e.onDispose(r), s ? this.onDispose(e.dispose) : this.onDispose(r), e;
435
+ const n = this.on(e.set);
436
+ return e.onDispose(n), s ? this.onDispose(e.dispose) : this.onDispose(n), e;
412
437
  };
413
438
  /**
414
439
  * Derives a new property from the current signal.
@@ -446,11 +471,11 @@ class g {
446
471
  this._derivatives.indexOf(e),
447
472
  1
448
473
  );
449
- }), e.onDispose(this.on(e.setDirty)), this.onDispose(e.dispose);
474
+ }), e.onDispose(this.on(e.setDirty, { noAutoDispose: !0 })), this.onDispose(e.dispose);
450
475
  };
451
476
  }
452
- const Be = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
453
- class $ extends g {
477
+ const Ge = typeof queueMicrotask == "function" ? queueMicrotask : (t) => Promise.resolve().then(t);
478
+ class N extends g {
454
479
  /**
455
480
  * Creates a new Computed signal.
456
481
  *
@@ -477,8 +502,8 @@ class $ extends g {
477
502
  */
478
503
  constructor(e, s) {
479
504
  super(void 0, s), this._fn = e, this.setDirty();
480
- const r = ge();
481
- r?.track(this);
505
+ const n = ue();
506
+ n?.track(this);
482
507
  }
483
508
  /**
484
509
  * Checks if a value is an instance of `Computed`.
@@ -516,7 +541,7 @@ class $ extends g {
516
541
  */
517
542
  _scheduleNotify = () => {
518
543
  const e = ++this._scheduleCount;
519
- Be(() => {
544
+ Ge(() => {
520
545
  this._scheduleCount !== e || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn()));
521
546
  });
522
547
  };
@@ -571,15 +596,15 @@ class Z extends g {
571
596
  * @returns A dispatch function that can be used to update the state and trigger the effects.
572
597
  */
573
598
  reducer = (e, ...s) => {
574
- const r = this;
575
- return function n(i) {
576
- const o = r.value;
577
- r.update((l) => e(l, i)), !r.equals(o, r.value) && s.forEach(
599
+ const n = this;
600
+ return function r(o) {
601
+ const i = n.value;
602
+ n.update((l) => e(l, o)), !n.equals(i, n.value) && s.forEach(
578
603
  (l) => l({
579
- previousState: o,
580
- state: r.value,
581
- action: i,
582
- dispatch: n
604
+ previousState: i,
605
+ state: n.value,
606
+ action: o,
607
+ dispatch: r
583
608
  })
584
609
  );
585
610
  };
@@ -595,9 +620,9 @@ class Z extends g {
595
620
  * Defaults to a strict equality check (===).
596
621
  * @returns A Prop object representing the isomorphism.
597
622
  */
598
- iso = (e, s, r = (n, i) => n === i) => {
599
- const n = new Z(e(this.get()), r);
600
- return n.onDispose(this.on((i) => n.set(e(i)))), n.on((i) => this._setAndNotify(s(i))), n;
623
+ iso = (e, s, n = (r, o) => r === o) => {
624
+ const r = new Z(e(this.get()), n);
625
+ return r.onDispose(this.on((o) => r.set(e(o)))), r.on((o) => this._setAndNotify(s(o))), r;
601
626
  };
602
627
  /**
603
628
  * Returns a `Prop` that represents the value at the specified key of the current value.
@@ -619,38 +644,38 @@ class Z extends g {
619
644
  this._setAndNotify(e);
620
645
  }
621
646
  }
622
- const z = (t, e, s = (r, n) => r === n) => {
623
- const r = new $(t, s);
624
- return e.forEach((n) => n.setDerivative(r)), r;
625
- }, me = (t, e, s = {}) => {
626
- let r = s.once ? () => {
627
- i(), t();
647
+ const z = (t, e, s = (n, r) => n === r) => {
648
+ const n = new N(t, s);
649
+ return e.forEach((r) => r.setDerivative(n)), n;
650
+ }, Se = (t, e, s = {}) => {
651
+ let n = s.once ? () => {
652
+ o(), t();
628
653
  } : t;
629
654
  if (s.skipInitial) {
630
- let o = !1;
631
- const l = r;
632
- r = () => {
633
- o ? l() : o = !0;
655
+ let i = !1;
656
+ const l = n;
657
+ n = () => {
658
+ i ? l() : i = !0;
634
659
  };
635
660
  }
636
- const n = z(r, e), i = () => {
637
- n.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", i);
638
- };
639
- return s.abortSignal != null && s.abortSignal.addEventListener("abort", i), i;
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) {
661
+ const r = z(n, e), o = () => {
662
+ r.dispose(), s.abortSignal != null && s.abortSignal.removeEventListener("abort", o);
663
+ };
664
+ return s.abortSignal != null && s.abortSignal.addEventListener("abort", o), o;
665
+ }, T = (t, e = (s, n) => s === n) => {
666
+ const s = new Z(t, e), n = ue();
667
+ return n?.track(s), s;
668
+ }, K = (t, e = (s, n) => s === n) => new g(t, e);
669
+ function we(t) {
645
670
  return t != null && t !== !1 && t !== 0 && t !== "";
646
671
  }
647
- function We(t) {
648
- return !ye(t);
672
+ function Je(t) {
673
+ return !we(t);
649
674
  }
650
- function Ue(t) {
675
+ function Xe(t) {
651
676
  return t == null;
652
677
  }
653
- function Je(t) {
678
+ function Ye(t) {
654
679
  return t != null;
655
680
  }
656
681
  const y = {
@@ -737,48 +762,48 @@ const y = {
737
762
  * @param value - The value or signal to check.
738
763
  * @returns A signal that emits `true` if the value is truthy, `false` otherwise.
739
764
  */
740
- truthy: (t) => y.map(t, ye),
765
+ truthy: (t) => y.map(t, we),
741
766
  /**
742
767
  * Creates a new signal that emits `true` if the value is falsy, `false` otherwise.
743
768
  * @param value - The value or signal to check.
744
769
  * @returns A signal that emits `true` if the value is falsy, `false` otherwise.
745
770
  */
746
- falsy: (t) => y.map(t, We),
771
+ falsy: (t) => y.map(t, Je),
747
772
  /**
748
773
  * Creates a new signal that emits `true` if the value is null or undefined, `false` otherwise.
749
774
  * @param value - The value or signal to check.
750
775
  * @returns A signal that emits `true` if the value is null or undefined, `false` otherwise.
751
776
  */
752
- nil: (t) => y.map(t, Ue),
777
+ nil: (t) => y.map(t, Xe),
753
778
  /**
754
779
  * Creates a new signal that emits `true` if the value is not null or undefined, `false` otherwise.
755
780
  * @param value - The value or signal to check.
756
781
  * @returns A signal that emits `true` if the value is not null or undefined, `false` otherwise.
757
782
  */
758
- defined: (t) => y.map(t, Je)
783
+ defined: (t) => y.map(t, Ye)
759
784
  }, ee = (...t) => (e, s) => {
760
785
  if (t.length === 1)
761
786
  return y.toSignal(t[0]).map(e);
762
- const r = t.filter((n) => g.is(n));
787
+ const n = t.filter((r) => g.is(r));
763
788
  return z(
764
- () => e(...t.map((n) => y.get(n))),
765
- r,
789
+ () => e(...t.map((r) => y.get(r))),
790
+ n,
766
791
  s
767
792
  );
768
- }, Jt = (t) => {
793
+ }, es = (t) => {
769
794
  const e = Object.keys(t);
770
795
  return ee(...Object.values(t))(
771
- (...s) => Object.fromEntries(e.map((r, n) => [r, s[n]]))
796
+ (...s) => Object.fromEntries(e.map((n, r) => [n, s[r]]))
772
797
  );
773
- }, Ge = (...t) => (e, s = {}) => {
774
- const r = t.filter((n) => g.is(n));
775
- return me(
798
+ }, Qe = (...t) => (e, s = {}) => {
799
+ const n = t.filter((r) => g.is(r));
800
+ return Se(
776
801
  () => e(...t.map(y.get)),
777
- r,
802
+ n,
778
803
  s
779
804
  );
780
805
  };
781
- class q {
806
+ class j {
782
807
  _signals = /* @__PURE__ */ new Set();
783
808
  _callbacks = [];
784
809
  _disposed = !1;
@@ -851,8 +876,8 @@ class q {
851
876
  * @public
852
877
  */
853
878
  prop(e, s) {
854
- const r = oe(() => T(e, s));
855
- return this.track(r), r;
879
+ const n = ie(() => T(e, s));
880
+ return this.track(n), n;
856
881
  }
857
882
  /**
858
883
  * Creates a computed signal and tracks it in this scope.
@@ -864,9 +889,9 @@ class q {
864
889
  * @returns A tracked Computed signal
865
890
  * @public
866
891
  */
867
- computed(e, s, r) {
868
- const n = oe(() => z(e, s, r));
869
- return this.track(n), n;
892
+ computed(e, s, n) {
893
+ const r = ie(() => z(e, s, n));
894
+ return this.track(r), r;
870
895
  }
871
896
  /**
872
897
  * Creates an effect and tracks it in this scope.
@@ -878,8 +903,8 @@ class q {
878
903
  * @returns A clear function (the effect itself is tracked in the scope)
879
904
  * @public
880
905
  */
881
- effect(e, s, r) {
882
- return L(this, () => me(e, s, r));
906
+ effect(e, s, n) {
907
+ return x(this, () => Se(e, s, n));
883
908
  }
884
909
  /**
885
910
  * Creates a computed signal with curried signature and tracks it in this scope.
@@ -890,9 +915,9 @@ class q {
890
915
  * @public
891
916
  */
892
917
  computedOf(...e) {
893
- return (s, r) => {
894
- const n = oe(() => ee(...e)(s, r));
895
- return this.track(n), n;
918
+ return (s, n) => {
919
+ const r = ie(() => ee(...e)(s, n));
920
+ return this.track(r), r;
896
921
  };
897
922
  }
898
923
  /**
@@ -904,20 +929,20 @@ class q {
904
929
  * @public
905
930
  */
906
931
  effectOf(...e) {
907
- return (s, r) => L(this, () => Ge(...e)(s, r));
932
+ return (s, n) => x(this, () => Qe(...e)(s, n));
908
933
  }
909
934
  }
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);
935
+ const Ze = (t, e, s) => t + (e - t) * s, ge = 97, ze = (t, e, s) => {
936
+ const n = Math.max(t.length, e.length);
937
+ let r = "";
938
+ for (let o = 0; o < n; o++) {
939
+ let i = t.charCodeAt(o);
940
+ isNaN(i) && (i = ge);
941
+ let l = e.charCodeAt(o);
942
+ isNaN(l) && (l = ge), r += String.fromCharCode(i + (l - i) * s);
918
943
  }
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;
944
+ return r;
945
+ }, Ke = (t, e, s) => new Date(t.getTime() + (e.getTime() - t.getTime()) * s), et = (t, e) => e, tt = (t) => typeof t == "number" ? Ze : typeof t == "string" ? ze : t instanceof Date ? Ke : et;
921
946
  class le {
922
947
  /**
923
948
  * Creates a new instance of `ElementPosition`.
@@ -966,7 +991,7 @@ class le {
966
991
  this.#e?.dispose(), this.#e = void 0;
967
992
  };
968
993
  }
969
- const ce = () => (
994
+ const he = () => (
970
995
  /* c8 ignore next */
971
996
  typeof window < "u" ? window : void 0
972
997
  );
@@ -987,164 +1012,172 @@ class be {
987
1012
  this._store.set(e, s);
988
1013
  };
989
1014
  }
990
- const Se = ({
1015
+ let ce = null, ae = null;
1016
+ const st = () => (ce || (ce = new be()), ce), nt = () => (ae || (ae = new be()), ae), _e = ({
991
1017
  key: t,
992
1018
  defaultValue: e,
993
1019
  store: s,
994
- serialize: r = JSON.stringify,
995
- deserialize: n = JSON.parse,
996
- equals: i = (a, u) => a === u,
997
- onLoad: o = (a) => a,
1020
+ serialize: n = JSON.stringify,
1021
+ deserialize: r = JSON.parse,
1022
+ equals: o = (a, u) => a === u,
1023
+ onLoad: i = (a) => a,
998
1024
  syncTabs: l = !0,
999
1025
  onKeyChange: c = "load"
1000
1026
  }) => {
1001
1027
  let a = y.get(t);
1002
1028
  const u = s.getItem(a), h = new Z(
1003
- u != null ? o(n(u)) : typeof e == "function" ? e() : e,
1004
- i
1005
- ), p = ce(), f = l && typeof p?.BroadcastChannel == "function";
1006
- let m = !1, S = null, D = null;
1007
- const w = (b) => {
1008
- if (!f) return null;
1009
- const k = `tempo:storedProp:${b}`, A = new p.BroadcastChannel(k), M = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, x = (F) => {
1029
+ u != null ? i(r(u)) : typeof e == "function" ? e() : e,
1030
+ o
1031
+ ), p = he(), d = l && typeof p?.BroadcastChannel == "function";
1032
+ let m = !1, w = null, D = null;
1033
+ const b = (S) => {
1034
+ if (!d) return null;
1035
+ const M = `tempo:storedProp:${S}`, A = new p.BroadcastChannel(M), k = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`, P = (F) => {
1010
1036
  const v = F.data;
1011
- if (!(v == null || typeof v != "object" || v.key !== b || typeof v.value != "string" || v.sourceId != null && v.sourceId === M))
1037
+ if (!(v == null || typeof v != "object" || v.key !== S || typeof v.value != "string" || v.sourceId != null && v.sourceId === k))
1012
1038
  try {
1013
1039
  m = !0;
1014
- const ie = o(n(v.value));
1015
- h.set(ie);
1016
- } catch (ie) {
1040
+ const oe = i(r(v.value));
1041
+ h.set(oe);
1042
+ } catch (oe) {
1017
1043
  console.warn(
1018
- `Failed to sync storedProp for key "${b}" via BroadcastChannel`,
1019
- ie
1044
+ `Failed to sync storedProp for key "${S}" via BroadcastChannel`,
1045
+ oe
1020
1046
  );
1021
1047
  } finally {
1022
1048
  m = !1;
1023
1049
  }
1024
1050
  };
1025
- return A.addEventListener("message", x), h.onDispose(() => {
1026
- A?.removeEventListener("message", x), A?.close();
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);
1051
+ return A.addEventListener("message", P), h.onDispose(() => {
1052
+ A?.removeEventListener("message", P), A?.close();
1053
+ }), { channel: A, instanceId: k, handleMessage: P };
1054
+ }, L = b(a);
1055
+ L && (w = L.channel, D = L.instanceId);
1056
+ const re = (S) => {
1057
+ const M = a;
1058
+ if (M === S) return;
1059
+ const A = h.get(), k = n(A);
1060
+ if (s.setItem(M, k), w != null && (w.close(), w = null, D = null), a = S, c === "load") {
1061
+ const F = s.getItem(S);
1036
1062
  if (F != null)
1037
1063
  try {
1038
- const v = o(n(F));
1064
+ const v = i(r(F));
1039
1065
  h.set(v);
1040
1066
  } catch (v) {
1041
1067
  console.warn(
1042
- `Failed to load storedProp from new key "${b}"`,
1068
+ `Failed to load storedProp from new key "${S}"`,
1043
1069
  v
1044
1070
  );
1045
1071
  }
1046
1072
  else
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);
1051
- };
1052
- return g.is(t) && h.onDispose(t.on(ne)), h.on((b, k) => {
1053
- const A = r(b);
1054
- s.setItem(a, A), S != null && !m && k !== void 0 && D != null && S.postMessage({
1073
+ s.setItem(S, k);
1074
+ } else c === "migrate" && s.setItem(S, k);
1075
+ const P = b(S);
1076
+ P && (w = P.channel, D = P.instanceId);
1077
+ };
1078
+ return g.is(t) && h.onDispose(t.on(re)), h.on((S, M) => {
1079
+ const A = n(S);
1080
+ s.setItem(a, A), w != null && !m && M !== void 0 && D != null && w.postMessage({
1055
1081
  key: a,
1056
1082
  value: A,
1057
1083
  sourceId: D
1058
1084
  });
1059
1085
  }), h;
1060
- }, Gt = (t) => Se({
1061
- ...t,
1062
- /* c8 ignore next 3 */
1063
- store: ce()?.localStorage ?? new be()
1064
- }), Xt = (t) => Se({
1065
- ...t,
1066
- /* c8 ignore next 3 */
1067
- store: ce()?.sessionStorage ?? new be()
1068
- });
1069
- function fe(t) {
1086
+ }, ts = (t) => {
1087
+ const s = he()?.localStorage, n = s && typeof s.getItem == "function" ? s : st();
1088
+ return _e({
1089
+ ...t,
1090
+ store: n
1091
+ });
1092
+ }, ss = (t) => {
1093
+ const s = he()?.sessionStorage, n = s && typeof s.getItem == "function" ? s : nt();
1094
+ return _e({
1095
+ ...t,
1096
+ store: n
1097
+ });
1098
+ };
1099
+ function me(t) {
1070
1100
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(t) : setTimeout(t, 0);
1071
1101
  }
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);
1102
+ const rt = (t, e, s, n) => {
1103
+ const r = n?.duration ?? 300, o = n?.easing ?? ((b) => b), i = n?.equals ?? ((b, L) => b === L);
1104
+ let l = n?.interpolate, c = t, a = e(), u = performance.now(), h = null, p = !0;
1105
+ const d = new N(e, i), m = T(t, i);
1076
1106
  m.onDispose(() => {
1077
1107
  h !== null && cancelAnimationFrame(h);
1078
- }), m.onDispose(f.dispose), s.forEach((w) => {
1079
- w.setDerivative(f), w.onDispose(m.dispose);
1108
+ }), m.onDispose(d.dispose), s.forEach((b) => {
1109
+ b.setDerivative(d), b.onDispose(m.dispose);
1080
1110
  });
1081
- const S = (w) => {
1082
- a = w, u = performance.now(), c = m.value, p && (p = !1, h = fe(D));
1111
+ const w = (b) => {
1112
+ a = b, u = performance.now(), c = m.value, p && (p = !1, h = me(D));
1083
1113
  }, 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) => {
1091
- const { initialValue: s, ...r } = e ?? {};
1092
- return Ke(
1114
+ const L = (performance.now() - u) / y.get(r), re = o(L);
1115
+ l == null && (l = tt(c));
1116
+ let S = l(c, a, re);
1117
+ L >= 1 ? (p = !0, S = a) : h = me(D), m.set(S);
1118
+ };
1119
+ return d.on(w), m;
1120
+ }, ns = (t, e) => {
1121
+ const { initialValue: s, ...n } = e ?? {};
1122
+ return rt(
1093
1123
  /* c8 ignore next 2 */
1094
1124
  s ?? t.get(),
1095
1125
  t.get,
1096
1126
  [t],
1097
- r
1127
+ n
1098
1128
  );
1099
- }, et = (t, e) => {
1100
- const s = Object.values(t).filter(g.is), r = Object.keys(t);
1129
+ }, ot = (t, e) => {
1130
+ const s = Object.values(t).filter(g.is), n = Object.keys(t);
1101
1131
  return z(() => {
1102
- const n = {};
1103
- for (const i of r)
1104
- n[i] = y.get(t[i]);
1105
- return e(n);
1132
+ const r = {};
1133
+ for (const o of n)
1134
+ r[o] = y.get(t[o]);
1135
+ return e(r);
1106
1136
  }, s);
1107
- }, Qt = (t) => et(t, (e) => e), Zt = (t, e) => {
1137
+ }, rs = (t) => ot(t, (e) => e), os = (t, e) => {
1108
1138
  const s = T(t.get());
1109
- let r = null;
1110
- const n = t.on((i) => {
1111
- r != null && clearTimeout(r), r = setTimeout(
1112
- () => {
1113
- r = null, s.set(i);
1114
- },
1115
- typeof e == "function" ? e(i) : e
1116
- );
1117
- });
1139
+ let n = null;
1140
+ const r = t.on(
1141
+ (o) => {
1142
+ n != null && clearTimeout(n), n = setTimeout(
1143
+ () => {
1144
+ n = null, s.set(o);
1145
+ },
1146
+ typeof e == "function" ? e(o) : e
1147
+ );
1148
+ },
1149
+ { noAutoDispose: !0 }
1150
+ );
1118
1151
  return s.onDispose(() => {
1119
- n(), r != null && clearTimeout(r);
1152
+ r(), n != null && clearTimeout(n);
1120
1153
  }), s;
1121
- }, zt = (t) => {
1154
+ }, is = (t) => {
1122
1155
  let e;
1123
1156
  return t.map((s) => {
1124
- const r = e;
1125
- return e = s, r;
1157
+ const n = e;
1158
+ return e = s, n;
1126
1159
  });
1127
- }, Kt = ({
1160
+ }, ls = ({
1128
1161
  size: t = void 0,
1129
1162
  signal: e
1130
1163
  }) => {
1131
1164
  const s = [];
1132
- return e.map((r) => (s.push(r), t != null && s.length > t && s.shift(), s.slice()));
1133
- }, es = (t) => (...e) => ee(
1165
+ return e.map((n) => (s.push(n), t != null && s.length > t && s.shift(), s.slice()));
1166
+ }, cs = (t) => (...e) => ee(
1134
1167
  t,
1135
1168
  ...e
1136
- )((s, ...r) => s(...r));
1137
- function ts(...t) {
1169
+ )((s, ...n) => s(...n));
1170
+ function as(...t) {
1138
1171
  return ee(...t)((...e) => {
1139
1172
  for (const s of e) if (s != null) return s;
1140
1173
  });
1141
1174
  }
1142
- const we = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), _e = /* @__PURE__ */ new Set(["selected"]), ve = /* @__PURE__ */ new Set([
1175
+ const ve = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), Te = /* @__PURE__ */ new Set(["selected"]), Ae = /* @__PURE__ */ new Set([
1143
1176
  "rowSpan",
1144
1177
  "colSpan",
1145
1178
  "tabIndex",
1146
1179
  "valueAsNumber"
1147
- ]), Te = /* @__PURE__ */ new Set(["valueAsDate"]), Ae = /* @__PURE__ */ new Set([
1180
+ ]), Ee = /* @__PURE__ */ new Set(["valueAsDate"]), Ce = /* @__PURE__ */ new Set([
1148
1181
  "value",
1149
1182
  "textContent",
1150
1183
  "innerText",
@@ -1152,28 +1185,28 @@ const we = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), _e = /* @
1152
1185
  "outerHTML",
1153
1186
  "className",
1154
1187
  "classList"
1155
- ]), tt = (t, e) => _e.has(t) ? (s) => {
1188
+ ]), it = (t, e) => Te.has(t) ? (s) => {
1156
1189
  s == null || s !== !0 ? e.removeAttribute(t) : e.setAttribute(t, "");
1157
- } : we.has(t) ? (s) => {
1158
- s == null ? e[t] = null : e[t] = !!s;
1159
1190
  } : ve.has(t) ? (s) => {
1191
+ s == null ? e[t] = null : e[t] = !!s;
1192
+ } : Ae.has(t) ? (s) => {
1160
1193
  s == null ? e[t] = null : e[t] = Number(s);
1161
- } : Te.has(t) ? (s) => {
1194
+ } : Ee.has(t) ? (s) => {
1162
1195
  s == null ? e[t] = null : e[t] = s;
1163
- } : Ae.has(t) ? (s) => {
1196
+ } : Ce.has(t) ? (s) => {
1164
1197
  s == null ? e[t] = null : e[t] = String(s);
1165
1198
  } : (s) => {
1166
1199
  s == null ? e.removeAttribute(t) : e.setAttribute(t, s);
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) => {
1200
+ }, lt = (t, e) => Te.has(t) ? () => e.hasAttribute(t) : ve.has(t) ? () => !!e[t] : Ae.has(t) ? () => Number(e[t]) : Ee.has(t) ? () => e[t] : Ce.has(t) ? () => String(e[t]) : () => e.getAttribute(t), U = (t) => {
1168
1201
  const e = t;
1169
1202
  e && e.onblur && (e.onblur = null), !(!t || t.ownerDocument === void 0) && t.parentElement && t.parentElement.removeChild(t);
1170
- }, rt = (t) => Ee(t) ? t : t.parentElement, Ee = (t) => t.nodeType === 1;
1171
- class Ce extends Error {
1203
+ }, ct = (t) => De(t) ? t : t.parentElement, De = (t) => t.nodeType === 1;
1204
+ class Le extends Error {
1172
1205
  constructor(e) {
1173
1206
  super(`Provider not found: ${e.description}`);
1174
1207
  }
1175
1208
  }
1176
- class N {
1209
+ class $ {
1177
1210
  /**
1178
1211
  * Constructs a new `DOMContext` instance.
1179
1212
  *
@@ -1183,8 +1216,8 @@ class N {
1183
1216
  * @param providers - The `Providers` instance associated with this context.
1184
1217
  * @param isFirstLevel - A boolean value indicating whether this context is at the first level, meaning the outermost node in the generated DOM.
1185
1218
  */
1186
- constructor(e, s, r, n) {
1187
- this.document = e, this.element = s, this.reference = r, this.providers = n;
1219
+ constructor(e, s, n, r) {
1220
+ this.document = e, this.element = s, this.reference = n, this.providers = r;
1188
1221
  }
1189
1222
  /**
1190
1223
  * Creates a new `DOMContext` instance for the given `Element` and optional reference `Node`.
@@ -1194,8 +1227,8 @@ class N {
1194
1227
  * @param providers - The providers to associate with the `DOMContext`.
1195
1228
  * @returns A new `DOMContext` instance.
1196
1229
  */
1197
- static of(e, s, r) {
1198
- return new N(e.ownerDocument, e, s, r);
1230
+ static of(e, s, n) {
1231
+ return new $(e.ownerDocument, e, s, n);
1199
1232
  }
1200
1233
  /**
1201
1234
  * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace.
@@ -1228,8 +1261,8 @@ class N {
1228
1261
  * @returns A new DOMContext focused on the newly created child element
1229
1262
  */
1230
1263
  makeChildElement = (e, s) => {
1231
- const r = this.createElement(e, s);
1232
- return this.appendOrInsert(r), this.withElement(r);
1264
+ const n = this.createElement(e, s);
1265
+ return this.appendOrInsert(n), this.withElement(n);
1233
1266
  };
1234
1267
  /**
1235
1268
  * Creates a new text node with the specified text content.
@@ -1280,7 +1313,7 @@ class N {
1280
1313
  * @param element - The DOM element to use in the new `DOMContext` instance.
1281
1314
  * @returns A new `DOMContext` instance with the provided `element`.
1282
1315
  */
1283
- withElement = (e) => new N(this.document, e, void 0, this.providers);
1316
+ withElement = (e) => new $(this.document, e, void 0, this.providers);
1284
1317
  /**
1285
1318
  * Creates a portal to render content in a different part of the DOM tree.
1286
1319
  *
@@ -1337,7 +1370,7 @@ class N {
1337
1370
  * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
1338
1371
  * @returns A new `DOMContext` instance with the specified reference.
1339
1372
  */
1340
- withReference = (e) => new N(this.document, this.element, e, this.providers);
1373
+ withReference = (e) => new $(this.document, this.element, e, this.providers);
1341
1374
  /**
1342
1375
  * Sets a provider for the given provider mark.
1343
1376
  *
@@ -1345,9 +1378,9 @@ class N {
1345
1378
  * @param value - The provider to set for the given mark.
1346
1379
  * @returns A new `DOMContext` instance with the specified provider.
1347
1380
  */
1348
- setProvider = (e, s, r) => new N(this.document, this.element, this.reference, {
1381
+ setProvider = (e, s, n) => new $(this.document, this.element, this.reference, {
1349
1382
  ...this.providers,
1350
- [e]: [s, r]
1383
+ [e]: [s, n]
1351
1384
  });
1352
1385
  /**
1353
1386
  * Retrieves a provider for the given provider mark.
@@ -1358,9 +1391,9 @@ class N {
1358
1391
  */
1359
1392
  getProvider = (e) => {
1360
1393
  if (this.providers[e] === void 0)
1361
- throw new Ce(e);
1362
- const [s, r] = this.providers[e];
1363
- return { value: s, onUse: r };
1394
+ throw new Le(e);
1395
+ const [s, n] = this.providers[e];
1396
+ return { value: s, onUse: n };
1364
1397
  };
1365
1398
  clear = (e) => {
1366
1399
  e && (this.reference !== void 0 ? U(this.reference) : U(this.element));
@@ -1391,10 +1424,10 @@ class N {
1391
1424
  * @param options - The options for the event listener.
1392
1425
  * @returns A function to remove the event listener.
1393
1426
  */
1394
- on = (e, s, r) => {
1395
- const n = (i) => s(i, this);
1396
- return this.element.addEventListener(e, n, r), (i) => {
1397
- i && this.element.removeEventListener(e, n, r);
1427
+ on = (e, s, n) => {
1428
+ const r = (o) => s(o, this);
1429
+ return this.element.addEventListener(e, r, n), (o) => {
1430
+ o && this.element.removeEventListener(e, r, n);
1398
1431
  };
1399
1432
  };
1400
1433
  /**
@@ -1433,57 +1466,57 @@ class N {
1433
1466
  */
1434
1467
  getStyle = (e) => this.element.style[e];
1435
1468
  makeAccessors = (e) => ({
1436
- get: st(e, this.element),
1437
- set: tt(e, this.element)
1469
+ get: lt(e, this.element),
1470
+ set: it(e, this.element)
1438
1471
  });
1439
1472
  getWindow = () => this.document.defaultView;
1440
1473
  }
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 = {} } = {}) => {
1447
- const o = typeof e == "string" ? (s ?? document).querySelector(e) : e;
1448
- if (o === null)
1449
- throw new it(
1474
+ const at = (t) => Symbol(t), fe = (t, e) => {
1475
+ const s = new j(), n = x(s, () => t(e));
1476
+ return (r = !0) => {
1477
+ s.dispose(), n(r);
1478
+ };
1479
+ }, us = (t, e, { doc: s, clear: n, disposeWithParent: r = !0, providers: o = {} } = {}) => {
1480
+ const i = typeof e == "string" ? (s ?? document).querySelector(e) : e;
1481
+ if (i === null)
1482
+ throw new ut(
1450
1483
  `Cannot find element by selector for render: ${e}`
1451
1484
  );
1452
- r !== !1 && (s ?? o.ownerDocument) != null && o.nodeType === 1 && (o.innerHTML = "");
1453
- const l = rt(o), c = Ee(o) ? void 0 : o, a = N.of(l, c, i), u = ae(t, a);
1485
+ n !== !1 && (s ?? i.ownerDocument) != null && i.nodeType === 1 && (i.innerHTML = "");
1486
+ const l = ct(i), c = De(i) ? void 0 : i, a = $.of(l, c, o), u = fe(t, a);
1454
1487
  let h;
1455
- return n && (h = new MutationObserver((p) => {
1456
- p[0]?.removedNodes.forEach((f) => {
1457
- f === o && (h?.disconnect(), u(o.nodeType !== 1));
1488
+ return r && (h = new MutationObserver((p) => {
1489
+ p[0]?.removedNodes.forEach((d) => {
1490
+ d === i && (h?.disconnect(), u(i.nodeType !== 1));
1458
1491
  });
1459
- }), h.observe(o.parentElement, {
1492
+ }), h.observe(i.parentElement, {
1460
1493
  childList: !0,
1461
1494
  subtree: !1,
1462
1495
  attributes: !1
1463
1496
  })), () => {
1464
1497
  h?.disconnect(), u(!0);
1465
1498
  };
1466
- }, rs = (t, {
1499
+ }, hs = (t, {
1467
1500
  startUrl: e = "https://example.com",
1468
1501
  selector: s,
1469
- providers: r = {}
1502
+ providers: n = {}
1470
1503
  } = {
1471
1504
  selector: "body"
1472
1505
  }) => {
1473
- const n = y.toSignal(e).deriveProp(), i = new Oe(s, void 0), o = new R(i, void 0, { currentURL: n }, r);
1506
+ const r = y.toSignal(e).deriveProp(), o = new ke(s, void 0), i = new R(o, void 0, { currentURL: r }, n);
1474
1507
  return {
1475
- clear: ae(t(), o),
1476
- root: i,
1477
- currentURL: n
1508
+ clear: fe(t(), i),
1509
+ root: o,
1510
+ currentURL: r
1478
1511
  };
1479
1512
  };
1480
- class it extends Error {
1513
+ class ut extends Error {
1481
1514
  constructor(e) {
1482
1515
  super(e);
1483
1516
  }
1484
1517
  }
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 {
1518
+ const Pe = "data-tts-node", G = "data-tts-class", J = "data-tts-style", X = "data-tts-html", Y = "data-tts-text", Q = "data-tts-attrs";
1519
+ class fs {
1487
1520
  /**
1488
1521
  * Selects elements from the headless environment.
1489
1522
  * @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
@@ -1560,10 +1593,10 @@ class ns {
1560
1593
  constructor({
1561
1594
  select: e,
1562
1595
  getAttribute: s,
1563
- setAttribute: r,
1564
- getClass: n,
1565
- setClass: i,
1566
- getStyles: o,
1596
+ setAttribute: n,
1597
+ getClass: r,
1598
+ setClass: o,
1599
+ getStyles: i,
1567
1600
  setStyles: l,
1568
1601
  appendHTML: c,
1569
1602
  getInnerHTML: a,
@@ -1571,7 +1604,7 @@ class ns {
1571
1604
  getInnerText: h,
1572
1605
  setInnerText: p
1573
1606
  }) {
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;
1607
+ this.select = e, this.getAttribute = s, this.setAttribute = n, this.getClass = r, this.setClass = o, this.getStyles = i, this.setStyles = l, this.appendHTML = c, this.getInnerHTML = a, this.setInnerHTML = u, this.getInnerText = h, this.setInnerText = p;
1575
1608
  }
1576
1609
  /**
1577
1610
  * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
@@ -1582,116 +1615,116 @@ class ns {
1582
1615
  * when you render on the server and then hydrate on the client.
1583
1616
  */
1584
1617
  setFromRoot = (e, s) => {
1585
- e.getPortals().forEach((n) => {
1586
- const i = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
1587
- for (const o of i) {
1588
- if (o == null)
1618
+ e.getPortals().forEach((r) => {
1619
+ const o = typeof r.selector == "string" ? this.select(r.selector) : [r.selector];
1620
+ for (const i of o) {
1621
+ if (i == null)
1589
1622
  throw new Error(
1590
- `Cannot find element by selector for render: ${n.selector}`
1623
+ `Cannot find element by selector for render: ${r.selector}`
1591
1624
  );
1592
- if (n.hasChildren() && this.appendHTML(o, n.contentToHTML(s)), n.hasInnerHTML()) {
1625
+ if (r.hasChildren() && this.appendHTML(i, r.contentToHTML(s)), r.hasInnerHTML()) {
1593
1626
  if (s) {
1594
- const l = this.getInnerHTML(o);
1595
- l != null && this.setAttribute(o, X, l);
1627
+ const l = this.getInnerHTML(i);
1628
+ l != null && this.setAttribute(i, X, l);
1596
1629
  }
1597
- this.setInnerHTML(o, n.getInnerHTML());
1630
+ this.setInnerHTML(i, r.getInnerHTML());
1598
1631
  }
1599
- if (n.hasInnerText()) {
1632
+ if (r.hasInnerText()) {
1600
1633
  if (s) {
1601
- const l = this.getInnerText(o);
1602
- l != null && this.setAttribute(o, Y, l);
1634
+ const l = this.getInnerText(i);
1635
+ l != null && this.setAttribute(i, Y, l);
1603
1636
  }
1604
- this.setInnerText(o, n.getInnerText());
1637
+ this.setInnerText(i, r.getInnerText());
1605
1638
  }
1606
- if (n.hasClasses()) {
1639
+ if (r.hasClasses()) {
1607
1640
  if (s) {
1608
- const l = this.getClass(o);
1609
- l != null && this.setAttribute(o, J, l);
1641
+ const l = this.getClass(i);
1642
+ l != null && this.setAttribute(i, G, l);
1610
1643
  }
1611
- this.setClass(o, n.getClasses().join(" "));
1644
+ this.setClass(i, r.getClasses().join(" "));
1612
1645
  }
1613
- if (n.hasStyles()) {
1646
+ if (r.hasStyles()) {
1614
1647
  if (s) {
1615
- const l = this.getStyles(o);
1648
+ const l = this.getStyles(i);
1616
1649
  Object.keys(l).length > 0 && this.setAttribute(
1617
- o,
1618
- G,
1650
+ i,
1651
+ J,
1619
1652
  JSON.stringify(l)
1620
1653
  );
1621
1654
  }
1622
- this.setStyles(o, n.getStyles());
1655
+ this.setStyles(i, r.getStyles());
1623
1656
  }
1624
- if (n.hasAttributes()) {
1625
- const l = n.getAttributes();
1657
+ if (r.hasAttributes()) {
1658
+ const l = r.getAttributes();
1626
1659
  if (s) {
1627
1660
  const c = [];
1628
1661
  l.forEach(([a]) => {
1629
- const u = this.getAttribute(o, a);
1662
+ const u = this.getAttribute(i, a);
1630
1663
  u != null && c.push([a, u]);
1631
1664
  }), c.length > 0 && this.setAttribute(
1632
- o,
1665
+ i,
1633
1666
  Q,
1634
1667
  JSON.stringify(Object.fromEntries(c))
1635
1668
  );
1636
1669
  }
1637
1670
  l.forEach(([c, a]) => {
1638
- this.setAttribute(o, c, a);
1671
+ this.setAttribute(i, c, a);
1639
1672
  });
1640
1673
  }
1641
1674
  }
1642
1675
  });
1643
1676
  };
1644
1677
  }
1645
- const ot = () => {
1646
- document.querySelectorAll(`[${De}]`).forEach(U);
1647
- }, lt = (t) => {
1648
- const e = t.getAttribute(J);
1649
- t.removeAttribute(J), e != null && t.setAttribute("class", e);
1650
- }, ct = () => {
1651
- document.querySelectorAll(`[${J}]`).forEach((e) => lt(e));
1652
- }, at = (t) => {
1678
+ const ht = () => {
1679
+ document.querySelectorAll(`[${Pe}]`).forEach(U);
1680
+ }, ft = (t) => {
1681
+ const e = t.getAttribute(G);
1682
+ t.removeAttribute(G), e != null && t.setAttribute("class", e);
1683
+ }, dt = () => {
1684
+ document.querySelectorAll(`[${G}]`).forEach((e) => ft(e));
1685
+ }, pt = (t) => {
1653
1686
  const e = t.getAttribute(X);
1654
1687
  t.removeAttribute(X), e != null && (t.innerHTML = e);
1655
- }, ut = () => {
1656
- document.querySelectorAll(`[${X}]`).forEach((e) => at(e));
1657
- }, ht = (t) => {
1688
+ }, gt = () => {
1689
+ document.querySelectorAll(`[${X}]`).forEach((e) => pt(e));
1690
+ }, mt = (t) => {
1658
1691
  const e = t.getAttribute(Y);
1659
1692
  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) => {
1663
- const e = t.getAttribute(G);
1664
- if (t.removeAttribute(G), e != null) {
1665
- const s = Pe(e);
1666
- Object.entries(s).forEach(([r, n]) => {
1667
- t.style.setProperty(r, n);
1693
+ }, yt = () => {
1694
+ document.querySelectorAll(`[${Y}]`).forEach((e) => mt(e));
1695
+ }, xe = (t) => JSON.parse(t.replace(/&quot;/g, '"')), St = (t) => {
1696
+ const e = t.getAttribute(J);
1697
+ if (t.removeAttribute(J), e != null) {
1698
+ const s = xe(e);
1699
+ Object.entries(s).forEach(([n, r]) => {
1700
+ t.style.setProperty(n, r);
1668
1701
  });
1669
1702
  }
1670
- }, pt = () => {
1671
- document.querySelectorAll(`[${G}]`).forEach((e) => ft(e));
1672
- }, gt = (t) => {
1703
+ }, wt = () => {
1704
+ document.querySelectorAll(`[${J}]`).forEach((e) => St(e));
1705
+ }, bt = (t) => {
1673
1706
  const e = t.getAttribute(Q);
1674
1707
  if (t.removeAttribute(Q), e != null) {
1675
- const s = Pe(e);
1676
- Object.entries(s).forEach(([r, n]) => {
1677
- n == null ? t.removeAttribute(r) : t.setAttribute(r, n);
1708
+ const s = xe(e);
1709
+ Object.entries(s).forEach(([n, r]) => {
1710
+ r == null ? t.removeAttribute(n) : t.setAttribute(n, r);
1678
1711
  });
1679
1712
  }
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 {
1713
+ }, _t = () => {
1714
+ document.querySelectorAll(`[${Q}]`).forEach((e) => bt(e));
1715
+ }, ds = () => {
1716
+ ht(), dt(), yt(), gt(), wt(), _t();
1717
+ }, I = Symbol("class"), H = Symbol("style"), B = Symbol("handler"), Oe = () => Math.random().toString(36).substring(2, 15), vt = (t) => t.replace(/<[^>]*>?/g, "");
1718
+ class Me {
1686
1719
  constructor(e) {
1687
1720
  this.parent = e;
1688
1721
  }
1689
- id = xe();
1722
+ id = Oe();
1690
1723
  properties = {};
1691
1724
  children = [];
1692
1725
  isElement = () => !0;
1693
1726
  isText = () => !1;
1694
- getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? yt(this.properties.innerHTML) : this.children.map((e) => e.getText()).join("");
1727
+ getText = () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? vt(this.properties.innerHTML) : this.children.map((e) => e.getText()).join("");
1695
1728
  removeChild = (e) => {
1696
1729
  const s = this.children.indexOf(e);
1697
1730
  s !== -1 && this.children.splice(s, 1);
@@ -1721,43 +1754,43 @@ class Le {
1721
1754
  if (this.properties.id === e)
1722
1755
  return this;
1723
1756
  for (const s of this.elements()) {
1724
- const r = s.getById(e);
1725
- if (r != null)
1726
- return r;
1757
+ const n = s.getById(e);
1758
+ if (n != null)
1759
+ return n;
1727
1760
  }
1728
1761
  };
1729
1762
  trigger = (e, s) => {
1730
- ((this.properties[B] ?? {})[e] ?? []).forEach((n) => n(s));
1763
+ ((this.properties[B] ?? {})[e] ?? []).forEach((r) => r(s));
1731
1764
  };
1732
1765
  click = () => {
1733
1766
  this.trigger("click", {});
1734
1767
  };
1735
- on = (e, s, r, n) => {
1736
- const i = this.properties[B] ??= {}, o = n?.once ? (c) => {
1737
- l(), s(c, r);
1738
- } : (c) => s(c, r);
1739
- i[e] = [...i[e] ?? [], o];
1768
+ on = (e, s, n, r) => {
1769
+ const o = this.properties[B] ??= {}, i = r?.once ? (c) => {
1770
+ l(), s(c, n);
1771
+ } : (c) => s(c, n);
1772
+ o[e] = [...o[e] ?? [], i];
1740
1773
  const l = () => {
1741
- const c = i[e] ?? [], a = c.indexOf(o);
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));
1774
+ const c = o[e] ?? [], a = c.indexOf(i);
1775
+ a !== -1 && (c.splice(a, 1), c.length === 0 ? (delete o[e], Object.keys(o).length === 0 && delete this.properties[B]) : o[e] = c, r?.signal != null && r.signal.removeEventListener("abort", l));
1743
1776
  };
1744
- return n?.signal != null && n.signal.addEventListener("abort", l), l;
1777
+ return r?.signal != null && r.signal.addEventListener("abort", l), l;
1745
1778
  };
1746
1779
  addClasses = (e) => {
1747
1780
  if (e.length === 0)
1748
1781
  return;
1749
1782
  const s = this.properties[I] ??= [];
1750
- e.forEach((r) => {
1751
- s.includes(r) || s.push(r);
1783
+ e.forEach((n) => {
1784
+ s.includes(n) || s.push(n);
1752
1785
  });
1753
1786
  };
1754
1787
  removeClasses = (e) => {
1755
1788
  if (e.length === 0)
1756
1789
  return;
1757
1790
  const s = this.properties[I] ??= [];
1758
- e.forEach((r) => {
1759
- const n = s.indexOf(r);
1760
- n !== -1 && s.splice(n, 1);
1791
+ e.forEach((n) => {
1792
+ const r = s.indexOf(n);
1793
+ r !== -1 && s.splice(r, 1);
1761
1794
  }), s.length === 0 && delete this.properties[I];
1762
1795
  };
1763
1796
  getClasses = () => this.properties[I] ?? [];
@@ -1768,8 +1801,8 @@ class Le {
1768
1801
  (e) => e === I ? [["class", this.getClasses()]] : e === H ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1769
1802
  );
1770
1803
  setStyle = (e, s) => {
1771
- const r = this.properties[H] ??= {};
1772
- r[e] = s, s === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[H]);
1804
+ const n = this.properties[H] ??= {};
1805
+ n[e] = s, s === "" && (delete n[e], Object.keys(n).length === 0 && delete this.properties[H]);
1773
1806
  };
1774
1807
  getStyle = (e) => this.properties[H]?.[e] ?? "";
1775
1808
  getStyles = () => this.properties[H] ?? {};
@@ -1777,24 +1810,24 @@ class Le {
1777
1810
  const s = this.properties;
1778
1811
  return {
1779
1812
  get: () => s[e],
1780
- set: (r) => s[e] = r
1813
+ set: (n) => s[e] = n
1781
1814
  };
1782
1815
  };
1783
1816
  }
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 {
1786
- constructor(e, s, r) {
1787
- super(r), this.tagName = e, this.namespace = s;
1817
+ const Tt = (t) => t.replace(/"/g, "&quot;"), At = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1818
+ class Et extends Me {
1819
+ constructor(e, s, n) {
1820
+ super(n), this.tagName = e, this.namespace = s;
1788
1821
  }
1789
1822
  isPortal = () => !1;
1790
1823
  toHTML = (e = !1) => {
1791
- const s = this.children.map((l) => l.toHTML()).join(""), r = this.namespace ? ` xmlns="${this.namespace}"` : "";
1792
- let n = null;
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}>`;
1824
+ const s = this.children.map((l) => l.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
1825
+ let r = null;
1826
+ const o = 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(" ")}"` : Dt.has(l) ? ` ${l}` : l === "innerHTML" ? (r = c, "") : l === "innerText" ? (r = At(c), "") : ` ${l}="${Tt(c)}"`).join(""), i = e ? ` ${Pe}` : "";
1827
+ return Lt.has(this.tagName) && s === "" ? `<${this.tagName}${n}${o}${i} />` : `<${this.tagName}${n}${o}${i}>${r ?? s}</${this.tagName}>`;
1795
1828
  };
1796
1829
  }
1797
- class Oe extends Le {
1830
+ class ke extends Me {
1798
1831
  constructor(e, s) {
1799
1832
  super(s), this.selector = e;
1800
1833
  }
@@ -1802,19 +1835,19 @@ class Oe extends Le {
1802
1835
  toHTML = () => "";
1803
1836
  contentToHTML = (e = !1) => this.children.map((s) => s.toHTML(e)).join("");
1804
1837
  }
1805
- class _t {
1838
+ class Ct {
1806
1839
  constructor(e) {
1807
1840
  this.text = e;
1808
1841
  }
1809
- id = xe();
1842
+ id = Oe();
1810
1843
  isElement = () => !1;
1811
1844
  isText = () => !0;
1812
1845
  getText = () => this.text;
1813
1846
  toHTML = () => this.text;
1814
1847
  }
1815
1848
  class R {
1816
- constructor(e, s, r, n) {
1817
- this.element = e, this.reference = s, this.container = r, this.providers = n;
1849
+ constructor(e, s, n, r) {
1850
+ this.element = e, this.reference = s, this.container = n, this.providers = r;
1818
1851
  }
1819
1852
  appendOrInsert = (e) => {
1820
1853
  if (this.reference != null) {
@@ -1824,16 +1857,16 @@ class R {
1824
1857
  this.element.children.push(e);
1825
1858
  };
1826
1859
  makeChildElement = (e, s) => {
1827
- const r = new wt(e, s, this.element);
1828
- return this.appendOrInsert(r), new R(
1829
- r,
1860
+ const n = new Et(e, s, this.element);
1861
+ return this.appendOrInsert(n), new R(
1862
+ n,
1830
1863
  void 0,
1831
1864
  this.container,
1832
1865
  this.providers
1833
1866
  );
1834
1867
  };
1835
1868
  makeChildText = (e) => {
1836
- const s = new _t(e);
1869
+ const s = new Ct(e);
1837
1870
  return this.appendOrInsert(s), new R(
1838
1871
  this.element,
1839
1872
  s,
@@ -1847,7 +1880,7 @@ class R {
1847
1880
  getText = () => this.reference?.getText() ?? this.element.getText();
1848
1881
  makeRef = () => this.makeChildText("");
1849
1882
  makePortal = (e) => {
1850
- const s = new Oe(e, this.element);
1883
+ const s = new ke(e, this.element);
1851
1884
  return this.appendOrInsert(s), new R(
1852
1885
  s,
1853
1886
  void 0,
@@ -1862,15 +1895,15 @@ class R {
1862
1895
  * @param value - The provider to set for the given mark.
1863
1896
  * @returns A new `DOMContext` instance with the specified provider.
1864
1897
  */
1865
- setProvider = (e, s, r) => new R(this.element, this.reference, this.container, {
1898
+ setProvider = (e, s, n) => new R(this.element, this.reference, this.container, {
1866
1899
  ...this.providers,
1867
- [e]: [s, r]
1900
+ [e]: [s, n]
1868
1901
  });
1869
1902
  getProvider = (e) => {
1870
1903
  if (this.providers[e] === void 0)
1871
- throw new Ce(e);
1872
- const [s, r] = this.providers[e];
1873
- return { value: s, onUse: r };
1904
+ throw new Le(e);
1905
+ const [s, n] = this.providers[e];
1906
+ return { value: s, onUse: n };
1874
1907
  };
1875
1908
  clear = (e) => {
1876
1909
  e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
@@ -1887,48 +1920,51 @@ class R {
1887
1920
  getStyle = (e) => this.element.getStyle(e);
1888
1921
  makeAccessors = (e) => this.element.makeAccessors(e);
1889
1922
  }
1890
- const vt = /* @__PURE__ */ new Set([
1923
+ const Dt = /* @__PURE__ */ new Set([
1891
1924
  "checked",
1892
1925
  "disabled",
1893
1926
  "multiple",
1894
1927
  "readonly",
1895
1928
  "required",
1896
1929
  "selected"
1897
- ]), Tt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), ke = (t) => (e) => e.makeChildText(t).clear, Me = (t) => (e) => {
1898
- const s = e.makeChildText(t.value), r = t.on(s.setText);
1899
- return (n) => {
1900
- r(), s.clear(n);
1901
- };
1902
- }, os = (t) => g.is(t) ? Me(t) : ke(t), E = (...t) => (e) => {
1903
- const s = t.map((r) => d(r)(e));
1930
+ ]), Lt = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), Ie = (t) => (e) => e.makeChildText(t).clear, He = (t) => (e) => {
1931
+ const s = e.makeChildText(t.value), n = t.on(s.setText);
1904
1932
  return (r) => {
1905
- s.forEach((n) => n(r));
1933
+ n(), s.clear(r);
1934
+ };
1935
+ }, ps = (t) => g.is(t) ? He(t) : Ie(t), E = (...t) => (e) => {
1936
+ const s = t.map((n) => f(n)(e));
1937
+ return (n) => {
1938
+ s.forEach((r) => r(n));
1906
1939
  };
1907
1940
  }, C = () => () => {
1908
- }, At = (t) => (e) => (e.addClasses(t), (s) => {
1941
+ }, Pt = (t) => (e) => (e.addClasses(t), (s) => {
1909
1942
  s && e.removeClasses(t);
1910
- }), Et = (t) => (e) => {
1943
+ }), xt = (t) => (e) => {
1911
1944
  let s = [];
1912
- const r = t.on((n) => {
1913
- e.removeClasses(s), s = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(s);
1914
- });
1915
- return (n) => {
1916
- r(), n && e.removeClasses(s), s.length = 0;
1945
+ const n = t.on(
1946
+ (r) => {
1947
+ e.removeClasses(s), s = (r ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(s);
1948
+ },
1949
+ { noAutoDispose: !0 }
1950
+ );
1951
+ return (r) => {
1952
+ n(), r && e.removeClasses(s), s.length = 0;
1917
1953
  };
1918
- }, Ct = (t, e) => (s) => {
1919
- const { get: r, set: n } = s.makeAccessors(t), i = r();
1920
- return n(e), (o) => {
1921
- o && n(i);
1954
+ }, Ot = (t, e) => (s) => {
1955
+ const { get: n, set: r } = s.makeAccessors(t), o = n();
1956
+ return r(e), (i) => {
1957
+ i && r(o);
1922
1958
  };
1923
- }, Dt = (t, e) => (s) => {
1924
- const { get: r, set: n } = s.makeAccessors(t), i = r(), o = e.on(n);
1959
+ }, Mt = (t, e) => (s) => {
1960
+ const { get: n, set: r } = s.makeAccessors(t), o = n(), i = e.on(r, { noAutoDispose: !0 });
1925
1961
  return (l) => {
1926
- o(), l && n(i);
1962
+ i(), l && r(o);
1927
1963
  };
1928
- }, V = (t, e) => g.is(e) ? Dt(t, e) : Ct(t, e), te = (t = "") => (e, s) => {
1929
- const r = t ? `${t}${e}` : e;
1930
- return V(r, s);
1931
- }, j = new Proxy(
1964
+ }, q = (t, e) => g.is(e) ? Mt(t, e) : Ot(t, e), kt = (t, e) => t === "class" ? g.is(e) ? xt(e) : Pt(
1965
+ /* c8 ignore next */
1966
+ (e ?? "").split(" ").filter((s) => s.length > 0)
1967
+ ) : q(t, e), V = new Proxy(
1932
1968
  {},
1933
1969
  {
1934
1970
  /**
@@ -1942,12 +1978,9 @@ const vt = /* @__PURE__ */ new Set([
1942
1978
  * @returns The renderable component for the specified attribute.
1943
1979
  *
1944
1980
  */
1945
- get: (t, e) => e === "class" ? (s) => g.is(s) ? Et(s) : At(
1946
- /* c8 ignore next */
1947
- (s ?? "").split(" ").filter((r) => r.length > 0)
1948
- ) : e === "set" ? te() : (s) => V(e, s)
1981
+ get: (t, e) => (s) => kt(e, s)
1949
1982
  }
1950
- ), ls = new Proxy(
1983
+ ), It = (t, e) => q(`data-${t}`, e), gs = new Proxy(
1951
1984
  {},
1952
1985
  {
1953
1986
  /**
@@ -1958,9 +1991,9 @@ const vt = /* @__PURE__ */ new Set([
1958
1991
  * @returns The renderable component for the specified attribute.
1959
1992
  *
1960
1993
  */
1961
- get: (t, e) => e === "set" ? te("data-") : (s) => V(`data-${e}`, s)
1994
+ get: (t, e) => (s) => It(e, s)
1962
1995
  }
1963
- ), cs = new Proxy(
1996
+ ), Ht = (t, e) => q(`aria-${t}`, e), ms = new Proxy(
1964
1997
  {},
1965
1998
  {
1966
1999
  /**
@@ -1971,9 +2004,9 @@ const vt = /* @__PURE__ */ new Set([
1971
2004
  * @returns The renderable component for the specified attribute.
1972
2005
  *
1973
2006
  */
1974
- get: (t, e) => e === "set" ? te("aria-") : (s) => V(`aria-${e}`, s)
2007
+ get: (t, e) => (s) => Ht(e, s)
1975
2008
  }
1976
- ), as = new Proxy(
2009
+ ), Nt = (t, e) => q(t, e), ys = new Proxy(
1977
2010
  {},
1978
2011
  {
1979
2012
  /**
@@ -1984,9 +2017,9 @@ const vt = /* @__PURE__ */ new Set([
1984
2017
  * @returns The renderable component for the specified attribute.
1985
2018
  *
1986
2019
  */
1987
- get: (t, e) => e === "set" ? te() : (s) => V(e, s)
2020
+ get: (t, e) => (s) => Nt(e, s)
1988
2021
  }
1989
- ), us = new Proxy(
2022
+ ), $t = (t, e) => q(t, e), Ss = new Proxy(
1990
2023
  {},
1991
2024
  {
1992
2025
  /**
@@ -1996,31 +2029,31 @@ const vt = /* @__PURE__ */ new Set([
1996
2029
  * @returns The renderable component for the specified attribute.
1997
2030
  *
1998
2031
  */
1999
- get: (t, e) => (s) => V(e, s)
2032
+ get: (t, e) => (s) => $t(e, s)
2000
2033
  }
2001
- ), d = (t) => {
2034
+ ), f = (t) => {
2002
2035
  if (t == null)
2003
2036
  return C;
2004
2037
  if (Array.isArray(t))
2005
- return E(...t.map(d));
2038
+ return E(...t.map(f));
2006
2039
  if (typeof t == "string")
2007
- return ke(t);
2040
+ return Ie(t);
2008
2041
  if (g.is(t))
2009
- return Me(t);
2042
+ return He(t);
2010
2043
  if (typeof t == "function")
2011
2044
  return t;
2012
2045
  throw new Error(`Unknown type: '${typeof t}' for child: ${t}`);
2013
- }, Ie = (t, ...e) => (s) => {
2014
- const r = s.makeChildElement(t, void 0), n = e.map((i) => d(i)(r));
2015
- return (i) => {
2016
- n.forEach((o) => o(!1)), r.clear(i);
2017
- };
2018
- }, He = (t, e, ...s) => (r) => {
2019
- const n = r.makeChildElement(t, e), i = s.map((o) => d(o)(n));
2046
+ }, Ne = (t, ...e) => (s) => {
2047
+ const n = s.makeChildElement(t, void 0), r = e.map((o) => f(o)(n));
2020
2048
  return (o) => {
2021
- i.forEach((l) => l(!1)), n.clear(o);
2049
+ r.forEach((i) => i(!1)), n.clear(o);
2022
2050
  };
2023
- }, hs = new Proxy(
2051
+ }, te = (t, e, ...s) => (n) => {
2052
+ const r = n.makeChildElement(t, e), o = s.map((i) => f(i)(r));
2053
+ return (i) => {
2054
+ o.forEach((l) => l(!1)), r.clear(i);
2055
+ };
2056
+ }, ws = new Proxy(
2024
2057
  {},
2025
2058
  {
2026
2059
  /**
@@ -2028,9 +2061,9 @@ const vt = /* @__PURE__ */ new Set([
2028
2061
  * @param tagName - The HTML tag name.
2029
2062
  * @returns A renderable function that creates and appends the HTML element to the DOM.
2030
2063
  */
2031
- get: (t, e) => (...s) => Ie(e, s.flatMap(d))
2064
+ get: (t, e) => (...s) => Ne(e, s.flatMap(f))
2032
2065
  }
2033
- ), ds = new Proxy(
2066
+ ), bs = new Proxy(
2034
2067
  {},
2035
2068
  {
2036
2069
  /**
@@ -2038,9 +2071,9 @@ const vt = /* @__PURE__ */ new Set([
2038
2071
  * @param type - The input type name.
2039
2072
  * @returns A renderable function that creates and appends the HTMLInput element to the DOM.
2040
2073
  */
2041
- get: (t, e) => (...s) => Ie("input", j.type(e), ...s)
2074
+ get: (t, e) => (...s) => Ne("input", V.type(e), ...s)
2042
2075
  }
2043
- ), Pt = "http://www.w3.org/2000/svg", fs = new Proxy(
2076
+ ), $e = "http://www.w3.org/2000/svg", _s = (t, ...e) => te(t, $e, ...e), vs = new Proxy(
2044
2077
  {},
2045
2078
  {
2046
2079
  /**
@@ -2048,9 +2081,9 @@ const vt = /* @__PURE__ */ new Set([
2048
2081
  * @param tagName - The SVG tag name.
2049
2082
  * @returns A renderable function that creates and appends the SVG element to the DOM.
2050
2083
  */
2051
- get: (t, e) => (...s) => He(e, Pt, s.flatMap(d))
2084
+ get: (t, e) => (...s) => te(e, $e, s.flatMap(f))
2052
2085
  }
2053
- ), xt = "http://www.w3.org/1998/Math/MathML", ps = new Proxy(
2086
+ ), Re = "http://www.w3.org/1998/Math/MathML", Ts = (t, ...e) => te(t, Re, ...e), As = new Proxy(
2054
2087
  {},
2055
2088
  {
2056
2089
  /**
@@ -2058,33 +2091,33 @@ const vt = /* @__PURE__ */ new Set([
2058
2091
  * @param tagName - The Math tag name.
2059
2092
  * @returns A renderable function that creates and appends the Math element to the DOM.
2060
2093
  */
2061
- get: (t, e) => (...s) => He(e, xt, s.flatMap(d))
2094
+ get: (t, e) => (...s) => te(e, Re, s.flatMap(f))
2062
2095
  }
2063
- ), $e = (t, e) => {
2096
+ ), Ve = (t, e) => {
2064
2097
  if (typeof e == "function")
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;
2067
- return (i) => {
2068
- let o = !0;
2069
- const l = t(), c = i.makeRef();
2070
- let a = d(s)(c);
2098
+ return Ve(t, { then: e });
2099
+ const s = e.pending != null ? f(e.pending()) : C, n = e.then, r = e.error != null ? (o) => f(e.error(o)) : () => C;
2100
+ return (o) => {
2101
+ let i = !0;
2102
+ const l = t(), c = o.makeRef();
2103
+ let a = f(s)(c);
2071
2104
  return l.then(
2072
2105
  (u) => {
2073
- o && (a(!0), a = d(r(u))(c));
2106
+ i && (a(!0), a = f(n(u))(c));
2074
2107
  },
2075
2108
  (u) => {
2076
- o && (a(!0), a = d(n(u))(c));
2109
+ i && (a(!0), a = f(r(u))(c));
2077
2110
  }
2078
2111
  ), (u) => {
2079
- o = !1, a(u), c.clear(u);
2112
+ i = !1, a(u), c.clear(u);
2080
2113
  };
2081
2114
  };
2082
- }, gs = (t, e) => $e(() => t, e), Ne = (t, e, s) => (r) => r.on(t, e, s), Lt = (t) => Ne("click", (e, s) => {
2115
+ }, Es = (t, e) => Ve(() => t, e), je = (t, e, s) => (n) => n.on(t, e, s), Rt = (t) => je("click", (e, s) => {
2083
2116
  e.preventDefault();
2084
- const r = e.target;
2117
+ const n = e.target;
2085
2118
  setTimeout(() => {
2086
- const n = r.ownerDocument != null ? r?.checked : void 0;
2087
- n != null && t(!n, s);
2119
+ const r = n.ownerDocument != null ? n?.checked : void 0;
2120
+ r != null && t(!r, s);
2088
2121
  }, 0);
2089
2122
  }), se = new Proxy(
2090
2123
  {},
@@ -2094,133 +2127,136 @@ const vt = /* @__PURE__ */ new Set([
2094
2127
  * @param fn - The function to call when the event is triggered.
2095
2128
  * @returns A `Renderable` function that adds the event listener to the element.
2096
2129
  */
2097
- get: (t, e) => (s) => Ne(e, s)
2130
+ get: (t, e) => (s) => je(e, s)
2098
2131
  }
2099
- ), Ot = (t, e) => (s) => {
2132
+ ), Vt = (t, e) => (s) => {
2100
2133
  e?.preventDefault === !0 && s.preventDefault(), e?.stopPropagation === !0 && s.stopPropagation(), e?.stopImmediatePropagation === !0 && s.stopImmediatePropagation(), t(s);
2101
- }, O = (t, e) => Ot((s) => {
2102
- const r = s.target;
2103
- t(r, s);
2104
- }, e), kt = (t, e) => O(
2105
- (s, r) => t(s.value, r),
2134
+ }, O = (t, e) => Vt((s) => {
2135
+ const n = s.target;
2136
+ t(n, s);
2137
+ }, e), jt = (t, e) => O(
2138
+ (s, n) => t(s.value, n),
2106
2139
  e
2107
- ), Mt = (t, e) => O(
2108
- (s, r) => t(s.valueAsNumber, r),
2140
+ ), qt = (t, e) => O(
2141
+ (s, n) => t(s.valueAsNumber, n),
2109
2142
  e
2110
- ), It = (t, e) => O((s, r) => {
2143
+ ), Ft = (t, e) => O((s, n) => {
2111
2144
  if (s.value === "")
2112
2145
  return;
2113
- const n = s.value.split("-"), i = new Date(
2114
- Number(n[0]),
2115
- Number(n[1]) - 1,
2116
- Number(n[2].substring(0, 2))
2146
+ const r = s.value.split("-"), o = new Date(
2147
+ Number(r[0]),
2148
+ Number(r[1]) - 1,
2149
+ Number(r[2].substring(0, 2))
2117
2150
  );
2118
- t(i, r);
2119
- }, e), ms = (t, e) => O((s, r) => {
2151
+ t(o, n);
2152
+ }, e), Cs = (t, e) => O((s, n) => {
2120
2153
  if (s.value === "") {
2121
- t(null, r);
2154
+ t(null, n);
2122
2155
  return;
2123
2156
  }
2124
- const n = s.value.split("-"), i = new Date(
2125
- Number(n[0]),
2126
- Number(n[1]) - 1,
2127
- Number(n[2].substring(0, 2))
2157
+ const r = s.value.split("-"), o = new Date(
2158
+ Number(r[0]),
2159
+ Number(r[1]) - 1,
2160
+ Number(r[2].substring(0, 2))
2128
2161
  );
2129
- t(i, r);
2130
- }, e), Ht = (t, e) => O((s, r) => {
2162
+ t(o, n);
2163
+ }, e), Bt = (t, e) => O((s, n) => {
2131
2164
  if (s.value === "")
2132
2165
  return;
2133
- const n = s.value.split("T"), i = n[0].split("-"), o = new Date(
2134
- Number(i[0]),
2135
- Number(i[1]) - 1,
2136
- Number(i[2])
2137
- ), l = n[1].split(":");
2138
- o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), t(o, r);
2139
- }, e), ys = (t, e) => O((s, r) => {
2166
+ const r = s.value.split("T"), o = r[0].split("-"), i = new Date(
2167
+ Number(o[0]),
2168
+ Number(o[1]) - 1,
2169
+ Number(o[2])
2170
+ ), l = r[1].split(":");
2171
+ i.setHours(Number(l[0])), i.setMinutes(Number(l[1])), i.setSeconds(Number(l[2])), t(i, n);
2172
+ }, e), Ds = (t, e) => O((s, n) => {
2140
2173
  if (s.value === "") {
2141
- t(null, r);
2174
+ t(null, n);
2142
2175
  return;
2143
2176
  }
2144
- const n = s.value.split("T");
2145
- if (n.length !== 2) {
2146
- t(null, r);
2177
+ const r = s.value.split("T");
2178
+ if (r.length !== 2) {
2179
+ t(null, n);
2147
2180
  return;
2148
2181
  }
2149
- const i = n[0].split("-"), o = new Date(
2150
- Number(i[0]),
2151
- Number(i[1]) - 1,
2152
- Number(i[2])
2153
- ), l = n[1].split(":");
2154
- o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), t(o, r);
2155
- }, e), bs = (t, e) => O((s, r) => {
2156
- t(s.checked, r);
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) => {
2158
- const r = t.makeRef();
2159
- let n = () => {
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
- );
2166
- });
2182
+ const o = r[0].split("-"), i = new Date(
2183
+ Number(o[0]),
2184
+ Number(o[1]) - 1,
2185
+ Number(o[2])
2186
+ ), l = r[1].split(":");
2187
+ i.setHours(Number(l[0] ?? 0)), i.setMinutes(Number(l[1] ?? 0)), i.setSeconds(Number(l[2] ?? 0)), t(i, n);
2188
+ }, e), Ls = (t, e) => O((s, n) => {
2189
+ t(s.checked, n);
2190
+ }, e), Ps = (t, e = "input") => E(V.valueAsDate(t), se[e](Ft(t.set))), xs = (t, e = "input") => E(V.valueAsDate(t), se[e](Bt(t.set))), Os = (t, e = "input") => E(V.valueAsNumber(t), se[e](qt(t.set))), Ms = (t, e = "input") => E(V.value(t), se[e](jt(t.set))), ks = (t) => E(V.checked(t), Rt(t.set)), de = (t, e, s) => g.is(t) ? e(t) : s(t), Wt = (t, e, s) => {
2191
+ const n = t.makeRef();
2192
+ let r = () => {
2193
+ }, o = null;
2194
+ const i = e.on(
2195
+ (l) => {
2196
+ o?.dispose(), r(!0), o = new j(), r = x(
2197
+ o,
2198
+ () => f(s(l))(n)
2199
+ );
2200
+ },
2201
+ { noAutoDispose: !0 }
2202
+ );
2167
2203
  return (l) => {
2168
- i?.dispose(), n(l), o(), r.clear(l);
2204
+ o?.dispose(), r(l), i(), n.clear(l);
2169
2205
  };
2170
- }, re = (t, e) => {
2171
- function s(n) {
2172
- return (i) => {
2173
- const o = i.makeRef();
2206
+ }, ne = (t, e) => {
2207
+ function s(r) {
2208
+ return (o) => {
2209
+ const i = o.makeRef();
2174
2210
  let l, c;
2175
- const a = n.map((p) => Object.keys(p)[0]);
2211
+ const a = r.map((p) => Object.keys(p)[0]);
2176
2212
  let u;
2177
2213
  const h = a.on((p) => {
2178
2214
  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);
2215
+ u = p, c?.dispose(), l?.(!0), c = r.map((m) => m[p]);
2216
+ const d = e[p](c);
2217
+ l = f(d)(i);
2182
2218
  }
2183
2219
  });
2184
2220
  return (p) => {
2185
- c?.dispose(), h(), o.clear(p), l?.(p);
2221
+ c?.dispose(), h(), i.clear(p), l?.(p);
2186
2222
  };
2187
2223
  };
2188
2224
  }
2189
- function r(n) {
2190
- const i = Object.keys(n)[0];
2191
- return d(e[i](K(n[i])));
2225
+ function n(r) {
2226
+ const o = Object.keys(r)[0];
2227
+ return f(e[o](K(r[o])));
2192
2228
  }
2193
- return ue(t, s, r);
2194
- }, Re = (t, e, s) => re(
2195
- y.map(t, (r) => ({ [r[e]]: r })),
2229
+ return de(t, s, n);
2230
+ }, qe = (t, e, s) => ne(
2231
+ y.map(t, (n) => ({ [n[e]]: n })),
2196
2232
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2197
2233
  s
2198
- ), As = (t, e) => Re(t, "kind", e), Es = (t, e) => {
2199
- const s = y.map(t, ([r, n]) => ({ [r]: n }));
2200
- return re(s, e);
2201
- }, Cs = (t, e) => Re(t, "type", e), Nt = (t, e) => re(
2234
+ ), Is = (t, e) => qe(t, "kind", e), Hs = (t, e) => {
2235
+ const s = y.map(t, ([n, r]) => ({ [n]: r }));
2236
+ return ne(s, e);
2237
+ }, Ns = (t, e) => qe(t, "type", e), Ut = (t, e) => ne(
2202
2238
  y.map(t, (s) => ({ [s]: !0 })),
2203
2239
  e
2204
- ), Ds = (t, e = {}) => (s) => {
2205
- const r = e?.firstSeparator ?? t, n = e?.lastSeparator ?? t;
2206
- return Nt(
2207
- s.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
2240
+ ), $s = (t, e = {}) => (s) => {
2241
+ const n = e?.firstSeparator ?? t, r = e?.lastSeparator ?? t;
2242
+ return Ut(
2243
+ s.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
2208
2244
  {
2209
- first: r,
2210
- last: n,
2245
+ first: n,
2246
+ last: r,
2211
2247
  other: t
2212
2248
  }
2213
2249
  );
2214
- }, Ps = (t) => (e) => (e.appendOrInsert(t), (s) => {
2250
+ }, Rs = (t) => (e) => (e.appendOrInsert(t), (s) => {
2215
2251
  s && U(t);
2216
- }), xs = (t, e, s) => {
2217
- function r(i) {
2218
- return (o) => {
2219
- const l = o.makeRef();
2252
+ }), Vs = (t, e, s) => {
2253
+ function n(o) {
2254
+ return (i) => {
2255
+ const l = i.makeRef();
2220
2256
  let c = () => {
2221
2257
  }, a = !1, u = null;
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))(
2258
+ const h = o.on((p) => {
2259
+ p == null ? (c(!0), c = f(s?.())(l), a = !1, u?.dispose(), u = null) : a ? u.set(p) : (u = T(p), c(!0), c = f(e(u))(
2224
2260
  l
2225
2261
  ), a = !0);
2226
2262
  });
@@ -2229,196 +2265,196 @@ const vt = /* @__PURE__ */ new Set([
2229
2265
  };
2230
2266
  };
2231
2267
  }
2232
- function n(i) {
2233
- if (i == null) {
2234
- const o = s?.();
2235
- return o != null ? d(o) : C;
2268
+ function r(o) {
2269
+ if (o == null) {
2270
+ const i = s?.();
2271
+ return i != null ? f(i) : C;
2236
2272
  }
2237
- return d(e(K(i)));
2273
+ return f(e(K(o)));
2238
2274
  }
2239
- return ue(
2275
+ return de(
2240
2276
  t,
2241
- r,
2242
- n
2277
+ n,
2278
+ r
2243
2279
  );
2244
- }, Ls = (...t) => (e, s) => (r) => {
2245
- const n = r.makeRef();
2280
+ }, js = (...t) => (e, s) => (n) => {
2281
+ const r = n.makeRef();
2246
2282
  if (t.some(
2247
- (f) => !g.is(f) && f == null
2283
+ (d) => !g.is(d) && d == null
2248
2284
  ))
2249
- return (s != null ? d(s?.()) : C)(
2250
- n
2285
+ return (s != null ? f(s?.()) : C)(
2286
+ r
2251
2287
  );
2252
- const o = t.map(() => null), l = t.map(
2253
- (f) => g.is(f) ? f.value != null : f != null
2288
+ const i = t.map(() => null), l = t.map(
2289
+ (d) => g.is(d) ? d.value != null : d != null
2254
2290
  );
2255
2291
  let c = null;
2256
- const a = T(l.every((f) => f)), u = (f, m) => {
2257
- if (f.value != null) {
2258
- if (o[m] == null) {
2259
- const S = T(f.value);
2260
- o[m] = S;
2292
+ const a = T(l.every((d) => d)), u = (d, m) => {
2293
+ if (d.value != null) {
2294
+ if (i[m] == null) {
2295
+ const w = T(d.value);
2296
+ i[m] = w;
2261
2297
  } else
2262
- o[m].value = f.value;
2298
+ i[m].value = d.value;
2263
2299
  l[m] = !0;
2264
2300
  } else
2265
2301
  l[m] = !1;
2266
2302
  };
2267
2303
  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, () => {
2304
+ const p = t.map((d, m) => {
2305
+ if (!g.is(d)) {
2306
+ const w = T(d);
2307
+ return i[m] = w, () => {
2272
2308
  };
2273
2309
  }
2274
- return f.on(() => {
2275
- u(f, m), h === 0 ? a.value = l.every((S) => S) : h--;
2310
+ return d.on(() => {
2311
+ u(d, m), h === 0 ? a.value = l.every((w) => w) : h--;
2276
2312
  });
2277
2313
  });
2278
- return a.on((f) => {
2279
- c?.(!0), c = null, f ? c = d(e(...o))(n) : c = d(s?.() ?? C)(n);
2280
- }), (f) => {
2281
- o.forEach((m) => m?.dispose()), a.dispose(), p.forEach((m) => m()), c?.(f), n.clear(f);
2314
+ return a.on((d) => {
2315
+ c?.(!0), c = null, d ? c = f(e(...i))(r) : c = f(s?.() ?? C)(r);
2316
+ }), (d) => {
2317
+ i.forEach((m) => m?.dispose()), a.dispose(), p.forEach((m) => m()), c?.(d), r.clear(d);
2282
2318
  };
2283
- }, Ve = (t, e, s) => ue(
2319
+ }, Fe = (t, e, s) => de(
2284
2320
  t,
2285
- (r) => (n) => $t(
2286
- n,
2321
+ (n) => (r) => Wt(
2287
2322
  r,
2288
- (i) => i ? e() : s?.()
2323
+ n,
2324
+ (o) => o ? e() : s?.()
2289
2325
  ),
2290
- (r) => {
2291
- if (r) {
2292
- const n = e();
2293
- return n != null ? d(n) : C;
2326
+ (n) => {
2327
+ if (n) {
2328
+ const r = e();
2329
+ return r != null ? f(r) : C;
2294
2330
  }
2295
- return d(s?.());
2331
+ return f(s?.());
2296
2332
  }
2297
- ), Os = (t, e, s) => Ve(
2298
- y.map(t, (r) => !r),
2333
+ ), qs = (t, e, s) => Fe(
2334
+ y.map(t, (n) => !n),
2299
2335
  e,
2300
2336
  s
2301
- ), je = (t, e, s) => {
2337
+ ), Be = (t, e, s) => {
2302
2338
  if (s != null)
2303
- return je(t, (r) => {
2304
- const n = new le(
2305
- r.index,
2306
- r.total.map((i) => i - 1)
2339
+ return Be(t, (n) => {
2340
+ const r = new le(
2341
+ n.index,
2342
+ n.total.map((o) => o - 1)
2307
2343
  );
2308
2344
  return E(
2309
- d(e(r)),
2310
- Ve(
2311
- r.isLast,
2345
+ f(e(n)),
2346
+ Fe(
2347
+ n.isLast,
2312
2348
  () => C,
2313
- () => s(n)
2349
+ () => s(r)
2314
2350
  )
2315
2351
  );
2316
2352
  });
2317
2353
  if (g.is(t))
2318
- return (r) => {
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);
2354
+ return (n) => {
2355
+ const r = t.derive(), o = n.makeRef(), i = [], l = [];
2356
+ return r.on((c) => {
2357
+ const a = i.splice(c), u = l.splice(c);
2322
2358
  for (const h of u)
2323
2359
  h.dispose();
2324
2360
  for (const h of a)
2325
2361
  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))
2362
+ for (let h = i.length; h < c; h++) {
2363
+ const p = new le(h, r), d = new j();
2364
+ l.push(d), i.push(
2365
+ x(d, () => f(e(p))(o))
2330
2366
  );
2331
2367
  }
2332
2368
  }), (c) => {
2333
2369
  for (const a of l)
2334
2370
  a.dispose();
2335
- l.length = 0, n.dispose();
2336
- for (const a of o)
2371
+ l.length = 0, r.dispose();
2372
+ for (const a of i)
2337
2373
  a(c);
2338
- o.length = 0, i.clear(c);
2374
+ i.length = 0, o.clear(c);
2339
2375
  };
2340
2376
  };
2341
2377
  {
2342
- const r = K(t);
2378
+ const n = K(t);
2343
2379
  return E(
2344
- ...Array.from({ length: t }, (n, i) => i).map((n) => {
2345
- const i = new le(n, r);
2346
- return d(e(i));
2380
+ ...Array.from({ length: t }, (r, o) => o).map((r) => {
2381
+ const o = new le(r, n);
2382
+ return f(e(o));
2347
2383
  })
2348
2384
  );
2349
2385
  }
2350
- }, ks = (t, e, s) => {
2351
- const r = y.map(t, (i) => i.length), n = y.toSignal(t);
2352
- return je(
2353
- r,
2354
- (i) => {
2355
- const o = n.map((l) => l[i.index]);
2356
- return d(e(o, i));
2386
+ }, Fs = (t, e, s) => {
2387
+ const n = y.map(t, (o) => o.length), r = y.toSignal(t);
2388
+ return Be(
2389
+ n,
2390
+ (o) => {
2391
+ const i = r.map((l) => l[o.index]);
2392
+ return f(e(i, o));
2357
2393
  },
2358
2394
  s
2359
2395
  );
2360
- }, Rt = (...t) => (e) => (s) => t.forEach((r) => {
2361
- typeof r == "function" ? r(s, e) : r.dispose(s, e);
2362
- }), Ms = (t, e) => {
2396
+ }, Gt = (...t) => (e) => (s) => t.forEach((n) => {
2397
+ typeof n == "function" ? n(s, e) : n.dispose(s, e);
2398
+ }), Bs = (t, e) => {
2363
2399
  if (g.is(t)) {
2364
2400
  const s = t;
2365
- return (r) => {
2366
- r = r.makeRef();
2367
- const n = s.map((l) => d(e(l)));
2368
- let i = () => {
2401
+ return (n) => {
2402
+ n = n.makeRef();
2403
+ const r = s.map((l) => f(e(l)));
2404
+ let o = () => {
2369
2405
  };
2370
- const o = n.on((l) => {
2371
- i(!0), i = l(r);
2406
+ const i = r.on((l) => {
2407
+ o(!0), o = l(n);
2372
2408
  });
2373
2409
  return (l) => {
2374
- o(), i(l);
2410
+ i(), o(l);
2375
2411
  };
2376
2412
  };
2377
2413
  }
2378
- return d(e(t));
2379
- }, Is = (t, e, s = () => C) => re(
2414
+ return f(e(t));
2415
+ }, Ws = (t, e, s = () => C) => ne(
2380
2416
  y.map(
2381
2417
  t,
2382
- (r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
2418
+ (n) => n.length > 0 ? { notEmpty: n } : { whenEmpty: null }
2383
2419
  ),
2384
2420
  {
2385
- notEmpty: (r) => e(r),
2421
+ notEmpty: (n) => e(n),
2386
2422
  whenEmpty: () => s()
2387
2423
  }
2388
- ), Hs = (t, e) => (s) => {
2389
- const r = s.makePortal(t), n = ae(d(e), r);
2390
- return () => n(!0);
2391
- }, W = /* @__PURE__ */ new Map(), Vt = (t) => ({
2392
- mark: nt(`Probe(${t.description})`),
2424
+ ), Us = (t, e) => (s) => {
2425
+ const n = s.makePortal(t), r = fe(f(e), n);
2426
+ return () => r(!0);
2427
+ }, W = /* @__PURE__ */ new Map(), Jt = (t) => ({
2428
+ mark: at(`Probe(${t.description})`),
2393
2429
  create: ({ callback: e = () => {
2394
2430
  }, timeout: s = 10 } = {}) => {
2395
- const r = (l) => {
2396
- clearTimeout(n), W.delete(t), e(l);
2431
+ const n = (l) => {
2432
+ clearTimeout(r), W.delete(t), e(l);
2397
2433
  };
2398
2434
  if (W.has(t))
2399
2435
  throw new Error(`Probe already exists: ${t.description}`);
2400
- const n = setTimeout(() => r("timeout"), s), i = { counter: 0, timeoutId: n };
2401
- return W.set(t, i), {
2436
+ const r = setTimeout(() => n("timeout"), s), o = { counter: 0, timeoutId: r };
2437
+ return W.set(t, o), {
2402
2438
  value: () => {
2403
- clearTimeout(n);
2439
+ clearTimeout(r);
2404
2440
  const l = W.get(t);
2405
- l != null && --l.counter === 0 && r("resolved");
2441
+ l != null && --l.counter === 0 && n("resolved");
2406
2442
  },
2407
- dispose: () => r("disposed"),
2408
- onUse: () => i.counter++
2443
+ dispose: () => n("disposed"),
2444
+ onUse: () => o.counter++
2409
2445
  };
2410
2446
  }
2411
- }), $s = Vt(Symbol("GlobalProbe")), jt = (t, e) => (s) => {
2412
- const r = s.getStyle(t);
2413
- return s.setStyle(t, e), (n) => {
2414
- n && s.setStyle(t, r);
2447
+ }), Gs = Jt(Symbol("GlobalProbe")), Xt = (t, e) => (s) => {
2448
+ const n = s.getStyle(t);
2449
+ return s.setStyle(t, e), (r) => {
2450
+ r && s.setStyle(t, n);
2415
2451
  };
2416
- }, qt = (t, e) => (s) => {
2417
- const r = s.getStyle(t), n = e.on((i) => s.setStyle(t, i));
2418
- return (i) => {
2419
- n(), i && s.setStyle(t, r);
2452
+ }, Yt = (t, e) => (s) => {
2453
+ const n = s.getStyle(t), r = e.on((o) => s.setStyle(t, o));
2454
+ return (o) => {
2455
+ r(), o && s.setStyle(t, n);
2420
2456
  };
2421
- }, pe = (t, e) => g.is(e) ? qt(t, e) : jt(t, e), Ns = new Proxy({}, {
2457
+ }, ye = (t, e) => g.is(e) ? Yt(t, e) : Xt(t, e), Js = new Proxy({}, {
2422
2458
  /**
2423
2459
  * Creates a renderable component for the specified `style` property.
2424
2460
  *
@@ -2427,184 +2463,191 @@ const vt = /* @__PURE__ */ new Set([
2427
2463
  * @returns The renderable component for the specified attribute.
2428
2464
  *
2429
2465
  */
2430
- get: (t, e) => e === "variable" ? (s, r) => pe(s, r) : (s) => pe(e, s)
2431
- }), Ft = (t) => (e) => {
2466
+ get: (t, e) => e === "variable" ? (s, n) => ye(s, n) : (s) => ye(e, s)
2467
+ }), Qt = (t) => (e) => {
2432
2468
  if (e.isBrowser()) {
2433
2469
  const s = t(e);
2434
2470
  if (s != null)
2435
- return d(s)(e);
2471
+ return f(s)(e);
2436
2472
  }
2437
2473
  return () => {
2438
2474
  };
2439
- }, Rs = (t) => (e) => {
2475
+ }, Xs = (t) => (e) => {
2440
2476
  const s = t(e);
2441
2477
  return s == null ? () => {
2442
- } : d(s)(e);
2443
- }, Vs = (t) => Ft((e) => t(e.element)), js = (t) => (e) => {
2478
+ } : f(s)(e);
2479
+ }, Ys = (t) => Qt((e) => t(e.element)), Qs = (t) => (e) => {
2444
2480
  if (e.isHeadlessDOM()) {
2445
2481
  const s = t(e);
2446
2482
  if (s)
2447
- return d(s)(e);
2483
+ return f(s)(e);
2448
2484
  }
2449
2485
  return () => {
2450
2486
  };
2451
- }, qs = (t) => (e) => {
2452
- const s = new q(), r = L(s, () => d(t(s))(e));
2453
- return (n) => {
2454
- s.dispose(), r(n);
2487
+ }, Zs = (t) => (e) => {
2488
+ const s = new j(), n = x(s, () => f(t(s))(e));
2489
+ return (r) => {
2490
+ s.dispose(), n(r);
2455
2491
  };
2456
- }, he = (t) => (e) => {
2492
+ }, pe = (t) => (e) => {
2457
2493
  let s = e;
2458
- function r() {
2494
+ function n() {
2459
2495
  return s;
2460
2496
  }
2461
- function n(l) {
2497
+ function r(l) {
2462
2498
  s = l;
2463
2499
  }
2464
- const i = [], o = t({
2500
+ const o = [], i = t({
2465
2501
  use: ({ mark: l }) => {
2466
- const { value: c, onUse: a } = r().getProvider(l);
2502
+ const { value: c, onUse: a } = n().getProvider(l);
2467
2503
  return a?.(), c;
2468
2504
  },
2469
2505
  set: ({ mark: l, create: c }, a) => {
2470
- const { value: u, dispose: h, onUse: p } = c(a, r());
2471
- i.push(h), n(r().setProvider(l, u, p));
2506
+ const { value: u, dispose: h, onUse: p } = c(a, n());
2507
+ o.push(h), r(n().setProvider(l, u, p));
2472
2508
  }
2473
2509
  });
2474
- return o == null ? () => {
2510
+ return i == null ? () => {
2475
2511
  } : E(
2476
- d(o),
2477
- Rt(() => i.forEach((l) => l()))
2478
- )(r());
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 }) => {
2480
- const r = t.map(s);
2481
- return e(...r);
2512
+ f(i),
2513
+ Gt(() => o.forEach((l) => l()))
2514
+ )(n());
2515
+ }, zs = (t, e, s) => pe(({ set: n }) => (n(t, e), s())), Ks = (t, e) => pe(({ use: s }) => e(s(t))), en = (...t) => (e) => pe(({ use: s }) => {
2516
+ const n = t.map(s);
2517
+ return e(...n);
2482
2518
  });
2483
2519
  export {
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,
2520
+ Ht as Aria,
2521
+ Es as Async,
2522
+ kt as Attr,
2523
+ ks as BindChecked,
2524
+ Ps as BindDate,
2525
+ xs as BindDateTime,
2526
+ Os as BindNumber,
2527
+ Ms as BindText,
2528
+ $ as BrowserContext,
2529
+ G as CLASS_PLACEHOLDER_ATTR,
2530
+ N as Computed,
2531
+ $s as Conjunction,
2532
+ Rs as DOMNode,
2533
+ It as DataAttr,
2534
+ j as DisposalScope,
2535
+ Ne as El,
2536
+ te as ElNS,
2498
2537
  le as ElementPosition,
2499
2538
  C as Empty,
2500
- xs as Ensure,
2501
- Ls as EnsureAll,
2502
- ks as ForEach,
2539
+ Vs as Ensure,
2540
+ js as EnsureAll,
2541
+ Fs as ForEach,
2503
2542
  E as Fragment,
2504
- $s as GlobalProbe,
2505
- ns as HeadlessAdapter,
2543
+ Gs as GlobalProbe,
2544
+ fs as HeadlessAdapter,
2506
2545
  R as HeadlessContext,
2507
- wt as HeadlessElement,
2508
- Oe as HeadlessPortal,
2509
- _t as HeadlessText,
2510
- Ms as MapSignal,
2546
+ Et as HeadlessElement,
2547
+ ke as HeadlessPortal,
2548
+ Ct as HeadlessText,
2549
+ Bs as MapSignal,
2550
+ $t as MathAttr,
2551
+ Ts as MathEl,
2511
2552
  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,
2553
+ Ws as NotEmpty,
2554
+ Rt as OnChecked,
2555
+ Gt as OnDispose,
2556
+ ne as OneOf,
2557
+ qe as OneOfField,
2558
+ Is as OneOfKind,
2559
+ Hs as OneOfTuple,
2560
+ Ns as OneOfType,
2561
+ Ut as OneOfValue,
2562
+ Us as Portal,
2522
2563
  Z as Prop,
2523
- Fs as Provide,
2524
- Ce as ProviderNotFoundError,
2525
- it as RenderingError,
2526
- je as Repeat,
2564
+ zs as Provide,
2565
+ Le as ProviderNotFoundError,
2566
+ ut as RenderingError,
2567
+ Be as Repeat,
2568
+ Nt as SVGAttr,
2569
+ _s as SVGEl,
2527
2570
  g as Signal,
2528
- $e as Task,
2529
- os as TextNode,
2530
- Os as Unless,
2531
- Bs as Use,
2532
- Ws as UseMany,
2571
+ Ve as Task,
2572
+ ps as TextNode,
2573
+ qs as Unless,
2574
+ Ks as Use,
2575
+ en as UseMany,
2533
2576
  y as Value,
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,
2577
+ Fe as When,
2578
+ Qt as WithBrowserCtx,
2579
+ Xs as WithCtx,
2580
+ Ys as WithElement,
2581
+ Qs as WithHeadlessCtx,
2582
+ pe as WithProvider,
2583
+ Zs as WithScope,
2584
+ Pe as _NODE_PLACEHOLDER_ATTR,
2585
+ ct as _getSelfOrParentElement,
2586
+ De as _isElement,
2587
+ lt as _makeGetter,
2588
+ it as _makeSetter,
2546
2589
  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,
2590
+ He as _signalText,
2591
+ Ie as _staticText,
2592
+ ns as animateSignal,
2593
+ rt as animateSignals,
2594
+ ms as aria,
2595
+ V as attr,
2596
+ cs as bind,
2597
+ as as coalesce,
2555
2598
  z as computed,
2556
2599
  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,
2600
+ ot as computedRecord,
2601
+ gs as dataAttr,
2602
+ os as delaySignal,
2603
+ Se as effect,
2604
+ Qe as effectOf,
2605
+ Vt as emit,
2606
+ Ls as emitChecked,
2564
2607
  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,
2608
+ jt as emitValue,
2609
+ Ft as emitValueAsDate,
2610
+ Bt as emitValueAsDateTime,
2611
+ Cs as emitValueAsNullableDate,
2612
+ Ds as emitValueAsNullableDateTime,
2613
+ qt as emitValueAsNumber,
2614
+ et as endInterpolate,
2615
+ ue as getCurrentScope,
2616
+ zt as getParentScope,
2617
+ Zt as getScopeStack,
2618
+ he as getWindow,
2619
+ tt as guessInterpolate,
2620
+ ws as html,
2621
+ bs as input,
2622
+ Ke as interpolateDate,
2623
+ Ze as interpolateNumber,
2624
+ ze as interpolateString,
2625
+ es as joinSignals,
2626
+ ts as localStorageProp,
2627
+ Jt as makeProbe,
2628
+ at as makeProviderMark,
2629
+ As as math,
2630
+ Ss as mathAttr,
2631
+ rs as merge,
2589
2632
  se as on,
2590
- Fe as popScope,
2591
- zt as previousSignal,
2633
+ Ue as popScope,
2634
+ is as previousSignal,
2592
2635
  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,
2636
+ We as pushScope,
2637
+ us as render,
2638
+ fe as renderWithContext,
2639
+ f as renderableOfTNode,
2640
+ ds as restoreTempoPlaceholders,
2641
+ hs as runHeadless,
2599
2642
  _ as scopeStack,
2600
- Ut as scoped,
2601
- Xt as sessionStorageProp,
2643
+ Kt as scoped,
2644
+ ss as sessionStorageProp,
2602
2645
  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
2646
+ ls as slidingWindowSignal,
2647
+ _e as storedProp,
2648
+ Js as style,
2649
+ vs as svg,
2650
+ ys as svgAttr,
2651
+ ie as untracked,
2652
+ x as withScope
2610
2653
  };