@tempots/dom 26.11.0 → 28.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,24 +1,24 @@
1
1
  var Oe = Object.defineProperty;
2
- var se = (s) => {
2
+ var re = (s) => {
3
3
  throw TypeError(s);
4
4
  };
5
5
  var He = (s, e, t) => e in s ? Oe(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
6
- var i = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t), re = (s, e, t) => e.has(s) || se("Cannot " + t);
7
- var X = (s, e, t) => (re(s, e, "read from private field"), t ? t.call(s) : e.get(s)), ne = (s, e, t) => e.has(s) ? se("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), ie = (s, e, t, r) => (re(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 $e = (s, e, t) => {
6
+ var o = (s, e, t) => He(s, typeof e != "symbol" ? e + "" : e, t), ne = (s, e, t) => e.has(s) || re("Cannot " + t);
7
+ var I = (s, e, t) => (ne(s, e, "read from private field"), t ? t.call(s) : e.get(s)), ie = (s, e, t) => e.has(s) ? re("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), z = (s, e, t, r) => (ne(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t);
8
+ const $e = (s, e, t) => s + (e - s) * t;
9
+ const ke = (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), Ie = (s, e) => e, Re = (s) => typeof s == "number" ? Ne : typeof s == "string" ? $e : s instanceof Date ? ke : Ie;
20
- var D;
21
- class Y {
19
+ }, Ne = (s, e, t) => new Date(s.getTime() + (e.getTime() - s.getTime()) * t), Ie = (s, e) => e, Re = (s) => typeof s == "number" ? $e : typeof s == "string" ? ke : s instanceof Date ? Ne : Ie;
20
+ var w;
21
+ class Q {
22
22
  /**
23
23
  * Creates a new instance of `ElementPosition`.
24
24
  * @param index - The index of the element.
@@ -28,25 +28,26 @@ class Y {
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
- ne(this, D);
48
- i(this, "dispose", () => {
49
- this.total.dispose();
46
+ o(this, "isOdd");
47
+ ie(this, w);
48
+ o(this, "dispose", () => {
49
+ var e;
50
+ (e = I(this, w)) == null || e.dispose(), z(this, w, void 0);
50
51
  });
51
52
  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
53
  }
@@ -55,11 +56,11 @@ class Y {
55
56
  * @returns `true` if the element is the last element, `false` otherwise.
56
57
  */
57
58
  get isLast() {
58
- return X(this, D) == null && ie(this, D, this.total.map((e) => this.counter === e)), X(this, D);
59
+ return I(this, w) == null && z(this, w, this.total.map((e) => this.counter === e)), I(this, w);
59
60
  }
60
61
  }
61
- D = new WeakMap();
62
- const O = class O {
62
+ w = new WeakMap();
63
+ const H = class H {
63
64
  /**
64
65
  * Represents a signal with a value of type T.
65
66
  *
@@ -71,33 +72,33 @@ const O = class O {
71
72
  /**
72
73
  * @internal
73
74
  */
74
- i(this, "$__signal__", !0);
75
+ o(this, "$__signal__", !0);
75
76
  /**
76
77
  * @internal
77
78
  */
78
- i(this, "_value");
79
+ o(this, "_value");
79
80
  /**
80
81
  * @internal
81
82
  */
82
- i(this, "_derivatives", []);
83
+ o(this, "_derivatives", []);
83
84
  /**
84
85
  * @internal
85
86
  */
86
- i(this, "_onValueListeners", []);
87
+ o(this, "_onValueListeners", []);
87
88
  /**
88
89
  * @internal
89
90
  */
90
- i(this, "_onDisposeListeners", []);
91
+ o(this, "_onDisposeListeners", []);
91
92
  /**
92
93
  * Gets the current value of the signal.
93
94
  * @returns The current value of the signal.
94
95
  */
95
- i(this, "get", () => this._value);
96
+ o(this, "get", () => this._value);
96
97
  /**
97
98
  * Checks if the signal has any registered listeners.
98
99
  * @returns `true` if the signal has listeners, `false` otherwise.
99
100
  */
100
- i(this, "hasListeners", () => this._onValueListeners.length > 0);
101
+ o(this, "hasListeners", () => this._onValueListeners.length > 0);
101
102
  /**
102
103
  * Registers a listener function to be called whenever the value of the signal changes.
103
104
  * The listener function will be immediately called with the current value of the signal.
@@ -106,10 +107,10 @@ const O = class O {
106
107
  * @param listener - The listener function to be called when the value of the signal changes.
107
108
  * @param options - Options for the listener.
108
109
  */
109
- i(this, "on", (e, t = {}) => {
110
+ o(this, "on", (e, t = {}) => {
110
111
  t.skipInitial || e(this.get(), void 0);
111
- const r = t.once ? (o, l) => {
112
- n(), e(o, l);
112
+ const r = t.once ? (i, l) => {
113
+ n(), e(i, l);
113
114
  } : e;
114
115
  this._onValueListeners.push(r);
115
116
  const n = () => {
@@ -123,45 +124,86 @@ const O = class O {
123
124
  /**
124
125
  * @internal
125
126
  */
126
- i(this, "_setAndNotify", (e, t) => {
127
+ o(this, "_setAndNotify", (e, t) => {
127
128
  if (this._disposed) return;
128
129
  const r = this._value, n = this.equals(r, e);
129
- n || (this._value = e), (t || !n) && this._onValueListeners.forEach((o) => o(e, r));
130
+ n || (this._value = e), (t || !n) && this._onValueListeners.forEach((i) => i(e, r));
130
131
  });
131
132
  /**
132
133
  * @internal
133
134
  */
134
- i(this, "_disposed", !1);
135
+ o(this, "_disposed", !1);
135
136
  /**
136
137
  * Checks whether the signal is disposed.
137
138
  * @returns True if the signal is disposed, false otherwise.
138
139
  */
139
- i(this, "isDisposed", () => this._disposed);
140
+ o(this, "isDisposed", () => this._disposed);
140
141
  /**
141
142
  * Adds a listener function to be called when the object is disposed.
142
143
  * @param listener - The listener function to be called when the object is disposed.
143
144
  * @returns A function that can be called to remove the listener.
144
145
  */
145
- i(this, "onDispose", (e) => {
146
+ o(this, "onDispose", (e) => {
146
147
  this._onDisposeListeners.push(e);
147
148
  });
148
149
  /**
149
150
  * Disposes the signal, releasing any resources associated with it.
150
151
  */
151
- i(this, "dispose", () => {
152
+ o(this, "dispose", () => {
152
153
  this._disposed || (this._disposed = !0, this._onDisposeListeners.forEach((e) => e()), this._onDisposeListeners.length = 0, this._derivatives.length = 0);
153
154
  });
154
155
  /**
155
- * Returns a new Computed instance that applies the given mapping function to the value of this Signal.
156
- * The mapping function is called whenever the value of this Signal changes.
156
+ * Creates a new computed signal by applying a transformation function to this signal's value.
157
157
  *
158
- * @typeParam O - The type of the mapped value.
159
- * @param fn - The mapping function to apply to the value of this Signal.
160
- * @param equals - Optional equality function to determine if two mapped values are equal.
161
- * @returns - A new Computed instance with the mapped value.
158
+ * The `map` method is one of the most commonly used signal operations. It creates a new
159
+ * computed signal that automatically updates whenever the source signal changes. The
160
+ * transformation function is called with the current value and should return the new value.
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const count = prop(5)
165
+ *
166
+ * // Transform to different types
167
+ * const doubled = count.map(n => n * 2)
168
+ * const message = count.map(n => `Count is ${n}`)
169
+ * const isEven = count.map(n => n % 2 === 0)
170
+ *
171
+ * // Use in UI
172
+ * html.div(
173
+ * html.div('Original: ', count.map(String)),
174
+ * html.div('Doubled: ', doubled.map(String)),
175
+ * html.div('Message: ', message),
176
+ * html.div('Is even: ', isEven.map(String))
177
+ * )
178
+ * ```
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * // Chain multiple transformations
183
+ * const user = prop({ name: 'John', age: 30 })
184
+ * const greeting = user
185
+ * .map(u => u.name)
186
+ * .map(name => name.toUpperCase())
187
+ * .map(name => `Hello, ${name}!`)
188
+ * ```
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * // With custom equality function for objects
193
+ * const items = prop([{ id: 1, name: 'Item 1' }])
194
+ * const itemNames = items.map(
195
+ * items => items.map(item => item.name),
196
+ * (a, b) => JSON.stringify(a) === JSON.stringify(b) // deep equality
197
+ * )
198
+ * ```
199
+ *
200
+ * @typeParam O - The type of the transformed value
201
+ * @param fn - Function that transforms the signal's value to a new value
202
+ * @param equals - Optional function to determine if two transformed values are equal (defaults to strict equality)
203
+ * @returns A new computed signal with the transformed value
162
204
  */
163
- i(this, "map", (e, t = (r, n) => r === n) => {
164
- const r = new x(() => {
205
+ o(this, "map", (e, t = (r, n) => r === n) => {
206
+ const r = new P(() => {
165
207
  try {
166
208
  return e(this.get());
167
209
  } catch (n) {
@@ -180,8 +222,8 @@ const O = class O {
180
222
  * Defaults to a strict equality check (===).
181
223
  * @returns A new Signal that emits the values of the resulting Signal.
182
224
  */
183
- i(this, "flatMap", (e, t = (r, n) => r === n) => {
184
- const r = new x(() => {
225
+ o(this, "flatMap", (e, t = (r, n) => r === n) => {
226
+ const r = new P(() => {
185
227
  try {
186
228
  return e(this.get()).get();
187
229
  } catch (n) {
@@ -196,26 +238,26 @@ const O = class O {
196
238
  * @param fn - The callback function to be invoked with the current value of the signal.
197
239
  * @returns A new signal that emits the same value as the original signal and invokes the callback function.
198
240
  */
199
- i(this, "tap", (e) => this.map((t) => (e(t), t)));
241
+ o(this, "tap", (e) => this.map((t) => (e(t), t)));
200
242
  /**
201
243
  * Returns a new Signal that emits the value at the specified key of the current value.
202
244
  *
203
245
  * @param key - The key of the value to retrieve.
204
246
  * @returns A new Signal that emits the value at the specified key.
205
247
  */
206
- i(this, "at", (e) => this.map((t) => t[e]));
248
+ o(this, "at", (e) => this.map((t) => t[e]));
207
249
  /**
208
250
  * @internal
209
251
  */
210
- i(this, "_$");
211
- i(this, "filter", (e, t) => {
252
+ o(this, "_$");
253
+ o(this, "filter", (e, t) => {
212
254
  let r = t ?? this.get();
213
- const n = new x(() => {
255
+ const n = new P(() => {
214
256
  try {
215
- const o = this.get();
216
- return r = e(o) ? o : r;
217
- } catch (o) {
218
- throw console.error("Error in Signal.filter:", o), o;
257
+ const i = this.get();
258
+ return r = e(i) ? i : r;
259
+ } catch (i) {
260
+ throw console.error("Error in Signal.filter:", i), i;
219
261
  }
220
262
  }, this.equals);
221
263
  return this.setDerivative(n), n;
@@ -230,9 +272,9 @@ const O = class O {
230
272
  * @param equals - Optional equality function to determine if two values are equal.
231
273
  * @returns - A new Computed object with the mapped and filtered values.
232
274
  */
233
- i(this, "filterMap", (e, t, r = (n, o) => n === o) => {
275
+ o(this, "filterMap", (e, t, r = (n, i) => n === i) => {
234
276
  let n = t;
235
- const o = new x(() => {
277
+ const i = new P(() => {
236
278
  try {
237
279
  const l = this.get(), c = e(l);
238
280
  return n = c ?? n;
@@ -240,7 +282,7 @@ const O = class O {
240
282
  throw console.error("Error in Signal.filterMap:", l), l;
241
283
  }
242
284
  }, r);
243
- return this.setDerivative(o), o;
285
+ return this.setDerivative(i), i;
244
286
  });
245
287
  /**
246
288
  * Maps the values emitted by the signal to a new value asynchronously using the provided function.
@@ -255,25 +297,25 @@ const O = class O {
255
297
  * @param equals - The equality function to compare the mapped values for equality.
256
298
  * @returns A property that holds the mapped value and can be observed for changes.
257
299
  */
258
- i(this, "mapAsync", (e, t, r, n = (o, l) => o === l) => {
259
- const o = w(t, n);
300
+ o(this, "mapAsync", (e, t, r, n = (i, l) => i === l) => {
301
+ const i = E(t, n);
260
302
  let l = 0, c = new AbortController();
261
- return o.onDispose(
303
+ return i.onDispose(
262
304
  this.on(async (a) => {
263
305
  const u = ++l;
264
306
  c.abort(), c = new AbortController();
265
307
  try {
266
308
  const h = await e(a, { abortSignal: c.signal });
267
- u === l && o.set(h);
309
+ u === l && i.set(h);
268
310
  } catch (h) {
269
311
  if (u === l)
270
312
  if (r != null)
271
- o.set(r(h));
313
+ i.set(r(h));
272
314
  else
273
315
  throw h;
274
316
  }
275
317
  })
276
- ), o;
318
+ ), i;
277
319
  });
278
320
  /**
279
321
  * Maps the values of the signal using the provided function `fn`, and returns a new signal
@@ -285,14 +327,14 @@ const O = class O {
285
327
  * @param alt - The alternative value to use when the mapped value is `undefined` or `null`.
286
328
  * @returns A new signal containing the mapped values.
287
329
  */
288
- i(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
330
+ o(this, "mapMaybe", (e, t) => this.map((r) => e(r) ?? t));
289
331
  /**
290
332
  * Feeds a property into the signal and sets up disposal behavior.
291
333
  * @param prop - The property to feed into the signal.
292
334
  * @param autoDisposeProp - Determines whether the property should be automatically disposed when the signal is disposed.
293
335
  * @returns The input property.
294
336
  */
295
- i(this, "feedProp", (e, t = !1) => {
337
+ o(this, "feedProp", (e, t = !1) => {
296
338
  const r = this.on(e.set);
297
339
  return e.onDispose(r), t ? this.onDispose(e.dispose) : this.onDispose(r), e;
298
340
  });
@@ -303,20 +345,20 @@ const O = class O {
303
345
  * @param options.equals - A function that determines if two values are equal.
304
346
  * @returns The derived property.
305
347
  */
306
- i(this, "deriveProp", ({
348
+ o(this, "deriveProp", ({
307
349
  autoDisposeProp: e = !0,
308
350
  equals: t
309
- } = {}) => this.feedProp(w(this.get(), t), e));
351
+ } = {}) => this.feedProp(E(this.get(), t), e));
310
352
  /**
311
353
  * Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
312
354
  * @returns A new signal that emits the same values as the current signal.
313
355
  */
314
- i(this, "derive", () => this.map((e) => e));
356
+ o(this, "derive", () => this.map((e) => e));
315
357
  /**
316
358
  * Returns a signal that emits the count of values received so far.
317
359
  * @returns A signal that emits the count of values received so far.
318
360
  */
319
- i(this, "count", () => {
361
+ o(this, "count", () => {
320
362
  let e = 0;
321
363
  return this.map(() => ++e);
322
364
  });
@@ -326,7 +368,7 @@ const O = class O {
326
368
  * Additionally, when the computed value is disposed, it sets the signal as dirty.
327
369
  * @param computed - The computed value to add as a derivative.
328
370
  */
329
- i(this, "setDerivative", (e) => {
371
+ o(this, "setDerivative", (e) => {
330
372
  this._derivatives.push(e), e.onDispose(() => {
331
373
  this._derivatives.splice(
332
374
  this._derivatives.indexOf(e),
@@ -354,36 +396,67 @@ const O = class O {
354
396
  }
355
397
  };
356
398
  /**
357
- * Creates a Signal that holds the result of a Promise.
399
+ * Creates a Signal that holds the result of a Promise, with proper error handling.
400
+ *
401
+ * This static method creates a signal that starts with an initial value and updates
402
+ * when the promise resolves. If the promise rejects, an optional recovery function
403
+ * can provide a fallback value.
404
+ *
405
+ * @example
406
+ * ```typescript
407
+ * // Basic usage with API call
408
+ * const userData = Signal.ofPromise(
409
+ * fetch('/api/user').then(r => r.json()),
410
+ * { loading: true }, // initial state
411
+ * error => ({ error: error.message, loading: false }) // error recovery
412
+ * )
413
+ *
414
+ * // Use in UI
415
+ * Ensure(userData,
416
+ * (user) => html.div('Welcome, ', user.map(u => u.name)),
417
+ * () => html.div('Loading...')
418
+ * )
419
+ * ```
358
420
  *
359
- * @typeParam O - The type of the value returned by the Promise.
360
- * @param promise - The Promise to use to feed the Signal.
361
- * @param init - The initial value of the Signal before the Promise resolves.
362
- * @param recover - A function to recover from Promise rejection and provide an alternative value for the Signal.
363
- * @param equals - A function to compare two values of type O for equality. Defaults to strict equality (===).
364
- * @returns - A Signal that represents the result of the Promise.
421
+ * @example
422
+ * ```typescript
423
+ * // With custom equality function
424
+ * const config = Signal.ofPromise(
425
+ * loadConfig(),
426
+ * {},
427
+ * () => ({}),
428
+ * (a, b) => JSON.stringify(a) === JSON.stringify(b) // deep equality
429
+ * )
430
+ * ```
431
+ *
432
+ * @typeParam O - The type of the value returned by the Promise
433
+ * @param promise - The Promise to use to feed the Signal
434
+ * @param init - The initial value of the Signal before the Promise resolves
435
+ * @param recover - Optional function to recover from Promise rejection and provide an alternative value
436
+ * @param equals - Function to compare two values for equality (defaults to strict equality)
437
+ * @returns A Signal that represents the result of the Promise
365
438
  */
366
- i(O, "ofPromise", (e, t, r, n = (o, l) => o === l) => {
367
- const o = new O(t, n);
368
- return e.then((l) => o._setAndNotify(l, !1)).catch((l) => {
369
- r != null ? o._setAndNotify(r(l), !1) : console.error(
439
+ o(H, "ofPromise", (e, t, r, n = (i, l) => i === l) => {
440
+ const i = new H(t, n);
441
+ return e.then((l) => i._setAndNotify(l, !1)).catch((l) => {
442
+ r != null ? i._setAndNotify(r(l), !1) : console.error(
370
443
  "Unhandled promise rejection in Signal.ofPromise:",
371
444
  l
372
445
  );
373
- }), o;
446
+ }), i;
374
447
  }), /**
375
448
  * Checks if a value is a Signal.
376
449
  *
377
450
  * @param value - The value to check.
378
451
  * @returns `true` if the value is a Signal, `false` otherwise.
379
452
  */
380
- i(O, "is", (e) => (
453
+ o(H, "is", (e) => (
381
454
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
382
455
  e != null && e.$__signal__ === !0
383
456
  ));
384
- let d = O;
457
+ let d = H;
385
458
  const Ve = typeof queueMicrotask == "function" ? queueMicrotask : (s) => Promise.resolve().then(s);
386
- class x extends d {
459
+ class P extends d {
387
460
  /**
388
461
  * Represents a Signal object.
389
462
  * @param _fn - The function that returns the value of the signal.
@@ -394,36 +467,36 @@ class x extends d {
394
467
  /**
395
468
  * @internal
396
469
  */
397
- i(this, "$__computed__", !0);
470
+ o(this, "$__computed__", !0);
398
471
  /**
399
472
  * @internal
400
473
  */
401
- i(this, "_isDirty", !1);
474
+ o(this, "_isDirty", !1);
402
475
  /**
403
476
  * Marks the signal as dirty, indicating that its value has changed and needs to be recalculated.
404
477
  * If the signal is already dirty or disposed, this method does nothing.
405
478
  * It also marks all dependent signals as dirty and schedules a notification to update their values.
406
479
  */
407
- i(this, "setDirty", () => {
480
+ o(this, "setDirty", () => {
408
481
  this._isDirty || this._disposed || (this._isDirty = !0, this._derivatives.forEach((t) => t.setDirty()), this._scheduleNotify());
409
482
  });
410
483
  /**
411
484
  * @internal
412
485
  */
413
- i(this, "_scheduleCount", 0);
486
+ o(this, "_scheduleCount", 0);
414
487
  /**
415
488
  * Schedules a notification to be executed asynchronously.
416
489
  * If the signal is dirty, it will be updated and notified.
417
490
  * @internal
418
491
  */
419
- i(this, "_scheduleNotify", () => {
492
+ o(this, "_scheduleNotify", () => {
420
493
  const t = ++this._scheduleCount;
421
494
  Ve(() => {
422
495
  this._scheduleCount !== t || this._disposed || this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !1));
423
496
  });
424
497
  });
425
498
  /** {@inheritDoc Signal.get} */
426
- i(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !0)), this._value));
499
+ o(this, "get", () => (this._isDirty && (this._isDirty = !1, this._setAndNotify(this._fn(), !0)), this._value));
427
500
  this._fn = t, this.setDirty();
428
501
  }
429
502
  /**
@@ -440,26 +513,26 @@ class x extends d {
440
513
  return this.get();
441
514
  }
442
515
  }
443
- const W = class W extends d {
516
+ const J = class J extends d {
444
517
  constructor() {
445
518
  super(...arguments);
446
519
  /**
447
520
  * @internal
448
521
  */
449
- i(this, "$__prop__", !0);
522
+ o(this, "$__prop__", !0);
450
523
  /**
451
524
  * Changes the value of the property and notifies its listeners.
452
525
  *
453
526
  * @param value - The new value of the property.
454
527
  */
455
- i(this, "set", (t) => {
528
+ o(this, "set", (t) => {
456
529
  this._setAndNotify(t, !1);
457
530
  });
458
531
  /**
459
532
  * Updates the value of the signal by applying the provided function to the current value.
460
533
  * @param fn - The function to apply to the current value.
461
534
  */
462
- i(this, "update", (t) => {
535
+ o(this, "update", (t) => {
463
536
  this._setAndNotify(t(this.get()), !1);
464
537
  });
465
538
  /**
@@ -468,16 +541,16 @@ const W = class W extends d {
468
541
  * @param effects - An array of effects to be executed after the state is updated.
469
542
  * @returns A dispatch function that can be used to update the state and trigger the effects.
470
543
  */
471
- i(this, "reducer", (t, ...r) => {
544
+ o(this, "reducer", (t, ...r) => {
472
545
  const n = this;
473
- return function o(l) {
546
+ return function i(l) {
474
547
  const c = n.value;
475
548
  n.update((a) => t(a, l)), !n.equals(c, n.value) && r.forEach(
476
549
  (a) => a({
477
550
  previousState: c,
478
551
  state: n.value,
479
552
  action: l,
480
- dispatch: o
553
+ dispatch: i
481
554
  })
482
555
  );
483
556
  };
@@ -493,9 +566,9 @@ const W = class W extends d {
493
566
  * Defaults to a strict equality check (===).
494
567
  * @returns A Prop object representing the isomorphism.
495
568
  */
496
- i(this, "iso", (t, r, n = (o, l) => o === l) => {
497
- const o = new W(t(this.get()), n);
498
- return o.onDispose(this.on((l) => o.set(t(l)))), o.on((l) => this._setAndNotify(r(l), !1)), o;
569
+ o(this, "iso", (t, r, n = (i, l) => i === l) => {
570
+ const i = new J(t(this.get()), n);
571
+ return i.onDispose(this.on((l) => i.set(t(l)))), i.on((l) => this._setAndNotify(r(l), !1)), i;
499
572
  });
500
573
  /**
501
574
  * Returns a `Prop` that represents the value at the specified key of the current value.
@@ -503,7 +576,7 @@ const W = class W extends d {
503
576
  * @param key - The key of the value to access.
504
577
  * @returns A `Prop` that represents the value at the specified key.
505
578
  */
506
- i(this, "atProp", (t) => this.iso(
579
+ o(this, "atProp", (t) => this.iso(
507
580
  (r) => r[t],
508
581
  (r) => ({ ...this.value, [t]: r })
509
582
  ));
@@ -523,17 +596,17 @@ const W = class W extends d {
523
596
  * @param value - The value to check.
524
597
  * @returns `true` if the value is a Prop, `false` otherwise.
525
598
  */
526
- i(W, "is", (t) => (
599
+ o(J, "is", (t) => (
527
600
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
528
601
  t != null && t.$__prop__ === !0
529
602
  ));
530
- let I = W;
531
- const z = (s, e, t = (r, n) => r === n) => {
532
- const r = new x(s, t);
603
+ let V = J;
604
+ const Z = (s, e, t = (r, n) => r === n) => {
605
+ const r = new P(s, t);
533
606
  return e.forEach((n) => n.setDerivative(r)), r;
534
607
  }, je = (s, e, t = {}) => {
535
608
  let r = t.once ? () => {
536
- o(), s();
609
+ i(), s();
537
610
  } : s;
538
611
  if (t.skipInitial) {
539
612
  let l = !1;
@@ -542,11 +615,11 @@ const z = (s, e, t = (r, n) => r === n) => {
542
615
  l ? c() : l = !0;
543
616
  };
544
617
  }
545
- const n = z(r, e), o = () => {
546
- n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", o);
618
+ const n = Z(r, e), i = () => {
619
+ n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", i);
547
620
  };
548
- return t.abortSignal != null && t.abortSignal.addEventListener("abort", o), o;
549
- }, w = (s, e = (t, r) => t === r) => new I(s, e), U = (s, e = (t, r) => t === r) => new d(s, e), le = () => typeof window < "u" ? window : void 0, T = {
621
+ return t.abortSignal != null && t.abortSignal.addEventListener("abort", i), i;
622
+ }, E = (s, e = (t, r) => t === r) => new V(s, e), G = (s, e = (t, r) => t === r) => new d(s, e), le = () => typeof window < "u" ? window : void 0, T = {
550
623
  /**
551
624
  * Maps a value or a Signal to a new value.
552
625
  * If the value is a Signal, it returns a new Signal with the mapped value.
@@ -569,7 +642,7 @@ const z = (s, e, t = (r, n) => r === n) => {
569
642
  * @param equals - A function that determines if two values are equal. Defaults to strict equality (===).
570
643
  * @returns A Signal instance.
571
644
  */
572
- toSignal: (s, e) => d.is(s) ? s : U(s, e),
645
+ toSignal: (s, e) => d.is(s) ? s : G(s, e),
573
646
  /**
574
647
  * Wraps a value in a `Signal` if it is not already a `Signal`.
575
648
  * If the value is `null` or `undefined`, it returns `null` or `undefined` respectively.
@@ -616,20 +689,20 @@ const z = (s, e, t = (r, n) => r === n) => {
616
689
  deriveProp: (s, {
617
690
  autoDisposeProp: e = !0,
618
691
  equals: t
619
- } = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) : w(s, t)
692
+ } = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) : E(s, t)
620
693
  }, qe = (...s) => (e, t) => {
621
694
  const r = s.filter((n) => d.is(n));
622
- return z(
695
+ return Z(
623
696
  () => e(...s.map((n) => T.get(n))),
624
697
  r,
625
698
  t
626
699
  );
627
- }, Lt = (s) => {
700
+ }, Pt = (s) => {
628
701
  const e = Object.keys(s);
629
702
  return qe(...Object.values(s))(
630
703
  (...t) => Object.fromEntries(e.map((r, n) => [r, t[n]]))
631
704
  );
632
- }, Pt = (...s) => (e, t = {}) => {
705
+ }, Lt = (...s) => (e, t = {}) => {
633
706
  const r = s.filter((n) => d.is(n));
634
707
  return je(
635
708
  () => e(...s.map(T.get)),
@@ -639,19 +712,19 @@ const z = (s, e, t = (r, n) => r === n) => {
639
712
  };
640
713
  class ce {
641
714
  constructor() {
642
- i(this, "_store", /* @__PURE__ */ new Map());
715
+ o(this, "_store", /* @__PURE__ */ new Map());
643
716
  /**
644
717
  * Retrieves the value associated with the specified key from the memory store.
645
718
  * @param key - The key to retrieve the value for.
646
719
  * @returns The value associated with the key, or `null` if the key is not found.
647
720
  */
648
- i(this, "getItem", (e) => this._store.get(e) ?? null);
721
+ o(this, "getItem", (e) => this._store.get(e) ?? null);
649
722
  /**
650
723
  * Sets the value associated with the specified key in the memory store.
651
724
  * @param key - The key to set the value for.
652
725
  * @param value - The value to set.
653
726
  */
654
- i(this, "setItem", (e, t) => {
727
+ o(this, "setItem", (e, t) => {
655
728
  this._store.set(e, t);
656
729
  });
657
730
  }
@@ -662,12 +735,12 @@ const ae = ({
662
735
  store: t,
663
736
  serialize: r = JSON.stringify,
664
737
  deserialize: n = JSON.parse,
665
- equals: o = (c, a) => c === a,
738
+ equals: i = (c, a) => c === a,
666
739
  onLoad: l = (c) => c
667
740
  }) => {
668
- const c = t.getItem(s), a = new I(
741
+ const c = t.getItem(s), a = new V(
669
742
  c != null ? l(n(c)) : typeof e == "function" ? e() : e,
670
- o
743
+ i
671
744
  );
672
745
  return a.on((u) => {
673
746
  t.setItem(s, r(u));
@@ -689,21 +762,21 @@ function oe(s) {
689
762
  return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : setTimeout(s, 0);
690
763
  }
691
764
  const Fe = (s, e, t, r) => {
692
- const n = (r == null ? void 0 : r.duration) ?? 300, o = (r == null ? void 0 : r.easing) ?? ((S) => S), l = (r == null ? void 0 : r.equals) ?? ((S, $) => S === $);
765
+ const n = (r == null ? void 0 : r.duration) ?? 300, i = (r == null ? void 0 : r.easing) ?? ((S) => S), l = (r == null ? void 0 : r.equals) ?? ((S, N) => S === N);
693
766
  let c = r == null ? void 0 : r.interpolate, a = s, u = e(), h = performance.now(), g = null, y = !0;
694
- const p = new x(e, l), m = w(s, l);
767
+ const p = new P(e, l), m = E(s, l);
695
768
  m.onDispose(() => {
696
769
  g !== null && cancelAnimationFrame(g);
697
770
  }), m.onDispose(p.dispose), t.forEach((S) => {
698
771
  S.setDerivative(p), S.onDispose(m.dispose);
699
772
  });
700
773
  const C = (S) => {
701
- u = S, h = performance.now(), a = m.value, y && (y = !1, g = oe(ee));
702
- }, ee = () => {
703
- const $ = (performance.now() - h) / T.get(n), Me = o($);
774
+ u = S, h = performance.now(), a = m.value, y && (y = !1, g = oe(te));
775
+ }, te = () => {
776
+ const N = (performance.now() - h) / T.get(n), Me = i(N);
704
777
  c == null && (c = Re(a));
705
- let te = c(a, u, Me);
706
- $ >= 1 ? (y = !0, te = u) : g = oe(ee), m.set(te);
778
+ let se = c(a, u, Me);
779
+ N >= 1 ? (y = !0, se = u) : g = oe(te), m.set(se);
707
780
  };
708
781
  return p.on(C), m;
709
782
  }, Ot = (s, e) => {
@@ -716,10 +789,10 @@ const Fe = (s, e, t, r) => {
716
789
  );
717
790
  }, Ht = (s, e) => {
718
791
  const { signals: t, literals: r } = Object.entries(s).reduce(
719
- ({ signals: o, literals: l }, [c, a]) => (d.is(a) ? o.push([c, a]) : l[c] = a, { signals: o, literals: l }),
792
+ ({ signals: i, literals: l }, [c, a]) => (d.is(a) ? i.push([c, a]) : l[c] = a, { signals: i, literals: l }),
720
793
  { signals: [], literals: {} }
721
- ), n = t.map(([, o]) => o);
722
- return z(() => (t.forEach(([o, l]) => r[o] = l.value), e(r)), n);
794
+ ), n = t.map(([, i]) => i);
795
+ return Z(() => (t.forEach(([i, l]) => r[i] = l.value), e(r)), n);
723
796
  }, ue = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), he = /* @__PURE__ */ new Set(["selected"]), fe = /* @__PURE__ */ new Set([
724
797
  "rowSpan",
725
798
  "colSpan",
@@ -745,7 +818,7 @@ const Fe = (s, e, t, r) => {
745
818
  t == null ? e[s] = null : e[s] = String(t);
746
819
  } : (t) => {
747
820
  t == null ? e.removeAttribute(s) : e.setAttribute(s, t);
748
- }, We = (s, e) => he.has(s) ? () => e.hasAttribute(s) : ue.has(s) ? () => !!e[s] : fe.has(s) ? () => Number(e[s]) : de.has(s) ? () => e[s] : pe.has(s) ? () => String(e[s]) : () => e.getAttribute(s), R = (s) => {
821
+ }, We = (s, e) => he.has(s) ? () => e.hasAttribute(s) : ue.has(s) ? () => !!e[s] : fe.has(s) ? () => Number(e[s]) : de.has(s) ? () => e[s] : pe.has(s) ? () => String(e[s]) : () => e.getAttribute(s), j = (s) => {
749
822
  const e = s;
750
823
  e && e.onblur && (e.onblur = null), !(!s || s.ownerDocument === void 0) && s.parentElement && s.parentElement.removeChild(s);
751
824
  }, Ue = (s) => ge(s) ? s : s.parentElement, ge = (s) => s.nodeType === 1;
@@ -772,15 +845,30 @@ class L {
772
845
  * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
773
846
  * @returns The newly created element.
774
847
  */
775
- i(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
848
+ o(this, "createElement", (e, t) => t !== void 0 ? this.document.createElementNS(t, e) : this.document.createElement(e));
776
849
  /**
777
- * Creates a new DOM element (eg: HTML or SVG) with the specified tag name and namespace and appends it to the current element.
850
+ * Creates a new child element and appends it to the current element, returning a new context.
778
851
  *
779
- * @param tagName - The tag name of the element to create.
780
- * @param namespace - The namespace URI to create the element in, or `undefined` to create a standard HTML element.
781
- * @returns The newly created element.
852
+ * This method creates a new DOM element with the specified tag name and namespace,
853
+ * appends it to the current element, and returns a new DOMContext focused on the
854
+ * newly created child element. This is the primary method for building DOM trees.
855
+ *
856
+ * @example
857
+ * ```typescript
858
+ * // Create HTML elements
859
+ * const divCtx = ctx.makeChildElement('div', undefined)
860
+ * const spanCtx = divCtx.makeChildElement('span', undefined)
861
+ *
862
+ * // Create SVG elements
863
+ * const svgCtx = ctx.makeChildElement('svg', 'http://www.w3.org/2000/svg')
864
+ * const circleCtx = svgCtx.makeChildElement('circle', 'http://www.w3.org/2000/svg')
865
+ * ```
866
+ *
867
+ * @param tagName - The tag name of the element to create (e.g., 'div', 'span', 'svg')
868
+ * @param namespace - The namespace URI for the element, or undefined for HTML elements
869
+ * @returns A new DOMContext focused on the newly created child element
782
870
  */
783
- i(this, "makeChildElement", (e, t) => {
871
+ o(this, "makeChildElement", (e, t) => {
784
872
  const r = this.createElement(e, t);
785
873
  return this.appendOrInsert(r), this.withElement(r);
786
874
  });
@@ -789,13 +877,13 @@ class L {
789
877
  * @param text - The text content for the new text node.
790
878
  * @returns A new `Text` node with the specified text content.
791
879
  */
792
- i(this, "createText", (e) => this.document.createTextNode(e));
880
+ o(this, "createText", (e) => this.document.createTextNode(e));
793
881
  /**
794
882
  * Creates a new text node with the specified text content and appends it to the current element.
795
883
  * @param text - The text content for the new text node.
796
884
  * @returns A new `DOMContext` with a reference to the new text node.
797
885
  */
798
- i(this, "makeChildText", (e) => {
886
+ o(this, "makeChildText", (e) => {
799
887
  const t = this.createText(e);
800
888
  return this.appendOrInsert(t), this.withReference(t);
801
889
  });
@@ -803,14 +891,14 @@ class L {
803
891
  * Sets the text content of the current element.
804
892
  * @param text - The text content to set.
805
893
  */
806
- i(this, "setText", (e) => {
894
+ o(this, "setText", (e) => {
807
895
  this.reference.nodeValue = e;
808
896
  });
809
897
  /**
810
898
  * Gets the text content of the current element or text node.
811
899
  * @returns The text content of the current element or text node.
812
900
  */
813
- i(this, "getText", () => {
901
+ o(this, "getText", () => {
814
902
  var e;
815
903
  return ((e = this.reference) == null ? void 0 : e.nodeValue) ?? this.element.textContent ?? "";
816
904
  });
@@ -819,7 +907,7 @@ class L {
819
907
  * The text node is appended or inserted to the current `DOMContext`.
820
908
  * The new `DOMContext` with the reference is returned.
821
909
  */
822
- i(this, "makeRef", () => {
910
+ o(this, "makeRef", () => {
823
911
  const e = this.createText("");
824
912
  return this.appendOrInsert(e), this.withReference(e);
825
913
  });
@@ -828,7 +916,7 @@ class L {
828
916
  *
829
917
  * @param child - The child node to append or insert.
830
918
  */
831
- i(this, "appendOrInsert", (e) => {
919
+ o(this, "appendOrInsert", (e) => {
832
920
  this.reference === void 0 ? this.element.appendChild(e) : this.element.insertBefore(e, this.reference);
833
921
  });
834
922
  /**
@@ -836,13 +924,52 @@ class L {
836
924
  * @param element - The DOM element to use in the new `DOMContext` instance.
837
925
  * @returns A new `DOMContext` instance with the provided `element`.
838
926
  */
839
- i(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
927
+ o(this, "withElement", (e) => new L(this.document, e, void 0, this.providers));
840
928
  /**
841
- * Creates a new `DOMContext` instance with a reference to a DOM element selected by the provided `selector`.
842
- * @param selector - The CSS selector for the target DOM element.
843
- * @returns A new `DOMContext` instance with a reference to the selected DOM element.
929
+ * Creates a portal to render content in a different part of the DOM tree.
930
+ *
931
+ * Portals allow you to render child components into a DOM node that exists outside
932
+ * the parent component's DOM hierarchy. This is useful for modals, tooltips,
933
+ * dropdowns, and other UI elements that need to break out of their container's
934
+ * styling or z-index context.
935
+ *
936
+ * @example
937
+ * ```typescript
938
+ * // Portal to a modal container
939
+ * const modalCtx = ctx.makePortal('#modal-root')
940
+ * const modal = modalCtx.makeChildElement('div', undefined)
941
+ *
942
+ * // Add modal content
943
+ * modal.makeChildText('This renders in #modal-root')
944
+ * ```
945
+ *
946
+ * @example
947
+ * ```typescript
948
+ * // Portal to an existing element reference
949
+ * const tooltipContainer = document.getElementById('tooltip-container')!
950
+ * const tooltipCtx = ctx.makePortal(tooltipContainer)
951
+ *
952
+ * // Render tooltip content
953
+ * const tooltip = tooltipCtx.makeChildElement('div', undefined)
954
+ * tooltip.addClasses(['tooltip', 'tooltip-top'])
955
+ * ```
956
+ *
957
+ * @example
958
+ * ```typescript
959
+ * // Portal for dropdown menu
960
+ * const dropdownCtx = ctx.makePortal('body') // Render at body level
961
+ * const dropdown = dropdownCtx.makeChildElement('div', undefined)
962
+ * dropdown.addClasses(['dropdown-menu'])
963
+ * dropdown.setStyle('position', 'absolute')
964
+ * dropdown.setStyle('top', '100px')
965
+ * dropdown.setStyle('left', '50px')
966
+ * ```
967
+ *
968
+ * @param selector - CSS selector string or HTMLElement reference for the portal target
969
+ * @returns A new DOMContext focused on the portal target element
970
+ * @throws {Error} When the selector doesn't match any element in the document
844
971
  */
845
- i(this, "makePortal", (e) => {
972
+ o(this, "makePortal", (e) => {
846
973
  const t = typeof e == "string" ? this.document.querySelector(e) : e;
847
974
  if (t == null)
848
975
  throw new Error(`Cannot find element by selector for portal: ${e}`);
@@ -854,7 +981,7 @@ class L {
854
981
  * @param reference - The optional `Text` node to use as the reference for the new `DOMContext`.
855
982
  * @returns A new `DOMContext` instance with the specified reference.
856
983
  */
857
- i(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
984
+ o(this, "withReference", (e) => new L(this.document, this.element, e, this.providers));
858
985
  /**
859
986
  * Sets a provider for the given provider mark.
860
987
  *
@@ -862,7 +989,7 @@ class L {
862
989
  * @param value - The provider to set for the given mark.
863
990
  * @returns A new `DOMContext` instance with the specified provider.
864
991
  */
865
- i(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
992
+ o(this, "setProvider", (e, t, r) => new L(this.document, this.element, this.reference, {
866
993
  ...this.providers,
867
994
  [e]: [t, r]
868
995
  }));
@@ -873,34 +1000,34 @@ class L {
873
1000
  * @returns The provider for the given mark.
874
1001
  * @throws Throws `ProviderNotFoundError` if the provider for the given mark is not found.
875
1002
  */
876
- i(this, "getProvider", (e) => {
1003
+ o(this, "getProvider", (e) => {
877
1004
  if (this.providers[e] === void 0)
878
1005
  throw new me(e);
879
1006
  const [t, r] = this.providers[e];
880
1007
  return { value: t, onUse: r };
881
1008
  });
882
- i(this, "clear", (e) => {
883
- e && (this.reference !== void 0 ? R(this.reference) : R(this.element));
1009
+ o(this, "clear", (e) => {
1010
+ e && (this.reference !== void 0 ? j(this.reference) : j(this.element));
884
1011
  });
885
1012
  /**
886
1013
  * Adds classes to the element.
887
1014
  * @param tokens - The class names to add.
888
1015
  */
889
- i(this, "addClasses", (e) => {
1016
+ o(this, "addClasses", (e) => {
890
1017
  this.element.classList.add(...e);
891
1018
  });
892
1019
  /**
893
1020
  * Removes classes from the element.
894
1021
  * @param tokens - The class names to remove.
895
1022
  */
896
- i(this, "removeClasses", (e) => {
1023
+ o(this, "removeClasses", (e) => {
897
1024
  this.element.classList.remove(...e);
898
1025
  });
899
1026
  /**
900
1027
  * Gets the classes of the element.
901
1028
  * @returns The classes of the element.
902
1029
  */
903
- i(this, "getClasses", () => Array.from(this.element.classList));
1030
+ o(this, "getClasses", () => Array.from(this.element.classList));
904
1031
  /**
905
1032
  * Adds an event listener to the element.
906
1033
  * @param event - The event to listen for.
@@ -908,10 +1035,10 @@ class L {
908
1035
  * @param options - The options for the event listener.
909
1036
  * @returns A function to remove the event listener.
910
1037
  */
911
- i(this, "on", (e, t, r) => {
912
- const n = (o) => t(o, this);
913
- return this.element.addEventListener(e, n, r), (o) => {
914
- o && this.element.removeEventListener(e, n, r);
1038
+ o(this, "on", (e, t, r) => {
1039
+ const n = (i) => t(i, this);
1040
+ return this.element.addEventListener(e, n, r), (i) => {
1041
+ i && this.element.removeEventListener(e, n, r);
915
1042
  };
916
1043
  });
917
1044
  /**
@@ -919,28 +1046,28 @@ class L {
919
1046
  * @returns `true` if the context is a browser DOM context.
920
1047
  * @deprecated Use `isBrowser()` instead.
921
1048
  */
922
- i(this, "isBrowserDOM", () => !0);
1049
+ o(this, "isBrowserDOM", () => !0);
923
1050
  /**
924
1051
  * Returns `true` if the context is a browser context.
925
1052
  * @returns `true` if the context is a browser context.
926
1053
  */
927
- i(this, "isBrowser", () => !0);
1054
+ o(this, "isBrowser", () => !0);
928
1055
  /**
929
1056
  * Returns `true` if the context is a headless DOM context.
930
1057
  * @returns `true` if the context is a headless DOM context.
931
1058
  */
932
- i(this, "isHeadlessDOM", () => !1);
1059
+ o(this, "isHeadlessDOM", () => !1);
933
1060
  /**
934
1061
  * Returns `true` if the context is a headless context.
935
1062
  * @returns `true` if the context is a headless context.
936
1063
  */
937
- i(this, "isHeadless", () => !1);
1064
+ o(this, "isHeadless", () => !1);
938
1065
  /**
939
1066
  * Sets the style of the element.
940
1067
  * @param name - The name of the style to set.
941
1068
  * @param value - The value of the style to set.
942
1069
  */
943
- i(this, "setStyle", (e, t) => {
1070
+ o(this, "setStyle", (e, t) => {
944
1071
  this.element.style[e] = t;
945
1072
  });
946
1073
  /**
@@ -948,12 +1075,12 @@ class L {
948
1075
  * @param name - The name of the style to get.
949
1076
  * @returns The value of the style.
950
1077
  */
951
- i(this, "getStyle", (e) => this.element.style[e]);
952
- i(this, "makeAccessors", (e) => ({
1078
+ o(this, "getStyle", (e) => this.element.style[e]);
1079
+ o(this, "makeAccessors", (e) => ({
953
1080
  get: We(e, this.element),
954
1081
  set: Be(e, this.element)
955
1082
  }));
956
- i(this, "getWindow", () => this.document.defaultView);
1083
+ o(this, "getWindow", () => this.document.defaultView);
957
1084
  this.document = e, this.element = t, this.reference = r, this.providers = n;
958
1085
  }
959
1086
  /**
@@ -968,22 +1095,22 @@ class L {
968
1095
  return new L(e.ownerDocument, e, t, r);
969
1096
  }
970
1097
  }
971
- const Je = (s) => Symbol(s), Q = (s, e) => {
1098
+ const Je = (s) => Symbol(s), K = (s, e) => {
972
1099
  const t = s(e);
973
1100
  return (r = !0) => t(r);
974
- }, Nt = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: o = {} } = {}) => {
1101
+ }, $t = (s, e, { doc: t, clear: r, disposeWithParent: n = !0, providers: i = {} } = {}) => {
975
1102
  const l = typeof e == "string" ? (t ?? document).querySelector(e) : e;
976
1103
  if (l === null)
977
1104
  throw new Ge(
978
1105
  `Cannot find element by selector for render: ${e}`
979
1106
  );
980
1107
  r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
981
- const c = Ue(l), a = ge(l) ? void 0 : l, u = L.of(c, a, o), h = Q(s, u);
1108
+ const c = Ue(l), a = ge(l) ? void 0 : l, u = L.of(c, a, i), h = K(s, u);
982
1109
  let g;
983
1110
  return n && (g = new MutationObserver((y) => {
984
1111
  var p;
985
1112
  (p = y[0]) == null || p.removedNodes.forEach((m) => {
986
- m === l && (g == null || g.disconnect(), h(l.nodeType !== Node.ELEMENT_NODE));
1113
+ m === l && (g == null || g.disconnect(), h(l.nodeType !== 1));
987
1114
  });
988
1115
  }), g.observe(l.parentElement, {
989
1116
  childList: !0,
@@ -992,17 +1119,17 @@ const Je = (s) => Symbol(s), Q = (s, e) => {
992
1119
  })), () => {
993
1120
  g == null || g.disconnect(), h(!0);
994
1121
  };
995
- }, $t = (s, {
1122
+ }, kt = (s, {
996
1123
  startUrl: e = "https://example.com",
997
1124
  selector: t,
998
1125
  providers: r = {}
999
1126
  } = {
1000
1127
  selector: "body"
1001
1128
  }) => {
1002
- const n = T.toSignal(e).deriveProp(), o = new Se(t, void 0), l = new P(o, void 0, { currentURL: n }, r);
1129
+ const n = T.toSignal(e).deriveProp(), i = new Se(t, void 0), l = new D(i, void 0, { currentURL: n }, r);
1003
1130
  return {
1004
- clear: Q(s(), l),
1005
- root: o,
1131
+ clear: K(s(), l),
1132
+ root: i,
1006
1133
  currentURL: n
1007
1134
  };
1008
1135
  };
@@ -1011,14 +1138,14 @@ class Ge extends Error {
1011
1138
  super(e);
1012
1139
  }
1013
1140
  }
1014
- const ye = "data-tts-node", V = "data-tts-class", j = "data-tts-style", q = "data-tts-html", F = "data-tts-text", B = "data-tts-attrs";
1015
- class kt {
1141
+ const ye = "data-tts-node", q = "data-tts-class", F = "data-tts-style", B = "data-tts-html", W = "data-tts-text", U = "data-tts-attrs";
1142
+ class Nt {
1016
1143
  constructor({
1017
1144
  select: e,
1018
1145
  getAttribute: t,
1019
1146
  setAttribute: r,
1020
1147
  getClass: n,
1021
- setClass: o,
1148
+ setClass: i,
1022
1149
  getStyles: l,
1023
1150
  setStyles: c,
1024
1151
  appendHTML: a,
@@ -1032,74 +1159,74 @@ class kt {
1032
1159
  * @param selector - The selector to select elements from. The supported selectors are CSS selectors whose complexity depends on the adapter implementation.
1033
1160
  * @returns An array of elements.
1034
1161
  */
1035
- i(this, "select");
1162
+ o(this, "select");
1036
1163
  /**
1037
1164
  * Gets the value of an attribute from an element.
1038
1165
  * @param el - The element to get the attribute from.
1039
1166
  * @param attr - The attribute to get the value from.
1040
1167
  * @returns The value of the attribute or null if the attribute is not set.
1041
1168
  */
1042
- i(this, "getAttribute");
1169
+ o(this, "getAttribute");
1043
1170
  /**
1044
1171
  * Sets the value of an attribute on an element.
1045
1172
  * @param el - The element to set the attribute on.
1046
1173
  * @param attr - The attribute to set the value of.
1047
1174
  * @param value - The value to set the attribute to.
1048
1175
  */
1049
- i(this, "setAttribute");
1176
+ o(this, "setAttribute");
1050
1177
  /**
1051
1178
  * Gets the class of an element.
1052
1179
  * @param el - The element to get the class from.
1053
1180
  * @returns The class of the element or an empty string if the class is not set.
1054
1181
  */
1055
- i(this, "getClass");
1182
+ o(this, "getClass");
1056
1183
  /**
1057
1184
  * Sets the class of an element.
1058
1185
  * @param el - The element to set the class on.
1059
1186
  * @param cls - The class to set.
1060
1187
  */
1061
- i(this, "setClass");
1188
+ o(this, "setClass");
1062
1189
  /**
1063
1190
  * Gets the styles of an element.
1064
1191
  * @param el - The element to get the styles from.
1065
1192
  * @returns The styles of the element.
1066
1193
  */
1067
- i(this, "getStyles");
1194
+ o(this, "getStyles");
1068
1195
  /**
1069
1196
  * Sets the styles of an element.
1070
1197
  * @param el - The element to set the styles on.
1071
1198
  */
1072
- i(this, "setStyles");
1199
+ o(this, "setStyles");
1073
1200
  /**
1074
1201
  * Appends HTML to an element.
1075
1202
  * @param el - The element to append the HTML to.
1076
1203
  * @param html - The HTML to append.
1077
1204
  */
1078
- i(this, "appendHTML");
1205
+ o(this, "appendHTML");
1079
1206
  /**
1080
1207
  * Gets the inner HTML of an element.
1081
1208
  * @param el - The element to get the inner HTML from.
1082
1209
  * @returns The inner HTML of the element or an empty string if the inner HTML is not set.
1083
1210
  */
1084
- i(this, "getInnerHTML");
1211
+ o(this, "getInnerHTML");
1085
1212
  /**
1086
1213
  * Sets the inner HTML of an element.
1087
1214
  * @param el - The element to set the inner HTML on.
1088
1215
  * @param html - The inner HTML to set.
1089
1216
  */
1090
- i(this, "setInnerHTML");
1217
+ o(this, "setInnerHTML");
1091
1218
  /**
1092
1219
  * Gets the inner text of an element.
1093
1220
  * @param el - The element to get the inner text from.
1094
1221
  * @returns The inner text of the element or an empty string if the inner text is not set.
1095
1222
  */
1096
- i(this, "getInnerText");
1223
+ o(this, "getInnerText");
1097
1224
  /**
1098
1225
  * Sets the inner text of an element.
1099
1226
  * @param el - The element to set the inner text on.
1100
1227
  * @param text - The inner text to set.
1101
1228
  */
1102
- i(this, "setInnerText");
1229
+ o(this, "setInnerText");
1103
1230
  /**
1104
1231
  * Sets the content of the root element from a HeadlessPortal. Generally this will be the same instance that is
1105
1232
  * returned by `runHeadless`.
@@ -1108,10 +1235,10 @@ class kt {
1108
1235
  * @param setPlaceholders - Whether to set placeholders for the content. This allows you to restore the original content
1109
1236
  * when you render on the server and then hydrate on the client.
1110
1237
  */
1111
- i(this, "setFromRoot", (e, t) => {
1238
+ o(this, "setFromRoot", (e, t) => {
1112
1239
  e.getPortals().forEach((n) => {
1113
- const o = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
1114
- for (const l of o) {
1240
+ const i = typeof n.selector == "string" ? this.select(n.selector) : [n.selector];
1241
+ for (const l of i) {
1115
1242
  if (l == null)
1116
1243
  throw new Error(
1117
1244
  `Cannot find element by selector for render: ${n.selector}`
@@ -1119,21 +1246,21 @@ class kt {
1119
1246
  if (n.hasChildren() && this.appendHTML(l, n.contentToHTML(t)), n.hasInnerHTML()) {
1120
1247
  if (t) {
1121
1248
  const c = this.getInnerHTML(l);
1122
- c != null && this.setAttribute(l, q, c);
1249
+ c != null && this.setAttribute(l, B, c);
1123
1250
  }
1124
1251
  this.setInnerHTML(l, n.getInnerHTML());
1125
1252
  }
1126
1253
  if (n.hasInnerText()) {
1127
1254
  if (t) {
1128
1255
  const c = this.getInnerText(l);
1129
- c != null && this.setAttribute(l, F, c);
1256
+ c != null && this.setAttribute(l, W, c);
1130
1257
  }
1131
1258
  this.setInnerText(l, n.getInnerText());
1132
1259
  }
1133
1260
  if (n.hasClasses()) {
1134
1261
  if (t) {
1135
1262
  const c = this.getClass(l);
1136
- c != null && this.setAttribute(l, V, c);
1263
+ c != null && this.setAttribute(l, q, c);
1137
1264
  }
1138
1265
  this.setClass(l, n.getClasses().join(" "));
1139
1266
  }
@@ -1142,7 +1269,7 @@ class kt {
1142
1269
  const c = this.getStyles(l);
1143
1270
  Object.keys(c).length > 0 && this.setAttribute(
1144
1271
  l,
1145
- j,
1272
+ F,
1146
1273
  JSON.stringify(c)
1147
1274
  );
1148
1275
  }
@@ -1157,7 +1284,7 @@ class kt {
1157
1284
  h != null && a.push([u, h]);
1158
1285
  }), a.length > 0 && this.setAttribute(
1159
1286
  l,
1160
- B,
1287
+ U,
1161
1288
  JSON.stringify(Object.fromEntries(a))
1162
1289
  );
1163
1290
  }
@@ -1168,83 +1295,83 @@ class kt {
1168
1295
  }
1169
1296
  });
1170
1297
  });
1171
- this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = o, this.getStyles = l, this.setStyles = c, this.appendHTML = a, this.getInnerHTML = u, this.setInnerHTML = h, this.getInnerText = g, this.setInnerText = y;
1298
+ 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 = g, this.setInnerText = y;
1172
1299
  }
1173
1300
  }
1174
1301
  const Xe = () => {
1175
- document.querySelectorAll(`[${ye}]`).forEach(R);
1302
+ document.querySelectorAll(`[${ye}]`).forEach(j);
1176
1303
  }, Ye = (s) => {
1177
- const e = s.getAttribute(V);
1178
- s.removeAttribute(V), e != null && s.setAttribute("class", e);
1304
+ const e = s.getAttribute(q);
1305
+ s.removeAttribute(q), e != null && s.setAttribute("class", e);
1179
1306
  }, ze = () => {
1180
- document.querySelectorAll(`[${V}]`).forEach((e) => Ye(e));
1307
+ document.querySelectorAll(`[${q}]`).forEach((e) => Ye(e));
1181
1308
  }, Qe = (s) => {
1182
- const e = s.getAttribute(q);
1183
- s.removeAttribute(q), e != null && (s.innerHTML = e);
1309
+ const e = s.getAttribute(B);
1310
+ s.removeAttribute(B), e != null && (s.innerHTML = e);
1184
1311
  }, Ze = () => {
1185
- document.querySelectorAll(`[${q}]`).forEach((e) => Qe(e));
1312
+ document.querySelectorAll(`[${B}]`).forEach((e) => Qe(e));
1186
1313
  }, Ke = (s) => {
1187
- const e = s.getAttribute(F);
1188
- s.removeAttribute(F), e != null && (s.innerText = e);
1314
+ const e = s.getAttribute(W);
1315
+ s.removeAttribute(W), e != null && (s.innerText = e);
1189
1316
  }, et = () => {
1190
- document.querySelectorAll(`[${F}]`).forEach((e) => Ke(e));
1317
+ document.querySelectorAll(`[${W}]`).forEach((e) => Ke(e));
1191
1318
  }, Te = (s) => JSON.parse(s.replace(/&quot;/g, '"')), tt = (s) => {
1192
- const e = s.getAttribute(j);
1193
- if (s.removeAttribute(j), e != null) {
1319
+ const e = s.getAttribute(F);
1320
+ if (s.removeAttribute(F), e != null) {
1194
1321
  const t = Te(e);
1195
1322
  Object.entries(t).forEach(([r, n]) => {
1196
1323
  s.style.setProperty(r, n);
1197
1324
  });
1198
1325
  }
1199
1326
  }, st = () => {
1200
- document.querySelectorAll(`[${j}]`).forEach((e) => tt(e));
1327
+ document.querySelectorAll(`[${F}]`).forEach((e) => tt(e));
1201
1328
  }, rt = (s) => {
1202
- const e = s.getAttribute(B);
1203
- if (s.removeAttribute(B), e != null) {
1329
+ const e = s.getAttribute(U);
1330
+ if (s.removeAttribute(U), e != null) {
1204
1331
  const t = Te(e);
1205
1332
  Object.entries(t).forEach(([r, n]) => {
1206
1333
  n == null ? s.removeAttribute(r) : s.setAttribute(r, n);
1207
1334
  });
1208
1335
  }
1209
1336
  }, nt = () => {
1210
- document.querySelectorAll(`[${B}]`).forEach((e) => rt(e));
1337
+ document.querySelectorAll(`[${U}]`).forEach((e) => rt(e));
1211
1338
  }, It = () => {
1212
1339
  Xe(), ze(), et(), Ze(), st(), nt();
1213
- }, b = Symbol("class"), E = Symbol("style"), v = Symbol("handler"), be = () => Math.random().toString(36).substring(2, 15), it = (s) => s.replace(/<[^>]*>?/g, "");
1340
+ }, A = Symbol("class"), _ = Symbol("style"), x = Symbol("handler"), be = () => Math.random().toString(36).substring(2, 15), it = (s) => s.replace(/<[^>]*>?/g, "");
1214
1341
  class Ae {
1215
1342
  constructor(e) {
1216
- i(this, "id", be());
1217
- i(this, "properties", {});
1218
- i(this, "children", []);
1219
- i(this, "isElement", () => !0);
1220
- i(this, "isText", () => !1);
1221
- i(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? it(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
1222
- i(this, "removeChild", (e) => {
1343
+ o(this, "id", be());
1344
+ o(this, "properties", {});
1345
+ o(this, "children", []);
1346
+ o(this, "isElement", () => !0);
1347
+ o(this, "isText", () => !1);
1348
+ o(this, "getText", () => this.properties.innerText != null ? this.properties.innerText : this.properties.innerHTML != null ? it(this.properties.innerHTML) : this.children.map((e) => e.getText()).join(""));
1349
+ o(this, "removeChild", (e) => {
1223
1350
  const t = this.children.indexOf(e);
1224
1351
  t !== -1 && this.children.splice(t, 1);
1225
1352
  });
1226
- i(this, "remove", () => {
1353
+ o(this, "remove", () => {
1227
1354
  if (this.parent != null)
1228
1355
  this.parent.removeChild(this);
1229
1356
  else
1230
1357
  throw new Error("Parent is undefined");
1231
1358
  });
1232
- i(this, "getPortals", () => {
1359
+ o(this, "getPortals", () => {
1233
1360
  const e = this.elements().flatMap((t) => t.isPortal() ? [t, ...t.getPortals()] : t.getPortals());
1234
1361
  return this.isPortal() && e.unshift(this), e;
1235
1362
  });
1236
- i(this, "elements", () => this.children.filter((e) => e.isElement()));
1237
- i(this, "hasInnerHTML", () => this.properties.innerHTML != null);
1238
- i(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
1239
- i(this, "getInnerText", () => this.properties.innerText ?? "");
1240
- i(this, "hasInnerText", () => this.properties.innerText != null);
1241
- i(this, "hasChildren", () => this.children.length > 0);
1242
- i(this, "hasClasses", () => this.properties[b] != null);
1243
- i(this, "hasStyles", () => this.properties[E] != null);
1244
- i(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
1245
- i(this, "hasHandlers", () => this.properties[v] != null);
1246
- i(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
1247
- i(this, "getById", (e) => {
1363
+ o(this, "elements", () => this.children.filter((e) => e.isElement()));
1364
+ o(this, "hasInnerHTML", () => this.properties.innerHTML != null);
1365
+ o(this, "getInnerHTML", () => this.properties.innerHTML ?? "");
1366
+ o(this, "getInnerText", () => this.properties.innerText ?? "");
1367
+ o(this, "hasInnerText", () => this.properties.innerText != null);
1368
+ o(this, "hasChildren", () => this.children.length > 0);
1369
+ o(this, "hasClasses", () => this.properties[A] != null);
1370
+ o(this, "hasStyles", () => this.properties[_] != null);
1371
+ o(this, "hasAttributes", () => Object.keys(this.properties).length > 0);
1372
+ o(this, "hasHandlers", () => this.properties[x] != null);
1373
+ o(this, "hasRenderableProperties", () => this.hasClasses() || this.hasAttributes() || this.hasStyles());
1374
+ o(this, "getById", (e) => {
1248
1375
  if (this.properties.id === e)
1249
1376
  return this;
1250
1377
  for (const t of this.elements()) {
@@ -1253,61 +1380,61 @@ class Ae {
1253
1380
  return r;
1254
1381
  }
1255
1382
  });
1256
- i(this, "trigger", (e, t) => {
1257
- ((this.properties[v] ?? {})[e] ?? []).forEach((n) => n(t));
1383
+ o(this, "trigger", (e, t) => {
1384
+ ((this.properties[x] ?? {})[e] ?? []).forEach((n) => n(t));
1258
1385
  });
1259
- i(this, "click", () => {
1386
+ o(this, "click", () => {
1260
1387
  this.trigger("click", {});
1261
1388
  });
1262
- i(this, "on", (e, t, r, n) => {
1389
+ o(this, "on", (e, t, r, n) => {
1263
1390
  var a;
1264
- const o = (a = this.properties)[v] ?? (a[v] = {}), l = n != null && n.once ? (u) => {
1391
+ const i = (a = this.properties)[x] ?? (a[x] = {}), l = n != null && n.once ? (u) => {
1265
1392
  c(), t(u, r);
1266
1393
  } : (u) => t(u, r);
1267
- o[e] = [...o[e] ?? [], l];
1394
+ i[e] = [...i[e] ?? [], l];
1268
1395
  const c = () => {
1269
- const u = o[e] ?? [], h = u.indexOf(l);
1270
- h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete o[e], Object.keys(o).length === 0 && delete this.properties[v]) : o[e] = u, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
1396
+ const u = i[e] ?? [], h = u.indexOf(l);
1397
+ h !== -1 && (u.splice(h, 1), u.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[x]) : i[e] = u, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
1271
1398
  };
1272
1399
  return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
1273
1400
  });
1274
- i(this, "addClasses", (e) => {
1401
+ o(this, "addClasses", (e) => {
1275
1402
  var r;
1276
1403
  if (e.length === 0)
1277
1404
  return;
1278
- const t = (r = this.properties)[b] ?? (r[b] = []);
1405
+ const t = (r = this.properties)[A] ?? (r[A] = []);
1279
1406
  e.forEach((n) => {
1280
1407
  t.includes(n) || t.push(n);
1281
1408
  });
1282
1409
  });
1283
- i(this, "removeClasses", (e) => {
1410
+ o(this, "removeClasses", (e) => {
1284
1411
  var r;
1285
1412
  if (e.length === 0)
1286
1413
  return;
1287
- const t = (r = this.properties)[b] ?? (r[b] = []);
1414
+ const t = (r = this.properties)[A] ?? (r[A] = []);
1288
1415
  e.forEach((n) => {
1289
- const o = t.indexOf(n);
1290
- o !== -1 && t.splice(o, 1);
1291
- }), t.length === 0 && delete this.properties[b];
1416
+ const i = t.indexOf(n);
1417
+ i !== -1 && t.splice(i, 1);
1418
+ }), t.length === 0 && delete this.properties[A];
1292
1419
  });
1293
- i(this, "getClasses", () => this.properties[b] ?? []);
1294
- i(this, "getAttributes", () => Object.entries(this.properties).filter(
1420
+ o(this, "getClasses", () => this.properties[A] ?? []);
1421
+ o(this, "getAttributes", () => Object.entries(this.properties).filter(
1295
1422
  ([e]) => !["innerText", "innerHTML"].includes(e)
1296
1423
  ));
1297
- i(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
1298
- (e) => e === b ? [["class", this.getClasses()]] : e === E ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1424
+ o(this, "getVisibleAttributes", () => Reflect.ownKeys(this.properties).flatMap(
1425
+ (e) => e === A ? [["class", this.getClasses()]] : e === _ ? [["style", this.getStyles()]] : typeof e == "string" ? [[e, String(this.properties[e])]] : []
1299
1426
  ));
1300
- i(this, "setStyle", (e, t) => {
1427
+ o(this, "setStyle", (e, t) => {
1301
1428
  var n;
1302
- const r = (n = this.properties)[E] ?? (n[E] = {});
1303
- r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[E]);
1429
+ const r = (n = this.properties)[_] ?? (n[_] = {});
1430
+ r[e] = t, t === "" && (delete r[e], Object.keys(r).length === 0 && delete this.properties[_]);
1304
1431
  });
1305
- i(this, "getStyle", (e) => {
1432
+ o(this, "getStyle", (e) => {
1306
1433
  var t;
1307
- return ((t = this.properties[E]) == null ? void 0 : t[e]) ?? "";
1434
+ return ((t = this.properties[_]) == null ? void 0 : t[e]) ?? "";
1308
1435
  });
1309
- i(this, "getStyles", () => this.properties[E] ?? {});
1310
- i(this, "makeAccessors", (e) => {
1436
+ o(this, "getStyles", () => this.properties[_] ?? {});
1437
+ o(this, "makeAccessors", (e) => {
1311
1438
  const t = this.properties;
1312
1439
  return {
1313
1440
  get: () => t[e],
@@ -1321,12 +1448,12 @@ const ot = (s) => s.replace(/"/g, "&quot;"), lt = (s) => s.replace(/&/g, "&amp;"
1321
1448
  class ct extends Ae {
1322
1449
  constructor(t, r, n) {
1323
1450
  super(n);
1324
- i(this, "isPortal", () => !1);
1325
- i(this, "toHTML", (t = !1) => {
1451
+ o(this, "isPortal", () => !1);
1452
+ o(this, "toHTML", (t = !1) => {
1326
1453
  const r = this.children.map((a) => a.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
1327
- let o = null;
1328
- 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, g]) => `${h}: ${g};`).join(" ")}"` : ut.has(a) ? ` ${a}` : a === "innerHTML" ? (o = u, "") : a === "innerText" ? (o = lt(u), "") : ` ${a}="${ot(u)}"`).join(""), c = t ? ` ${ye}` : "";
1329
- return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${o ?? r}</${this.tagName}>`;
1454
+ let i = null;
1455
+ 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, g]) => `${h}: ${g};`).join(" ")}"` : ut.has(a) ? ` ${a}` : a === "innerHTML" ? (i = u, "") : a === "innerText" ? (i = lt(u), "") : ` ${a}="${ot(u)}"`).join(""), c = t ? ` ${ye}` : "";
1456
+ return ht.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${i ?? r}</${this.tagName}>`;
1330
1457
  });
1331
1458
  this.tagName = t, this.namespace = r;
1332
1459
  }
@@ -1334,60 +1461,60 @@ class ct extends Ae {
1334
1461
  class Se extends Ae {
1335
1462
  constructor(t, r) {
1336
1463
  super(r);
1337
- i(this, "isPortal", () => !0);
1338
- i(this, "toHTML", () => "");
1339
- i(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
1464
+ o(this, "isPortal", () => !0);
1465
+ o(this, "toHTML", () => "");
1466
+ o(this, "contentToHTML", (t = !1) => this.children.map((r) => r.toHTML(t)).join(""));
1340
1467
  this.selector = t;
1341
1468
  }
1342
1469
  }
1343
1470
  class at {
1344
1471
  constructor(e) {
1345
- i(this, "id", be());
1346
- i(this, "isElement", () => !1);
1347
- i(this, "isText", () => !0);
1348
- i(this, "getText", () => this.text);
1349
- i(this, "toHTML", () => this.text);
1472
+ o(this, "id", be());
1473
+ o(this, "isElement", () => !1);
1474
+ o(this, "isText", () => !0);
1475
+ o(this, "getText", () => this.text);
1476
+ o(this, "toHTML", () => this.text);
1350
1477
  this.text = e;
1351
1478
  }
1352
1479
  }
1353
- class P {
1480
+ class D {
1354
1481
  constructor(e, t, r, n) {
1355
- i(this, "appendOrInsert", (e) => {
1482
+ o(this, "appendOrInsert", (e) => {
1356
1483
  if (this.reference != null) {
1357
1484
  const t = this.element.children.indexOf(this.reference);
1358
1485
  this.element.children.splice(t, 0, e);
1359
1486
  } else
1360
1487
  this.element.children.push(e);
1361
1488
  });
1362
- i(this, "makeChildElement", (e, t) => {
1489
+ o(this, "makeChildElement", (e, t) => {
1363
1490
  const r = new ct(e, t, this.element);
1364
- return this.appendOrInsert(r), new P(
1491
+ return this.appendOrInsert(r), new D(
1365
1492
  r,
1366
1493
  void 0,
1367
1494
  this.container,
1368
1495
  this.providers
1369
1496
  );
1370
1497
  });
1371
- i(this, "makeChildText", (e) => {
1498
+ o(this, "makeChildText", (e) => {
1372
1499
  const t = new at(e);
1373
- return this.appendOrInsert(t), new P(
1500
+ return this.appendOrInsert(t), new D(
1374
1501
  this.element,
1375
1502
  t,
1376
1503
  this.container,
1377
1504
  this.providers
1378
1505
  );
1379
1506
  });
1380
- i(this, "setText", (e) => {
1507
+ o(this, "setText", (e) => {
1381
1508
  this.reference && this.reference.isText() && (this.reference.text = e);
1382
1509
  });
1383
- i(this, "getText", () => {
1510
+ o(this, "getText", () => {
1384
1511
  var e;
1385
1512
  return ((e = this.reference) == null ? void 0 : e.getText()) ?? this.element.getText();
1386
1513
  });
1387
- i(this, "makeRef", () => this.makeChildText(""));
1388
- i(this, "makePortal", (e) => {
1514
+ o(this, "makeRef", () => this.makeChildText(""));
1515
+ o(this, "makePortal", (e) => {
1389
1516
  const t = new Se(e, this.element);
1390
- return this.appendOrInsert(t), new P(
1517
+ return this.appendOrInsert(t), new D(
1391
1518
  t,
1392
1519
  void 0,
1393
1520
  this.container,
@@ -1401,30 +1528,30 @@ class P {
1401
1528
  * @param value - The provider to set for the given mark.
1402
1529
  * @returns A new `DOMContext` instance with the specified provider.
1403
1530
  */
1404
- i(this, "setProvider", (e, t, r) => new P(this.element, this.reference, this.container, {
1531
+ o(this, "setProvider", (e, t, r) => new D(this.element, this.reference, this.container, {
1405
1532
  ...this.providers,
1406
1533
  [e]: [t, r]
1407
1534
  }));
1408
- i(this, "getProvider", (e) => {
1535
+ o(this, "getProvider", (e) => {
1409
1536
  if (this.providers[e] === void 0)
1410
1537
  throw new me(e);
1411
1538
  const [t, r] = this.providers[e];
1412
1539
  return { value: t, onUse: r };
1413
1540
  });
1414
- i(this, "clear", (e) => {
1541
+ o(this, "clear", (e) => {
1415
1542
  e && (this.reference !== void 0 ? this.element.removeChild(this.reference) : this.element.remove());
1416
1543
  });
1417
- i(this, "on", (e, t) => this.element.on(e, t, this));
1418
- i(this, "addClasses", (e) => this.element.addClasses(e));
1419
- i(this, "removeClasses", (e) => this.element.removeClasses(e));
1420
- i(this, "getClasses", () => this.element.getClasses());
1421
- i(this, "isBrowserDOM", () => !1);
1422
- i(this, "isBrowser", () => !1);
1423
- i(this, "isHeadlessDOM", () => !0);
1424
- i(this, "isHeadless", () => !0);
1425
- i(this, "setStyle", (e, t) => this.element.setStyle(e, t));
1426
- i(this, "getStyle", (e) => this.element.getStyle(e));
1427
- i(this, "makeAccessors", (e) => this.element.makeAccessors(e));
1544
+ o(this, "on", (e, t) => this.element.on(e, t, this));
1545
+ o(this, "addClasses", (e) => this.element.addClasses(e));
1546
+ o(this, "removeClasses", (e) => this.element.removeClasses(e));
1547
+ o(this, "getClasses", () => this.element.getClasses());
1548
+ o(this, "isBrowserDOM", () => !1);
1549
+ o(this, "isBrowser", () => !1);
1550
+ o(this, "isHeadlessDOM", () => !0);
1551
+ o(this, "isHeadless", () => !0);
1552
+ o(this, "setStyle", (e, t) => this.element.setStyle(e, t));
1553
+ o(this, "getStyle", (e) => this.element.getStyle(e));
1554
+ o(this, "makeAccessors", (e) => this.element.makeAccessors(e));
1428
1555
  this.element = e, this.reference = t, this.container = r, this.providers = n;
1429
1556
  }
1430
1557
  }
@@ -1435,36 +1562,36 @@ const ut = /* @__PURE__ */ new Set([
1435
1562
  "readonly",
1436
1563
  "required",
1437
1564
  "selected"
1438
- ]), ht = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), _e = (s) => (e) => e.makeChildText(s).clear, Ee = (s) => (e) => {
1565
+ ]), ht = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), ve = (s) => (e) => e.makeChildText(s).clear, _e = (s) => (e) => {
1439
1566
  const t = e.makeChildText(s.value), r = s.on(t.setText);
1440
1567
  return (n) => {
1441
1568
  r(), t.clear(n);
1442
1569
  };
1443
- }, Rt = (s) => d.is(s) ? Ee(s) : _e(s), A = (...s) => (e) => {
1570
+ }, Rt = (s) => d.is(s) ? _e(s) : ve(s), b = (...s) => (e) => {
1444
1571
  const t = s.map((r) => f(r)(e));
1445
1572
  return (r) => {
1446
1573
  t.forEach((n) => n(r));
1447
1574
  };
1448
- }, _ = () => () => {
1575
+ }, v = () => () => {
1449
1576
  }, ft = (s) => (e) => (e.addClasses(s), (t) => {
1450
1577
  t && e.removeClasses(s);
1451
1578
  }), dt = (s) => (e) => {
1452
1579
  let t = [];
1453
1580
  const r = s.on((n) => {
1454
- e.removeClasses(t), t = (n ?? "").split(" ").filter((o) => o.length > 0), e.addClasses(t);
1581
+ e.removeClasses(t), t = (n ?? "").split(" ").filter((i) => i.length > 0), e.addClasses(t);
1455
1582
  });
1456
1583
  return (n) => {
1457
1584
  r(), n && e.removeClasses(t), t.length = 0;
1458
1585
  };
1459
- }, H = (s, e) => (t) => {
1460
- const { get: r, set: n } = t.makeAccessors(s), o = r();
1586
+ }, $ = (s, e) => (t) => {
1587
+ const { get: r, set: n } = t.makeAccessors(s), i = r();
1461
1588
  return n(e), (l) => {
1462
- l && n(o);
1589
+ l && n(i);
1463
1590
  };
1464
- }, N = (s, e) => (t) => {
1465
- const { get: r, set: n } = t.makeAccessors(s), o = r(), l = e.on(n);
1591
+ }, k = (s, e) => (t) => {
1592
+ const { get: r, set: n } = t.makeAccessors(s), i = r(), l = e.on(n);
1466
1593
  return (c) => {
1467
- l(), c && n(o);
1594
+ l(), c && n(i);
1468
1595
  };
1469
1596
  }, M = new Proxy(
1470
1597
  {},
@@ -1482,10 +1609,10 @@ const ut = /* @__PURE__ */ new Set([
1482
1609
  */
1483
1610
  get: (s, e) => e === "class" ? (t) => d.is(t) ? dt(t) : ft(
1484
1611
  (t ?? "").split(" ").filter((r) => r.length > 0)
1485
- ) : (t) => d.is(t) ? N(
1612
+ ) : (t) => d.is(t) ? k(
1486
1613
  e,
1487
1614
  t
1488
- ) : H(
1615
+ ) : $(
1489
1616
  e,
1490
1617
  t
1491
1618
  )
@@ -1501,10 +1628,10 @@ const ut = /* @__PURE__ */ new Set([
1501
1628
  * @returns The renderable component for the specified attribute.
1502
1629
  *
1503
1630
  */
1504
- get: (s, e) => (t) => d.is(t) ? N(
1631
+ get: (s, e) => (t) => d.is(t) ? k(
1505
1632
  `data-${e}`,
1506
1633
  t
1507
- ) : H(`data-${e}`, t)
1634
+ ) : $(`data-${e}`, t)
1508
1635
  }
1509
1636
  ), jt = new Proxy(
1510
1637
  {},
@@ -1517,10 +1644,10 @@ const ut = /* @__PURE__ */ new Set([
1517
1644
  * @returns The renderable component for the specified attribute.
1518
1645
  *
1519
1646
  */
1520
- get: (s, e) => (t) => d.is(t) ? N(
1647
+ get: (s, e) => (t) => d.is(t) ? k(
1521
1648
  `aria-${e}`,
1522
1649
  t
1523
- ) : H(
1650
+ ) : $(
1524
1651
  `aria-${e}`,
1525
1652
  t
1526
1653
  )
@@ -1536,10 +1663,10 @@ const ut = /* @__PURE__ */ new Set([
1536
1663
  * @returns The renderable component for the specified attribute.
1537
1664
  *
1538
1665
  */
1539
- get: (s, e) => (t) => d.is(t) ? N(
1666
+ get: (s, e) => (t) => d.is(t) ? k(
1540
1667
  e,
1541
1668
  t
1542
- ) : H(
1669
+ ) : $(
1543
1670
  e,
1544
1671
  t
1545
1672
  )
@@ -1554,35 +1681,35 @@ const ut = /* @__PURE__ */ new Set([
1554
1681
  * @returns The renderable component for the specified attribute.
1555
1682
  *
1556
1683
  */
1557
- get: (s, e) => (t) => d.is(t) ? N(
1684
+ get: (s, e) => (t) => d.is(t) ? k(
1558
1685
  e,
1559
1686
  t
1560
- ) : H(
1687
+ ) : $(
1561
1688
  e,
1562
1689
  t
1563
1690
  )
1564
1691
  }
1565
1692
  ), f = (s) => {
1566
1693
  if (s == null)
1567
- return _;
1694
+ return v;
1568
1695
  if (Array.isArray(s))
1569
- return A(...s.map(f));
1696
+ return b(...s.map(f));
1570
1697
  if (typeof s == "string")
1571
- return _e(s);
1698
+ return ve(s);
1572
1699
  if (d.is(s))
1573
- return Ee(s);
1700
+ return _e(s);
1574
1701
  if (typeof s == "function")
1575
1702
  return s;
1576
1703
  throw new Error(`Unknown type: '${typeof s}' for child: ${s}`);
1577
1704
  }, we = (s, ...e) => (t) => {
1578
- const r = t.makeChildElement(s, void 0), n = e.map((o) => f(o)(r));
1579
- return (o) => {
1580
- n.forEach((l) => l(!1)), r.clear(o);
1705
+ const r = t.makeChildElement(s, void 0), n = e.map((i) => f(i)(r));
1706
+ return (i) => {
1707
+ n.forEach((l) => l(!1)), r.clear(i);
1581
1708
  };
1582
- }, Ce = (s, e, ...t) => (r) => {
1583
- const n = r.makeChildElement(s, e), o = t.map((l) => f(l)(n));
1709
+ }, Ee = (s, e, ...t) => (r) => {
1710
+ const n = r.makeChildElement(s, e), i = t.map((l) => f(l)(n));
1584
1711
  return (l) => {
1585
- o.forEach((c) => c(!1)), n.clear(l);
1712
+ i.forEach((c) => c(!1)), n.clear(l);
1586
1713
  };
1587
1714
  }, Bt = new Proxy(
1588
1715
  {},
@@ -1612,7 +1739,7 @@ const ut = /* @__PURE__ */ new Set([
1612
1739
  * @param tagName - The SVG tag name.
1613
1740
  * @returns A renderable function that creates and appends the SVG element to the DOM.
1614
1741
  */
1615
- get: (s, e) => (...t) => Ce(e, pt, t.flatMap(f))
1742
+ get: (s, e) => (...t) => Ee(e, pt, t.flatMap(f))
1616
1743
  }
1617
1744
  ), gt = "http://www.w3.org/1998/Math/MathML", Jt = new Proxy(
1618
1745
  {},
@@ -1622,15 +1749,15 @@ const ut = /* @__PURE__ */ new Set([
1622
1749
  * @param tagName - The Math tag name.
1623
1750
  * @returns A renderable function that creates and appends the Math element to the DOM.
1624
1751
  */
1625
- get: (s, e) => (...t) => Ce(e, gt, t.flatMap(f))
1752
+ get: (s, e) => (...t) => Ee(e, gt, t.flatMap(f))
1626
1753
  }
1627
- ), ve = (s, e) => {
1754
+ ), Ce = (s, e) => {
1628
1755
  if (typeof e == "function")
1629
- return ve(s, { then: e });
1630
- const t = e.pending != null ? f(e.pending()) : _, r = e.then, n = e.error != null ? (o) => f(e.error(o)) : () => _;
1631
- return (o) => {
1756
+ return Ce(s, { then: e });
1757
+ const t = e.pending != null ? f(e.pending()) : v, r = e.then, n = e.error != null ? (i) => f(e.error(i)) : () => v;
1758
+ return (i) => {
1632
1759
  let l = !0;
1633
- const c = s(), a = o.makeRef();
1760
+ const c = s(), a = i.makeRef();
1634
1761
  let u = f(t)(a);
1635
1762
  return c.then(
1636
1763
  (h) => {
@@ -1643,14 +1770,14 @@ const ut = /* @__PURE__ */ new Set([
1643
1770
  l = !1, u(h), a.clear(h);
1644
1771
  };
1645
1772
  };
1646
- }, Gt = (s, e) => ve(() => s, e), xe = (s, e, t) => (r) => r.on(s, e, t), mt = (s) => xe("click", (e, t) => {
1773
+ }, Gt = (s, e) => Ce(() => s, e), xe = (s, e, t) => (r) => r.on(s, e, t), mt = (s) => xe("click", (e, t) => {
1647
1774
  e.preventDefault();
1648
1775
  const r = e.target;
1649
1776
  setTimeout(() => {
1650
1777
  const n = r.ownerDocument != null ? r == null ? void 0 : r.checked : void 0;
1651
1778
  n != null && s(!n, t);
1652
1779
  }, 0);
1653
- }), J = new Proxy(
1780
+ }), X = new Proxy(
1654
1781
  {},
1655
1782
  {
1656
1783
  /**
@@ -1692,12 +1819,12 @@ const ut = /* @__PURE__ */ new Set([
1692
1819
  const t = e.target;
1693
1820
  if (t.value === "")
1694
1821
  return;
1695
- const r = t.value.split("T"), n = r[0].split("-"), o = new Date(
1822
+ const r = t.value.split("T"), n = r[0].split("-"), i = new Date(
1696
1823
  Number(n[0]),
1697
1824
  Number(n[1]) - 1,
1698
1825
  Number(n[2])
1699
1826
  ), l = r[1].split(":");
1700
- o.setHours(Number(l[0])), o.setMinutes(Number(l[1])), o.setSeconds(Number(l[2])), s(o);
1827
+ i.setHours(Number(l[0])), i.setMinutes(Number(l[1])), i.setSeconds(Number(l[2])), s(i);
1701
1828
  }, Yt = (s) => (e) => {
1702
1829
  const t = e.target;
1703
1830
  if (t.value === "") {
@@ -1709,12 +1836,12 @@ const ut = /* @__PURE__ */ new Set([
1709
1836
  s(null);
1710
1837
  return;
1711
1838
  }
1712
- const n = r[0].split("-"), o = new Date(
1839
+ const n = r[0].split("-"), i = new Date(
1713
1840
  Number(n[0]),
1714
1841
  Number(n[1]) - 1,
1715
1842
  Number(n[2])
1716
1843
  ), l = r[1].split(":");
1717
- o.setHours(Number(l[0] ?? 0)), o.setMinutes(Number(l[1] ?? 0)), o.setSeconds(Number(l[2] ?? 0)), s(o);
1844
+ i.setHours(Number(l[0] ?? 0)), i.setMinutes(Number(l[1] ?? 0)), i.setSeconds(Number(l[2] ?? 0)), s(i);
1718
1845
  }, zt = (s) => (e) => {
1719
1846
  const t = e.target;
1720
1847
  s(t.checked);
@@ -1724,40 +1851,40 @@ const ut = /* @__PURE__ */ new Set([
1724
1851
  e.stopPropagation(), s();
1725
1852
  }, Kt = (s) => (e) => {
1726
1853
  e.stopImmediatePropagation(), s();
1727
- }, es = (s, e = "input") => A(M.valueAsDate(s), J[e](bt(s.set))), ts = (s, e = "input") => A(M.valueAsDate(s), J[e](At(s.set))), ss = (s, e = "input") => A(M.valueAsNumber(s), J[e](Tt(s.set))), rs = (s, e = "input") => A(M.value(s), J[e](yt(s.set))), ns = (s) => A(M.checked(s), mt(s.set)), G = (s, e) => {
1854
+ }, es = (s, e = "input") => b(M.valueAsDate(s), X[e](bt(s.set))), ts = (s, e = "input") => b(M.valueAsDate(s), X[e](At(s.set))), ss = (s, e = "input") => b(M.valueAsNumber(s), X[e](Tt(s.set))), rs = (s, e = "input") => b(M.value(s), X[e](yt(s.set))), ns = (s) => b(M.checked(s), mt(s.set)), Y = (s, e) => {
1728
1855
  if (d.is(s))
1729
1856
  return (r) => {
1730
1857
  const n = r.makeRef();
1731
- let o, l;
1858
+ let i, l;
1732
1859
  const c = s.map((h) => Object.keys(h)[0]);
1733
1860
  let a;
1734
1861
  const u = c.on((h) => {
1735
1862
  if (h !== a) {
1736
- a = h, l == null || l.dispose(), o == null || o(!0), l = s.map((y) => y[h]);
1863
+ a = h, l == null || l.dispose(), i == null || i(!0), l = s.map((y) => y[h]);
1737
1864
  const g = e[h](l);
1738
- o = f(g)(n);
1865
+ i = f(g)(n);
1739
1866
  }
1740
1867
  });
1741
1868
  return (h) => {
1742
- l == null || l.dispose(), u(), n.clear(h), o == null || o(h);
1869
+ l == null || l.dispose(), u(), n.clear(h), i == null || i(h);
1743
1870
  };
1744
1871
  };
1745
1872
  const t = Object.keys(s)[0];
1746
- return f(e[t](U(s[t])));
1747
- }, Le = (s, e, t) => G(
1873
+ return f(e[t](G(s[t])));
1874
+ }, Pe = (s, e, t) => Y(
1748
1875
  T.map(s, (r) => ({ [r[e]]: r })),
1749
1876
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1750
1877
  t
1751
- ), is = (s, e) => Le(s, "kind", e), os = (s, e) => {
1878
+ ), is = (s, e) => Pe(s, "kind", e), os = (s, e) => {
1752
1879
  const t = T.map(s, ([r, n]) => ({ [r]: n }));
1753
- return G(t, e);
1754
- }, ls = (s, e) => Le(s, "type", e), St = (s, e) => G(
1880
+ return Y(t, e);
1881
+ }, ls = (s, e) => Pe(s, "type", e), St = (s, e) => Y(
1755
1882
  T.map(s, (t) => ({ [t]: !0 })),
1756
1883
  e
1757
1884
  ), cs = (s, e = {}) => (t) => {
1758
1885
  const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
1759
1886
  return St(
1760
- t.map((o) => o.isFirst ? "first" : o.isLast ? "last" : "other"),
1887
+ t.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
1761
1888
  {
1762
1889
  first: r,
1763
1890
  last: n,
@@ -1765,47 +1892,47 @@ const ut = /* @__PURE__ */ new Set([
1765
1892
  }
1766
1893
  );
1767
1894
  }, as = (s) => (e) => (e.appendOrInsert(s), (t) => {
1768
- t && R(s);
1769
- }), _t = (s, e, t) => {
1895
+ t && j(s);
1896
+ }), vt = (s, e, t) => {
1770
1897
  if (d.is(s)) {
1771
1898
  const r = s;
1772
1899
  return (n) => {
1773
- const o = n.makeRef();
1900
+ const i = n.makeRef();
1774
1901
  let l = () => {
1775
1902
  }, c = !1, a = null;
1776
1903
  const u = r.on((h) => {
1777
- h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? _)(o), c = !1, a == null || a.dispose(), a = null) : (a == null ? a = w(h) : a.value = h, c || (l(!0), l = f(e(a))(
1778
- o
1904
+ h == null ? (l(!0), l = f((t == null ? void 0 : t()) ?? v)(i), c = !1, a == null || a.dispose(), a = null) : (a == null ? a = E(h) : a.value = h, c || (l(!0), l = f(e(a))(
1905
+ i
1779
1906
  ), c = !0));
1780
1907
  });
1781
1908
  return (h) => {
1782
- a == null || a.dispose(), u(), l == null || l(h), o.clear(h);
1909
+ a == null || a.dispose(), u(), l == null || l(h), i.clear(h);
1783
1910
  };
1784
1911
  };
1785
1912
  } else {
1786
1913
  const r = s;
1787
1914
  if (r == null) {
1788
1915
  const n = t == null ? void 0 : t();
1789
- return n != null ? f(n) : _;
1916
+ return n != null ? f(n) : v;
1790
1917
  }
1791
- return f(e(U(r)));
1918
+ return f(e(G(r)));
1792
1919
  }
1793
1920
  }, us = (...s) => (e, t) => (r) => {
1794
1921
  const n = r.makeRef();
1795
1922
  if (s.some(
1796
1923
  (p) => !d.is(p) && p == null
1797
1924
  ))
1798
- return (t != null ? f(t == null ? void 0 : t()) : _)(
1925
+ return (t != null ? f(t == null ? void 0 : t()) : v)(
1799
1926
  n
1800
1927
  );
1801
1928
  const l = s.map(() => null), c = s.map(
1802
1929
  (p) => d.is(p) ? p.value != null : p != null
1803
1930
  );
1804
1931
  let a = null;
1805
- const u = w(c.every((p) => p)), h = (p, m) => {
1932
+ const u = E(c.every((p) => p)), h = (p, m) => {
1806
1933
  if (p.value != null) {
1807
1934
  if (l[m] == null) {
1808
- const C = w(p.value);
1935
+ const C = E(p.value);
1809
1936
  l[m] = C;
1810
1937
  } else
1811
1938
  l[m].value = p.value;
@@ -1816,7 +1943,7 @@ const ut = /* @__PURE__ */ new Set([
1816
1943
  let g = s.length - 1;
1817
1944
  const y = s.map((p, m) => {
1818
1945
  if (!d.is(p)) {
1819
- const C = w(p);
1946
+ const C = E(p);
1820
1947
  return l[m] = C, () => {
1821
1948
  };
1822
1949
  }
@@ -1825,61 +1952,79 @@ const ut = /* @__PURE__ */ new Set([
1825
1952
  });
1826
1953
  });
1827
1954
  return u.on((p) => {
1828
- a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ?? _)(n);
1955
+ a == null || a(!0), a = null, p ? a = f(e(...l))(n) : a = f((t == null ? void 0 : t()) ?? v)(n);
1829
1956
  }), (p) => {
1830
1957
  l.forEach((m) => m == null ? void 0 : m.dispose()), u.dispose(), y.forEach((m) => m()), a == null || a(p), n.clear(p);
1831
1958
  };
1832
- }, Z = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Pe = (s, e, t) => _t(
1959
+ }, O = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), Le = (s, e, t) => vt(
1833
1960
  T.map(s, (r) => r ? !0 : null),
1834
1961
  e,
1835
1962
  t ?? void 0
1836
- ), hs = (s, e, t) => Pe(
1963
+ ), hs = (s, e, t) => Le(
1837
1964
  T.map(s, (r) => !r),
1838
1965
  e,
1839
1966
  t
1840
- ), De = (s, e, t) => t != null ? De(s, (r) => {
1841
- const n = new Y(
1842
- r.index,
1843
- r.total.map((o) => o - 1)
1844
- );
1845
- return A(
1846
- Z(n.dispose),
1847
- f(e(r)),
1848
- Pe(
1849
- r.isLast,
1850
- () => _,
1851
- () => t(n)
1852
- )
1853
- );
1854
- }) : d.is(s) ? (r) => {
1855
- const n = r.makeRef(), o = [], l = s.on((c) => {
1856
- const a = o.splice(c);
1857
- for (const u of a)
1858
- u(!0);
1859
- for (let u = o.length; u < c; u++) {
1860
- const h = new Y(u, s);
1861
- o.push(f(e(h))(n));
1862
- }
1863
- });
1864
- return (c) => {
1865
- l();
1866
- for (const a of o)
1867
- a(c);
1868
- o.length = 0, n.clear(c);
1869
- };
1870
- } : A(
1871
- ...Array.from({ length: s }, (r, n) => n).map(
1872
- (r) => f(e(new Y(r, U(s))))
1873
- )
1874
- ), fs = (s, e, t) => {
1875
- const r = T.map(s, (o) => o.length), n = T.toSignal(s);
1967
+ ), De = (s, e, t) => {
1968
+ if (t != null)
1969
+ return De(s, (r) => {
1970
+ const n = new Q(
1971
+ r.index,
1972
+ r.total.map((i) => i - 1)
1973
+ );
1974
+ return b(
1975
+ O(n.dispose, r.dispose),
1976
+ f(e(r)),
1977
+ Le(
1978
+ r.isLast,
1979
+ () => v,
1980
+ () => t(n)
1981
+ )
1982
+ );
1983
+ });
1984
+ if (d.is(s))
1985
+ return (r) => {
1986
+ const n = r.makeRef(), i = [], l = s.on((c) => {
1987
+ const a = i.splice(c);
1988
+ for (const u of a)
1989
+ u(!0);
1990
+ for (let u = i.length; u < c; u++) {
1991
+ const h = new Q(u, s);
1992
+ i.push(
1993
+ b(
1994
+ O(h.dispose),
1995
+ f(e(h))
1996
+ )(n)
1997
+ );
1998
+ }
1999
+ });
2000
+ return (c) => {
2001
+ l();
2002
+ for (const a of i)
2003
+ a(c);
2004
+ i.length = 0, n.clear(c);
2005
+ };
2006
+ };
2007
+ {
2008
+ const r = G(s);
2009
+ return b(
2010
+ ...Array.from({ length: s }, (n, i) => i).map((n) => {
2011
+ const i = new Q(n, r);
2012
+ return b(
2013
+ O(i.dispose),
2014
+ f(e(i))
2015
+ );
2016
+ })
2017
+ );
2018
+ }
2019
+ }, fs = (s, e, t) => {
2020
+ const r = T.map(s, (i) => i.length), n = T.toSignal(s);
1876
2021
  return De(
1877
2022
  r,
1878
- (o) => {
1879
- const l = n.map((c) => c[o.index]);
1880
- return A(
1881
- Z(l.dispose),
1882
- f(e(l, o))
2023
+ (i) => {
2024
+ const l = n.map((c) => c[i.index]);
2025
+ return b(
2026
+ O(l.dispose),
2027
+ f(e(l, i))
1883
2028
  );
1884
2029
  },
1885
2030
  t
@@ -1890,18 +2035,18 @@ const ut = /* @__PURE__ */ new Set([
1890
2035
  return (r) => {
1891
2036
  r = r.makeRef();
1892
2037
  const n = t.map((c) => f(e(c)));
1893
- let o = () => {
2038
+ let i = () => {
1894
2039
  };
1895
2040
  const l = n.on((c) => {
1896
- o(!0), o = c(r);
2041
+ i(!0), i = c(r);
1897
2042
  });
1898
2043
  return (c) => {
1899
- l(), o(c);
2044
+ l(), i(c);
1900
2045
  };
1901
2046
  };
1902
2047
  }
1903
2048
  return f(e(s));
1904
- }, ps = (s, e, t = () => _) => G(
2049
+ }, ps = (s, e, t = () => v) => Y(
1905
2050
  T.map(
1906
2051
  s,
1907
2052
  (r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
@@ -1912,33 +2057,33 @@ const ut = /* @__PURE__ */ new Set([
1912
2057
  }
1913
2058
  ), gs = (s, e) => (t) => {
1914
2059
  const r = t.makePortal(s);
1915
- return Q(f(e), r);
1916
- }, k = /* @__PURE__ */ new Map(), Et = (s) => ({
2060
+ return K(f(e), r);
2061
+ }, R = /* @__PURE__ */ new Map(), _t = (s) => ({
1917
2062
  mark: Je(`Probe(${s.description})`),
1918
2063
  create: ({ callback: e = () => {
1919
2064
  }, timeout: t = 10 } = {}) => {
1920
2065
  const r = (c) => {
1921
- clearTimeout(n), k.delete(s), e(c);
2066
+ clearTimeout(n), R.delete(s), e(c);
1922
2067
  };
1923
- if (k.has(s))
2068
+ if (R.has(s))
1924
2069
  throw new Error(`Probe already exists: ${s.description}`);
1925
- const n = setTimeout(() => r("timeout"), t), o = { counter: 0, timeoutId: n };
1926
- return k.set(s, o), {
2070
+ const n = setTimeout(() => r("timeout"), t), i = { counter: 0, timeoutId: n };
2071
+ return R.set(s, i), {
1927
2072
  value: () => {
1928
2073
  clearTimeout(n);
1929
- const c = k.get(s);
2074
+ const c = R.get(s);
1930
2075
  c != null && --c.counter === 0 && r("resolved");
1931
2076
  },
1932
2077
  dispose: () => r("disposed"),
1933
- onUse: () => o.counter++
2078
+ onUse: () => i.counter++
1934
2079
  };
1935
2080
  }
1936
- }), ms = Et(Symbol("GlobalProbe")), wt = (s, e) => (t) => {
2081
+ }), ms = _t(Symbol("GlobalProbe")), wt = (s, e) => (t) => {
1937
2082
  const r = t.getStyle(s);
1938
2083
  return t.setStyle(s, e), (n) => {
1939
2084
  n && t.setStyle(s, r);
1940
2085
  };
1941
- }, Ct = (s, e) => (t) => {
2086
+ }, Et = (s, e) => (t) => {
1942
2087
  const r = t.getStyle(s);
1943
2088
  return e.on((n) => t.setStyle(s, n)), (n) => {
1944
2089
  n && t.setStyle(s, r);
@@ -1954,9 +2099,9 @@ const ut = /* @__PURE__ */ new Set([
1954
2099
  * @returns The renderable component for the specified attribute.
1955
2100
  *
1956
2101
  */
1957
- get: (s, e) => (t) => d.is(t) ? Ct(e, t) : wt(e, t)
2102
+ get: (s, e) => (t) => d.is(t) ? Et(e, t) : wt(e, t)
1958
2103
  }
1959
- ), vt = (s) => (e) => {
2104
+ ), Ct = (s) => (e) => {
1960
2105
  if (e.isBrowser()) {
1961
2106
  const t = s(e);
1962
2107
  if (t != null)
@@ -1968,7 +2113,7 @@ const ut = /* @__PURE__ */ new Set([
1968
2113
  const t = s(e);
1969
2114
  return t == null ? () => {
1970
2115
  } : f(t)(e);
1971
- }, bs = (s) => vt((e) => s(e.element)), As = (s) => (e) => {
2116
+ }, bs = (s) => Ct((e) => s(e.element)), As = (s) => (e) => {
1972
2117
  if (e.isHeadlessDOM()) {
1973
2118
  const t = s(e);
1974
2119
  if (t)
@@ -1976,7 +2121,7 @@ const ut = /* @__PURE__ */ new Set([
1976
2121
  }
1977
2122
  return () => {
1978
2123
  };
1979
- }, K = (s) => (e) => {
2124
+ }, ee = (s) => (e) => {
1980
2125
  let t = e;
1981
2126
  function r() {
1982
2127
  return t;
@@ -1984,22 +2129,22 @@ const ut = /* @__PURE__ */ new Set([
1984
2129
  function n(c) {
1985
2130
  t = c;
1986
2131
  }
1987
- const o = [], l = s({
2132
+ const i = [], l = s({
1988
2133
  use: ({ mark: c }) => {
1989
2134
  const { value: a, onUse: u } = r().getProvider(c);
1990
2135
  return u == null || u(), a;
1991
2136
  },
1992
2137
  set: ({ mark: c, create: a }, u) => {
1993
2138
  const { value: h, dispose: g, onUse: y } = a(u, r());
1994
- o.push(g), n(r().setProvider(c, h, y));
2139
+ i.push(g), n(r().setProvider(c, h, y));
1995
2140
  }
1996
2141
  });
1997
2142
  return l == null ? () => {
1998
- } : A(
2143
+ } : b(
1999
2144
  f(l),
2000
- Z(() => o.forEach((c) => c()))
2145
+ O(() => i.forEach((c) => c()))
2001
2146
  )(r());
2002
- }, Ss = (s, e, t) => K(({ set: r }) => (r(s, e), t())), _s = (s, e) => K(({ use: t }) => e(t(s))), Es = (...s) => (e) => K(({ use: t }) => {
2147
+ }, Ss = (s, e, t) => ee(({ set: r }) => (r(s, e), t())), vs = (s, e) => ee(({ use: t }) => e(t(s))), _s = (...s) => (e) => ee(({ use: t }) => {
2003
2148
  const r = s.map(t);
2004
2149
  return e(...r);
2005
2150
  });
@@ -2011,21 +2156,21 @@ export {
2011
2156
  ss as BindNumber,
2012
2157
  rs as BindText,
2013
2158
  L as BrowserContext,
2014
- V as CLASS_PLACEHOLDER_ATTR,
2015
- x as Computed,
2159
+ q as CLASS_PLACEHOLDER_ATTR,
2160
+ P as Computed,
2016
2161
  cs as Conjunction,
2017
2162
  as as DOMNode,
2018
2163
  we as El,
2019
- Ce as ElNS,
2020
- Y as ElementPosition,
2021
- _ as Empty,
2022
- _t as Ensure,
2164
+ Ee as ElNS,
2165
+ Q as ElementPosition,
2166
+ v as Empty,
2167
+ vt as Ensure,
2023
2168
  us as EnsureAll,
2024
2169
  fs as ForEach,
2025
- A as Fragment,
2170
+ b as Fragment,
2026
2171
  ms as GlobalProbe,
2027
- kt as HeadlessAdapter,
2028
- P as HeadlessContext,
2172
+ Nt as HeadlessAdapter,
2173
+ D as HeadlessContext,
2029
2174
  ct as HeadlessElement,
2030
2175
  Se as HeadlessPortal,
2031
2176
  at as HeadlessText,
@@ -2033,50 +2178,50 @@ export {
2033
2178
  ce as MemoryStore,
2034
2179
  ps as NotEmpty,
2035
2180
  mt as OnChecked,
2036
- Z as OnDispose,
2037
- G as OneOf,
2038
- Le as OneOfField,
2181
+ O as OnDispose,
2182
+ Y as OneOf,
2183
+ Pe as OneOfField,
2039
2184
  is as OneOfKind,
2040
2185
  os as OneOfTuple,
2041
2186
  ls as OneOfType,
2042
2187
  St as OneOfValue,
2043
2188
  gs as Portal,
2044
- I as Prop,
2189
+ V as Prop,
2045
2190
  Ss as Provide,
2046
2191
  me as ProviderNotFoundError,
2047
2192
  Ge as RenderingError,
2048
2193
  De as Repeat,
2049
2194
  d as Signal,
2050
- ve as Task,
2195
+ Ce as Task,
2051
2196
  Rt as TextNode,
2052
2197
  hs as Unless,
2053
- _s as Use,
2054
- Es as UseMany,
2198
+ vs as Use,
2199
+ _s as UseMany,
2055
2200
  T as Value,
2056
- Pe as When,
2057
- vt as WithBrowserCtx,
2201
+ Le as When,
2202
+ Ct as WithBrowserCtx,
2058
2203
  Ts as WithCtx,
2059
2204
  bs as WithElement,
2060
2205
  As as WithHeadlessCtx,
2061
- K as WithProvider,
2206
+ ee as WithProvider,
2062
2207
  ye as _NODE_PLACEHOLDER_ATTR,
2063
2208
  Ue as _getSelfOrParentElement,
2064
2209
  ge as _isElement,
2065
2210
  We as _makeGetter,
2066
2211
  Be as _makeSetter,
2067
- R as _removeDOMNode,
2068
- Ee as _signalText,
2069
- _e as _staticText,
2212
+ j as _removeDOMNode,
2213
+ _e as _signalText,
2214
+ ve as _staticText,
2070
2215
  Ot as animateSignal,
2071
2216
  Fe as animateSignals,
2072
2217
  jt as aria,
2073
2218
  M as attr,
2074
- z as computed,
2219
+ Z as computed,
2075
2220
  qe as computedOf,
2076
2221
  Ht as computedRecord,
2077
2222
  Vt as dataAttr,
2078
2223
  je as effect,
2079
- Pt as effectOf,
2224
+ Lt as effectOf,
2080
2225
  zt as emitChecked,
2081
2226
  Qt as emitPreventDefault,
2082
2227
  Kt as emitStopImmediatePropagation,
@@ -2092,24 +2237,24 @@ export {
2092
2237
  Re as guessInterpolate,
2093
2238
  Bt as html,
2094
2239
  Wt as input,
2095
- ke as interpolateDate,
2096
- Ne as interpolateNumber,
2097
- $e as interpolateString,
2098
- Lt as joinSignals,
2240
+ Ne as interpolateDate,
2241
+ $e as interpolateNumber,
2242
+ ke as interpolateString,
2243
+ Pt as joinSignals,
2099
2244
  Dt as localStorageProp,
2100
- Et as makeProbe,
2245
+ _t as makeProbe,
2101
2246
  Je as makeProviderMark,
2102
2247
  Jt as math,
2103
2248
  Ft as mathAttr,
2104
- J as on,
2105
- w as prop,
2106
- Nt as render,
2107
- Q as renderWithContext,
2249
+ X as on,
2250
+ E as prop,
2251
+ $t as render,
2252
+ K as renderWithContext,
2108
2253
  f as renderableOfTNode,
2109
2254
  It as restoreTempoPlaceholders,
2110
- $t as runHeadless,
2255
+ kt as runHeadless,
2111
2256
  Mt as sessionStorageProp,
2112
- U as signal,
2257
+ G as signal,
2113
2258
  ae as storedProp,
2114
2259
  ys as style,
2115
2260
  Ut as svg,