@tempots/dom 24.0.0-next.0 → 24.0.0-next.10

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
- var De = Object.defineProperty;
2
- var X = (s) => {
1
+ var Ie = Object.defineProperty;
2
+ var te = (s) => {
3
3
  throw TypeError(s);
4
4
  };
5
- var Oe = (s, e, t) => e in s ? De(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
6
- var i = (s, e, t) => Oe(s, typeof e != "symbol" ? e + "" : e, t), Y = (s, e, t) => e.has(s) || X("Cannot " + t);
7
- var A = (s, e, t) => (Y(s, e, "read from private field"), t ? t.call(s) : e.get(s)), Z = (s, e, t) => e.has(s) ? X("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), F = (s, e, t, r) => (Y(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
8
- const Ae = (s, e, t) => s + (e - s) * t;
9
- const Me = (s, e, t) => {
5
+ var ke = (s, e, t) => e in s ? Ie(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
6
+ var o = (s, e, t) => ke(s, typeof e != "symbol" ? e + "" : e, t), se = (s, e, t) => e.has(s) || te("Cannot " + t);
7
+ var O = (s, e, t) => (se(s, e, "read from private field"), t ? t.call(s) : e.get(s)), re = (s, e, t) => e.has(s) ? te("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), Y = (s, e, t, r) => (se(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
8
+ const Ne = (s, e, t) => s + (e - s) * t;
9
+ const Re = (s, e, t) => {
10
10
  const r = Math.max(s.length, e.length);
11
11
  let n = "";
12
- for (let o = 0; o < r; o++) {
13
- let l = s.charCodeAt(o);
12
+ for (let i = 0; i < r; i++) {
13
+ let l = s.charCodeAt(i);
14
14
  isNaN(l) && (l = 97);
15
- let c = e.charCodeAt(o);
15
+ let c = e.charCodeAt(i);
16
16
  isNaN(c) && (c = 97), n += String.fromCharCode(l + (c - l) * t);
17
17
  }
18
18
  return n;
19
- }, ke = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Le = (s, e) => e, $e = (s) => typeof s == "number" ? Ae : typeof s == "string" ? Me : s instanceof Date ? ke : Le;
20
- var w;
21
- class M {
19
+ }, je = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), qe = (s, e) => e, Ve = (s) => typeof s == "number" ? Ne : typeof s == "string" ? Re : s instanceof Date ? je : qe;
20
+ var b;
21
+ class D {
22
22
  /**
23
23
  * Creates a new instance of `ElementPosition`.
24
24
  * @param index - The index of the element.
@@ -28,25 +28,25 @@ class M {
28
28
  /**
29
29
  * The counter of the element starting from 1.
30
30
  */
31
- i(this, "counter");
31
+ o(this, "counter");
32
32
  /**
33
33
  * Checks if the element is the first element in the collection.
34
34
  * @returns `true` if the element is the first element, `false` otherwise.
35
35
  */
36
- i(this, "isFirst");
36
+ o(this, "isFirst");
37
37
  /**
38
38
  * Checks if the counter of the element is even.
39
39
  * @returns `true` if the counter is even, `false` otherwise.
40
40
  */
41
- i(this, "isEven");
41
+ o(this, "isEven");
42
42
  /**
43
43
  * Checks if the counter of the element is odd.
44
44
  * @returns `true` if the counter is odd, `false` otherwise.
45
45
  */
46
- i(this, "isOdd");
47
- Z(this, w);
48
- i(this, "dispose", () => {
49
- A(this, w) != null && (A(this, w).dispose(), F(this, w, void 0));
46
+ o(this, "isOdd");
47
+ re(this, b);
48
+ o(this, "dispose", () => {
49
+ O(this, b) != null && (O(this, b).dispose(), Y(this, b, void 0));
50
50
  });
51
51
  this.index = e, this.total = t, this.counter = e + 1, this.isFirst = e === 0, this.isEven = e % 2 === 1, this.isOdd = e % 2 === 0;
52
52
  }
@@ -55,11 +55,11 @@ class M {
55
55
  * @returns `true` if the element is the last element, `false` otherwise.
56
56
  */
57
57
  get isLast() {
58
- return A(this, w) == null && F(this, w, this.total.map((e) => this.counter === e)), A(this, w);
58
+ return O(this, b) == null && Y(this, b, this.total.map((e) => this.counter === e)), O(this, b);
59
59
  }
60
60
  }
61
- w = new WeakMap();
62
- const k = class k {
61
+ b = new WeakMap();
62
+ const M = class M {
63
63
  /**
64
64
  * Represents a signal with a value of type T.
65
65
  *
@@ -71,71 +71,83 @@ const k = class k {
71
71
  /**
72
72
  * @internal
73
73
  */
74
- i(this, "$__signal__", !0);
74
+ o(this, "$__signal__", !0);
75
75
  /**
76
76
  * @internal
77
77
  */
78
- i(this, "_value");
78
+ o(this, "_value");
79
79
  /**
80
80
  * @internal
81
81
  */
82
- i(this, "_derivatives", []);
82
+ o(this, "_derivatives", []);
83
83
  /**
84
84
  * @internal
85
85
  */
86
- i(this, "_onValueListeners", []);
86
+ o(this, "_onValueListeners", []);
87
87
  /**
88
88
  * @internal
89
89
  */
90
- i(this, "_onDisposeListeners", []);
90
+ o(this, "_onDisposeListeners", []);
91
91
  /**
92
92
  * Gets the current value of the signal.
93
93
  * @returns The current value of the signal.
94
94
  */
95
- i(this, "get", () => this._value);
95
+ o(this, "get", () => this._value);
96
96
  /**
97
97
  * Checks if the signal has any registered listeners.
98
98
  * @returns `true` if the signal has listeners, `false` otherwise.
99
99
  */
100
- i(this, "hasListeners", () => this._onValueListeners.length > 0);
100
+ o(this, "hasListeners", () => this._onValueListeners.length > 0);
101
101
  /**
102
102
  * Registers a listener function to be called whenever the value of the signal changes.
103
103
  * The listener function will be immediately called with the current value of the signal.
104
104
  * Returns a function that can be called to unregister the listener.
105
105
  *
106
106
  * @param listener - The listener function to be called when the value of the signal changes.
107
- */
108
- i(this, "on", (e) => (e(this.get()), this._onValueListeners.push(e), () => {
109
- this._onValueListeners.splice(this._onValueListeners.indexOf(e), 1);
110
- }));
107
+ * @param options - Options for the listener.
108
+ */
109
+ o(this, "on", (e, t = {}) => {
110
+ t.skipInitial || e(this.get());
111
+ const r = t.once ? (i) => {
112
+ n(), e(i);
113
+ } : e;
114
+ this._onValueListeners.push(r);
115
+ const n = () => {
116
+ this._onValueListeners.splice(
117
+ this._onValueListeners.indexOf(r),
118
+ 1
119
+ ), t.abortSignal != null && t.abortSignal.removeEventListener("abort", n);
120
+ };
121
+ return t.abortSignal != null && t.abortSignal.addEventListener("abort", n), n;
122
+ });
111
123
  /**
112
124
  * @internal
113
125
  */
114
- i(this, "_setAndNotify", (e, t) => {
126
+ o(this, "_setAndNotify", (e, t) => {
115
127
  const r = this.equals(this._value, e);
116
128
  r || (this._value = e), (t || !r) && this._onValueListeners.forEach((n) => n(e));
117
129
  });
118
130
  /**
119
131
  * @internal
120
132
  */
121
- i(this, "_disposed", !1);
133
+ o(this, "_disposed", !1);
122
134
  /**
123
135
  * Checks whether the signal is disposed.
124
136
  * @returns True if the signal is disposed, false otherwise.
125
137
  */
126
- i(this, "isDisposed", () => this._disposed);
138
+ o(this, "isDisposed", () => this._disposed);
127
139
  /**
128
140
  * Adds a listener function to be called when the object is disposed.
129
141
  * @param listener - The listener function to be called when the object is disposed.
130
142
  * @returns A function that can be called to remove the listener.
131
143
  */
132
- i(this, "onDispose", (e) => {
144
+ o(this, "onDispose", (e) => {
133
145
  this._onDisposeListeners.push(e);
134
146
  });
135
147
  /**
136
148
  * Disposes the signal, releasing any resources associated with it.
137
149
  */
138
- i(this, "dispose", () => {
150
+ o(this, "dispose", () => {
139
151
  this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
140
152
  });
141
153
  /**
@@ -147,8 +159,8 @@ const k = class k {
147
159
  * @param equals - Optional equality function to determine if two mapped values are equal.
148
160
  * @returns - A new Computed instance with the mapped value.
149
161
  */
150
- i(this, "map", (e, t = (r, n) => r === n) => {
151
- const r = new T(() => {
162
+ o(this, "map", (e, t = (r, n) => r === n) => {
163
+ const r = new C(() => {
152
164
  try {
153
165
  return e(this.get());
154
166
  } catch (n) {
@@ -167,8 +179,8 @@ const k = class k {
167
179
  * Defaults to a strict equality check (===).
168
180
  * @returns A new Signal that emits the values of the resulting Signal.
169
181
  */
170
- i(this, "flatMap", (e, t = (r, n) => r === n) => {
171
- const r = new T(() => {
182
+ o(this, "flatMap", (e, t = (r, n) => r === n) => {
183
+ const r = new C(() => {
172
184
  try {
173
185
  return e(this.get()).get();
174
186
  } catch (n) {
@@ -183,26 +195,26 @@ const k = class k {
183
195
  * @param fn - The callback function to be invoked with the current value of the signal.
184
196
  * @returns A new signal that emits the same value as the original signal and invokes the callback function.
185
197
  */
186
- i(this, "tap", (e) => this.map((t) => (e(t), t)));
198
+ o(this, "tap", (e) => this.map((t) => (e(t), t)));
187
199
  /**
188
200
  * Returns a new Signal that emits the value at the specified key of the current value.
189
201
  *
190
202
  * @param key - The key of the value to retrieve.
191
203
  * @returns A new Signal that emits the value at the specified key.
192
204
  */
193
- i(this, "at", (e) => this.map((t) => t[e]));
205
+ o(this, "at", (e) => this.map((t) => t[e]));
194
206
  /**
195
207
  * @internal
196
208
  */
197
- i(this, "_$");
198
- i(this, "filter", (e, t) => {
209
+ o(this, "_$");
210
+ o(this, "filter", (e, t) => {
199
211
  let r = t ?? this.get();
200
- const n = new T(() => {
212
+ const n = new C(() => {
201
213
  try {
202
- const o = this.get();
203
- return r = e(o) ? o : r;
204
- } catch (o) {
205
- throw console.error("Error in Signal.filter:", o), o;
214
+ const i = this.get();
215
+ return r = e(i) ? i : r;
216
+ } catch (i) {
217
+ throw console.error("Error in Signal.filter:", i), i;
206
218
  }
207
219
  }, this.equals);
208
220
  return this.setDerivative(n), n;
@@ -217,9 +229,9 @@ const k = class k {
217
229
  * @param equals - Optional equality function to determine if two values are equal.
218
230
  * @returns - A new Computed object with the mapped and filtered values.
219
231
  */
220
- i(this, "filterMap", (e, t, r = (n, o) => n === o) => {
232
+ o(this, "filterMap", (e, t, r = (n, i) => n === i) => {
221
233
  let n = t;
222
- const o = new T(() => {
234
+ const i = new C(() => {
223
235
  try {
224
236
  const l = this.get(), c = e(l);
225
237
  return n = c ?? n;
@@ -227,7 +239,7 @@ const k = class k {
227
239
  throw console.error("Error in Signal.filterMap:", l), l;
228
240
  }
229
241
  }, r);
230
- return this.setDerivative(o), o;
242
+ return this.setDerivative(i), i;
231
243
  });
232
244
  /**
233
245
  * Maps the values emitted by the signal to a new value asynchronously using the provided function.
@@ -242,25 +254,25 @@ const k = class k {
242
254
  * @param equals - The equality function to compare the mapped values for equality.
243
255
  * @returns A property that holds the mapped value and can be observed for changes.
244
256
  */
245
- i(this, "mapAsync", (e, t, r, n = (o, l) => o === l) => {
246
- const o = L(t, n);
257
+ o(this, "mapAsync", (e, t, r, n = (i, l) => i === l) => {
258
+ const i = N(t, n);
247
259
  let l = 0, c = new AbortController();
248
- return o.onDispose(
260
+ return i.onDispose(
249
261
  this.on(async (a) => {
250
- const f = ++l;
262
+ const u = ++l;
251
263
  c.abort(), c = new AbortController();
252
264
  try {
253
265
  const h = await e(a, { abortSignal: c.signal });
254
- f === l && o.set(h);
266
+ u === l && i.set(h);
255
267
  } catch (h) {
256
- if (f === l)
268
+ if (u === l)
257
269
  if (r != null)
258
- o.set(r(h));
270
+ i.set(r(h));
259
271
  else
260
272
  throw h;
261
273
  }
262
274
  })
263
- ), o;
275
+ ), i;
264
276
  });
265
277
  /**
266
278
  * Maps the values of the signal using the provided function `fn`, and returns a new signal
@@ -272,14 +284,14 @@ const k = class k {
272
284
  * @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
273
285
  * @returns A new signal containing the mapped values.
274
286
  */
275
- i(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
287
+ o(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
276
288
  /**
277
289
  * Feeds a property into the signal and sets up disposal behavior.
278
290
  * @param prop - The property to feed into the signal.
279
291
  * @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
280
292
  * @returns The input property.
281
293
  */
282
- i(this, "feedProp", (e, t = !1) => {
294
+ o(this, "feedProp", (e, t = !1) => {
283
295
  const r = this.on(e.set);
284
296
  return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
285
297
  });
@@ -288,12 +300,12 @@ const k = class k {
288
300
  * @param autoDisposeProp - Determines whether the derived property should be automatically disposed.
289
301
  * @returns The derived property.
290
302
  */
291
- i(this, "deriveProp", (e = !0) => this.feedProp(L(this.get()), e));
303
+ o(this, "deriveProp", (e = !0) => this.feedProp(N(this.get()), e));
292
304
  /**
293
305
  * Returns a signal that emits the count of values received so far.
294
306
  * @returns A signal that emits the count of values received so far.
295
307
  */
296
- i(this, "count", () => {
308
+ o(this, "count", () => {
297
309
  let e = 0;
298
310
  return this.map(() => ++e);
299
311
  });
@@ -303,7 +315,7 @@ const k = class k {
303
315
  * Additionally, when the computed value is disposed, it sets the signal as dirty.
304
316
  * @param computed - The computed value to add as a derivative.
305
317
  */
306
- i(this, "setDerivative", (e) => {
318
+ o(this, "setDerivative", (e) => {
307
319
  this._derivatives.push(e), e.onDispose(() => {
308
320
  this._derivatives.splice(
309
321
  this._derivatives.indexOf(e),
@@ -340,27 +352,27 @@ const k = class k {
340
352
  * @param equals - A function to compare two values of type O for equality. Defaults to strict equality (===).
341
353
  * @returns - A Signal that represents the result of the Promise.
342
354
  */
343
- i(k, "ofPromise", (e, t, r, n = (o, l) => o === l) => {
344
- const o = new k(t, n);
345
- return e.then((l) => o._setAndNotify(l, !1)).catch((l) => {
346
- r != null ? o._setAndNotify(r(l), !1) : console.error(
355
+ o(M, "ofPromise", (e, t, r, n = (i, l) => i === l) => {
356
+ const i = new M(t, n);
357
+ return e.then((l) => i._setAndNotify(l, !1)).catch((l) => {
358
+ r != null ? i._setAndNotify(r(l), !1) : console.error(
347
359
  "Unhandled promise rejection in Signal.ofPromise:",
348
360
  l
349
361
  );
350
- }), o;
362
+ }), i;
351
363
  }), /**
352
364
  * Checks if a value is a Signal.
353
365
  *
354
366
  * @param value - The value to check.
355
367
  * @returns `true` if the value is a Signal, `false` otherwise.
356
368
  */
357
- i(k, "is", (e) => (
369
+ o(M, "is", (e) => (
358
370
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
359
371
  e != null && e.$__signal__ === !0
360
372
  ));
361
- let d = k;
362
- const Ne = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
363
- class T extends d {
373
+ let d = M;
374
+ const Be = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
375
+ class C extends d {
364
376
  /**
365
377
  * Represents a Signal object.
366
378
  * @param _fn - The function that returns the value of the signal.
@@ -371,36 +383,36 @@ class T extends d {
371
383
  /**
372
384
  * @internal
373
385
  */
374
- i(this, "$__computed__", !0);
386
+ o(this, "$__computed__", !0);
375
387
  /**
376
388
  * @internal
377
389
  */
378
- i(this, "_isDirty", !1);
390
+ o(this, "_isDirty", !1);
379
391
  /**
380
392
  * Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
381
393
  * If the signal is already dirty or disposed, this method does nothing.
382
394
  * It also marks all dependent signals as dirty and schedules a notification to update their values.
383
395
  */
384
- i(this, "setDirty", () => {
396
+ o(this, "setDirty", () => {
385
397
  this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
386
398
  });
387
399
  /**
388
400
  * @internal
389
401
  */
390
- i(this, "_scheduleCount", 0);
402
+ o(this, "_scheduleCount", 0);
391
403
  /**
392
404
  * Schedules a notification to be executed asynchronously.
393
405
  * If the signal is dirty, it will be updated and notified.
394
406
  * @internal
395
407
  */
396
- i(this, "_scheduleNotify", () => {
408
+ o(this, "_scheduleNotify", () => {
397
409
  const t = ++this._scheduleCount;
398
- Ne(() => {
410
+ Be(() => {
399
411
  this._scheduleCount !== t || this._disposed !== !1 || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
400
412
  });
401
413
  });
402
414
  /** {@inheritDoc Signal.get} */
403
- i(this, "get", () => (this._isDirty && (this._isDirty = !1, this._value = this._fn(), this._setAndNotify(this._value, !0)), this._value));
415
+ o(this, "get", () => (this._isDirty && (this._isDirty = !1, this._value = this._fn(), this._setAndNotify(this._value, !0)), this._value));
404
416
  this._fn = t, this.setDirty();
405
417
  }
406
418
  /**
@@ -417,26 +429,26 @@ class T extends d {
417
429
  return this.get();
418
430
  }
419
431
  }
420
- const V = class V extends d {
432
+ const W = class W extends d {
421
433
  constructor() {
422
434
  super(...arguments);
423
435
  /**
424
436
  * @internal
425
437
  */
426
- i(this, "$__prop__", !0);
438
+ o(this, "$__prop__", !0);
427
439
  /**
428
440
  * Changes the value of the property and notifies its listeners.
429
441
  *
430
442
  * @param value - The new value of the property.
431
443
  */
432
- i(this, "set", (t) => {
444
+ o(this, "set", (t) => {
433
445
  this._setAndNotify(t, !1);
434
446
  });
435
447
  /**
436
448
  * Updates the value of the signal by applying the provided function to the current value.
437
449
  * @param fn - The function to apply to the current value.
438
450
  */
439
- i(this, "update", (t) => {
451
+ o(this, "update", (t) => {
440
452
  this._setAndNotify(t(this.get()), !1);
441
453
  });
442
454
  /**
@@ -445,16 +457,16 @@ const V = class V extends d {
445
457
  * @param effects - An array of effects to be executed after the state is updated.
446
458
  * @returns A dispatch function that can be used to update the state and trigger the effects.
447
459
  */
448
- i(this, "reducer", (t, ...r) => {
460
+ o(this, "reducer", (t, ...r) => {
449
461
  const n = this;
450
- return function o(l) {
462
+ return function i(l) {
451
463
  const c = n.value;
452
464
  n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
453
465
  (a) => a({
454
466
  previousState: c,
455
467
  state: n.value,
456
468
  action: l,
457
- dispatch: o
469
+ dispatch: i
458
470
  })
459
471
  );
460
472
  };
@@ -470,9 +482,9 @@ const V = class V extends d {
470
482
  * Defaults to a strict equality check (===).
471
483
  * @returns A Prop object representing the isomorphism.
472
484
  */
473
- i(this, "iso", (t, r, n = (o, l) => o === l) => {
474
- const o = new V(t(this.get()), n);
475
- return o.onDispose(this.on((l) => o.set(t(l)))), o.on((l) => this._setAndNotify(r(l), !1)), o;
485
+ o(this, "iso", (t, r, n = (i, l) => i === l) => {
486
+ const i = new W(t(this.get()), n);
487
+ return i.onDispose(this.on((l) => i.set(t(l)))), i.on((l) => this._setAndNotify(r(l), !1)), i;
476
488
  });
477
489
  /**
478
490
  * Returns a `Prop` that represents the value at the specified key of the current value.
@@ -480,7 +492,7 @@ const V = class V extends d {
480
492
  * @param key - The key of the value to access.
481
493
  * @returns A `Prop` that represents the value at the specified key.
482
494
  */
483
- i(this, "atProp", (t) => this.iso(
495
+ o(this, "atProp", (t) => this.iso(
484
496
  (r) => r[t],
485
497
  (r) => ({ ...this.value, [t]: r })
486
498
  ));
@@ -500,15 +512,29 @@ const V = class V extends d {
500
512
  * @param value - The value to check.
501
513
  * @returns `true` if the value is a Prop, `false` otherwise.
502
514
  */
503
- i(V, "is", (t) => (
515
+ o(W, "is", (t) => (
504
516
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
505
517
  t != null && t.$__prop__ === !0
506
518
  ));
507
- let I = V;
508
- const G = (s, e, t = (r, n) => r === n) => {
509
- const r = new T(s, t);
519
+ let k = W;
520
+ const Q = (s, e, t = (r, n) => r === n) => {
521
+ const r = new C(s, t);
510
522
  return e.forEach((n) => n.setDerivative(r)), r;
511
- }, He = (s, e) => G(s, e).dispose, L = (s, e = (t, r) => t === r) => new I(s, e), R = (s, e = (t, r) => t === r) => new d(s, e), ee = () => typeof window < "u" ? window : void 0, p = {
523
+ }, Fe = (s, e, t = {}) => {
524
+ let r = t.once ? () => {
525
+ i(), s();
526
+ } : s;
527
+ if (t.skipInitial) {
528
+ let l = !1;
529
+ r = () => {
530
+ l || (l = !0, r());
531
+ };
532
+ }
533
+ const n = Q(r, e), i = () => {
534
+ n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", i);
535
+ };
536
+ return t.abortSignal != null && t.abortSignal.addEventListener("abort", i), i;
537
+ }, N = (s, e = (t, r) => t === r) => new k(s, e), J = (s, e = (t, r) => t === r) => new d(s, e), ie = () => typeof window < "u" ? window : void 0, p = {
512
538
  /**
513
539
  * Maps a value or a Signal to a new value.
514
540
  * If the value is a Signal, it returns a new Signal with the mapped value.
@@ -531,7 +557,7 @@ const G = (s, e, t = (r, n) => r === n) => {
531
557
  * @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
532
558
  * @returns A Signal instance.
533
559
  */
534
- toSignal: (s, e) => d.is(s) ? s : R(s, e),
560
+ toSignal: (s, e) => d.is(s) ? s : J(s, e),
535
561
  /**
536
562
  * Wraps a value in a `Signal` if it is not already a `Signal`.
537
563
  * If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
@@ -565,106 +591,110 @@ const G = (s, e, t = (r, n) => r === n) => {
565
591
  dispose: (s) => {
566
592
  d.is(s) && s.dispose();
567
593
  }
568
- }, yt = (...s) => (e, t) => {
594
+ }, It = (...s) => (e, t) => {
569
595
  const r = s.filter((n) => d.is(n));
570
- return G(
596
+ return Q(
571
597
  () => e(...s.map((n) => p.get(n))),
572
598
  r,
573
599
  t
574
600
  );
575
- }, wt = (...s) => (e) => {
576
- const t = s.filter((r) => d.is(r));
577
- He(() => e(...s.map(p.get)), t);
601
+ }, kt = (...s) => (e, t = {}) => {
602
+ const r = s.filter((n) => d.is(n));
603
+ return Fe(
604
+ () => e(...s.map(p.get)),
605
+ r,
606
+ t
607
+ );
578
608
  };
579
- class te {
609
+ class oe {
580
610
  constructor() {
581
- i(this, "_store", /* @__PURE__ */ new Map());
611
+ o(this, "_store", /* @__PURE__ */ new Map());
582
612
  /**
583
613
  * Retrieves the value associated with the specified key from the memory store.
584
614
  * @param key - The key to retrieve the value for.
585
615
  * @returns The value associated with the key, or `null` if the key is not found.
586
616
  */
587
- i(this, "getItem", (e) => this._store.get(e) ?? null);
617
+ o(this, "getItem", (e) => this._store.get(e) ?? null);
588
618
  /**
589
619
  * Sets the value associated with the specified key in the memory store.
590
620
  * @param key - The key to set the value for.
591
621
  * @param value - The value to set.
592
622
  */
593
- i(this, "setItem", (e, t) => {
623
+ o(this, "setItem", (e, t) => {
594
624
  this._store.set(e, t);
595
625
  });
596
626
  }
597
627
  }
598
- const se = ({
628
+ const le = ({
599
629
  key: s,
600
630
  defaultValue: e,
601
631
  store: t,
602
632
  serialize: r = JSON.stringify,
603
633
  deserialize: n = JSON.parse,
604
- equals: o = (c, a) => c === a,
634
+ equals: i = (c, a) => c === a,
605
635
  onLoad: l = (c) => c
606
636
  }) => {
607
- const c = t.getItem(s), a = new I(
637
+ const c = t.getItem(s), a = new k(
608
638
  c != null ? l(n(c)) : typeof e == "function" ? e() : e,
609
- o
639
+ i
610
640
  );
611
- return a.on((f) => {
612
- t.setItem(s, r(f));
641
+ return a.on((u) => {
642
+ t.setItem(s, r(u));
613
643
  }), a;
614
- }, _t = (s) => {
644
+ }, Nt = (s) => {
615
645
  var e;
616
- return se({
646
+ return le({
617
647
  ...s,
618
- store: ((e = ee()) == null ? void 0 : e.localStorage) ?? new te()
648
+ store: ((e = ie()) == null ? void 0 : e.localStorage) ?? new oe()
619
649
  });
620
- }, vt = (s) => {
650
+ }, Rt = (s) => {
621
651
  var e;
622
- return se({
652
+ return le({
623
653
  ...s,
624
- store: ((e = ee()) == null ? void 0 : e.sessionStorage) ?? new te()
654
+ store: ((e = ie()) == null ? void 0 : e.sessionStorage) ?? new oe()
625
655
  });
626
656
  };
627
- function K(s) {
657
+ function ne(s) {
628
658
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
629
659
  }
630
- const Ie = (s, e, t, r) => {
631
- const n = (r == null ? void 0 : r.duration) ?? 300, o = (r == null ? void 0 : r.easing) ?? ((y) => y), l = (r == null ? void 0 : r.equals) ?? ((y, H) => y === H);
632
- let c = r == null ? void 0 : r.interpolate, a = s, f = e(), h = performance.now(), P = null, O = !0;
633
- const B = new T(e, l), C = L(s, l);
634
- C.onDispose(() => {
635
- P !== null && cancelAnimationFrame(P);
636
- }), C.onDispose(B.dispose), t.forEach((y) => {
637
- y.setDerivative(B), y.onDispose(C.dispose);
660
+ const Ue = (s, e, t, r) => {
661
+ const n = (r == null ? void 0 : r.duration) ?? 300, i = (r == null ? void 0 : r.easing) ?? ((T) => T), l = (r == null ? void 0 : r.equals) ?? ((T, I) => T === I);
662
+ let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), m = null, w = !0;
663
+ const X = new C(e, l), A = N(s, l);
664
+ A.onDispose(() => {
665
+ m !== null && cancelAnimationFrame(m);
666
+ }), A.onDispose(X.dispose), t.forEach((T) => {
667
+ T.setDerivative(X), T.onDispose(A.dispose);
638
668
  });
639
- const be = (y) => {
640
- f = y, h = performance.now(), a = C.value, O && (O = !1, P = K(J));
641
- }, J = () => {
642
- const H = (performance.now() - h) / p.get(n), Ee = o(H);
643
- c == null && (c = $e(a));
644
- let Q = c(a, f, Ee);
645
- H >= 1 ? (O = !0, Q = f) : P = K(J), C.set(Q);
669
+ const He = (T) => {
670
+ u = T, h = performance.now(), a = A.value, w && (w = !1, m = ne(K));
671
+ }, K = () => {
672
+ const I = (performance.now() - h) / p.get(n), $e = i(I);
673
+ c == null && (c = Ve(a));
674
+ let ee = c(a, u, $e);
675
+ I >= 1 ? (w = !0, ee = u) : m = ne(K), A.set(ee);
646
676
  };
647
- return B.on(be), C;
648
- }, St = (s, e) => {
677
+ return X.on(He), A;
678
+ }, jt = (s, e) => {
649
679
  const { initialValue: t, ...r } = e ?? {};
650
- return Ie(
680
+ return Ue(
651
681
  t ?? s.get(),
652
682
  s.get,
653
683
  [s],
654
684
  r
655
685
  );
656
- }, Pt = (s, e) => {
686
+ }, qt = (s, e) => {
657
687
  const { signals: t, literals: r } = Object.entries(s).reduce(
658
- ({ signals: o, literals: l }, [c, a]) => (d.is(a) ? o.push([c, a]) : l[c] = a, { signals: o, literals: l }),
688
+ ({ signals: i, literals: l }, [c, a]) => (d.is(a) ? i.push([c, a]) : l[c] = a, { signals: i, literals: l }),
659
689
  { signals: [], literals: {} }
660
- ), n = t.map(([, o]) => o);
661
- return G(() => (t.forEach(([o, l]) => r[o] = l.value), e(r)), n);
662
- }, re = /* @__PURE__ */ new Set(["checked", "disabled", "hidden", "selected"]), ne = /* @__PURE__ */ new Set([
690
+ ), n = t.map(([, i]) => i);
691
+ return Q(() => (t.forEach(([i, l]) => r[i] = l.value), e(r)), n);
692
+ }, ce = /* @__PURE__ */ new Set(["checked", "disabled", "hidden", "selected"]), ae = /* @__PURE__ */ new Set([
663
693
  "rowSpan",
664
694
  "colSpan",
665
695
  "tabIndex",
666
696
  "valueAsNumber"
667
- ]), ie = /* @__PURE__ */ new Set(["valueAsDate"]), oe = /* @__PURE__ */ new Set([
697
+ ]), ue = /* @__PURE__ */ new Set(["valueAsDate"]), he = /* @__PURE__ */ new Set([
668
698
  "value",
669
699
  "textContent",
670
700
  "innerText",
@@ -672,26 +702,26 @@ const Ie = (s, e, t, r) => {
672
702
  "outerHTML",
673
703
  "className",
674
704
  "classList"
675
- ]), Ve = (s, e) => re.has(s) ? (t) => {
705
+ ]), We = (s, e) => ce.has(s) ? (t) => {
676
706
  t == null ? e[s] = null : e[s] = !!t;
677
- } : ne.has(s) ? (t) => {
707
+ } : ae.has(s) ? (t) => {
678
708
  t == null ? e[s] = null : e[s] = Number(t);
679
- } : ie.has(s) ? (t) => {
709
+ } : ue.has(s) ? (t) => {
680
710
  t == null ? e[s] = null : e[s] = t;
681
- } : oe.has(s) ? (t) => {
711
+ } : he.has(s) ? (t) => {
682
712
  t == null ? e[s] = null : e[s] = String(t);
683
713
  } : (t) => {
684
714
  t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
685
- }, Re = (s, e) => re.has(s) ? () => !!e[s] : ne.has(s) ? () => Number(e[s]) : ie.has(s) ? () => e[s] : oe.has(s) ? () => String(e[s]) : () => e.getAttribute(s), U = (s) => {
715
+ }, Je = (s, e) => ce.has(s) ? () => !!e[s] : ae.has(s) ? () => Number(e[s]) : ue.has(s) ? () => e[s] : he.has(s) ? () => String(e[s]) : () => e.getAttribute(s), R = (s) => {
686
716
  const e = s;
687
717
  e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
688
- }, je = (s) => le(s) ? s : s.parentElement, le = (s) => s.nodeType === 1;
689
- class ce extends Error {
718
+ }, Ge = (s) => fe(s) ? s : s.parentElement, fe = (s) => s.nodeType === 1;
719
+ class de extends Error {
690
720
  constructor(e) {
691
721
  super(`Provider not found: ${e.description}`);
692
722
  }
693
723
  }
694
- class b {
724
+ class P {
695
725
  /**
696
726
  * Constructs a new `DOMContext` instance.
697
727
  *
@@ -709,7 +739,7 @@ class b {
709
739
  * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
710
740
  * @returns The newly created element.
711
741
  */
712
- i(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
742
+ o(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
713
743
  /**
714
744
  * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace and appends it to the current element.
715
745
  *
@@ -717,7 +747,7 @@ class b {
717
747
  * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
718
748
  * @returns The newly created element.
719
749
  */
720
- i(this, "makeChildElement", (e, t) => {
750
+ o(this, "makeChildElement", (e, t) => {
721
751
  const r = this.createElement(e, t);
722
752
  return this.appendOrInsert(r), this.withElement(r);
723
753
  });
@@ -726,13 +756,13 @@ class b {
726
756
  * @param text - The text content for the new text node.
727
757
  * @returns A new `Text` node with the specified text content.
728
758
  */
729
- i(this, "createText", (e) => this.document.createTextNode(e));
759
+ o(this, "createText", (e) => this.document.createTextNode(e));
730
760
  /**
731
761
  * Creates a new text node with the specified text content and appends it to the current element.
732
762
  * @param text - The text content for the new text node.
733
763
  * @returns A new `DOMContext` with a reference to the new text node.
734
764
  */
735
- i(this, "makeChildText", (e) => {
765
+ o(this, "makeChildText", (e) => {
736
766
  const t = this.createText(e);
737
767
  return this.appendOrInsert(t), this.withReference(t);
738
768
  });
@@ -740,14 +770,14 @@ class b {
740
770
  * Sets the text content of the current element.
741
771
  * @param text - The text content to set.
742
772
  */
743
- i(this, "setText", (e) => {
773
+ o(this, "setText", (e) => {
744
774
  this.reference.nodeValue = e;
745
775
  });
746
776
  /**
747
777
  * Gets the text content of the current element or text node.
748
778
  * @returns The text content of the current element or text node.
749
779
  */
750
- i(this, "getText", () => {
780
+ o(this, "getText", () => {
751
781
  var e;
752
782
  return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
753
783
  });
@@ -756,7 +786,7 @@ class b {
756
786
  * The text node is appended or inserted to the current `DOMContext`.
757
787
  * The new `DOMContext` with the reference is returned.
758
788
  */
759
- i(this, "makeRef", () => {
789
+ o(this, "makeRef", () => {
760
790
  const e = this.createText("");
761
791
  return this.appendOrInsert(e), this.withReference(e);
762
792
  });
@@ -765,7 +795,7 @@ class b {
765
795
  *
766
796
  * @param child - The child node to append or insert.
767
797
  */
768
- i(this, "appendOrInsert", (e) => {
798
+ o(this, "appendOrInsert", (e) => {
769
799
  this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
770
800
  });
771
801
  /**
@@ -773,43 +803,25 @@ class b {
773
803
  * @param element - The DOM element to use in the new `DOMContext` instance.
774
804
  * @returns A new `DOMContext` instance with the provided `element`.
775
805
  */
776
- i(this, "withElement", (e) => new b(this.document, e, void 0, this.providers));
806
+ o(this, "withElement", (e) => new P(this.document, e, void 0, this.providers));
777
807
  /**
778
808
  * Creates a new `DOMContext` instance with a reference to a DOM element selected by the provided `selector`.
779
809
  * @param selector - The CSS selector for the target DOM element.
780
810
  * @returns A new `DOMContext` instance with a reference to the selected DOM element.
781
811
  */
782
- i(this, "makePortal", (e) => {
812
+ o(this, "makePortal", (e) => {
783
813
  const t = this.document.querySelector(e);
784
814
  if (t == null)
785
815
  throw new Error(`Cannot find element by selector for portal: ${e}`);
786
816
  return this.withElement(t);
787
817
  });
788
- // /**
789
- // * Creates a new `DOMContext` instance with the `isFirstLevel` property set to `true`.
790
- // * @returns A new `DOMContext` instance with the `isFirstLevel` property set to `true`.
791
- // */
792
- // readonly withFirstLevel = (): DOMContext =>
793
- // new BrowserContext(
794
- // this.document,
795
- // this.element,
796
- // this.reference,
797
- // this.providers,
798
- // true
799
- // )
800
818
  /**
801
819
  * Creates a new `DOMContext` instance with the specified reference.
802
820
  *
803
821
  * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
804
822
  * @returns A new `DOMContext` instance with the specified reference.
805
823
  */
806
- i(this, "withReference", (e) => new b(
807
- this.document,
808
- this.element,
809
- e,
810
- this.providers
811
- // this.isFirstLevel
812
- ));
824
+ o(this, "withReference", (e) => new P(this.document, this.element, e, this.providers));
813
825
  /**
814
826
  * Returns a new HTMLDOMContext instance with the specified providers merged into
815
827
  * the existing providers.
@@ -817,16 +829,10 @@ class b {
817
829
  * @param providers - An object containing the providers to be merged into the existing providers.
818
830
  * @returns A new HTMLDOMContext instance with the merged providers.
819
831
  */
820
- i(this, "withProviders", (e) => new b(
821
- this.document,
822
- this.element,
823
- this.reference,
824
- {
825
- ...this.providers,
826
- ...e
827
- }
828
- // this.isFirstLevel
829
- ));
832
+ o(this, "withProviders", (e) => new P(this.document, this.element, this.reference, {
833
+ ...this.providers,
834
+ ...e
835
+ }));
830
836
  /**
831
837
  * Retrieves a provider for the given provider mark.
832
838
  *
@@ -834,58 +840,63 @@ class b {
834
840
  * @returns The provider for the given mark.
835
841
  * @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
836
842
  */
837
- i(this, "getProvider", (e) => {
843
+ o(this, "getProvider", (e) => {
838
844
  if (this.providers[e] === void 0)
839
- throw new ce(e);
845
+ throw new de(e);
840
846
  return this.providers[e];
841
847
  });
842
- i(this, "clear", (e) => {
843
- e && (this.reference !== void 0 ? U(this.reference) : U(this.element));
848
+ o(this, "clear", (e) => {
849
+ e && (this.reference !== void 0 ? R(this.reference) : R(this.element));
844
850
  });
845
851
  /**
846
852
  * Adds classes to the element.
847
853
  * @param tokens - The class names to add.
848
854
  */
849
- i(this, "addClasses", (e) => {
855
+ o(this, "addClasses", (e) => {
850
856
  this.element.classList.add(...e);
851
857
  });
852
858
  /**
853
859
  * Removes classes from the element.
854
860
  * @param tokens - The class names to remove.
855
861
  */
856
- i(this, "removeClasses", (e) => {
862
+ o(this, "removeClasses", (e) => {
857
863
  this.element.classList.remove(...e);
858
864
  });
859
865
  /**
860
866
  * Gets the classes of the element.
861
867
  * @returns The classes of the element.
862
868
  */
863
- i(this, "getClasses", () => Array.from(this.element.classList));
869
+ o(this, "getClasses", () => Array.from(this.element.classList));
864
870
  /**
865
871
  * Adds an event listener to the element.
866
872
  * @param event - The event to listen for.
867
873
  * @param listener - The listener to call when the event occurs.
874
+ * @param options - The options for the event listener.
868
875
  * @returns A function to remove the event listener.
869
876
  */
870
- i(this, "on", (e, t) => (this.element.addEventListener(e, t), (r) => {
871
- r && this.element.removeEventListener(e, t);
877
+ o(this, "on", (e, t, r) => (this.element.addEventListener(e, t, r), (n) => {
878
+ n && this.element.removeEventListener(
879
+ e,
880
+ t,
881
+ r
882
+ );
872
883
  }));
873
884
  /**
874
885
  * Returns `true` if the context is a browser DOM context.
875
886
  * @returns `true` if the context is a browser DOM context.
876
887
  */
877
- i(this, "isBrowserDOM", () => !0);
888
+ o(this, "isBrowserDOM", () => !0);
878
889
  /**
879
890
  * Returns `true` if the context is a headless DOM context.
880
891
  * @returns `true` if the context is a headless DOM context.
881
892
  */
882
- i(this, "isHeadlessDOM", () => !1);
893
+ o(this, "isHeadlessDOM", () => !1);
883
894
  /**
884
895
  * Sets the style of the element.
885
896
  * @param name - The name of the style to set.
886
897
  * @param value - The value of the style to set.
887
898
  */
888
- i(this, "setStyle", (e, t) => {
899
+ o(this, "setStyle", (e, t) => {
889
900
  this.element.style.setProperty(e, t);
890
901
  });
891
902
  /**
@@ -893,10 +904,10 @@ class b {
893
904
  * @param name - The name of the style to get.
894
905
  * @returns The value of the style.
895
906
  */
896
- i(this, "getStyle", (e) => this.element.style.getPropertyValue(e));
897
- i(this, "makeAccessors", (e) => ({
898
- get: Re(e, this.element),
899
- set: Ve(e, this.element)
907
+ o(this, "getStyle", (e) => this.element.style.getPropertyValue(e));
908
+ o(this, "makeAccessors", (e) => ({
909
+ get: Je(e, this.element),
910
+ set: We(e, this.element)
900
911
  }));
901
912
  this.document = e, this.element = t, this.reference = r, this.providers = n;
902
913
  }
@@ -908,44 +919,270 @@ class b {
908
919
  * @returns A new `DOMContext` instance.
909
920
  */
910
921
  static of(e, t) {
911
- return new b(e.ownerDocument, e, t, {});
922
+ return new P(e.ownerDocument, e, t, {});
923
+ }
924
+ }
925
+ const Z = (s, e) => {
926
+ const t = s(e);
927
+ return () => t(!0);
928
+ }, Vt = (s, e, { doc: t, clear: r } = {}) => {
929
+ const n = typeof e == "string" ? (t ?? document).querySelector(e) : e;
930
+ if (n === null)
931
+ throw new ze(
932
+ `Cannot find element by selector for render: ${e}`
933
+ );
934
+ r !== !1 && (t ?? n.ownerDocument) != null && n.nodeType === 1 && (n.innerHTML = "");
935
+ const i = Ge(n), l = fe(n) ? void 0 : n, c = P.of(i, l);
936
+ return Z(s, c);
937
+ }, Bt = (s, {
938
+ startUrl: e = "https://example.com",
939
+ selector: t = ":root"
940
+ } = {}) => {
941
+ const r = p.toSignal(e).deriveProp(), n = new Te(t, void 0), i = new x(n, void 0, { currentURL: r }, {});
942
+ return {
943
+ clear: Z(s(), i),
944
+ root: n,
945
+ currentURL: r
946
+ };
947
+ };
948
+ class ze extends Error {
949
+ constructor(e) {
950
+ super(e);
951
+ }
952
+ }
953
+ const pe = "data-tts-node", j = "data-tts-class", q = "data-tts-style", V = "data-tts-html", B = "data-tts-text", F = "data-tts-attrs";
954
+ class Ft {
955
+ constructor({
956
+ select: e,
957
+ getAttribute: t,
958
+ setAttribute: r,
959
+ getClass: n,
960
+ setClass: i,
961
+ getStyles: l,
962
+ setStyles: c,
963
+ appendHTML: a,
964
+ getInnerHTML: u,
965
+ setInnerHTML: h,
966
+ getInnerText: m,
967
+ setInnerText: w
968
+ }) {
969
+ /**
970
+ * Selects elements from the headless environment.
971
+ * @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
972
+ * @returns An array of elements.
973
+ */
974
+ o(this, "select");
975
+ /**
976
+ * Gets the value of an attribute from an element.
977
+ * @param el - The element to get the attribute from.
978
+ * @param attr - The attribute to get the value from.
979
+ * @returns The value of the attribute or null if the attribute is not set.
980
+ */
981
+ o(this, "getAttribute");
982
+ /**
983
+ * Sets the value of an attribute on an element.
984
+ * @param el - The element to set the attribute on.
985
+ * @param attr - The attribute to set the value of.
986
+ * @param value - The value to set the attribute to.
987
+ */
988
+ o(this, "setAttribute");
989
+ /**
990
+ * Gets the class of an element.
991
+ * @param el - The element to get the class from.
992
+ * @returns The class of the element or an empty string if the class is not set.
993
+ */
994
+ o(this, "getClass");
995
+ /**
996
+ * Sets the class of an element.
997
+ * @param el - The element to set the class on.
998
+ * @param cls - The class to set.
999
+ */
1000
+ o(this, "setClass");
1001
+ /**
1002
+ * Gets the styles of an element.
1003
+ * @param el - The element to get the styles from.
1004
+ * @returns The styles of the element.
1005
+ */
1006
+ o(this, "getStyles");
1007
+ /**
1008
+ * Sets the styles of an element.
1009
+ * @param el - The element to set the styles on.
1010
+ */
1011
+ o(this, "setStyles");
1012
+ /**
1013
+ * Appends HTML to an element.
1014
+ * @param el - The element to append the HTML to.
1015
+ * @param html - The HTML to append.
1016
+ */
1017
+ o(this, "appendHTML");
1018
+ /**
1019
+ * Gets the inner HTML of an element.
1020
+ * @param el - The element to get the inner HTML from.
1021
+ * @returns The inner HTML of the element or an empty string if the inner HTML is not set.
1022
+ */
1023
+ o(this, "getInnerHTML");
1024
+ /**
1025
+ * Sets the inner HTML of an element.
1026
+ * @param el - The element to set the inner HTML on.
1027
+ * @param html - The inner HTML to set.
1028
+ */
1029
+ o(this, "setInnerHTML");
1030
+ /**
1031
+ * Gets the inner text of an element.
1032
+ * @param el - The element to get the inner text from.
1033
+ * @returns The inner text of the element or an empty string if the inner text is not set.
1034
+ */
1035
+ o(this, "getInnerText");
1036
+ /**
1037
+ * Sets the inner text of an element.
1038
+ * @param el - The element to set the inner text on.
1039
+ * @param text - The inner text to set.
1040
+ */
1041
+ o(this, "setInnerText");
1042
+ /**
1043
+ * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
1044
+ * returned by `runHeadless`.
1045
+ *
1046
+ * @param root - The HeadlessPortal containing the content to set.
1047
+ * @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
1048
+ * when you render on the server and then hydrate on the client.
1049
+ */
1050
+ o(this, "setFromRoot", (e, t) => {
1051
+ e.getPortals().forEach((n) => {
1052
+ for (const i of this.select(n.selector)) {
1053
+ if (i == null)
1054
+ throw new Error(
1055
+ `Cannot find element by selector for render: ${n.selector}`
1056
+ );
1057
+ if (n.hasChildren() && this.appendHTML(i, n.contentToHTML(t)), n.hasInnerHTML()) {
1058
+ if (t) {
1059
+ const l = this.getInnerHTML(i);
1060
+ l != null && this.setAttribute(i, V, l);
1061
+ }
1062
+ this.setInnerHTML(i, n.getInnerHTML());
1063
+ }
1064
+ if (n.hasInnerText()) {
1065
+ if (t) {
1066
+ const l = this.getInnerText(i);
1067
+ l != null && this.setAttribute(i, B, l);
1068
+ }
1069
+ this.setInnerText(i, n.getInnerText());
1070
+ }
1071
+ if (n.hasClasses()) {
1072
+ if (t) {
1073
+ const l = this.getClass(i);
1074
+ l != null && this.setAttribute(i, j, l);
1075
+ }
1076
+ this.setClass(i, n.getClasses().join(" "));
1077
+ }
1078
+ if (n.hasStyles()) {
1079
+ if (t) {
1080
+ const l = this.getStyles(i);
1081
+ Object.keys(l).length > 0 && this.setAttribute(
1082
+ i,
1083
+ q,
1084
+ JSON.stringify(l)
1085
+ );
1086
+ }
1087
+ this.setStyles(i, n.getStyles());
1088
+ }
1089
+ if (n.hasAttributes()) {
1090
+ const l = n.getAttributes();
1091
+ if (t) {
1092
+ const c = [];
1093
+ l.forEach(([a]) => {
1094
+ const u = this.getAttribute(i, a);
1095
+ u != null && c.push([a, u]);
1096
+ }), c.length > 0 && this.setAttribute(
1097
+ i,
1098
+ F,
1099
+ JSON.stringify(Object.fromEntries(c))
1100
+ );
1101
+ }
1102
+ l.forEach(([c, a]) => {
1103
+ this.setAttribute(i, c, a);
1104
+ });
1105
+ }
1106
+ }
1107
+ });
1108
+ });
1109
+ this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = l, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = m, this.setInnerText = w;
912
1110
  }
913
1111
  }
914
- const g = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"), ae = () => Math.random().toString(36).substring(2, 15), qe = (s) => s.replace(/<[^>]*>?/g, "");
915
- class ue {
1112
+ const Xe = () => {
1113
+ document.querySelectorAll(`[${pe}]`).forEach(R);
1114
+ }, Ye = (s) => {
1115
+ const e = s.getAttribute(j);
1116
+ s.removeAttribute(j), e != null && s.setAttribute("class", e);
1117
+ }, Qe = () => {
1118
+ document.querySelectorAll(`[${j}]`).forEach((e) => Ye(e));
1119
+ }, Ze = (s) => {
1120
+ const e = s.getAttribute(V);
1121
+ s.removeAttribute(V), e != null && (s.innerHTML = e);
1122
+ }, Ke = () => {
1123
+ document.querySelectorAll(`[${V}]`).forEach((e) => Ze(e));
1124
+ }, et = (s) => {
1125
+ const e = s.getAttribute(B);
1126
+ s.removeAttribute(B), e != null && (s.innerText = e);
1127
+ }, tt = () => {
1128
+ document.querySelectorAll(`[${B}]`).forEach((e) => et(e));
1129
+ }, ge = (s) => JSON.parse(s.replace(/&quot;/g, '"')), st = (s) => {
1130
+ const e = s.getAttribute(q);
1131
+ if (s.removeAttribute(q), e != null) {
1132
+ const t = ge(e);
1133
+ Object.entries(t).forEach(([r, n]) => {
1134
+ s.style.setProperty(r, n);
1135
+ });
1136
+ }
1137
+ }, rt = () => {
1138
+ document.querySelectorAll(`[${q}]`).forEach((e) => st(e));
1139
+ }, nt = (s) => {
1140
+ const e = s.getAttribute(F);
1141
+ if (s.removeAttribute(F), e != null) {
1142
+ const t = ge(e);
1143
+ Object.entries(t).forEach(([r, n]) => {
1144
+ n == null ? s.removeAttribute(r) : s.setAttribute(r, n);
1145
+ });
1146
+ }
1147
+ }, it = () => {
1148
+ document.querySelectorAll(`[${F}]`).forEach((e) => nt(e));
1149
+ }, Ut = () => {
1150
+ Xe(), Qe(), tt(), Ke(), rt(), it();
1151
+ }, y = Symbol("class"), S = Symbol("style"), v = Symbol("handler"), me = () => Math.random().toString(36).substring(2, 15), ot = (s) => s.replace(/<[^>]*>?/g, "");
1152
+ class ye {
916
1153
  constructor(e) {
917
- i(this, "id", ae());
918
- i(this, "properties", {});
919
- i(this, "children", []);
920
- i(this, "isElement", () => !0);
921
- i(this, "isText", () => !1);
922
- i(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? qe(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
923
- i(this, "removeChild", (e) => {
1154
+ o(this, "id", me());
1155
+ o(this, "properties", {});
1156
+ o(this, "children", []);
1157
+ o(this, "isElement", () => !0);
1158
+ o(this, "isText", () => !1);
1159
+ o(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? ot(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
1160
+ o(this, "removeChild", (e) => {
924
1161
  const t = this.children.indexOf(e);
925
1162
  t !== -1 && this.children.splice(t, 1);
926
1163
  });
927
- i(this, "remove", () => {
1164
+ o(this, "remove", () => {
928
1165
  if (this.parent != null)
929
1166
  this.parent.removeChild(this);
930
1167
  else
931
1168
  throw new Error("Parent is undefined");
932
1169
  });
933
- i(this, "getPortals", () => {
1170
+ o(this, "getPortals", () => {
934
1171
  const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
935
1172
  return this.isPortal() && e.unshift(this), e;
936
1173
  });
937
- i(this, "elements", () => this.children.filter((e) => e.isElement()));
938
- i(this, "hasInnerHTML", () => this.properties.innerHTML != null);
939
- i(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
940
- i(this, "getInnerText", () => this.properties.innerText ?? "");
941
- i(this, "hasInnerText", () => this.properties.innerText != null);
942
- i(this, "hasChildren", () => this.children.length > 0);
943
- i(this, "hasClasses", () => this.properties[g] != null);
944
- i(this, "hasStyles", () => this.properties[_] != null);
945
- i(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
946
- i(this, "hasHandlers", () => this.properties[x] != null);
947
- i(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
948
- i(this, "getById", (e) => {
1174
+ o(this, "elements", () => this.children.filter((e) => e.isElement()));
1175
+ o(this, "hasInnerHTML", () => this.properties.innerHTML != null);
1176
+ o(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
1177
+ o(this, "getInnerText", () => this.properties.innerText ?? "");
1178
+ o(this, "hasInnerText", () => this.properties.innerText != null);
1179
+ o(this, "hasChildren", () => this.children.length > 0);
1180
+ o(this, "hasClasses", () => this.properties[y] != null);
1181
+ o(this, "hasStyles", () => this.properties[S] != null);
1182
+ o(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
1183
+ o(this, "hasHandlers", () => this.properties[v] != null);
1184
+ o(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
1185
+ o(this, "getById", (e) => {
949
1186
  if (this.properties.id === e)
950
1187
  return this;
951
1188
  for (const t of this.elements()) {
@@ -954,57 +1191,61 @@ class ue {
954
1191
  return r;
955
1192
  }
956
1193
  });
957
- i(this, "trigger", (e, t) => {
958
- ((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
1194
+ o(this, "trigger", (e, t) => {
1195
+ ((this.properties[v] ?? {})[e] ?? []).forEach((n) => n(t));
959
1196
  });
960
- i(this, "click", () => {
1197
+ o(this, "click", () => {
961
1198
  this.trigger("click", {});
962
1199
  });
963
- i(this, "on", (e, t) => {
964
- var o;
965
- const r = (o = this.properties)[x] ?? (o[x] = {}), n = t;
966
- return r[e] = [...r[e] ?? [], n], () => {
967
- const l = r[e] ?? [], c = l.indexOf(n);
968
- c !== -1 && (l.splice(c, 1), l.length === 0 ? (delete r[e], Object.keys(r).length === 0 && delete this.properties[x]) : r[e] = l);
1200
+ o(this, "on", (e, t, r) => {
1201
+ var c;
1202
+ const n = (c = this.properties)[v] ?? (c[v] = {}), i = r != null && r.once ? (a) => {
1203
+ l(), t(a);
1204
+ } : (a) => t(a);
1205
+ n[e] = [...n[e] ?? [], i];
1206
+ const l = () => {
1207
+ const a = n[e] ?? [], u = a.indexOf(i);
1208
+ u !== -1 && (a.splice(u, 1), a.length === 0 ? (delete n[e], Object.keys(n).length === 0 && delete this.properties[v]) : n[e] = a, (r == null ? void 0 : r.signal) != null && r.signal.removeEventListener("abort", l));
969
1209
  };
1210
+ return (r == null ? void 0 : r.signal) != null && r.signal.addEventListener("abort", l), l;
970
1211
  });
971
- i(this, "addClasses", (e) => {
1212
+ o(this, "addClasses", (e) => {
972
1213
  var r;
973
1214
  if (e.length === 0)
974
1215
  return;
975
- const t = (r = this.properties)[g] ?? (r[g] = []);
1216
+ const t = (r = this.properties)[y] ?? (r[y] = []);
976
1217
  e.forEach((n) => {
977
1218
  t.includes(n) || t.push(n);
978
1219
  });
979
1220
  });
980
- i(this, "removeClasses", (e) => {
1221
+ o(this, "removeClasses", (e) => {
981
1222
  var r;
982
1223
  if (e.length === 0)
983
1224
  return;
984
- const t = (r = this.properties)[g] ?? (r[g] = []);
1225
+ const t = (r = this.properties)[y] ?? (r[y] = []);
985
1226
  e.forEach((n) => {
986
- const o = t.indexOf(n);
987
- o !== -1 && t.splice(o, 1);
988
- }), t.length === 0 && delete this.properties[g];
1227
+ const i = t.indexOf(n);
1228
+ i !== -1 && t.splice(i, 1);
1229
+ }), t.length === 0 && delete this.properties[y];
989
1230
  });
990
- i(this, "getClasses", () => this.properties[g] ?? []);
991
- i(this, "getAttributes", () => Object.entries(this.properties).filter(
1231
+ o(this, "getClasses", () => this.properties[y] ?? []);
1232
+ o(this, "getAttributes", () => Object.entries(this.properties).filter(
992
1233
  ([e]) => !["innerText", "innerHTML"].includes(e)
993
1234
  ));
994
- i(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
995
- (e) => e === g ? [["class", this.getClasses()]] : e === _ ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1235
+ o(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
1236
+ (e) => e === y ? [["class", this.getClasses()]] : e === S ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
996
1237
  ));
997
- i(this, "setStyle", (e, t) => {
1238
+ o(this, "setStyle", (e, t) => {
998
1239
  var n;
999
- const r = (n = this.properties)[_] ?? (n[_] = {});
1000
- r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[_]);
1240
+ const r = (n = this.properties)[S] ?? (n[S] = {});
1241
+ r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[S]);
1001
1242
  });
1002
- i(this, "getStyle", (e) => {
1243
+ o(this, "getStyle", (e) => {
1003
1244
  var t;
1004
- return ((t = this.properties[_]) == null ? void 0 : t[e]) ?? "";
1245
+ return ((t = this.properties[S]) == null ? void 0 : t[e]) ?? "";
1005
1246
  });
1006
- i(this, "getStyles", () => this.properties[_] ?? {});
1007
- i(this, "makeAccessors", (e) => {
1247
+ o(this, "getStyles", () => this.properties[S] ?? {});
1248
+ o(this, "makeAccessors", (e) => {
1008
1249
  const t = this.properties;
1009
1250
  return {
1010
1251
  get: () => t[e],
@@ -1014,149 +1255,149 @@ class ue {
1014
1255
  this.parent = e;
1015
1256
  }
1016
1257
  }
1017
- const Be = (s) => s.replace(/"/g, "&quot;"), Fe = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1018
- class Ue extends ue {
1258
+ const lt = (s) => s.replace(/"/g, "&quot;"), ct = (s) => s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
1259
+ class at extends ye {
1019
1260
  constructor(t, r, n) {
1020
1261
  super(n);
1021
- i(this, "isPortal", () => !1);
1022
- i(this, "toHTML", () => {
1023
- const t = this.children.map((l) => l.toHTML()).join(""), r = this.namespace ? ` xmlns="${this.namespace}"` : "";
1024
- let n = null;
1025
- 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, f]) => `${a}: ${f};`).join(" ")}"` : Ge.has(l) ? ` ${l}` : l === "innerHTML" ? (n = c, "") : l === "innerText" ? (n = Fe(c), "") : ` ${l}="${Be(c)}"`).join("");
1026
- return ze.has(this.tagName) && t === "" ? `<${this.tagName}${r}${o} />` : `<${this.tagName}${r}${o}>${n ?? t}</${this.tagName}>`;
1262
+ o(this, "isPortal", () => !1);
1263
+ o(this, "toHTML", (t = !1) => {
1264
+ const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
1265
+ let i = null;
1266
+ const l = this.getVisibleAttributes().map(([a, u]) => a === "class" ? ` class="${u.join(" ")}"` : a === "style" ? typeof u == "string" ? ` style="${u}"` : ` style="${Object.entries(u).map(([h, m]) => `${h}: ${m};`).join(" ")}"` : ht.has(a) ? ` ${a}` : a === "innerHTML" ? (i = u, "") : a === "innerText" ? (i = ct(u), "") : ` ${a}="${lt(u)}"`).join(""), c = t ? ` ${pe}` : "";
1267
+ return ft.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${i ?? r}</${this.tagName}>`;
1027
1268
  });
1028
1269
  this.tagName = t, this.namespace = r;
1029
1270
  }
1030
1271
  }
1031
- class he extends ue {
1272
+ class Te extends ye {
1032
1273
  constructor(t, r) {
1033
1274
  super(r);
1034
- i(this, "isPortal", () => !0);
1035
- i(this, "toHTML", () => "");
1036
- i(this, "contentToHTML", () => this.children.map((t) => t.toHTML()).join(""));
1275
+ o(this, "isPortal", () => !0);
1276
+ o(this, "toHTML", () => "");
1277
+ o(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
1037
1278
  this.selector = t;
1038
1279
  }
1039
1280
  }
1040
- class We {
1281
+ class ut {
1041
1282
  constructor(e) {
1042
- i(this, "id", ae());
1043
- i(this, "isElement", () => !1);
1044
- i(this, "isText", () => !0);
1045
- i(this, "getText", () => this.text);
1046
- i(this, "toHTML", () => this.text);
1283
+ o(this, "id", me());
1284
+ o(this, "isElement", () => !1);
1285
+ o(this, "isText", () => !0);
1286
+ o(this, "getText", () => this.text);
1287
+ o(this, "toHTML", () => this.text);
1047
1288
  this.text = e;
1048
1289
  }
1049
1290
  }
1050
- class E {
1291
+ class x {
1051
1292
  constructor(e, t, r, n) {
1052
- i(this, "appendOrInsert", (e) => {
1293
+ o(this, "appendOrInsert", (e) => {
1053
1294
  if (this.reference != null) {
1054
1295
  const t = this.element.children.indexOf(this.reference);
1055
1296
  this.element.children.splice(t, 0, e);
1056
1297
  } else
1057
1298
  this.element.children.push(e);
1058
1299
  });
1059
- i(this, "makeChildElement", (e, t) => {
1060
- const r = new Ue(e, t, this.element);
1061
- return this.appendOrInsert(r), new E(
1300
+ o(this, "makeChildElement", (e, t) => {
1301
+ const r = new at(e, t, this.element);
1302
+ return this.appendOrInsert(r), new x(
1062
1303
  r,
1063
1304
  void 0,
1064
1305
  this.container,
1065
1306
  this.providers
1066
1307
  );
1067
1308
  });
1068
- i(this, "makeChildText", (e) => {
1069
- const t = new We(e);
1070
- return this.appendOrInsert(t), new E(
1309
+ o(this, "makeChildText", (e) => {
1310
+ const t = new ut(e);
1311
+ return this.appendOrInsert(t), new x(
1071
1312
  this.element,
1072
1313
  t,
1073
1314
  this.container,
1074
1315
  this.providers
1075
1316
  );
1076
1317
  });
1077
- i(this, "setText", (e) => {
1318
+ o(this, "setText", (e) => {
1078
1319
  this.reference && this.reference.isText() && (this.reference.text = e);
1079
1320
  });
1080
- i(this, "getText", () => {
1321
+ o(this, "getText", () => {
1081
1322
  var e;
1082
1323
  return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
1083
1324
  });
1084
- i(this, "makeRef", () => this.makeChildText(""));
1085
- i(this, "makePortal", (e) => {
1086
- const t = new he(e, this.element);
1087
- return this.appendOrInsert(t), new E(
1325
+ o(this, "makeRef", () => this.makeChildText(""));
1326
+ o(this, "makePortal", (e) => {
1327
+ const t = new Te(e, this.element);
1328
+ return this.appendOrInsert(t), new x(
1088
1329
  t,
1089
1330
  void 0,
1090
1331
  this.container,
1091
1332
  this.providers
1092
1333
  );
1093
1334
  });
1094
- i(this, "withProviders", (e) => new E(this.element, this.reference, this.container, {
1335
+ o(this, "withProviders", (e) => new x(this.element, this.reference, this.container, {
1095
1336
  ...this.providers,
1096
1337
  ...e
1097
1338
  }));
1098
- i(this, "getProvider", (e) => {
1339
+ o(this, "getProvider", (e) => {
1099
1340
  if (this.providers[e] === void 0)
1100
- throw new ce(e);
1341
+ throw new de(e);
1101
1342
  return this.providers[e];
1102
1343
  });
1103
- i(this, "clear", (e) => {
1344
+ o(this, "clear", (e) => {
1104
1345
  e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
1105
1346
  });
1106
- i(this, "on", (e, t) => this.element.on(e, t));
1107
- i(this, "addClasses", (e) => this.element.addClasses(e));
1108
- i(this, "removeClasses", (e) => this.element.removeClasses(e));
1109
- i(this, "getClasses", () => this.element.getClasses());
1110
- i(this, "isBrowserDOM", () => !1);
1111
- i(this, "isHeadlessDOM", () => !0);
1112
- i(this, "setStyle", (e, t) => this.element.setStyle(e, t));
1113
- i(this, "getStyle", (e) => this.element.getStyle(e));
1114
- i(this, "makeAccessors", (e) => this.element.makeAccessors(e));
1347
+ o(this, "on", (e, t) => this.element.on(e, t));
1348
+ o(this, "addClasses", (e) => this.element.addClasses(e));
1349
+ o(this, "removeClasses", (e) => this.element.removeClasses(e));
1350
+ o(this, "getClasses", () => this.element.getClasses());
1351
+ o(this, "isBrowserDOM", () => !1);
1352
+ o(this, "isHeadlessDOM", () => !0);
1353
+ o(this, "setStyle", (e, t) => this.element.setStyle(e, t));
1354
+ o(this, "getStyle", (e) => this.element.getStyle(e));
1355
+ o(this, "makeAccessors", (e) => this.element.makeAccessors(e));
1115
1356
  this.element = e, this.reference = t, this.container = r, this.providers = n;
1116
1357
  }
1117
1358
  }
1118
- const Ge = /* @__PURE__ */ new Set([
1359
+ const ht = /* @__PURE__ */ new Set([
1119
1360
  "checked",
1120
1361
  "disabled",
1121
1362
  "multiple",
1122
1363
  "readonly",
1123
1364
  "required",
1124
1365
  "selected"
1125
- ]), ze = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), fe = (s) => (e) => {
1366
+ ]), ft = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), be = (s) => (e) => {
1126
1367
  const t = e.makeChildText(s);
1127
1368
  return (r) => t.clear(r);
1128
- }, de = (s) => (e) => {
1369
+ }, Se = (s) => (e) => {
1129
1370
  const t = e.makeChildText(s.value), r = s.on((n) => t.setText(n));
1130
1371
  return (n) => {
1131
1372
  r(), t.clear(n);
1132
1373
  };
1133
- }, Ct = (s) => d.is(s) ? de(s) : fe(s), m = (...s) => (e) => {
1134
- const t = s.map((r) => u(r)(e));
1374
+ }, Wt = (s) => d.is(s) ? Se(s) : be(s), g = (...s) => (e) => {
1375
+ const t = s.map((r) => f(r)(e));
1135
1376
  return (r) => {
1136
1377
  t.forEach((n) => n(r));
1137
1378
  };
1138
- }, v = () => () => {
1139
- }, Je = (s) => (e) => (e.addClasses(s), (t) => {
1379
+ }, _ = () => () => {
1380
+ }, dt = (s) => (e) => (e.addClasses(s), (t) => {
1140
1381
  t && e.removeClasses(s);
1141
- }), Qe = (s) => (e) => {
1382
+ }), pt = (s) => (e) => {
1142
1383
  let t = [];
1143
1384
  const r = s.on((n) => {
1144
- e.removeClasses(t), t = (n ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(t);
1385
+ e.removeClasses(t), t = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(t);
1145
1386
  });
1146
1387
  return (n) => {
1147
1388
  r(), n && e.removeClasses(t), t.length = 0;
1148
1389
  };
1149
- }, $ = (s, e) => (t) => {
1150
- const { get: r, set: n } = t.makeAccessors(s), o = r();
1390
+ }, H = (s, e) => (t) => {
1391
+ const { get: r, set: n } = t.makeAccessors(s), i = r();
1151
1392
  return n(e), (l) => {
1152
- l && n(o);
1393
+ l && n(i);
1153
1394
  };
1154
- }, N = (s, e) => (t) => {
1155
- const { get: r, set: n } = t.makeAccessors(s), o = r(), l = e.on(n);
1395
+ }, $ = (s, e) => (t) => {
1396
+ const { get: r, set: n } = t.makeAccessors(s), i = r(), l = e.on(n);
1156
1397
  return (c) => {
1157
- l(), c && n(o);
1398
+ l(), c && n(i);
1158
1399
  };
1159
- }, D = new Proxy(
1400
+ }, L = new Proxy(
1160
1401
  {},
1161
1402
  {
1162
1403
  /**
@@ -1170,17 +1411,17 @@ const Ge = /* @__PURE__ */ new Set([
1170
1411
  * @returns The renderable component for the specified attribute.
1171
1412
  *
1172
1413
  */
1173
- get: (s, e) => e === "class" ? (t) => d.is(t) ? Qe(t) : Je(
1414
+ get: (s, e) => e === "class" ? (t) => d.is(t) ? pt(t) : dt(
1174
1415
  (t ?? "").split(" ").filter((r) => r.length > 0)
1175
- ) : (t) => d.is(t) ? N(
1416
+ ) : (t) => d.is(t) ? $(
1176
1417
  e,
1177
1418
  t
1178
- ) : $(
1419
+ ) : H(
1179
1420
  e,
1180
1421
  t
1181
1422
  )
1182
1423
  }
1183
- ), xt = new Proxy(
1424
+ ), Jt = new Proxy(
1184
1425
  {},
1185
1426
  {
1186
1427
  /**
@@ -1191,12 +1432,12 @@ const Ge = /* @__PURE__ */ new Set([
1191
1432
  * @returns The renderable component for the specified attribute.
1192
1433
  *
1193
1434
  */
1194
- get: (s, e) => (t) => d.is(t) ? N(
1435
+ get: (s, e) => (t) => d.is(t) ? $(
1195
1436
  `data-${e}`,
1196
1437
  t
1197
- ) : $(`data-${e}`, t)
1438
+ ) : H(`data-${e}`, t)
1198
1439
  }
1199
- ), Tt = new Proxy(
1440
+ ), Gt = new Proxy(
1200
1441
  {},
1201
1442
  {
1202
1443
  /**
@@ -1207,15 +1448,15 @@ const Ge = /* @__PURE__ */ new Set([
1207
1448
  * @returns The renderable component for the specified attribute.
1208
1449
  *
1209
1450
  */
1210
- get: (s, e) => (t) => d.is(t) ? N(
1451
+ get: (s, e) => (t) => d.is(t) ? $(
1211
1452
  `aria-${e}`,
1212
1453
  t
1213
- ) : $(
1454
+ ) : H(
1214
1455
  `aria-${e}`,
1215
1456
  t
1216
1457
  )
1217
1458
  }
1218
- ), bt = new Proxy(
1459
+ ), zt = new Proxy(
1219
1460
  {},
1220
1461
  {
1221
1462
  /**
@@ -1226,15 +1467,15 @@ const Ge = /* @__PURE__ */ new Set([
1226
1467
  * @returns The renderable component for the specified attribute.
1227
1468
  *
1228
1469
  */
1229
- get: (s, e) => (t) => d.is(t) ? N(
1470
+ get: (s, e) => (t) => d.is(t) ? $(
1230
1471
  e,
1231
1472
  t
1232
- ) : $(
1473
+ ) : H(
1233
1474
  e,
1234
1475
  t
1235
1476
  )
1236
1477
  }
1237
- ), Et = new Proxy(
1478
+ ), Xt = new Proxy(
1238
1479
  {},
1239
1480
  {
1240
1481
  /**
@@ -1244,37 +1485,37 @@ const Ge = /* @__PURE__ */ new Set([
1244
1485
  * @returns The renderable component for the specified attribute.
1245
1486
  *
1246
1487
  */
1247
- get: (s, e) => (t) => d.is(t) ? N(
1488
+ get: (s, e) => (t) => d.is(t) ? $(
1248
1489
  e,
1249
1490
  t
1250
- ) : $(
1491
+ ) : H(
1251
1492
  e,
1252
1493
  t
1253
1494
  )
1254
1495
  }
1255
- ), u = (s) => {
1496
+ ), f = (s) => {
1256
1497
  if (s == null)
1257
- return v;
1498
+ return _;
1258
1499
  if (Array.isArray(s))
1259
- return m(...s.map(u));
1500
+ return g(...s.map(f));
1260
1501
  if (typeof s == "string")
1261
- return fe(s);
1502
+ return be(s);
1262
1503
  if (d.is(s))
1263
- return de(s);
1504
+ return Se(s);
1264
1505
  if (typeof s == "function")
1265
1506
  return s;
1266
1507
  throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
1267
- }, pe = (s, ...e) => (t) => {
1268
- const r = t.makeChildElement(s, void 0), n = e.map((o) => u(o)(r));
1269
- return (o) => {
1270
- n.forEach((l) => l(!1)), r.clear(o);
1508
+ }, _e = (s, ...e) => (t) => {
1509
+ const r = t.makeChildElement(s, void 0), n = e.map((i) => f(i)(r));
1510
+ return (i) => {
1511
+ n.forEach((l) => l(!1)), r.clear(i);
1271
1512
  };
1272
- }, ge = (s, e, ...t) => (r) => {
1273
- const n = r.makeChildElement(s, e), o = t.map((l) => u(l)(n));
1513
+ }, we = (s, e, ...t) => (r) => {
1514
+ const n = r.makeChildElement(s, e), i = t.map((l) => f(l)(n));
1274
1515
  return (l) => {
1275
- o.forEach((c) => c(!1)), n.clear(l);
1516
+ i.forEach((c) => c(!1)), n.clear(l);
1276
1517
  };
1277
- }, Dt = new Proxy(
1518
+ }, Yt = new Proxy(
1278
1519
  {},
1279
1520
  {
1280
1521
  /**
@@ -1282,9 +1523,9 @@ const Ge = /* @__PURE__ */ new Set([
1282
1523
  * @param tagName - The HTML tag name.
1283
1524
  * @returns A renderable function that creates and appends the HTML element to the DOM.
1284
1525
  */
1285
- get: (s, e) => (...t) => pe(e, t.flatMap(u))
1526
+ get: (s, e) => (...t) => _e(e, t.flatMap(f))
1286
1527
  }
1287
- ), Ot = new Proxy(
1528
+ ), Qt = new Proxy(
1288
1529
  {},
1289
1530
  {
1290
1531
  /**
@@ -1292,9 +1533,9 @@ const Ge = /* @__PURE__ */ new Set([
1292
1533
  * @param type - The input type name.
1293
1534
  * @returns A renderable function that creates and appends the HTMLInput element to the DOM.
1294
1535
  */
1295
- get: (s, e) => (...t) => pe("input", D.type(e), ...t)
1536
+ get: (s, e) => (...t) => _e("input", L.type(e), ...t)
1296
1537
  }
1297
- ), Xe = "http://www.w3.org/2000/svg", At = new Proxy(
1538
+ ), gt = "http://www.w3.org/2000/svg", Zt = new Proxy(
1298
1539
  {},
1299
1540
  {
1300
1541
  /**
@@ -1302,9 +1543,9 @@ const Ge = /* @__PURE__ */ new Set([
1302
1543
  * @param tagName - The SVG tag name.
1303
1544
  * @returns A renderable function that creates and appends the SVG element to the DOM.
1304
1545
  */
1305
- get: (s, e) => (...t) => ge(e, Xe, t.flatMap(u))
1546
+ get: (s, e) => (...t) => we(e, gt, t.flatMap(f))
1306
1547
  }
1307
- ), Ye = "http://www.w3.org/1998/Math/MathML", Mt = new Proxy(
1548
+ ), mt = "http://www.w3.org/1998/Math/MathML", Kt = new Proxy(
1308
1549
  {},
1309
1550
  {
1310
1551
  /**
@@ -1312,35 +1553,35 @@ const Ge = /* @__PURE__ */ new Set([
1312
1553
  * @param tagName - The Math tag name.
1313
1554
  * @returns A renderable function that creates and appends the Math element to the DOM.
1314
1555
  */
1315
- get: (s, e) => (...t) => ge(e, Ye, t.flatMap(u))
1556
+ get: (s, e) => (...t) => we(e, mt, t.flatMap(f))
1316
1557
  }
1317
- ), me = (s, e) => {
1558
+ ), Ae = (s, e) => {
1318
1559
  if (typeof e == "function")
1319
- return me(s, { then: e });
1320
- const t = e.pending != null ? u(e.pending) : v, r = e.then, n = e.error != null ? (o) => u(e.error(o)) : () => v;
1321
- return (o) => {
1560
+ return Ae(s, { then: e });
1561
+ const t = e.pending != null ? f(e.pending) : _, r = e.then, n = e.error != null ? (i) => f(e.error(i)) : () => _;
1562
+ return (i) => {
1322
1563
  let l = !0;
1323
- const c = s(), a = o.makeRef();
1324
- let f = u(t)(a);
1564
+ const c = s(), a = i.makeRef();
1565
+ let u = f(t)(a);
1325
1566
  return c.then(
1326
1567
  (h) => {
1327
- l && (f(!0), f = u(r(h))(a));
1568
+ l && (u(!0), u = f(r(h))(a));
1328
1569
  },
1329
1570
  (h) => {
1330
- l && (f(!0), f = u(n(h))(a));
1571
+ l && (u(!0), u = f(n(h))(a));
1331
1572
  }
1332
1573
  ), (h) => {
1333
- l = !1, f(h), a.clear(h);
1574
+ l = !1, u(h), a.clear(h);
1334
1575
  };
1335
1576
  };
1336
- }, kt = (s, e) => me(() => s, e), ye = (s, e) => (t) => t.on(s, e), Ze = (s) => ye("click", (e) => {
1577
+ }, es = (s, e) => Ae(() => s, e), ve = (s, e, t) => (r) => r.on(s, e, t), yt = (s) => ve("click", (e) => {
1337
1578
  e.preventDefault();
1338
1579
  const t = e.target;
1339
1580
  setTimeout(() => {
1340
1581
  const r = t.ownerDocument != null ? t == null ? void 0 : t.checked : void 0;
1341
1582
  r != null && s(!r);
1342
1583
  }, 0);
1343
- }), j = new Proxy(
1584
+ }), G = new Proxy(
1344
1585
  {},
1345
1586
  {
1346
1587
  /**
@@ -1348,15 +1589,15 @@ const Ge = /* @__PURE__ */ new Set([
1348
1589
  * @param fn - The function to call when the event is triggered.
1349
1590
  * @returns A `Renderable` function that adds the event listener to the element.
1350
1591
  */
1351
- get: (s, e) => (t) => ye(e, t)
1592
+ get: (s, e) => (t) => ve(e, t)
1352
1593
  }
1353
- ), Ke = (s) => (e) => {
1594
+ ), Tt = (s) => (e) => {
1354
1595
  const t = e.target;
1355
1596
  s(t.value);
1356
- }, et = (s) => (e) => {
1597
+ }, bt = (s) => (e) => {
1357
1598
  const t = e.target;
1358
1599
  s(t.valueAsNumber);
1359
- }, tt = (s) => (e) => {
1600
+ }, St = (s) => (e) => {
1360
1601
  const t = e.target;
1361
1602
  if (t.value === "")
1362
1603
  return;
@@ -1366,211 +1607,211 @@ const Ge = /* @__PURE__ */ new Set([
1366
1607
  Number(r[2].substring(0, 2))
1367
1608
  );
1368
1609
  s(n);
1369
- }, st = (s) => (e) => {
1610
+ }, _t = (s) => (e) => {
1370
1611
  const t = e.target;
1371
1612
  if (t.value === "")
1372
1613
  return;
1373
- const r = t.value.split("T"), n = r[0].split("-"), o = new Date(
1614
+ const r = t.value.split("T"), n = r[0].split("-"), i = new Date(
1374
1615
  Number(n[0]),
1375
1616
  Number(n[1]) - 1,
1376
1617
  Number(n[2])
1377
1618
  ), l = r[1].split(":");
1378
- o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), s(o);
1379
- }, Lt = (s) => (e) => {
1619
+ i.setHours(Number(l[0])), i.setMinutes(Number(l[1])), i.setSeconds(Number(l[2])), s(i);
1620
+ }, ts = (s) => (e) => {
1380
1621
  const t = e.target;
1381
1622
  s(t.checked);
1382
- }, $t = (s) => (e) => {
1623
+ }, ss = (s) => (e) => {
1383
1624
  e.preventDefault(), s();
1384
- }, Nt = (s) => (e) => {
1625
+ }, rs = (s) => (e) => {
1385
1626
  e.stopPropagation(), s();
1386
- }, Ht = (s) => (e) => {
1627
+ }, ns = (s) => (e) => {
1387
1628
  e.stopImmediatePropagation(), s();
1388
- }, It = (s, e = "input") => m(
1389
- D.valueAsDate(s),
1390
- j[e](tt(s.set))
1391
- ), Vt = (s, e = "input") => m(
1392
- D.valueAsDate(s),
1393
- j[e](st(s.set))
1394
- ), Rt = (s, e = "input") => m(
1395
- D.valueAsNumber(s),
1396
- j[e](et(s.set))
1397
- ), jt = (s, e = "input") => m(D.value(s), j[e](Ke(s.set))), qt = (s) => m(D.checked(s), Ze(s.set)), q = (s, e) => {
1629
+ }, is = (s, e = "input") => g(
1630
+ L.valueAsDate(s),
1631
+ G[e](St(s.set))
1632
+ ), os = (s, e = "input") => g(
1633
+ L.valueAsDate(s),
1634
+ G[e](_t(s.set))
1635
+ ), ls = (s, e = "input") => g(
1636
+ L.valueAsNumber(s),
1637
+ G[e](bt(s.set))
1638
+ ), cs = (s, e = "input") => g(L.value(s), G[e](Tt(s.set))), as = (s) => g(L.checked(s), yt(s.set)), z = (s, e) => {
1398
1639
  if (d.is(s))
1399
1640
  return (r) => {
1400
1641
  const n = r.makeRef();
1401
- let o, l;
1642
+ let i, l;
1402
1643
  const c = s.map((h) => Object.keys(h)[0]);
1403
1644
  let a;
1404
- const f = c.on((h) => {
1645
+ const u = c.on((h) => {
1405
1646
  if (h !== a) {
1406
- l == null || l.dispose(), o == null || o(!0), l = s.map((O) => O[h]);
1407
- const P = e[h](l);
1408
- o = u(P)(n), a = h;
1647
+ l == null || l.dispose(), i == null || i(!0), l = s.map((w) => w[h]);
1648
+ const m = e[h](l);
1649
+ i = f(m)(n), a = h;
1409
1650
  }
1410
1651
  });
1411
1652
  return (h) => {
1412
- f(), n.clear(h), o == null || o(h);
1653
+ u(), n.clear(h), i == null || i(h);
1413
1654
  };
1414
1655
  };
1415
1656
  const t = Object.keys(s)[0];
1416
- return u(e[t](R(s[t])));
1417
- }, we = (s, e, t) => q(
1657
+ return f(e[t](J(s[t])));
1658
+ }, Ee = (s, e, t) => z(
1418
1659
  p.map(s, (r) => ({ [r[e]]: r })),
1419
1660
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1420
1661
  t
1421
- ), Bt = (s, e) => we(s, "kind", e), Ft = (s, e) => {
1662
+ ), us = (s, e) => Ee(s, "kind", e), hs = (s, e) => {
1422
1663
  const t = p.map(s, ([r, n]) => ({ [r]: n }));
1423
- return q(t, e);
1424
- }, Ut = (s, e) => we(s, "type", e), rt = (s, e) => q(
1664
+ return z(t, e);
1665
+ }, fs = (s, e) => Ee(s, "type", e), wt = (s, e) => z(
1425
1666
  p.map(s, (t) => ({ [t]: !0 })),
1426
1667
  e
1427
- ), Wt = (s, e = {}) => (t) => {
1668
+ ), ds = (s, e = {}) => (t) => {
1428
1669
  const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
1429
- return rt(
1430
- t.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
1670
+ return wt(
1671
+ t.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
1431
1672
  {
1432
1673
  first: () => r,
1433
1674
  last: () => n,
1434
1675
  other: () => s
1435
1676
  }
1436
1677
  );
1437
- }, _e = (s, e) => (t) => {
1438
- const r = Object.values(s).reduce((n, o) => {
1439
- const l = t.getProvider(o);
1440
- return n[o] = l, n;
1678
+ }, Ce = (s, e) => (t) => {
1679
+ const r = Object.values(s).reduce((n, i) => {
1680
+ const l = t.getProvider(i);
1681
+ return n[i] = l, n;
1441
1682
  }, {});
1442
- return u(e(r))(t);
1443
- }, Gt = (s, e) => (t) => {
1683
+ return f(e(r))(t);
1684
+ }, ps = (s, e) => (t) => {
1444
1685
  const r = [], n = Object.entries(s).reduce(
1445
- (o, [l, c]) => (r.push(
1446
- c((a) => (Reflect.set(o, l, a), null))(t)
1447
- ), o),
1686
+ (i, [l, c]) => (r.push(
1687
+ c((a) => (Reflect.set(i, l, a), null))(t)
1688
+ ), i),
1448
1689
  {}
1449
1690
  );
1450
- return r.push(e(n)(t)), (o) => {
1451
- r.forEach((l) => l(o));
1691
+ return r.push(e(n)(t)), (i) => {
1692
+ r.forEach((l) => l(i));
1452
1693
  };
1453
- }, nt = (s, e) => _e([s], (t) => u(e(t[s]))), zt = (s, e) => _e(s, (t) => u(e(t))), Jt = (s) => (e) => s(e) ?? (() => {
1454
- }), Qt = (s) => (e) => (e.appendOrInsert(s), (t) => {
1455
- t && U(s);
1456
- }), it = (s, e, t) => {
1694
+ }, At = (s, e) => Ce([s], (t) => f(e(t[s]))), gs = (s, e) => Ce(s, (t) => f(e(t))), ms = (s) => (e) => s(e) ?? (() => {
1695
+ }), ys = (s) => (e) => (e.appendOrInsert(s), (t) => {
1696
+ t && R(s);
1697
+ }), vt = (s, e, t) => {
1457
1698
  if (d.is(s)) {
1458
1699
  const r = s;
1459
1700
  return (n) => {
1460
- const o = n.makeRef();
1701
+ const i = n.makeRef();
1461
1702
  let l = null, c = !1;
1462
- const a = L(null), f = r.on((h) => {
1463
- h == null ? (l == null || l(!0), l = u((t == null ? void 0 : t()) ?? v)(o), c = !1) : (a.value = h, c || (l == null || l(!0), l = u(e(a))(
1464
- o
1703
+ const a = N(null), u = r.on((h) => {
1704
+ h == null ? (l == null || l(!0), l = f((t == null ? void 0 : t()) ?? _)(i), c = !1) : (a.value = h, c || (l == null || l(!0), l = f(e(a))(
1705
+ i
1465
1706
  ), c = !0));
1466
1707
  });
1467
1708
  return (h) => {
1468
- f(), l == null || l(h), o.clear(h);
1709
+ u(), l == null || l(h), i.clear(h);
1469
1710
  };
1470
1711
  };
1471
1712
  } else {
1472
1713
  const r = s;
1473
1714
  if (r == null) {
1474
1715
  const n = t == null ? void 0 : t();
1475
- return n != null ? u(n) : v;
1716
+ return n != null ? f(n) : _;
1476
1717
  }
1477
- return u(e(R(r)));
1718
+ return f(e(J(r)));
1478
1719
  }
1479
- }, W = (s) => (e) => (t) => s(t, e), ve = (s, e, t) => Se(
1720
+ }, U = (s) => (e) => (t) => s(t, e), Pe = (s, e, t) => xe(
1480
1721
  s,
1481
1722
  () => e,
1482
1723
  () => t
1483
- ), Se = (s, e, t) => it(
1724
+ ), xe = (s, e, t) => vt(
1484
1725
  p.map(s, (r) => r ? !0 : null),
1485
1726
  e,
1486
1727
  t ?? void 0
1487
- ), Xt = (s, e, t) => ot(
1728
+ ), Ts = (s, e, t) => Et(
1488
1729
  s,
1489
1730
  () => e,
1490
1731
  () => t
1491
- ), ot = (s, e, t) => Se(
1732
+ ), Et = (s, e, t) => xe(
1492
1733
  p.map(s, (r) => !r),
1493
1734
  e,
1494
1735
  t
1495
- ), Pe = (s, e, t) => t != null ? Pe(s, (r) => {
1496
- const n = new M(
1736
+ ), Le = (s, e, t) => t != null ? Le(s, (r) => {
1737
+ const n = new D(
1497
1738
  r.index,
1498
- r.total.map((o) => o - 1)
1739
+ r.total.map((i) => i - 1)
1499
1740
  );
1500
- return m(
1501
- W(n.dispose),
1502
- u(e(r)),
1503
- ve(r.isLast, v, t(n))
1741
+ return g(
1742
+ U(n.dispose),
1743
+ f(e(r)),
1744
+ Pe(r.isLast, _, t(n))
1504
1745
  );
1505
1746
  }) : d.is(s) ? (r) => {
1506
- const n = r.makeRef(), o = Array.from(
1747
+ const n = r.makeRef(), i = Array.from(
1507
1748
  { length: s.value },
1508
- (a, f) => f
1509
- ).map((a) => new M(a, s)), l = o.map(
1510
- (a) => u(e(a))(n)
1749
+ (a, u) => u
1750
+ ).map((a) => new D(a, s)), l = i.map(
1751
+ (a) => f(e(a))(n)
1511
1752
  ), c = s.on((a) => {
1512
1753
  for (; a < l.length; )
1513
- o.pop().dispose(), l.pop()(!0);
1514
- for (let f = 0; f < a; f++)
1515
- if (o[f] == null) {
1516
- o[f] = new M(f, s);
1517
- const h = u(e(o[f]));
1518
- l[f] = h(n);
1754
+ i.pop().dispose(), l.pop()(!0);
1755
+ for (let u = 0; u < a; u++)
1756
+ if (i[u] == null) {
1757
+ i[u] = new D(u, s);
1758
+ const h = f(e(i[u]));
1759
+ l[u] = h(n);
1519
1760
  }
1520
1761
  });
1521
1762
  return (a) => {
1522
1763
  c(), n.clear(a);
1523
1764
  };
1524
- } : m(
1765
+ } : g(
1525
1766
  ...Array.from({ length: s }, (r, n) => n).map(
1526
- (r) => u(e(new M(r, R(s))))
1767
+ (r) => f(e(new D(r, J(s))))
1527
1768
  )
1528
- ), lt = (s, e, t) => {
1769
+ ), Ct = (s, e, t) => {
1529
1770
  if (t != null)
1530
- return lt(s, (r, n) => {
1531
- const o = new M(
1771
+ return Ct(s, (r, n) => {
1772
+ const i = new D(
1532
1773
  n.index,
1533
1774
  n.total.map((l) => l - 1)
1534
1775
  );
1535
- return m([
1536
- W(o.dispose),
1537
- u(e(r, n)),
1538
- ve(n.isLast, v, t(o))
1776
+ return g([
1777
+ U(i.dispose),
1778
+ f(e(r, n)),
1779
+ Pe(n.isLast, _, t(i))
1539
1780
  ]);
1540
1781
  });
1541
1782
  {
1542
- const r = p.map(s, (o) => o.length), n = p.toSignal(s);
1543
- return Pe(r, (o) => {
1544
- const l = n.map((c) => c[o.index]);
1545
- return m(
1546
- W(l.dispose),
1547
- u(e(l, o))
1783
+ const r = p.map(s, (i) => i.length), n = p.toSignal(s);
1784
+ return Le(r, (i) => {
1785
+ const l = n.map((c) => c[i.index]);
1786
+ return g(
1787
+ U(l.dispose),
1788
+ f(e(l, i))
1548
1789
  );
1549
1790
  });
1550
1791
  }
1551
- }, ct = (s) => (e) => e.isBrowserDOM() ? s(e) ?? (() => {
1792
+ }, Pt = (s) => (e) => e.isBrowserDOM() ? s(e) ?? (() => {
1552
1793
  }) : () => {
1553
- }, Yt = (s) => (e) => e.isHeadlessDOM() ? s(e) ?? (() => {
1794
+ }, bs = (s) => (e) => e.isHeadlessDOM() ? s(e) ?? (() => {
1554
1795
  }) : () => {
1555
- }, Zt = (s) => ct((e) => s(e.element) ?? (() => {
1556
- })), Kt = (s, e) => {
1796
+ }, Ss = (s) => Pt((e) => s(e.element) ?? (() => {
1797
+ })), _s = (s, e) => {
1557
1798
  if (d.is(s)) {
1558
1799
  const t = s;
1559
1800
  return (r) => {
1560
1801
  r = r.makeRef();
1561
- const n = t.map((c) => u(e(c)));
1562
- let o = () => {
1802
+ const n = t.map((c) => f(e(c)));
1803
+ let i = () => {
1563
1804
  };
1564
1805
  const l = n.on((c) => {
1565
- o(!0), o = c(r);
1806
+ i(!0), i = c(r);
1566
1807
  });
1567
1808
  return (c) => {
1568
- l(), o(c);
1809
+ l(), i(c);
1569
1810
  };
1570
1811
  };
1571
1812
  }
1572
- return u(e(s));
1573
- }, es = (s, e, t = () => v) => q(
1813
+ return f(e(s));
1814
+ }, ws = (s, e, t = () => _) => z(
1574
1815
  p.map(
1575
1816
  s,
1576
1817
  (r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
@@ -1579,59 +1820,52 @@ const Ge = /* @__PURE__ */ new Set([
1579
1820
  notEmpty: (r) => e(r),
1580
1821
  whenEmpty: () => t()
1581
1822
  }
1582
- ), z = (s, e) => {
1583
- const t = s(e);
1584
- return () => t(!0);
1585
- }, ts = (s, e, { doc: t, clear: r } = {}) => {
1586
- const n = typeof e == "string" ? (t ?? document).querySelector(e) : e;
1587
- if (n === null)
1588
- throw new at(
1589
- `Cannot find element by selector for render: ${e}`
1590
- );
1591
- r !== !1 && (t ?? n.ownerDocument) != null && n.nodeType === 1 && (n.innerHTML = "");
1592
- const o = je(n), l = le(n) ? void 0 : n, c = b.of(o, l);
1593
- return z(s, c);
1594
- }, ss = (s, e) => {
1595
- const t = L(e), r = new he(":root", void 0), n = new E(r, void 0, { currentURL: t }, {});
1596
- return {
1597
- clear: z(s, n),
1598
- root: r,
1599
- currentURL: t
1600
- };
1601
- };
1602
- class at extends Error {
1603
- constructor(e) {
1604
- super(e);
1605
- }
1606
- }
1607
- const rs = (s, e) => (t) => {
1823
+ ), As = (s, e) => (t) => {
1608
1824
  const r = t.makePortal(s);
1609
- return z(u(e), r);
1610
- }, ut = (s) => Symbol(s), Ce = (s, e) => (t) => u(e)(t.withProviders(s)), ns = (...s) => s.length > 0 ? s.reduceRight((e, t) => (r) => e(t(r))) : u, ht = (s, e, t) => Ce({ [s]: e }, u(t)), is = (s, e) => Ce(s, u(e)), xe = ut("Probe"), S = /* @__PURE__ */ new Map(), ft = (s, e, t) => {
1611
- if (S.has(s))
1825
+ return Z(f(e), r);
1826
+ }, xt = (s) => Symbol(s), Oe = (s, e) => (t) => f(e)(t.withProviders(s)), vs = (...s) => s.length > 0 ? s.reduceRight((e, t) => (r) => e(t(r))) : f, Lt = (s, e, t) => Oe({ [s]: e }, f(t)), Es = (s, e) => Oe(s, f(e)), De = xt("Probe"), E = /* @__PURE__ */ new Map(), Ot = ({
1827
+ identifier: s,
1828
+ callback: e = () => {
1829
+ },
1830
+ child: t,
1831
+ timeout: r = 10
1832
+ }) => {
1833
+ if (E.has(s))
1612
1834
  throw new Error(`Probe already exists: ${s.description}`);
1613
- return S.set(s, 0), ht(xe, (n) => {
1614
- let o = S.get(n);
1615
- if (o == null)
1616
- throw new Error(`Probe not found: ${n.description}`);
1617
- --o === 0 ? (e(), S.delete(n)) : S.set(n, o);
1618
- }, t);
1619
- }, dt = (s, e) => nt(xe, (t) => {
1620
- const r = S.get(s);
1621
- if (r == null)
1622
- throw new Error(`Probe not found: ${s.description}`);
1623
- return S.set(s, r + 1), e(() => t(s));
1624
- }), Te = Symbol("globalProbe"), os = (s, e) => ft(Te, s, e), ls = (s) => dt(Te, s), pt = (s, e) => (t) => {
1835
+ const n = setTimeout(() => e("timeout"), r);
1836
+ E.set(s, {
1837
+ counter: 0,
1838
+ timeoutId: n
1839
+ });
1840
+ const i = (l) => {
1841
+ clearTimeout(n);
1842
+ const c = E.get(l);
1843
+ if (c == null)
1844
+ throw new Error(`Probe not found: ${l.description}`);
1845
+ --c.counter === 0 ? (e("resolved"), E.delete(l)) : E.set(l, c);
1846
+ };
1847
+ return g(
1848
+ U(() => clearTimeout(n)),
1849
+ Lt(De, i, t)
1850
+ );
1851
+ }, Dt = (s, e) => At(De, (t) => {
1852
+ const r = E.get(s);
1853
+ return r == null ? e(() => {
1854
+ }) : (clearTimeout(r.timeoutId), r.counter++, e(() => t(s)));
1855
+ }), Me = Symbol("globalProbe"), Cs = ({
1856
+ callback: s,
1857
+ timeout: e
1858
+ }, t) => Ot({ identifier: Me, callback: s, child: t, timeout: e }), Ps = (s) => Dt(Me, s), Mt = (s, e) => (t) => {
1625
1859
  const r = t.getStyle(s);
1626
1860
  return t.setStyle(s, e), (n) => {
1627
1861
  n && t.setStyle(s, r);
1628
1862
  };
1629
- }, gt = (s, e) => (t) => {
1863
+ }, Ht = (s, e) => (t) => {
1630
1864
  const r = t.getStyle(s);
1631
1865
  return e.on((n) => t.setStyle(s, n)), (n) => {
1632
1866
  n && t.setStyle(s, r);
1633
1867
  };
1634
- }, cs = new Proxy(
1868
+ }, xs = new Proxy(
1635
1869
  {},
1636
1870
  {
1637
1871
  /**
@@ -1642,117 +1876,121 @@ const rs = (s, e) => (t) => {
1642
1876
  * @returns The renderable component for the specified attribute.
1643
1877
  *
1644
1878
  */
1645
- get: (s, e) => (t) => d.is(t) ? gt(e, t) : pt(e, t)
1879
+ get: (s, e) => (t) => d.is(t) ? Ht(e, t) : Mt(e, t)
1646
1880
  }
1647
1881
  );
1648
1882
  export {
1649
- kt as Async,
1650
- qt as BindChecked,
1651
- It as BindDate,
1652
- Vt as BindDateTime,
1653
- Rt as BindNumber,
1654
- jt as BindText,
1655
- b as BrowserContext,
1656
- T as Computed,
1657
- Wt as Conjunction,
1658
- Qt as DOMNode,
1659
- pe as El,
1660
- ge as ElNS,
1661
- M as ElementPosition,
1662
- v as Empty,
1663
- it as Ensure,
1664
- lt as ForEach,
1665
- m as Fragment,
1666
- E as HeadlessContext,
1667
- Ue as HeadlessElement,
1668
- he as HeadlessPortal,
1669
- We as HeadlessText,
1670
- ot as LazyUnless,
1671
- Se as LazyWhen,
1672
- Kt as MapSignal,
1673
- te as MemoryStore,
1674
- es as NotEmpty,
1675
- ct as OnBrowserCtx,
1676
- Ze as OnChecked,
1677
- Jt as OnCtx,
1678
- W as OnDispose,
1679
- Zt as OnElement,
1680
- Yt as OnHeadlessCtx,
1681
- q as OneOf,
1682
- we as OneOfField,
1683
- Bt as OneOfKind,
1684
- Ft as OneOfTuple,
1685
- Ut as OneOfType,
1686
- rt as OneOfValue,
1687
- rs as Portal,
1688
- I as Prop,
1689
- ns as Provide,
1690
- os as ProvideGlobalProbe,
1691
- ft as ProvideProbe,
1692
- ce as ProviderNotFoundError,
1693
- at as RenderingError,
1694
- Pe as Repeat,
1883
+ es as Async,
1884
+ as as BindChecked,
1885
+ is as BindDate,
1886
+ os as BindDateTime,
1887
+ ls as BindNumber,
1888
+ cs as BindText,
1889
+ P as BrowserContext,
1890
+ j as CLASS_PLACEHOLDER_ATTR,
1891
+ C as Computed,
1892
+ ds as Conjunction,
1893
+ ys as DOMNode,
1894
+ _e as El,
1895
+ we as ElNS,
1896
+ D as ElementPosition,
1897
+ _ as Empty,
1898
+ vt as Ensure,
1899
+ Ct as ForEach,
1900
+ g as Fragment,
1901
+ Ft as HeadlessAdapter,
1902
+ x as HeadlessContext,
1903
+ at as HeadlessElement,
1904
+ Te as HeadlessPortal,
1905
+ ut as HeadlessText,
1906
+ Et as LazyUnless,
1907
+ xe as LazyWhen,
1908
+ _s as MapSignal,
1909
+ oe as MemoryStore,
1910
+ ws as NotEmpty,
1911
+ Pt as OnBrowserCtx,
1912
+ yt as OnChecked,
1913
+ ms as OnCtx,
1914
+ U as OnDispose,
1915
+ Ss as OnElement,
1916
+ bs as OnHeadlessCtx,
1917
+ z as OneOf,
1918
+ Ee as OneOfField,
1919
+ us as OneOfKind,
1920
+ hs as OneOfTuple,
1921
+ fs as OneOfType,
1922
+ wt as OneOfValue,
1923
+ As as Portal,
1924
+ k as Prop,
1925
+ vs as Provide,
1926
+ Cs as ProvideGlobalProbe,
1927
+ Ot as ProvideProbe,
1928
+ de as ProviderNotFoundError,
1929
+ ze as RenderingError,
1930
+ Le as Repeat,
1695
1931
  d as Signal,
1696
- me as Task,
1697
- Ct as TextNode,
1698
- Xt as Unless,
1699
- Gt as Use,
1700
- ls as UseGlobalProbe,
1701
- dt as UseProbe,
1702
- nt as UseProvider,
1703
- zt as UseProviders,
1932
+ Ae as Task,
1933
+ Wt as TextNode,
1934
+ Ts as Unless,
1935
+ ps as Use,
1936
+ Ps as UseGlobalProbe,
1937
+ Dt as UseProbe,
1938
+ At as UseProvider,
1939
+ gs as UseProviders,
1704
1940
  p as Value,
1705
- ve as When,
1706
- ht as WithProvider,
1707
- is as WithProviders,
1708
- je as _getSelfOrParentElement,
1709
- le as _isElement,
1710
- Re as _makeGetter,
1711
- Ve as _makeSetter,
1712
- U as _removeDOMNode,
1713
- de as _signalText,
1714
- fe as _staticText,
1715
- St as animateSignal,
1716
- Ie as animateSignals,
1717
- Tt as aria,
1718
- D as attr,
1719
- xt as dataAttr,
1720
- Lt as emitChecked,
1721
- $t as emitPreventDefault,
1722
- Ht as emitStopImmediatePropagation,
1723
- Nt as emitStopPropagation,
1724
- Ke as emitValue,
1725
- tt as emitValueAsDate,
1726
- st as emitValueAsDateTime,
1727
- et as emitValueAsNumber,
1728
- Le as endInterpolate,
1729
- ee as getWindow,
1730
- $e as guessInterpolate,
1731
- Dt as html,
1732
- Ot as input,
1733
- ke as interpolateDate,
1734
- Ae as interpolateNumber,
1735
- Me as interpolateString,
1736
- _t as localStorageProp,
1737
- G as makeComputed,
1738
- yt as makeComputedOf,
1739
- Pt as makeComputedRecord,
1740
- He as makeEffect,
1741
- wt as makeEffectOf,
1742
- L as makeProp,
1743
- ut as makeProviderMark,
1744
- R as makeSignal,
1745
- Mt as math,
1746
- Et as mathAttr,
1747
- j as on,
1748
- xe as probeMarker,
1749
- ts as render,
1750
- z as renderWithContext,
1751
- u as renderableOfTNode,
1752
- ss as runHeadless,
1753
- vt as sessionStorageProp,
1754
- se as storedProp,
1755
- cs as style,
1756
- At as svg,
1757
- bt as svgAttr
1941
+ Pe as When,
1942
+ Lt as WithProvider,
1943
+ Es as WithProviders,
1944
+ pe as _NODE_PLACEHOLDER_ATTR,
1945
+ Ge as _getSelfOrParentElement,
1946
+ fe as _isElement,
1947
+ Je as _makeGetter,
1948
+ We as _makeSetter,
1949
+ R as _removeDOMNode,
1950
+ Se as _signalText,
1951
+ be as _staticText,
1952
+ jt as animateSignal,
1953
+ Ue as animateSignals,
1954
+ Gt as aria,
1955
+ L as attr,
1956
+ Jt as dataAttr,
1957
+ ts as emitChecked,
1958
+ ss as emitPreventDefault,
1959
+ ns as emitStopImmediatePropagation,
1960
+ rs as emitStopPropagation,
1961
+ Tt as emitValue,
1962
+ St as emitValueAsDate,
1963
+ _t as emitValueAsDateTime,
1964
+ bt as emitValueAsNumber,
1965
+ qe as endInterpolate,
1966
+ ie as getWindow,
1967
+ Ve as guessInterpolate,
1968
+ Yt as html,
1969
+ Qt as input,
1970
+ je as interpolateDate,
1971
+ Ne as interpolateNumber,
1972
+ Re as interpolateString,
1973
+ Nt as localStorageProp,
1974
+ Q as makeComputed,
1975
+ It as makeComputedOf,
1976
+ qt as makeComputedRecord,
1977
+ Fe as makeEffect,
1978
+ kt as makeEffectOf,
1979
+ N as makeProp,
1980
+ xt as makeProviderMark,
1981
+ J as makeSignal,
1982
+ Kt as math,
1983
+ Xt as mathAttr,
1984
+ G as on,
1985
+ De as probeMarker,
1986
+ Vt as render,
1987
+ Z as renderWithContext,
1988
+ f as renderableOfTNode,
1989
+ Ut as restoreTempoPlaceholders,
1990
+ Bt as runHeadless,
1991
+ Rt as sessionStorageProp,
1992
+ le as storedProp,
1993
+ xs as style,
1994
+ Zt as svg,
1995
+ zt as svgAttr
1758
1996
  };