@jasonshimmy/custom-elements-runtime 0.1.24 → 0.2.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.
@@ -1,13 +1,13 @@
1
- function bt(e, t) {
2
- return te(e ? t : [], "when-block");
1
+ function mt(e, t) {
2
+ return oe(e ? t : [], "when-block");
3
3
  }
4
- function vt(e, t) {
4
+ function bt(e, t) {
5
5
  return e.map((r, n) => {
6
6
  const o = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${n}` : String(r);
7
- return te(t(r, n), `each-${o}`);
7
+ return oe(t(r, n), `each-${o}`);
8
8
  });
9
9
  }
10
- function Re() {
10
+ function Be() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function Re() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Pe(...e);
20
+ return Re(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Pe(...e) {
24
+ function Re(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, n] = e[t];
27
- if (r) return [te(n, `whenChain-branch-${t}`)];
27
+ if (r) return [oe(n, `whenChain-branch-${t}`)];
28
28
  }
29
- return [te([], "whenChain-empty")];
29
+ return [oe([], "whenChain-empty")];
30
30
  }
31
- function te(e, t) {
31
+ function oe(e, t) {
32
32
  const r = e ? Array.isArray(e) ? e.filter(Boolean) : [e].filter(Boolean) : [];
33
33
  return {
34
34
  tag: "#anchor",
@@ -36,7 +36,7 @@ function te(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class U extends EventTarget {
39
+ class V extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class U extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return U.instance || (U.instance = new U()), U.instance;
47
+ return V.instance || (V.instance = new V()), V.instance;
48
48
  }
49
49
  // Enhanced emit method with better typing and event storm protection
50
50
  /**
@@ -160,7 +160,7 @@ class U extends EventTarget {
160
160
  this.eventCounters.clear();
161
161
  }
162
162
  }
163
- const Z = U.getInstance(), xt = (e, t) => Z.emit(e, t), wt = (e, t) => Z.on(e, t), kt = (e, t) => Z.off(e, t), $t = (e, t) => Z.once(e, t), St = (e, t, r) => Z.listen(e, t, r);
163
+ const X = V.getInstance(), vt = (e, t) => X.emit(e, t), wt = (e, t) => X.on(e, t), xt = (e, t) => X.off(e, t), kt = (e, t) => X.once(e, t), $t = (e, t, r) => X.listen(e, t, r);
164
164
  function xe(e) {
165
165
  let t = { ...e };
166
166
  const r = [];
@@ -171,18 +171,18 @@ function xe(e) {
171
171
  return t;
172
172
  }
173
173
  function s(a) {
174
- const l = typeof a == "function" ? a(t) : a;
175
- t = { ...t, ...l }, i();
174
+ const c = typeof a == "function" ? a(t) : a;
175
+ t = { ...t, ...c }, i();
176
176
  }
177
177
  function i() {
178
178
  r.forEach((a) => a(t));
179
179
  }
180
180
  return { subscribe: n, getState: o, setState: s };
181
181
  }
182
- function me(e) {
182
+ function ve(e) {
183
183
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
184
184
  }
185
- function pe(e) {
185
+ function ge(e) {
186
186
  return typeof e == "string" ? e.replace(
187
187
  /[&<>"']/g,
188
188
  (t) => ({
@@ -201,27 +201,27 @@ function Oe(e, t, r) {
201
201
  if (Array.isArray(o) ? (s = o[0], i = o[1] || {}) : s = o, t.set(n, {
202
202
  callback: s,
203
203
  options: i,
204
- oldValue: he(e, n)
204
+ oldValue: ye(e, n)
205
205
  }), i.immediate)
206
206
  try {
207
- const a = he(e, n);
207
+ const a = ye(e, n);
208
208
  s(a, void 0, e);
209
209
  } catch (a) {
210
210
  console.error(`Error in immediate watcher for "${n}":`, a);
211
211
  }
212
212
  }
213
213
  }
214
- function he(e, t) {
214
+ function ye(e, t) {
215
215
  return t.split(".").reduce((r, n) => r?.[n], e);
216
216
  }
217
- function He(e, t, r, n) {
217
+ function Me(e, t, r, n) {
218
218
  const o = (i, a) => {
219
219
  if (i === a) return !0;
220
220
  if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
221
221
  if (Array.isArray(i) && Array.isArray(a))
222
- return i.length !== a.length ? !1 : i.every((u, h) => o(u, a[h]));
223
- const l = Object.keys(i), f = Object.keys(a);
224
- return l.length !== f.length ? !1 : l.every((u) => o(i[u], a[u]));
222
+ return i.length !== a.length ? !1 : i.every((l, y) => o(l, a[y]));
223
+ const c = Object.keys(i), u = Object.keys(a);
224
+ return c.length !== u.length ? !1 : c.every((l) => o(i[l], a[l]));
225
225
  }, s = t.get(r);
226
226
  if (s && !o(n, s.oldValue))
227
227
  try {
@@ -232,13 +232,13 @@ function He(e, t, r, n) {
232
232
  for (const [i, a] of t.entries())
233
233
  if (a.options.deep && r.startsWith(i + "."))
234
234
  try {
235
- const l = he(e, i);
236
- o(l, a.oldValue) || (a.callback(l, a.oldValue, e), a.oldValue = l);
237
- } catch (l) {
238
- console.error(`Error in deep watcher for "${i}":`, l);
235
+ const c = ye(e, i);
236
+ o(c, a.oldValue) || (a.callback(c, a.oldValue, e), a.oldValue = c);
237
+ } catch (c) {
238
+ console.error(`Error in deep watcher for "${i}":`, c);
239
239
  }
240
240
  }
241
- function Me(e, t, r) {
241
+ function Ne(e, t, r) {
242
242
  if (!t.props) return;
243
243
  function n(o, s) {
244
244
  return s === Boolean ? o === "true" : s === Number ? Number(o) : o;
@@ -247,140 +247,148 @@ function Me(e, t, r) {
247
247
  if (s.type === Function && typeof e[o] == "function")
248
248
  r[o] = e[o];
249
249
  else {
250
- const i = e.getAttribute(me(o));
251
- i !== null ? r[o] = pe(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = pe(s.default));
250
+ const i = e.getAttribute(ve(o));
251
+ i !== null ? r[o] = ge(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = ge(s.default));
252
252
  }
253
253
  });
254
254
  }
255
- function Ne(e, t, r, n) {
255
+ function We(e, t, r, n) {
256
256
  e.onConnected && !r && (e.onConnected(t), n(!0));
257
257
  }
258
- function We(e, t, r, n, o, s, i, a) {
259
- e.onDisconnected && e.onDisconnected(t), r.forEach((l) => l()), n(), o(), s(!1), i(null), a(!1);
258
+ function De(e, t, r, n, o, s, i, a) {
259
+ e.onDisconnected && e.onDisconnected(t), r.forEach((c) => c()), n(), o(), s(!1), i(null), a(!1);
260
260
  }
261
- function De(e, t, r, n, o) {
261
+ function qe(e, t, r, n, o) {
262
262
  e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
263
263
  }
264
- function D(e, t) {
264
+ function H(e, t) {
265
265
  if (t && e instanceof HTMLElement) {
266
266
  for (const r in t)
267
267
  t[r] === e && delete t[r];
268
268
  for (const r of Array.from(e.childNodes))
269
- D(r, t);
269
+ H(r, t);
270
270
  }
271
271
  }
272
- function q(e, t) {
272
+ function K(e, t) {
273
273
  return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
- function we(e, t, r) {
275
+ function ke(e, t, r) {
276
276
  const n = t.split("."), o = n.pop();
277
277
  if (!o) return;
278
278
  const s = n.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
279
279
  s[o] = r;
280
280
  }
281
- function qe(e, t, r, n, o, s, i) {
281
+ function Ie(e, t, r, n, o, s, i) {
282
282
  if (!s) return;
283
- const a = t.includes("lazy"), l = t.includes("trim"), f = t.includes("number"), u = () => {
284
- const g = s._state || s;
285
- return q(g, e);
286
- }, h = u();
287
- let c = "text";
288
- const v = n?.type;
289
- if (i instanceof HTMLInputElement ? c = v || i.type || "text" : i instanceof HTMLSelectElement ? c = "select" : i instanceof HTMLTextAreaElement && (c = "textarea"), c === "checkbox")
290
- if (Array.isArray(h)) {
291
- const g = i?.getAttribute("value") || n?.value || "", d = h.includes(g);
292
- i && i.checked !== d && (r.checked = d);
283
+ const a = t.includes("lazy"), c = t.includes("trim"), u = t.includes("number"), l = () => {
284
+ const p = s._state || s;
285
+ return K(p, e);
286
+ }, y = l();
287
+ let d = "text";
288
+ const b = n?.type;
289
+ if (i instanceof HTMLInputElement ? d = b || i.type || "text" : i instanceof HTMLSelectElement ? d = "select" : i instanceof HTMLTextAreaElement && (d = "textarea"), d === "checkbox")
290
+ if (Array.isArray(y)) {
291
+ const p = i?.getAttribute("value") || n?.value || "", f = y.includes(p);
292
+ i && i.checked !== f && (r.checked = f);
293
293
  } else {
294
- const g = i?.getAttribute("true-value") || !0, d = h === g;
295
- i && i.checked !== d && (r.checked = d);
294
+ const p = i?.getAttribute("true-value") || !0, f = y === p;
295
+ i && i.checked !== f && (r.checked = f);
296
296
  }
297
- else if (c === "radio") {
298
- const g = n?.value || "", d = h === g;
299
- i && i.checked !== d && (r.checked = d);
300
- } else if (c === "select")
297
+ else if (d === "radio") {
298
+ const p = n?.value || "", f = y === p;
299
+ i && i.checked !== f && (r.checked = f);
300
+ } else if (d === "select")
301
301
  if (i && i.hasAttribute("multiple")) {
302
- const g = i, d = Array.isArray(h) ? h : [];
302
+ const p = i, f = Array.isArray(y) ? y : [];
303
303
  setTimeout(() => {
304
- Array.from(g.options).forEach((y) => {
305
- const b = d.includes(y.value);
306
- y.selected !== b && (y.selected = b);
304
+ Array.from(p.options).forEach((g) => {
305
+ const m = f.includes(g.value);
306
+ g.selected !== m && (g.selected = m);
307
307
  });
308
308
  }, 0);
309
309
  } else
310
310
  setTimeout(() => {
311
- i instanceof HTMLSelectElement && i.value !== String(h) && (i.value = String(h));
311
+ i instanceof HTMLSelectElement && i.value !== String(y) && (i.value = String(y));
312
312
  }, 0);
313
313
  else {
314
- const g = String(h ?? "");
315
- (!i || i.value !== g) && (r.value = h);
316
- }
317
- const x = a || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", k = (g) => {
318
- if (g.isComposing || o._isComposing || g.isTrusted === !1) return;
319
- const d = g.target;
320
- if (d._modelUpdating) return;
321
- const y = u();
322
- let b = d.value;
323
- if (c === "checkbox")
324
- if (Array.isArray(y)) {
325
- const $ = d.getAttribute("value") || "", _ = [...y];
326
- if (d.checked)
314
+ const p = String(y ?? "");
315
+ (!i || i.value !== p) && (r.value = y);
316
+ }
317
+ const k = a || d === "checkbox" || d === "radio" || d === "select" ? "change" : "input", x = (p) => {
318
+ if (p.isComposing || o._isComposing || p.isTrusted === !1) return;
319
+ const f = p.target;
320
+ if (f._modelUpdating) return;
321
+ const g = l();
322
+ let m = f.value;
323
+ if (d === "checkbox")
324
+ if (Array.isArray(g)) {
325
+ const $ = f.getAttribute("value") || "", _ = [...g];
326
+ if (f.checked)
327
327
  _.includes($) || _.push($);
328
328
  else {
329
329
  const C = _.indexOf($);
330
330
  C > -1 && _.splice(C, 1);
331
331
  }
332
- b = _;
332
+ m = _;
333
333
  } else {
334
- const $ = d.getAttribute("true-value") || !0, _ = d.getAttribute("false-value") || !1;
335
- b = d.checked ? $ : _;
334
+ const $ = f.getAttribute("true-value") || !0, _ = f.getAttribute("false-value") || !1;
335
+ m = f.checked ? $ : _;
336
336
  }
337
- else if (c === "radio")
338
- b = d.getAttribute("value") || d.value;
339
- else if (c === "select" && d.multiple) {
340
- const $ = d;
341
- b = Array.from($.selectedOptions).map(
337
+ else if (d === "radio")
338
+ m = f.getAttribute("value") || f.value;
339
+ else if (d === "select" && f.multiple) {
340
+ const $ = f;
341
+ m = Array.from($.selectedOptions).map(
342
342
  (_) => _.value
343
343
  );
344
- } else if (l && (b = b.trim()), f) {
345
- const $ = Number(b);
346
- isNaN($) || (b = $);
344
+ } else if (c && (m = m.trim()), u) {
345
+ const $ = Number(m);
346
+ isNaN($) || (m = $);
347
347
  }
348
- const p = s._state || s, w = q(p, e);
349
- if (Array.isArray(b) && Array.isArray(w) ? JSON.stringify([...b].sort()) !== JSON.stringify([...w].sort()) : b !== w) {
350
- const $ = g.target;
351
- $._modelUpdating = !0, we(p, e, b), setTimeout(() => {
348
+ const h = s._state || s, w = K(h, e);
349
+ if (Array.isArray(m) && Array.isArray(w) ? JSON.stringify([...m].sort()) !== JSON.stringify([...w].sort()) : m !== w) {
350
+ const $ = p.target;
351
+ $._modelUpdating = !0, ke(h, e, m), setTimeout(() => {
352
352
  $._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (o[x] = k, c === "text" || c === "textarea") {
357
- const g = () => {
356
+ if (o[k] = x, d === "text" || d === "textarea") {
357
+ const p = () => {
358
358
  o._isComposing = !0;
359
- }, d = (y) => {
359
+ }, f = (g) => {
360
360
  o._isComposing = !1;
361
- const b = y.target;
361
+ const m = g.target;
362
362
  setTimeout(() => {
363
- if (b) {
364
- let p = b.value;
365
- if (l && (p = p.trim()), f) {
366
- const _ = Number(p);
367
- isNaN(_) || (p = _);
363
+ if (m) {
364
+ let h = m.value;
365
+ if (c && (h = h.trim()), u) {
366
+ const _ = Number(h);
367
+ isNaN(_) || (h = _);
368
368
  }
369
- const w = s._state || s, m = q(w, e);
370
- (Array.isArray(p) && Array.isArray(m) ? JSON.stringify([...p].sort()) !== JSON.stringify([...m].sort()) : p !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
- b._modelUpdating = !1;
372
- }, 0)), we(w, e, p), s._requestRender && s._requestRender());
369
+ const w = s._state || s, v = K(w, e);
370
+ (Array.isArray(h) && Array.isArray(v) ? JSON.stringify([...h].sort()) !== JSON.stringify([...v].sort()) : h !== v) && (m && (m._modelUpdating = !0, setTimeout(() => {
371
+ m._modelUpdating = !1;
372
+ }, 0)), ke(w, e, h), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
- o.compositionstart = g, o.compositionend = d;
376
+ o.compositionstart = p, o.compositionend = f;
377
377
  }
378
378
  }
379
- const Ie = "onHost";
380
379
  function Te(e) {
381
- return e.slice(Ie.length).toLowerCase();
380
+ return e.slice(2).charAt(0).toLowerCase() + e.slice(3);
381
+ }
382
+ function ee(e) {
383
+ if (!e) return [void 0, void 0];
384
+ if (typeof e == "function") return [e, void 0];
385
+ if (typeof e == "object") {
386
+ if (typeof e.handler == "function") return [e.handler, e.options];
387
+ if (typeof e.fn == "function") return [e.fn, e.options];
388
+ }
389
+ return [void 0, void 0];
382
390
  }
383
- function Fe(e, t, r, n) {
391
+ function He(e, t, r, n) {
384
392
  if (n) {
385
393
  if (typeof e == "object" && e !== null)
386
394
  for (const [o, s] of Object.entries(e))
@@ -394,35 +402,35 @@ function Fe(e, t, r, n) {
394
402
  return;
395
403
  }
396
404
  } catch {
397
- const o = q(n, e);
405
+ const o = K(n, e);
398
406
  r[e] = o;
399
407
  }
400
408
  }
401
409
  }
402
- function Ue(e, t, r) {
410
+ function Ke(e, t, r) {
403
411
  if (!r) return;
404
- const n = q(r, e), o = t.style || "", s = n ? "" : "none";
412
+ const n = K(r, e), o = t.style || "", s = n ? "" : "none";
405
413
  if (o) {
406
414
  const i = o.split(";").filter(Boolean), a = i.findIndex(
407
- (l) => l.trim().startsWith("display:")
415
+ (c) => c.trim().startsWith("display:")
408
416
  );
409
417
  a >= 0 ? i[a] = `display: ${s}` : i.push(`display: ${s}`), t.style = i.join("; ");
410
418
  } else
411
419
  t.style = `display: ${s}`;
412
420
  }
413
- function Ke(e, t, r) {
421
+ function Ue(e, t, r) {
414
422
  if (!r) return;
415
- const n = q(r, e);
423
+ const n = K(r, e);
416
424
  let o = [];
417
425
  typeof n == "string" ? o = [n] : Array.isArray(n) ? o = n.filter(Boolean) : typeof n == "object" && (o = Object.entries(n).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
418
426
  const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
419
427
  i && (t.class = i);
420
428
  }
421
- function Ve(e, t, r) {
429
+ function Fe(e, t, r) {
422
430
  let n;
423
431
  if (typeof e == "string") {
424
432
  if (!r) return;
425
- n = q(r, e);
433
+ n = K(r, e);
426
434
  } else
427
435
  n = e;
428
436
  let o = "";
@@ -430,12 +438,12 @@ function Ve(e, t, r) {
430
438
  o = n;
431
439
  else if (n && typeof n == "object") {
432
440
  const i = [];
433
- for (const [a, l] of Object.entries(n))
434
- if (l != null && l !== "") {
435
- const f = a.replace(
441
+ for (const [a, c] of Object.entries(n))
442
+ if (c != null && c !== "") {
443
+ const u = a.replace(
436
444
  /[A-Z]/g,
437
- (c) => `-${c.toLowerCase()}`
438
- ), u = [
445
+ (d) => `-${d.toLowerCase()}`
446
+ ), l = [
439
447
  "width",
440
448
  "height",
441
449
  "top",
@@ -461,8 +469,8 @@ function Ve(e, t, r) {
461
469
  "min-height",
462
470
  "max-height"
463
471
  ];
464
- let h = String(l);
465
- typeof l == "number" && u.includes(f) && (h = `${l}px`), i.push(`${f}: ${h}`);
472
+ let y = String(c);
473
+ typeof c == "number" && l.includes(u) && (y = `${c}px`), i.push(`${u}: ${y}`);
466
474
  }
467
475
  o = i.join("; ") + (i.length > 0 ? ";" : "");
468
476
  }
@@ -471,13 +479,13 @@ function Ve(e, t, r) {
471
479
  }
472
480
  function je(e, t, r, n) {
473
481
  const o = {}, s = { ...n || {} }, i = {};
474
- for (const [a, l] of Object.entries(e)) {
475
- const { value: f, modifiers: u } = l;
482
+ for (const [a, c] of Object.entries(e)) {
483
+ const { value: u, modifiers: l } = c;
476
484
  switch (a) {
477
485
  case "model":
478
- qe(
479
- typeof f == "string" ? f : String(f),
480
- u,
486
+ Ie(
487
+ typeof u == "string" ? u : String(u),
488
+ l,
481
489
  o,
482
490
  s,
483
491
  i,
@@ -486,44 +494,44 @@ function je(e, t, r, n) {
486
494
  );
487
495
  break;
488
496
  case "bind":
489
- Fe(f, o, s, t);
497
+ He(u, o, s, t);
490
498
  break;
491
499
  case "show":
492
- Ue(f, s, t);
500
+ Ke(u, s, t);
493
501
  break;
494
502
  case "class":
495
- Ke(f, s, t);
503
+ Ue(u, s, t);
496
504
  break;
497
505
  case "style":
498
- Ve(f, s, t);
506
+ Fe(u, s, t);
499
507
  break;
500
508
  }
501
509
  }
502
510
  return { props: o, attrs: s, listeners: i };
503
511
  }
504
- function ge(e, t) {
512
+ function me(e, t) {
505
513
  if (Array.isArray(e)) {
506
514
  const s = /* @__PURE__ */ new Set();
507
515
  return e.map((i) => {
508
516
  if (!i || typeof i != "object") return i;
509
517
  let a = i.props?.key ?? i.key;
510
518
  if (!a) {
511
- const h = i.tag || "node", c = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
512
- a = c ? `${t}:${h}:${c}` : `${t}:${h}`;
519
+ const y = i.tag || "node", d = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
520
+ a = d ? `${t}:${y}:${d}` : `${t}:${y}`;
513
521
  }
514
- let l = a, f = 1;
515
- for (; s.has(l); )
516
- l = `${a}#${f++}`;
517
- s.add(l);
518
- let u = i.children;
519
- return Array.isArray(u) && (u = ge(u, l)), { ...i, key: l, children: u };
522
+ let c = a, u = 1;
523
+ for (; s.has(c); )
524
+ c = `${a}#${u++}`;
525
+ s.add(c);
526
+ let l = i.children;
527
+ return Array.isArray(l) && (l = me(l, c)), { ...i, key: c, children: l };
520
528
  });
521
529
  }
522
530
  const r = e;
523
531
  let n = r.props?.key ?? r.key ?? t, o = r.children;
524
- return Array.isArray(o) && (o = ge(o, n)), { ...r, key: n, children: o };
532
+ return Array.isArray(o) && (o = me(o, n)), { ...r, key: n, children: o };
525
533
  }
526
- function Je(e, t, r, n) {
534
+ function Ve(e, t, r, n) {
527
535
  const o = r.directives ?? {}, s = je(
528
536
  o,
529
537
  n,
@@ -537,202 +545,205 @@ function Je(e, t, r, n) {
537
545
  ...t.attrs,
538
546
  ...r.attrs,
539
547
  ...s.attrs
540
- }, l = t.props ?? {}, f = i;
541
- for (const c in { ...l, ...f }) {
542
- const v = l[c], x = f[c];
543
- if (v !== x)
544
- if (c === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
545
- e.value !== x && (e.value = x ?? "");
546
- else if (c === "checked" && e instanceof HTMLInputElement)
547
- e.checked = !!x;
548
- else if (c.startsWith("onHost") && typeof x == "function") {
549
- const k = Te(c);
550
- typeof v == "function" && e.removeEventListener(k, v), e.addEventListener(k, x);
551
- } else x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x));
552
- }
553
- for (const [c, v] of Object.entries(
548
+ }, c = t.props ?? {}, u = i;
549
+ for (const d in { ...c, ...u }) {
550
+ const b = c[d], k = u[d];
551
+ if (b !== k)
552
+ if (d === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
553
+ e.value !== k && (e.value = k ?? "");
554
+ else if (d === "checked" && e instanceof HTMLInputElement)
555
+ e.checked = !!k;
556
+ else if (d.startsWith("on")) {
557
+ const x = Te(d), [p, f] = ee(k), [g, m] = ee(b);
558
+ g && e.removeEventListener(x, g, m), p && e.addEventListener(x, p, f);
559
+ } else k == null || k === !1 ? e.removeAttribute(d) : e.setAttribute(d, String(k));
560
+ }
561
+ for (const [d, b] of Object.entries(
554
562
  s.listeners || {}
555
- ))
556
- e.addEventListener(c, v);
557
- const u = t.attrs ?? {}, h = a;
558
- for (const c in { ...u, ...h }) {
559
- const v = u[c], x = h[c];
560
- v !== x && (x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x)));
563
+ )) {
564
+ const [k, x] = ee(b);
565
+ k && e.addEventListener(d, k, x);
566
+ }
567
+ const l = t.attrs ?? {}, y = a;
568
+ for (const d in { ...l, ...y }) {
569
+ const b = l[d], k = y[d];
570
+ b !== k && (k == null || k === !1 ? e.removeAttribute(d) : e.setAttribute(d, String(k)));
561
571
  }
562
572
  }
563
- function P(e, t, r) {
573
+ function O(e, t, r) {
564
574
  if (typeof e == "string")
565
575
  return document.createTextNode(e);
566
576
  if (e.tag === "#text") {
567
- const h = document.createTextNode(
577
+ const y = document.createTextNode(
568
578
  typeof e.children == "string" ? e.children : ""
569
579
  );
570
- return e.key != null && (h.key = e.key), h;
580
+ return e.key != null && (y.key = e.key), y;
571
581
  }
572
582
  if (e.tag === "#anchor") {
573
- const h = e, c = Array.isArray(h.children) ? h.children : [], v = document.createTextNode(""), x = document.createTextNode("");
574
- h.key != null && (v.key = `${h.key}:start`, x.key = `${h.key}:end`), h._startNode = v, h._endNode = x;
575
- const k = document.createDocumentFragment();
576
- k.appendChild(v);
577
- for (const g of c) {
578
- const d = P(g, t);
579
- k.appendChild(d);
583
+ const y = e, d = Array.isArray(y.children) ? y.children : [], b = document.createTextNode(""), k = document.createTextNode("");
584
+ y.key != null && (b.key = `${y.key}:start`, k.key = `${y.key}:end`), y._startNode = b, y._endNode = k;
585
+ const x = document.createDocumentFragment();
586
+ x.appendChild(b);
587
+ for (const p of d) {
588
+ const f = O(p, t);
589
+ x.appendChild(f);
580
590
  }
581
- return k.appendChild(x), k;
591
+ return x.appendChild(k), x;
582
592
  }
583
593
  const n = document.createElement(e.tag);
584
594
  e.key != null && (n.key = e.key);
585
- const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = je(i, t, n, s), l = {
595
+ const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = je(i, t, n, s), c = {
586
596
  ...o,
587
597
  ...a.props
588
- }, f = {
598
+ }, u = {
589
599
  ...s,
590
600
  ...a.attrs
591
601
  };
592
- for (const h in f) {
593
- const c = f[h];
594
- if (typeof h != "string" || /\[object Object\]/.test(h)) {
595
- typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", h, c);
602
+ for (const y in u) {
603
+ const d = u[y];
604
+ if (typeof y != "string" || /\[object Object\]/.test(y)) {
605
+ typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", y, d);
596
606
  continue;
597
607
  }
598
- typeof c == "boolean" ? c && n.setAttribute(h, "") : c != null && n.setAttribute(h, c);
608
+ typeof d == "boolean" ? d && n.setAttribute(y, "") : d != null && n.setAttribute(y, d);
599
609
  }
600
- for (const h in l) {
601
- const c = l[h];
602
- if (typeof h != "string" || /\[object Object\]/.test(h)) {
603
- typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", h, c);
610
+ for (const y in c) {
611
+ const d = c[y];
612
+ if (typeof y != "string" || /\[object Object\]/.test(y)) {
613
+ typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", y, d);
604
614
  continue;
605
615
  }
606
- if (h === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
607
- n.value = c ?? "";
608
- else if (h === "checked" && n instanceof HTMLInputElement)
609
- n.checked = !!c;
610
- else if (h.startsWith("onHost") && typeof c == "function")
611
- n.addEventListener(Te(h), c);
612
- else {
613
- if (h.startsWith("onHost") && c === void 0)
616
+ if (y === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
617
+ n.value = d ?? "";
618
+ else if (y === "checked" && n instanceof HTMLInputElement)
619
+ n.checked = !!d;
620
+ else if (y.startsWith("on")) {
621
+ const [b, k] = ee(d);
622
+ b && n.addEventListener(Te(y), b, k);
623
+ } else {
624
+ if (y.startsWith("on") && d === void 0)
614
625
  continue;
615
- c == null || c === !1 ? n.removeAttribute(h) : n.setAttribute(h, String(c));
626
+ d == null || d === !1 ? n.removeAttribute(y) : n.setAttribute(y, String(d));
616
627
  }
617
628
  }
618
- for (const [h, c] of Object.entries(
629
+ for (const [y, d] of Object.entries(
619
630
  a.listeners || {}
620
631
  ))
621
- n.addEventListener(h, c);
622
- const u = e.props?.ref ?? (e.props?.props && e.props.props.ref);
623
- if (typeof e != "string" && u && r && (r[u] = n), Array.isArray(e.children))
624
- for (const h of e.children)
625
- n.appendChild(P(h, t, r));
632
+ n.addEventListener(y, d);
633
+ const l = e.props?.ref ?? (e.props?.props && e.props.props.ref);
634
+ if (typeof e != "string" && l && r && (r[l] = n), Array.isArray(e.children))
635
+ for (const y of e.children)
636
+ n.appendChild(O(y, t, r));
626
637
  else typeof e.children == "string" && (n.textContent = e.children);
627
638
  return n;
628
639
  }
629
- function Ze(e, t, r, n, o) {
640
+ function Je(e, t, r, n, o) {
630
641
  if (typeof r == "string") {
631
642
  e.textContent !== r && (e.textContent = r);
632
643
  return;
633
644
  }
634
645
  if (!Array.isArray(r)) return;
635
646
  const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
636
- for (const v of i)
637
- v && v.key != null && a.set(v.key, v);
638
- const l = /* @__PURE__ */ new Map();
639
- for (const v of s) {
640
- const x = v.key;
641
- x != null && l.set(x, v);
642
- }
643
- const f = /* @__PURE__ */ new Set();
644
- let u = e.firstChild;
645
- function h(v, x) {
646
- let k = v;
647
- for (; k && (f.add(k), k !== x); )
648
- k = k.nextSibling;
649
- }
650
- function c(v, x, k, g) {
651
- const d = [];
652
- let y = v.nextSibling;
653
- for (; y && y !== x; )
654
- d.push(y), y = y.nextSibling;
655
- const b = Array.isArray(k) ? k : [];
656
- if (g.some((w) => w && w.key != null) || b.some((w) => w && w.key != null)) {
657
- const w = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
658
- for (const C of b)
647
+ for (const b of i)
648
+ b && b.key != null && a.set(b.key, b);
649
+ const c = /* @__PURE__ */ new Map();
650
+ for (const b of s) {
651
+ const k = b.key;
652
+ k != null && c.set(k, b);
653
+ }
654
+ const u = /* @__PURE__ */ new Set();
655
+ let l = e.firstChild;
656
+ function y(b, k) {
657
+ let x = b;
658
+ for (; x && (u.add(x), x !== k); )
659
+ x = x.nextSibling;
660
+ }
661
+ function d(b, k, x, p) {
662
+ const f = [];
663
+ let g = b.nextSibling;
664
+ for (; g && g !== k; )
665
+ f.push(g), g = g.nextSibling;
666
+ const m = Array.isArray(x) ? x : [];
667
+ if (p.some((w) => w && w.key != null) || m.some((w) => w && w.key != null)) {
668
+ const w = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
669
+ for (const C of m)
659
670
  C && C.key != null && w.set(C.key, C);
660
- for (const C of d) {
671
+ for (const C of f) {
661
672
  const E = C.key;
662
- E != null && m.set(E, C);
673
+ E != null && v.set(E, C);
663
674
  }
664
675
  const $ = /* @__PURE__ */ new Set();
665
- let _ = v.nextSibling;
666
- for (const C of g) {
676
+ let _ = b.nextSibling;
677
+ for (const C of p) {
667
678
  let E;
668
- if (C.key != null && m.has(C.key)) {
679
+ if (C.key != null && v.has(C.key)) {
669
680
  const j = w.get(C.key);
670
- E = Y(
671
- m.get(C.key),
681
+ E = te(
682
+ v.get(C.key),
672
683
  j,
673
684
  C,
674
685
  n
675
686
  ), $.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
676
687
  } else
677
- E = P(C, n), e.insertBefore(E, _), $.add(E);
688
+ E = O(C, n), e.insertBefore(E, _), $.add(E);
678
689
  _ = E.nextSibling;
679
690
  }
680
- for (const C of d)
691
+ for (const C of f)
681
692
  !$.has(C) && e.contains(C) && e.removeChild(C);
682
693
  } else {
683
694
  const w = Math.min(
684
- b.length,
685
- g.length
695
+ m.length,
696
+ p.length
686
697
  );
687
- for (let m = 0; m < w; m++) {
688
- const $ = b[m], _ = g[m], C = Y(d[m], $, _, n);
689
- C !== d[m] && (e.insertBefore(C, d[m]), e.removeChild(d[m]));
698
+ for (let v = 0; v < w; v++) {
699
+ const $ = m[v], _ = p[v], C = te(f[v], $, _, n);
700
+ C !== f[v] && (e.insertBefore(C, f[v]), e.removeChild(f[v]));
690
701
  }
691
- for (let m = w; m < g.length; m++)
692
- e.insertBefore(P(g[m], n), x);
693
- for (let m = w; m < d.length; m++)
694
- e.removeChild(d[m]);
702
+ for (let v = w; v < p.length; v++)
703
+ e.insertBefore(O(p[v], n), k);
704
+ for (let v = w; v < f.length; v++)
705
+ e.removeChild(f[v]);
695
706
  }
696
707
  }
697
- for (const v of r) {
698
- let x;
699
- if (v.tag === "#anchor") {
700
- const k = v.key, g = `${k}:start`, d = `${k}:end`;
701
- let y = l.get(g), b = l.get(d);
702
- const p = Array.isArray(v.children) ? v.children : [];
703
- if (y || (y = document.createTextNode(""), y.key = g), b || (b = document.createTextNode(""), b.key = d), v._startNode = y, v._endNode = b, !e.contains(y) || !e.contains(b)) {
704
- e.insertBefore(y, u);
705
- for (const w of p)
706
- e.insertBefore(P(w, n), u);
707
- e.insertBefore(b, u);
708
+ for (const b of r) {
709
+ let k;
710
+ if (b.tag === "#anchor") {
711
+ const x = b.key, p = `${x}:start`, f = `${x}:end`;
712
+ let g = c.get(p), m = c.get(f);
713
+ const h = Array.isArray(b.children) ? b.children : [];
714
+ if (g || (g = document.createTextNode(""), g.key = p), m || (m = document.createTextNode(""), m.key = f), b._startNode = g, b._endNode = m, !e.contains(g) || !e.contains(m)) {
715
+ e.insertBefore(g, l);
716
+ for (const w of h)
717
+ e.insertBefore(O(w, n), l);
718
+ e.insertBefore(m, l);
708
719
  } else
709
- c(
710
- y,
711
- b,
712
- a.get(k)?.children,
713
- p
720
+ d(
721
+ g,
722
+ m,
723
+ a.get(x)?.children,
724
+ h
714
725
  );
715
- h(y, b), u = b.nextSibling;
726
+ y(g, m), l = m.nextSibling;
716
727
  continue;
717
728
  }
718
- if (v.key != null && l.has(v.key)) {
719
- const k = a.get(v.key);
720
- x = Y(
721
- l.get(v.key),
722
- k,
723
- v,
729
+ if (b.key != null && c.has(b.key)) {
730
+ const x = a.get(b.key);
731
+ k = te(
732
+ c.get(b.key),
733
+ x,
734
+ b,
724
735
  n,
725
736
  o
726
- ), f.add(x), x !== u && e.contains(x) && (u && !e.contains(u) && (u = null), e.insertBefore(x, u));
737
+ ), u.add(k), k !== l && e.contains(k) && (l && !e.contains(l) && (l = null), e.insertBefore(k, l));
727
738
  } else
728
- x = P(v, n, o), u && !e.contains(u) && (u = null), e.insertBefore(x, u), f.add(x);
729
- u = x.nextSibling;
739
+ k = O(b, n, o), l && !e.contains(l) && (l = null), e.insertBefore(k, l), u.add(k);
740
+ l = k.nextSibling;
730
741
  }
731
- for (const v of s)
732
- !f.has(v) && e.contains(v) && (D(v, o), e.removeChild(v));
742
+ for (const b of s)
743
+ !u.has(b) && e.contains(b) && (H(b, o), e.removeChild(b));
733
744
  }
734
- function Y(e, t, r, n, o) {
735
- if (t && typeof t != "string" && t.props?.ref && o && D(e, o), t === r) return e;
745
+ function te(e, t, r, n, o) {
746
+ if (t && typeof t != "string" && t.props?.ref && o && H(e, o), t === r) return e;
736
747
  if (typeof r == "string") {
737
748
  if (e.nodeType === Node.TEXT_NODE)
738
749
  return e.textContent !== r && (e.textContent = r), e;
@@ -742,60 +753,60 @@ function Y(e, t, r, n, o) {
742
753
  }
743
754
  }
744
755
  if (r && typeof r != "string" && r.tag === "#anchor") {
745
- const i = r, a = Array.isArray(i.children) ? i.children : [], l = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
746
- i.key != null && (l.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = l, i._endNode = f;
747
- const u = document.createDocumentFragment();
748
- u.appendChild(l);
749
- for (const h of a) {
750
- const c = P(h, n);
751
- u.appendChild(c);
756
+ const i = r, a = Array.isArray(i.children) ? i.children : [], c = i._startNode ?? document.createTextNode(""), u = i._endNode ?? document.createTextNode("");
757
+ i.key != null && (c.key = `${i.key}:start`, u.key = `${i.key}:end`), i._startNode = c, i._endNode = u;
758
+ const l = document.createDocumentFragment();
759
+ l.appendChild(c);
760
+ for (const y of a) {
761
+ const d = O(y, n);
762
+ l.appendChild(d);
752
763
  }
753
- return u.appendChild(f), e.parentNode?.replaceChild(u, e), l;
764
+ return l.appendChild(u), e.parentNode?.replaceChild(l, e), c;
754
765
  }
755
766
  if (!r) {
756
- D(e, o);
767
+ H(e, o);
757
768
  const i = document.createComment("removed");
758
769
  return e.parentNode?.replaceChild(i, e), i;
759
770
  }
760
771
  if (!t || typeof t == "string") {
761
- D(e, o);
762
- const i = P(r, n, o);
772
+ H(e, o);
773
+ const i = O(r, n, o);
763
774
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
764
775
  }
765
776
  if (r.tag === "#anchor") {
766
- const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), l = r._endNode ?? document.createTextNode("");
767
- r.key != null && (a.key = `${r.key}:start`, l.key = `${r.key}:end`), r._startNode = a, r._endNode = l;
768
- const f = document.createDocumentFragment();
769
- f.appendChild(a);
770
- for (const u of i)
771
- f.appendChild(P(u, n));
772
- return f.appendChild(l), e.parentNode?.replaceChild(f, e), a;
777
+ const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), c = r._endNode ?? document.createTextNode("");
778
+ r.key != null && (a.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = a, r._endNode = c;
779
+ const u = document.createDocumentFragment();
780
+ u.appendChild(a);
781
+ for (const l of i)
782
+ u.appendChild(O(l, n));
783
+ return u.appendChild(c), e.parentNode?.replaceChild(u, e), a;
773
784
  }
774
785
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
775
786
  const i = e;
776
- return Je(i, t.props || {}, r.props || {}, n), Ze(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
787
+ return Ve(i, t.props || {}, r.props || {}, n), Je(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
777
788
  }
778
- D(e, o);
779
- const s = P(r, n, o);
789
+ H(e, o);
790
+ const s = O(r, n, o);
780
791
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
781
792
  }
782
- function Xe(e, t, r, n) {
793
+ function Ze(e, t, r, n) {
783
794
  let o;
784
795
  Array.isArray(t) ? t.length === 1 ? (o = t[0], o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })) : o = { tag: "div", key: "__root__", children: t } : (o = t, o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })), o && typeof o == "object" && o.tag === "#anchor" && (o = {
785
796
  tag: "div",
786
797
  key: "__anchor_root__",
787
798
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
788
799
  children: [o]
789
- }), o = ge(o, String(o.key ?? "root"));
800
+ }), o = me(o, String(o.key ?? "root"));
790
801
  const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
791
802
  let a;
792
- s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = Y(i, s, o, r, n) : (a = P(o, r, n), e.replaceChild(a, i)) : (a = P(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
793
- const l = [];
794
- for (let f = 0; f < e.childNodes.length; f++) {
795
- const u = e.childNodes[f];
796
- u !== a && u.nodeName !== "STYLE" && (D(u, n), l.push(u));
803
+ s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = te(i, s, o, r, n) : (a = O(o, r, n), e.replaceChild(a, i)) : (a = O(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
804
+ const c = [];
805
+ for (let u = 0; u < e.childNodes.length; u++) {
806
+ const l = e.childNodes[u];
807
+ l !== a && l.nodeName !== "STYLE" && (H(l, n), c.push(l));
797
808
  }
798
- l.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
809
+ c.forEach((u) => e.removeChild(u)), e._prevVNode = o, e._prevDom = a;
799
810
  }
800
811
  function Le(e, ...t) {
801
812
  let r = "";
@@ -806,14 +817,14 @@ function Le(e, ...t) {
806
817
  function ze(e) {
807
818
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
808
819
  }
809
- let X = null;
810
- function ke() {
811
- return X || (X = new CSSStyleSheet(), X.replaceSync(ze(Ye))), X;
820
+ let Y = null;
821
+ function $e() {
822
+ return Y || (Y = new CSSStyleSheet(), Y.replaceSync(ze(Xe))), Y;
812
823
  }
813
824
  function Qe(e) {
814
825
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
815
826
  }
816
- const Ye = Le`
827
+ const Xe = Le`
817
828
  :host, *, ::before, ::after {
818
829
  all: isolate;
819
830
  box-sizing: border-box;
@@ -871,7 +882,7 @@ const Ye = Le`
871
882
  sup { top: -.5em }
872
883
  [disabled], [aria-disabled=true] { cursor: not-allowed }
873
884
  [hidden] { display: none }
874
- `, Ge = {
885
+ `, Ye = {
875
886
  gray: {
876
887
  50: "var(--color-gray-50, #f9fafb)",
877
888
  100: "var(--color-gray-100, #f3f4f6)",
@@ -1006,7 +1017,7 @@ const Ye = Le`
1006
1017
  },
1007
1018
  white: { DEFAULT: "var(--color-white, #ffffff)" },
1008
1019
  black: { DEFAULT: "var(--color-black, #000000)" }
1009
- }, se = {
1020
+ }, le = {
1010
1021
  /* Display */
1011
1022
  block: "display:block;",
1012
1023
  inline: "display:inline;",
@@ -1187,7 +1198,7 @@ const Ye = Le`
1187
1198
  "z-30": "z-index:30;",
1188
1199
  "z-40": "z-index:40;",
1189
1200
  "z-50": "z-index:50;"
1190
- }, et = "0.25rem", $e = {
1201
+ }, Ge = "0.25rem", Se = {
1191
1202
  m: ["margin"],
1192
1203
  mx: ["margin-inline"],
1193
1204
  my: ["margin-block"],
@@ -1232,7 +1243,7 @@ function R(e, t) {
1232
1243
  }
1233
1244
  return e + t;
1234
1245
  }
1235
- const tt = {
1246
+ const et = {
1236
1247
  before: (e, t) => `${e}::before{${t}}`,
1237
1248
  after: (e, t) => `${e}::after{${t}}`,
1238
1249
  hover: (e, t) => `${R(e, ":hover")}{${t}}`,
@@ -1255,7 +1266,7 @@ const tt = {
1255
1266
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1256
1267
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1257
1268
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1258
- }, ae = {
1269
+ }, ce = {
1259
1270
  // Responsive
1260
1271
  sm: "(min-width:640px)",
1261
1272
  md: "(min-width:768px)",
@@ -1264,23 +1275,23 @@ const tt = {
1264
1275
  "2xl": "(min-width:1536px)",
1265
1276
  // Dark mode (now plain string)
1266
1277
  dark: "(prefers-color-scheme: dark)"
1267
- }, ce = ["sm", "md", "lg", "xl", "2xl"];
1268
- function le(e) {
1278
+ }, fe = ["sm", "md", "lg", "xl", "2xl"];
1279
+ function ue(e) {
1269
1280
  const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1270
1281
  if (n.length < 2) return null;
1271
1282
  const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
1272
- if (Number.isNaN(i) || !$e[o]) return null;
1283
+ if (Number.isNaN(i) || !Se[o]) return null;
1273
1284
  const a = t ? "-" : "";
1274
- return $e[o].map((l) => `${l}:calc(${a}${et} * ${i});`).join("");
1285
+ return Se[o].map((c) => `${c}:calc(${a}${Ge} * ${i});`).join("");
1275
1286
  }
1276
- function Se(e) {
1287
+ function _e(e) {
1277
1288
  const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
1278
1289
  return `${n} ${o} ${s}`;
1279
1290
  }
1280
- function rt(e) {
1291
+ function tt(e) {
1281
1292
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1282
1293
  if (!t) return null;
1283
- const [, r, n, o = "DEFAULT"] = t, s = Ge[n]?.[o];
1294
+ const [, r, n, o = "DEFAULT"] = t, s = Ye[n]?.[o];
1284
1295
  return s ? `${{
1285
1296
  bg: "background-color",
1286
1297
  decoration: "text-decoration-color",
@@ -1295,41 +1306,41 @@ function rt(e) {
1295
1306
  stroke: "stroke-color"
1296
1307
  }[r]}:${s};` : null;
1297
1308
  }
1298
- function nt(e) {
1309
+ function rt(e) {
1299
1310
  const [t, r] = e.split("/");
1300
1311
  if (!r) return { base: t };
1301
1312
  const n = parseInt(r, 10);
1302
1313
  return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1303
1314
  }
1304
- function fe(e) {
1305
- const { base: t, opacity: r } = nt(e), n = rt(t);
1315
+ function de(e) {
1316
+ const { base: t, opacity: r } = rt(e), n = tt(t);
1306
1317
  if (n) {
1307
1318
  if (r !== void 0) {
1308
1319
  const s = /#([0-9a-f]{6})/i.exec(n);
1309
1320
  if (s) {
1310
- const i = Se(s[0]);
1321
+ const i = _e(s[0]);
1311
1322
  return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1312
1323
  }
1313
1324
  }
1314
1325
  return n;
1315
1326
  }
1316
- const o = G(t);
1327
+ const o = re(t);
1317
1328
  if (o && r !== void 0) {
1318
1329
  const s = /#([0-9a-f]{6})/i.exec(o);
1319
1330
  if (s) {
1320
- const i = Se(s[0]);
1331
+ const i = _e(s[0]);
1321
1332
  return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1322
1333
  }
1323
1334
  }
1324
1335
  return o;
1325
1336
  }
1326
- function ue(e) {
1337
+ function pe(e) {
1327
1338
  const t = /^opacity-(\d{1,3})$/.exec(e);
1328
1339
  if (!t) return null;
1329
1340
  const r = parseInt(t[1], 10);
1330
1341
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1331
1342
  }
1332
- function G(e) {
1343
+ function re(e) {
1333
1344
  if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1334
1345
  const o = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1335
1346
  if (o) {
@@ -1391,7 +1402,7 @@ function G(e) {
1391
1402
  }
1392
1403
  return null;
1393
1404
  }
1394
- function ot(e) {
1405
+ function nt(e) {
1395
1406
  if (e.startsWith("[") && e.endsWith("]")) {
1396
1407
  const r = e.slice(1, -1);
1397
1408
  return r.includes("&") ? r : e;
@@ -1403,10 +1414,10 @@ function ot(e) {
1403
1414
  }
1404
1415
  return null;
1405
1416
  }
1406
- function it(e) {
1417
+ function ot(e) {
1407
1418
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1408
1419
  }
1409
- function st(e) {
1420
+ function it(e) {
1410
1421
  const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1411
1422
  let n;
1412
1423
  for (; n = t.exec(e); ) {
@@ -1415,32 +1426,32 @@ function st(e) {
1415
1426
  }
1416
1427
  return r.filter(Boolean);
1417
1428
  }
1418
- const _e = /* @__PURE__ */ new Map(), at = 16;
1419
- function ct(e) {
1420
- const t = Date.now(), r = _e.get(e);
1421
- if (r && t - r.timestamp < at) return r.css;
1422
- const n = st(e), o = new Set(n), s = [], i = [], a = [], l = [], f = {};
1423
- function u(g, d = !1) {
1424
- const y = (d ? "dark|" : "") + g;
1425
- if (y in f) return f[y];
1426
- const b = x(g, d);
1427
- return f[y] = b, b;
1428
- }
1429
- function h(g) {
1430
- const d = g.some((b) => ce.includes(b)), y = g.includes("dark");
1431
- return g.length === 0 ? 1 : !d && !y ? 2 : d && !y ? 3 : 4;
1432
- }
1433
- function c(g) {
1434
- const d = [];
1435
- let y = "", b = 0, p = 0;
1436
- for (let w = 0; w < g.length; w++) {
1437
- const m = g[w];
1438
- m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? p++ : m === ")" && p > 0 && p--, m === ":" && b === 0 && p === 0 ? (d.push(y), y = "") : y += m;
1429
+ const Ce = /* @__PURE__ */ new Map(), st = 16;
1430
+ function at(e) {
1431
+ const t = Date.now(), r = Ce.get(e);
1432
+ if (r && t - r.timestamp < st) return r.css;
1433
+ const n = it(e), o = new Set(n), s = [], i = [], a = [], c = [], u = {};
1434
+ function l(p, f = !1) {
1435
+ const g = (f ? "dark|" : "") + p;
1436
+ if (g in u) return u[g];
1437
+ const m = k(p, f);
1438
+ return u[g] = m, m;
1439
+ }
1440
+ function y(p) {
1441
+ const f = p.some((m) => fe.includes(m)), g = p.includes("dark");
1442
+ return p.length === 0 ? 1 : !f && !g ? 2 : f && !g ? 3 : 4;
1443
+ }
1444
+ function d(p) {
1445
+ const f = [];
1446
+ let g = "", m = 0, h = 0;
1447
+ for (let w = 0; w < p.length; w++) {
1448
+ const v = p[w];
1449
+ v === "[" ? m++ : v === "]" && m > 0 ? m-- : v === "(" ? h++ : v === ")" && h > 0 && h--, v === ":" && m === 0 && h === 0 ? (f.push(g), g = "") : g += v;
1439
1450
  }
1440
- return y && d.push(y), d;
1451
+ return g && f.push(g), f;
1441
1452
  }
1442
- function v(g) {
1443
- switch (g) {
1453
+ function b(p) {
1454
+ switch (p) {
1444
1455
  case "hover":
1445
1456
  return ":hover";
1446
1457
  case "focus":
@@ -1469,99 +1480,99 @@ function ct(e) {
1469
1480
  return null;
1470
1481
  }
1471
1482
  }
1472
- function x(g, d = !1) {
1473
- const y = c(g);
1474
- (g.includes("mask-image") || g.includes("sm: hover") || g.includes("sm:hover") || g.includes("mask.svg")) && console.error("DEBUG generateRule:", g, y);
1475
- let b = !1, p = y.find((S) => (S.startsWith("!") && (b = !0, S = S.slice(1)), se[S] || le(S) || ue(S) || fe(S) || G(S)));
1476
- if (!p) return null;
1477
- const w = p.replace(/^!/, ""), m = se[w] ?? le(w) ?? ue(w) ?? fe(w) ?? G(w);
1478
- if (!m) return null;
1479
- const $ = y.indexOf(p);
1480
- let _ = $ >= 0 ? y.slice(0, $) : [];
1481
- d && (_ = _.filter((S) => S !== "dark"));
1482
- const C = `.${it(g)}`, E = "__SUBJECT__", j = b ? m.replace(/;$/, " !important;") : m;
1483
- let A = E;
1484
- const re = [];
1483
+ function k(p, f = !1) {
1484
+ const g = d(p);
1485
+ (p.includes("mask-image") || p.includes("sm: hover") || p.includes("sm:hover") || p.includes("mask.svg")) && console.error("DEBUG generateRule:", p, g);
1486
+ let m = !1, h = g.find((S) => (S.startsWith("!") && (m = !0, S = S.slice(1)), le[S] || ue(S) || pe(S) || de(S) || re(S)));
1487
+ if (!h) return null;
1488
+ const w = h.replace(/^!/, ""), v = le[w] ?? ue(w) ?? pe(w) ?? de(w) ?? re(w);
1489
+ if (!v) return null;
1490
+ const $ = g.indexOf(h);
1491
+ let _ = $ >= 0 ? g.slice(0, $) : [];
1492
+ f && (_ = _.filter((S) => S !== "dark"));
1493
+ const C = `.${ot(p)}`, E = "__SUBJECT__", j = m ? v.replace(/;$/, " !important;") : v;
1494
+ let T = E;
1495
+ const A = [];
1485
1496
  for (const S of _)
1486
- S.startsWith("group-") ? (A = `.group:${S.slice(6)} ${A}`, re.push(S)) : S.startsWith("peer-") && (A = A.replace(E, `.peer:${S.slice(5)}~${E}`), re.push(S));
1487
- _ = _.filter((S) => !re.includes(S));
1488
- const ne = [], be = [];
1489
- let N = null;
1497
+ S.startsWith("group-") ? (T = `.group:${S.slice(6)} ${T}`, A.push(S)) : S.startsWith("peer-") && (T = T.replace(E, `.peer:${S.slice(5)}~${E}`), A.push(S));
1498
+ _ = _.filter((S) => !A.includes(S));
1499
+ const q = [], ie = [];
1500
+ let W = null;
1490
1501
  for (const S of _) {
1491
- if (S === "dark" || ce.includes(S)) continue;
1492
- const H = ot(S);
1493
- if (H) {
1494
- N = H;
1502
+ if (S === "dark" || fe.includes(S)) continue;
1503
+ const N = nt(S);
1504
+ if (N) {
1505
+ W = N;
1495
1506
  continue;
1496
1507
  }
1497
- const L = v(S);
1498
- if (L) {
1499
- N ? be.push(L) : ne.push(L);
1508
+ const z = b(S);
1509
+ if (z) {
1510
+ W ? ie.push(z) : q.push(z);
1500
1511
  continue;
1501
1512
  }
1502
- const B = tt[S];
1503
- typeof B == "function" && (A = B(A, j).split("{")[0]);
1513
+ const B = et[S];
1514
+ typeof B == "function" && (T = B(T, j).split("{")[0]);
1504
1515
  }
1505
- function Be(S, H) {
1506
- if (!H) return S;
1507
- let L = 0, B = 0;
1516
+ function Pe(S, N) {
1517
+ if (!N) return S;
1518
+ let z = 0, B = 0;
1508
1519
  if (S.length && (S[0] === ">" || S[0] === "+" || S[0] === "~" || S[0] === " ")) {
1509
- let T = 1;
1510
- for (; T < S.length && S[T] === " "; ) T++;
1511
- for (; T < S.length; T++) {
1512
- const z = S[T];
1513
- if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && (S[T] === ">" || S[T] === "+" || S[T] === "~" || S[T] === " "))
1514
- return S.slice(0, T) + H + S.slice(T);
1520
+ let L = 1;
1521
+ for (; L < S.length && S[L] === " "; ) L++;
1522
+ for (; L < S.length; L++) {
1523
+ const P = S[L];
1524
+ if (P === "[" ? z++ : P === "]" && z > 0 ? z-- : P === "(" ? B++ : P === ")" && B > 0 && B--, z === 0 && B === 0 && (S[L] === ">" || S[L] === "+" || S[L] === "~" || S[L] === " "))
1525
+ return S.slice(0, L) + N + S.slice(L);
1515
1526
  }
1516
- return S + H;
1527
+ return S + N;
1517
1528
  }
1518
- for (let T = 0; T < S.length; T++) {
1519
- const z = S[T];
1520
- if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && (z === ">" || z === "+" || z === "~" || z === " "))
1521
- return S.slice(0, T) + H + S.slice(T);
1529
+ for (let L = 0; L < S.length; L++) {
1530
+ const P = S[L];
1531
+ if (P === "[" ? z++ : P === "]" && z > 0 ? z-- : P === "(" ? B++ : P === ")" && B > 0 && B--, z === 0 && B === 0 && (P === ">" || P === "+" || P === "~" || P === " "))
1532
+ return S.slice(0, L) + N + S.slice(L);
1522
1533
  }
1523
- return S + H;
1534
+ return S + N;
1524
1535
  }
1525
- const oe = ne.join(""), K = be.join("");
1526
- if (N)
1527
- if (N.includes("&")) {
1528
- const S = N.indexOf("&"), H = N.slice(0, S), L = N.slice(S + 1), B = E + oe, T = A;
1529
- if (ne.length === 0)
1530
- A = T.replace(E, H + B + K + L);
1536
+ const se = q.join(""), J = ie.join("");
1537
+ if (W)
1538
+ if (W.includes("&")) {
1539
+ const S = W.indexOf("&"), N = W.slice(0, S), z = W.slice(S + 1), B = E + se, L = T;
1540
+ if (q.length === 0)
1541
+ T = L.replace(E, N + B + J + z);
1531
1542
  else {
1532
- const z = Be(L, K);
1533
- A = T.replace(E, H + B + z);
1543
+ const P = Pe(z, J);
1544
+ T = L.replace(E, N + B + P);
1534
1545
  }
1535
1546
  } else
1536
- A = A.replace(E, `${N}${E + oe}`), K && (A = A.replace(E, `${E}${K}`));
1547
+ T = T.replace(E, `${W}${E + se}`), J && (T = T.replace(E, `${E}${J}`));
1537
1548
  else
1538
- A = E + oe + K;
1539
- A = A.replace(new RegExp(E, "g"), C);
1540
- let O = `${A}{${j}}`;
1541
- const ie = _.filter((S) => ce.includes(S)), I = ie.length ? ie[ie.length - 1] : null, ve = _.includes("dark");
1542
- return d && I ? O = `@media (prefers-color-scheme: dark) and ${ae[I]}{${O}}` : d ? O = `@media (prefers-color-scheme: dark){${O}}` : ve && I ? O = `@media (prefers-color-scheme: dark) and ${ae[I]}{${O}}` : ve ? O = `@media (prefers-color-scheme: dark){${O}}` : I && (O = `@media ${ae[I]}{${O}}`), O;
1543
- }
1544
- for (const g of o) {
1545
- const d = c(g), y = d.find(
1546
- (m) => se[m] || le(m) || ue(m) || fe(m) || G(m)
1549
+ T = E + se + J;
1550
+ T = T.replace(new RegExp(E, "g"), C);
1551
+ let M = `${T}{${j}}`;
1552
+ const ae = _.filter((S) => fe.includes(S)), U = ae.length ? ae[ae.length - 1] : null, we = _.includes("dark");
1553
+ return f && U ? M = `@media (prefers-color-scheme: dark) and ${ce[U]}{${M}}` : f ? M = `@media (prefers-color-scheme: dark){${M}}` : we && U ? M = `@media (prefers-color-scheme: dark) and ${ce[U]}{${M}}` : we ? M = `@media (prefers-color-scheme: dark){${M}}` : U && (M = `@media ${ce[U]}{${M}}`), M;
1554
+ }
1555
+ for (const p of o) {
1556
+ const f = d(p), g = f.find(
1557
+ (v) => le[v] || ue(v) || pe(v) || de(v) || re(v)
1547
1558
  );
1548
- if (!y) continue;
1549
- const b = d.indexOf(y), p = b >= 0 ? d.slice(0, b) : [], w = h(p);
1559
+ if (!g) continue;
1560
+ const m = f.indexOf(g), h = m >= 0 ? f.slice(0, m) : [], w = y(h);
1550
1561
  if (w === 4) {
1551
- const m = u(g, !0);
1552
- m && l.push(m);
1562
+ const v = l(p, !0);
1563
+ v && c.push(v);
1553
1564
  } else {
1554
- const m = u(g);
1555
- m && (w === 1 ? s.push(m) : w === 2 ? i.push(m) : w === 3 && a.push(m));
1565
+ const v = l(p);
1566
+ v && (w === 1 ? s.push(v) : w === 2 ? i.push(v) : w === 3 && a.push(v));
1556
1567
  }
1557
1568
  }
1558
- const k = [...s, ...i, ...a, ...l].join("");
1559
- return _e.set(e, { css: k, timestamp: t }), k;
1569
+ const x = [...s, ...i, ...a, ...c].join("");
1570
+ return Ce.set(e, { css: x, timestamp: t }), x;
1560
1571
  }
1561
- const J = [];
1572
+ const Q = [];
1562
1573
  function lt(e, t, r, n, o, s, i, a) {
1563
1574
  if (e) {
1564
- J.push(r);
1575
+ Q.push(r);
1565
1576
  try {
1566
1577
  if (t.loadingTemplate && r.isLoading) {
1567
1578
  F(e, t.loadingTemplate(r), r, n, o);
@@ -1571,30 +1582,30 @@ function lt(e, t, r, n, o, s, i, a) {
1571
1582
  r.error instanceof Error && F(e, t.errorTemplate(r.error, r), r, n, o);
1572
1583
  return;
1573
1584
  }
1574
- const l = t.render(r);
1575
- if (l instanceof Promise) {
1576
- s(!0), l.then((f) => {
1577
- s(!1), i(null), F(e, f, r, n, o), a(e.innerHTML);
1578
- }).catch((f) => {
1579
- s(!1), i(f), t.errorTemplate && F(e, t.errorTemplate(f, r), r, n, o);
1585
+ const c = t.render(r);
1586
+ if (c instanceof Promise) {
1587
+ s(!0), c.then((u) => {
1588
+ s(!1), i(null), F(e, u, r, n, o), a(e.innerHTML);
1589
+ }).catch((u) => {
1590
+ s(!1), i(u), t.errorTemplate && F(e, t.errorTemplate(u, r), r, n, o);
1580
1591
  }), t.loadingTemplate && F(e, t.loadingTemplate(r), r, n, o);
1581
1592
  return;
1582
1593
  }
1583
- F(e, l, r, n, o), a(e.innerHTML);
1594
+ F(e, c, r, n, o), a(e.innerHTML);
1584
1595
  } finally {
1585
- J.pop();
1596
+ Q.pop();
1586
1597
  }
1587
1598
  }
1588
1599
  }
1589
1600
  function F(e, t, r, n, o) {
1590
- e && (Xe(
1601
+ e && (Ze(
1591
1602
  e,
1592
1603
  Array.isArray(t) ? t : [t],
1593
1604
  r,
1594
1605
  n
1595
1606
  ), o(e.innerHTML));
1596
1607
  }
1597
- function ft(e, t, r, n, o, s, i) {
1608
+ function ct(e, t, r, n, o, s, i) {
1598
1609
  if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1599
1610
  if (o(r + 1), r > 10) {
1600
1611
  console.warn("Potential infinite render loop detected. Skipping render."), i(null);
@@ -1602,37 +1613,37 @@ function ft(e, t, r, n, o, s, i) {
1602
1613
  }
1603
1614
  } else
1604
1615
  o(0);
1605
- const l = setTimeout(() => {
1616
+ const c = setTimeout(() => {
1606
1617
  n(Date.now()), e(), i(null);
1607
1618
  }, 0);
1608
- i(l);
1619
+ i(c);
1609
1620
  }
1610
- function ut(e, t, r, n, o, s) {
1621
+ function ft(e, t, r, n, o, s) {
1611
1622
  if (!e) return;
1612
- const i = ct(n);
1623
+ const i = at(n);
1613
1624
  if (!t.style && (!i || i.trim() === "")) {
1614
- s(null), e.adoptedStyleSheets = [ke()];
1625
+ s(null), e.adoptedStyleSheets = [$e()];
1615
1626
  return;
1616
1627
  }
1617
1628
  let a = "";
1618
1629
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1619
- let l = Qe(`${a}
1630
+ let c = Qe(`${a}
1620
1631
  ${i}
1621
1632
  `);
1622
- l = ze(l);
1623
- let f = o;
1624
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== l) && f.replaceSync(l), e.adoptedStyleSheets = [ke(), f], s(f);
1633
+ c = ze(c);
1634
+ let u = o;
1635
+ u || (u = new CSSStyleSheet()), (u.cssRules.length === 0 || u.toString() !== c) && u.replaceSync(c), e.adoptedStyleSheets = [$e(), u], s(u);
1625
1636
  }
1626
- const ye = /* @__PURE__ */ new Map(), Ce = /* @__PURE__ */ new WeakSet();
1637
+ const be = /* @__PURE__ */ new Map();
1627
1638
  function Ee(e, t, r) {
1628
- let n = me(e);
1639
+ let n = ve(e);
1629
1640
  n.includes("-") || (n = `cer-${n}`);
1630
1641
  let o;
1631
1642
  if (typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
1632
1643
  console.error(`[${n}] Error:`, s, i);
1633
- }), ye.set(n, o), typeof window < "u")
1644
+ }), be.set(n, o), typeof window < "u")
1634
1645
  if (!customElements.get(n))
1635
- customElements.define(n, dt(n, o));
1646
+ customElements.define(n, ut(n, o));
1636
1647
  else
1637
1648
  try {
1638
1649
  document.querySelectorAll(n).forEach((s) => {
@@ -1644,7 +1655,7 @@ function Ee(e, t, r) {
1644
1655
  } catch {
1645
1656
  }
1646
1657
  }
1647
- function dt(e, t) {
1658
+ function ut(e, t) {
1648
1659
  if (!t.render)
1649
1660
  throw new Error(
1650
1661
  "Component must have a render function"
@@ -1688,7 +1699,7 @@ function dt(e, t) {
1688
1699
  _templateLoading = !1;
1689
1700
  _templateError = null;
1690
1701
  constructor() {
1691
- super(), this.attachShadow({ mode: "open" }), this._cfg = ye.get(e) || t;
1702
+ super(), this.attachShadow({ mode: "open" }), this._cfg = be.get(e) || t;
1692
1703
  const r = this._initContext(t);
1693
1704
  Object.defineProperty(r, "refs", {
1694
1705
  value: this._refs,
@@ -1701,45 +1712,28 @@ function dt(e, t) {
1701
1712
  enumerable: !1,
1702
1713
  configurable: !1
1703
1714
  }), this.context = r, this._applyProps(t), Object.defineProperty(this.context, "emit", {
1704
- value: (i, a, l) => {
1705
- const f = new CustomEvent(i, {
1706
- detail: a,
1715
+ value: (o, s, i) => {
1716
+ const a = new CustomEvent(o, {
1717
+ detail: s,
1707
1718
  bubbles: !0,
1708
1719
  composed: !0,
1709
- ...l || {}
1720
+ ...i || {}
1710
1721
  });
1711
- if (this.dispatchEvent(f), Ce.has(f)) return;
1712
- const u = `onHost${i.charAt(0).toUpperCase()}${i.slice(1)}`, h = typeof this[u] == "function" ? this[u] : void 0, c = typeof this.context[u] == "function" ? this.context[u] : void 0, v = typeof t[u] == "function" ? t[u] : void 0;
1713
- h && h(a, this.context), c && c !== h && c(a, this.context), v && v !== h && v !== c && v(a, this.context);
1722
+ return this.dispatchEvent(a), !a.defaultPrevented;
1714
1723
  },
1715
1724
  writable: !1,
1716
1725
  enumerable: !1,
1717
1726
  configurable: !1
1718
1727
  });
1719
- const n = ye.get(e) || t, o = "onHost", s = (i) => {
1720
- if (!i.startsWith(o)) return null;
1721
- const a = i.slice(o.length);
1722
- return a ? a.charAt(0).toLowerCase() + a.slice(1) : null;
1723
- };
1724
- Object.keys(n).forEach((i) => {
1725
- const a = n[i], l = s(i);
1726
- if (typeof a == "function" && !l) {
1727
- this.context[i] = (...f) => a(...f, this.context);
1728
- return;
1729
- }
1730
- if (l) {
1731
- const f = l;
1732
- this.addEventListener(f, (u) => {
1733
- Ce.add(u);
1734
- const h = typeof this[i] == "function" ? this[i] : void 0, c = typeof this.context[i] == "function" ? this.context[i] : void 0, v = typeof n[i] == "function" ? n[i] : void 0, x = h ?? c ?? v;
1735
- typeof x == "function" && x(u.detail, this.context);
1736
- });
1737
- }
1728
+ const n = be.get(e) || t;
1729
+ Object.keys(n).forEach((o) => {
1730
+ const s = n[o];
1731
+ typeof s == "function" && (this.context[o] = (...i) => s(...i, this.context));
1738
1732
  }), this._applyComputed(n), this._initializing = !1, this._initWatchers(n), this._render(n);
1739
1733
  }
1740
1734
  connectedCallback() {
1741
1735
  this._runLogicWithinErrorBoundary(t, () => {
1742
- Ne(
1736
+ We(
1743
1737
  t,
1744
1738
  this.context,
1745
1739
  this._mounted,
@@ -1751,7 +1745,7 @@ function dt(e, t) {
1751
1745
  }
1752
1746
  disconnectedCallback() {
1753
1747
  this._runLogicWithinErrorBoundary(t, () => {
1754
- We(
1748
+ De(
1755
1749
  t,
1756
1750
  this.context,
1757
1751
  this._listeners,
@@ -1775,7 +1769,7 @@ function dt(e, t) {
1775
1769
  }
1776
1770
  attributeChangedCallback(r, n, o) {
1777
1771
  this._runLogicWithinErrorBoundary(t, () => {
1778
- this._applyProps(t), De(
1772
+ this._applyProps(t), qe(
1779
1773
  t,
1780
1774
  r,
1781
1775
  n,
@@ -1785,7 +1779,7 @@ function dt(e, t) {
1785
1779
  });
1786
1780
  }
1787
1781
  static get observedAttributes() {
1788
- return t.props ? Object.keys(t.props).map(me) : [];
1782
+ return t.props ? Object.keys(t.props).map(ve) : [];
1789
1783
  }
1790
1784
  _applyComputed(r) {
1791
1785
  this._runLogicWithinErrorBoundary(t, () => {
@@ -1793,7 +1787,7 @@ function dt(e, t) {
1793
1787
  Object.defineProperty(this.context, n, {
1794
1788
  get: () => {
1795
1789
  const s = o(this.context);
1796
- return pe(s);
1790
+ return ge(s);
1797
1791
  },
1798
1792
  enumerable: !0
1799
1793
  });
@@ -1826,7 +1820,7 @@ function dt(e, t) {
1826
1820
  }
1827
1821
  _requestRender() {
1828
1822
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1829
- ft(
1823
+ ct(
1830
1824
  () => this._render(this._cfg),
1831
1825
  this._lastRenderTime,
1832
1826
  this._renderCount,
@@ -1846,7 +1840,7 @@ function dt(e, t) {
1846
1840
  // --- Style ---
1847
1841
  _applyStyle(r, n) {
1848
1842
  this._runLogicWithinErrorBoundary(r, () => {
1849
- ut(
1843
+ ft(
1850
1844
  this.shadowRoot,
1851
1845
  r,
1852
1846
  this.context,
@@ -1875,9 +1869,9 @@ function dt(e, t) {
1875
1869
  try {
1876
1870
  let n = function(s, i = "") {
1877
1871
  return Array.isArray(s) ? new Proxy(s, {
1878
- get(a, l, f) {
1879
- const u = Reflect.get(a, l, f);
1880
- return typeof u == "function" && typeof l == "string" && [
1872
+ get(a, c, u) {
1873
+ const l = Reflect.get(a, c, u);
1874
+ return typeof l == "function" && typeof c == "string" && [
1881
1875
  "push",
1882
1876
  "pop",
1883
1877
  "shift",
@@ -1885,42 +1879,42 @@ function dt(e, t) {
1885
1879
  "splice",
1886
1880
  "sort",
1887
1881
  "reverse"
1888
- ].includes(l) ? function(...c) {
1889
- const v = u.apply(a, c);
1882
+ ].includes(c) ? function(...d) {
1883
+ const b = l.apply(a, d);
1890
1884
  if (!o._initializing) {
1891
- const x = i || "root";
1892
- o._triggerWatchers(x, a), o._render(r);
1885
+ const k = i || "root";
1886
+ o._triggerWatchers(k, a), o._render(r);
1893
1887
  }
1894
- return v;
1895
- } : u;
1888
+ return b;
1889
+ } : l;
1896
1890
  },
1897
- set(a, l, f) {
1898
- if (a[l] = f, !o._initializing) {
1899
- const u = i ? `${i}.${String(l)}` : String(l);
1900
- o._triggerWatchers(u, f), o._render(r);
1891
+ set(a, c, u) {
1892
+ if (a[c] = u, !o._initializing) {
1893
+ const l = i ? `${i}.${String(c)}` : String(c);
1894
+ o._triggerWatchers(l, u), o._render(r);
1901
1895
  }
1902
1896
  return !0;
1903
1897
  },
1904
- deleteProperty(a, l) {
1905
- if (delete a[l], !o._initializing) {
1906
- const f = i ? `${i}.${String(l)}` : String(l);
1907
- o._triggerWatchers(f, void 0), o._render(r);
1898
+ deleteProperty(a, c) {
1899
+ if (delete a[c], !o._initializing) {
1900
+ const u = i ? `${i}.${String(c)}` : String(c);
1901
+ o._triggerWatchers(u, void 0), o._render(r);
1908
1902
  }
1909
1903
  return !0;
1910
1904
  }
1911
1905
  }) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
1912
- const l = i ? `${i}.${a}` : a;
1913
- s[a] = n(s[a], l);
1906
+ const c = i ? `${i}.${a}` : a;
1907
+ s[a] = n(s[a], c);
1914
1908
  }), new Proxy(s, {
1915
- set(a, l, f) {
1916
- const u = i ? `${i}.${String(l)}` : String(l);
1917
- return a[l] = n(f, u), o._initializing || (o._triggerWatchers(
1918
- u,
1919
- a[l]
1909
+ set(a, c, u) {
1910
+ const l = i ? `${i}.${String(c)}` : String(c);
1911
+ return a[c] = n(u, l), o._initializing || (o._triggerWatchers(
1912
+ l,
1913
+ a[c]
1920
1914
  ), o._render(r)), !0;
1921
1915
  },
1922
- get(a, l, f) {
1923
- return Reflect.get(a, l, f);
1916
+ get(a, c, u) {
1917
+ return Reflect.get(a, c, u);
1924
1918
  }
1925
1919
  })) : s;
1926
1920
  };
@@ -1940,12 +1934,12 @@ function dt(e, t) {
1940
1934
  });
1941
1935
  }
1942
1936
  _triggerWatchers(r, n) {
1943
- He(this.context, this._watchers, r, n);
1937
+ Me(this.context, this._watchers, r, n);
1944
1938
  }
1945
1939
  _applyProps(r) {
1946
1940
  this._runLogicWithinErrorBoundary(r, () => {
1947
1941
  try {
1948
- Me(this, r, this.context);
1942
+ Ne(this, r, this.context);
1949
1943
  } catch (n) {
1950
1944
  this._hasError = !0, r.onError && r.onError(n, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(n, this.context));
1951
1945
  }
@@ -1953,102 +1947,147 @@ function dt(e, t) {
1953
1947
  }
1954
1948
  };
1955
1949
  }
1956
- function V(e, t = {}, r, n) {
1950
+ function Z(e, t = {}, r, n) {
1957
1951
  const o = n ?? t.key;
1958
1952
  return { tag: e, key: o, props: t, children: r };
1959
1953
  }
1960
- function ee(e) {
1954
+ function ne(e) {
1961
1955
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
1962
1956
  }
1963
- function Q(e) {
1964
- return typeof e == "object" && e !== null && "tag" in e && !ee(e);
1957
+ function G(e) {
1958
+ return typeof e == "object" && e !== null && "tag" in e && !ne(e);
1965
1959
  }
1966
- function pt(e, t) {
1960
+ function dt(e, t) {
1967
1961
  return e.key != null ? e : { ...e, key: t };
1968
1962
  }
1969
- function ht(e, t = [], r = {}) {
1970
- const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1971
- let a;
1972
- for (; a = i.exec(e); ) {
1973
- const l = a[1], f = a[2], u = (a[4] || a[6]) ?? "", h = u.match(/^{{(\d+)}}$/);
1974
- let c = h ? t[Number(h[1])] ?? null : u;
1975
- h || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
1976
- const v = ["model", "bind", "show", "class", "style"];
1977
- if (l === ":") {
1978
- const [x, ...k] = f.split(".");
1979
- if (v.includes(x)) {
1980
- const g = [...k];
1963
+ function pt(e, t = [], r = {}) {
1964
+ const n = {}, o = {}, s = {};
1965
+ function i(u, l, y) {
1966
+ const d = typeof u == "function" ? u : typeof y[u] == "function" ? y[u] : void 0;
1967
+ if (typeof d != "function") return;
1968
+ const b = l.includes("prevent"), k = l.includes("stop"), x = l.includes("stopImmediate") || l.includes("stopImmediatePropagation"), p = l.includes("self"), f = l.includes("left"), g = l.includes("middle"), m = l.includes("right"), h = l.includes("ctrl") || l.includes("control"), w = l.includes("alt") || l.includes("option"), v = l.includes("shift"), $ = l.includes("meta") || l.includes("cmd") || l.includes("command"), _ = {
1969
+ enter: "Enter",
1970
+ tab: "Tab",
1971
+ space: " ",
1972
+ spacebar: " ",
1973
+ esc: "Escape",
1974
+ escape: "Escape",
1975
+ del: "Delete",
1976
+ delete: "Delete",
1977
+ backspace: "Backspace",
1978
+ up: "ArrowUp",
1979
+ down: "ArrowDown",
1980
+ left: "ArrowLeft",
1981
+ right: "ArrowRight",
1982
+ home: "Home",
1983
+ end: "End",
1984
+ pageup: "PageUp",
1985
+ pagedown: "PageDown",
1986
+ insert: "Insert",
1987
+ pause: "Pause"
1988
+ };
1989
+ let C = l.filter((A) => _[A]);
1990
+ (f || g || m) && (C = C.filter((A) => A !== "left" && A !== "middle" && A !== "right"));
1991
+ const E = function(A) {
1992
+ if (!((f || g || m) && A instanceof MouseEvent && (f && A.button !== 0 || g && A.button !== 1 || m && A.button !== 2)) && !(h && !A.ctrlKey) && !(w && !A.altKey) && !(v && !A.shiftKey) && !($ && !A.metaKey)) {
1993
+ if (C.length > 0) {
1994
+ const q = A.key;
1995
+ if (!q || !C.some((W) => _[W] === q)) return;
1996
+ }
1997
+ if (!(p && A.target !== A.currentTarget)) {
1998
+ b && A.preventDefault(), k && A.stopPropagation(), x && A.stopImmediatePropagation();
1999
+ try {
2000
+ return typeof u == "function" ? u.call(void 0, A) : d.call(y, A);
2001
+ } catch (q) {
2002
+ throw q;
2003
+ }
2004
+ }
2005
+ }
2006
+ }, j = {};
2007
+ return l.includes("once") && (j.once = !0), l.includes("capture") && (j.capture = !0), l.includes("passive") && (j.passive = !0), Object.keys(j).length > 0 ? { handler: E, options: j } : E;
2008
+ }
2009
+ const a = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2010
+ let c;
2011
+ for (; c = a.exec(e); ) {
2012
+ const u = c[1], l = c[2], y = (c[4] || c[6]) ?? "", d = y.match(/^{{(\d+)}}$/);
2013
+ let b = d ? t[Number(d[1])] ?? null : y;
2014
+ d || (b === "true" ? b = !0 : b === "false" ? b = !1 : b === "null" ? b = null : isNaN(Number(b)) || (b = Number(b)));
2015
+ const k = ["model", "bind", "show", "class", "style"];
2016
+ if (u === ":") {
2017
+ const [x, ...p] = l.split(".");
2018
+ if (k.includes(x)) {
2019
+ const f = [...p];
1981
2020
  s[x] = {
1982
- value: c,
1983
- modifiers: g
2021
+ value: b,
2022
+ modifiers: f
1984
2023
  };
1985
2024
  } else
1986
- o[f] = c;
1987
- } else if (l === "@") {
1988
- const x = "onHost" + f.charAt(0).toUpperCase() + f.slice(1);
1989
- n[x] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
1990
- } else f === "ref" ? n.ref = c : o[f] = c;
2025
+ o[l] = b;
2026
+ } else if (u === "@") {
2027
+ const x = l.split("."), p = x[0], f = x.slice(1), g = "on" + p.charAt(0).toUpperCase() + p.slice(1), m = i(b, f, r);
2028
+ m !== void 0 && (n[g] = m);
2029
+ } else l === "ref" ? n.ref = b : o[l] = b;
1991
2030
  }
1992
2031
  return { props: n, attrs: o, directives: s };
1993
2032
  }
1994
- function gt(e, t, r) {
1995
- const n = J.length > 0 ? J[J.length - 1] : void 0, o = r ?? n;
1996
- function s(p, w) {
1997
- return V("#text", {}, p, w);
2033
+ function ht(e, t, r) {
2034
+ const n = Q.length > 0 ? Q[Q.length - 1] : void 0, o = r ?? n;
2035
+ function s(h, w) {
2036
+ return Z("#text", {}, h, w);
1998
2037
  }
1999
2038
  let i = "";
2000
- for (let p = 0; p < e.length; p++)
2001
- i += e[p], p < t.length && (i += `{{${p}}}`);
2002
- const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, l = [];
2003
- let f, u = [], h = null, c = {}, v, x = 0, k = [];
2004
- function g(p) {
2005
- !p || typeof p != "object" || ee(p) || (p.props || p.attrs ? (p.props && (c.props || (c.props = {}), Object.assign(c.props, p.props)), p.attrs && (c.attrs || (c.attrs = {}), Object.keys(p.attrs).forEach((w) => {
2006
- if (w === "style" && c.attrs.style) {
2007
- const m = c.attrs.style.replace(
2039
+ for (let h = 0; h < e.length; h++)
2040
+ i += e[h], h < t.length && (i += `{{${h}}}`);
2041
+ const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
2042
+ let u, l = [], y = null, d = {}, b, k = 0, x = [];
2043
+ function p(h) {
2044
+ !h || typeof h != "object" || ne(h) || (h.props || h.attrs ? (h.props && (d.props || (d.props = {}), Object.assign(d.props, h.props)), h.attrs && (d.attrs || (d.attrs = {}), Object.keys(h.attrs).forEach((w) => {
2045
+ if (w === "style" && d.attrs.style) {
2046
+ const v = d.attrs.style.replace(
2008
2047
  /;?\s*$/,
2009
2048
  ""
2010
- ), $ = p.attrs.style.replace(/^;?\s*/, "");
2011
- c.attrs.style = m + "; " + $;
2012
- } else if (w === "class" && c.attrs.class) {
2013
- const m = c.attrs.class.trim().split(/\s+/).filter(Boolean), $ = p.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
2014
- .../* @__PURE__ */ new Set([...m, ...$])
2049
+ ), $ = h.attrs.style.replace(/^;?\s*/, "");
2050
+ d.attrs.style = v + "; " + $;
2051
+ } else if (w === "class" && d.attrs.class) {
2052
+ const v = d.attrs.class.trim().split(/\s+/).filter(Boolean), $ = h.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
2053
+ .../* @__PURE__ */ new Set([...v, ...$])
2015
2054
  ];
2016
- c.attrs.class = _.join(" ");
2055
+ d.attrs.class = _.join(" ");
2017
2056
  } else
2018
- c.attrs[w] = p.attrs[w];
2019
- }))) : (c.props || (c.props = {}), Object.assign(c.props, p)));
2020
- }
2021
- function d(p, w) {
2022
- const m = h ? u : k;
2023
- if (ee(p)) {
2024
- const $ = p.key ?? w;
2025
- let _ = p.children;
2026
- m.push({
2027
- ...p,
2057
+ d.attrs[w] = h.attrs[w];
2058
+ }))) : (d.props || (d.props = {}), Object.assign(d.props, h)));
2059
+ }
2060
+ function f(h, w) {
2061
+ const v = y ? l : x;
2062
+ if (ne(h)) {
2063
+ const $ = h.key ?? w;
2064
+ let _ = h.children;
2065
+ v.push({
2066
+ ...h,
2028
2067
  key: $,
2029
2068
  children: _
2030
2069
  });
2031
2070
  return;
2032
2071
  }
2033
- if (Q(p)) {
2034
- m.push(pt(p, void 0));
2072
+ if (G(h)) {
2073
+ v.push(dt(h, void 0));
2035
2074
  return;
2036
2075
  }
2037
- if (Array.isArray(p)) {
2038
- if (p.length === 0) return;
2039
- for (let $ = 0; $ < p.length; $++) {
2040
- const _ = p[$];
2041
- ee(_) || Q(_) || Array.isArray(_) ? d(_, `${w}-${$}`) : _ !== null && typeof _ == "object" ? g(_) : m.push(s(String(_), `${w}-${$}`));
2076
+ if (Array.isArray(h)) {
2077
+ if (h.length === 0) return;
2078
+ for (let $ = 0; $ < h.length; $++) {
2079
+ const _ = h[$];
2080
+ ne(_) || G(_) || Array.isArray(_) ? f(_, `${w}-${$}`) : _ !== null && typeof _ == "object" ? p(_) : v.push(s(String(_), `${w}-${$}`));
2042
2081
  }
2043
2082
  return;
2044
2083
  }
2045
- if (p !== null && typeof p == "object") {
2046
- g(p);
2084
+ if (h !== null && typeof h == "object") {
2085
+ p(h);
2047
2086
  return;
2048
2087
  }
2049
- m.push(s(String(p), w));
2088
+ v.push(s(String(h), w));
2050
2089
  }
2051
- const y = /* @__PURE__ */ new Set([
2090
+ const g = /* @__PURE__ */ new Set([
2052
2091
  "area",
2053
2092
  "base",
2054
2093
  "br",
@@ -2064,221 +2103,221 @@ function gt(e, t, r) {
2064
2103
  "track",
2065
2104
  "wbr"
2066
2105
  ]);
2067
- for (; f = a.exec(i); )
2068
- if (f[1]) {
2069
- const p = f[1], w = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || y.has(p), {
2106
+ for (; u = a.exec(i); )
2107
+ if (u[1]) {
2108
+ const h = u[1], w = u[0][1] === "/", v = u[0][u[0].length - 2] === "/" || g.has(h), {
2070
2109
  props: $,
2071
2110
  attrs: _,
2072
2111
  directives: C
2073
- } = ht(f[2] || "", t, o), E = { props: {}, attrs: {} };
2112
+ } = pt(u[2] || "", t, o), E = { props: {}, attrs: {} };
2074
2113
  for (const j in $) E.props[j] = $[j];
2075
2114
  for (const j in _) E.attrs[j] = _[j];
2076
2115
  if (Object.keys(C).length > 0 && (E.directives = { ...C }), w) {
2077
- const j = V(
2078
- h,
2079
- c,
2080
- u.length === 1 && Q(u[0]) && u[0].tag === "#text" ? typeof u[0].children == "string" ? u[0].children : "" : u.length ? u : void 0,
2081
- v
2082
- ), A = l.pop();
2083
- A ? (h = A.tag, c = A.props, v = A.key, u = A.children, u.push(j)) : (k.push(j), h = null, c = {}, v = void 0, u = []);
2084
- } else m ? h ? u.push(V(p, E, void 0, void 0)) : k.push(V(p, E, void 0, void 0)) : (h && l.push({
2085
- tag: h,
2086
- props: c,
2087
- children: u,
2088
- key: v
2089
- }), h = p, c = E, u = []);
2090
- } else if (typeof f[3] < "u") {
2091
- const p = Number(f[3]), w = t[p], m = `interp-${p}`;
2092
- d(w, m);
2093
- } else if (f[4]) {
2094
- const p = f[4], w = h ? u : k, m = p.split(/({{\d+}})/);
2095
- for (const $ of m) {
2116
+ const j = Z(
2117
+ y,
2118
+ d,
2119
+ l.length === 1 && G(l[0]) && l[0].tag === "#text" ? typeof l[0].children == "string" ? l[0].children : "" : l.length ? l : void 0,
2120
+ b
2121
+ ), T = c.pop();
2122
+ T ? (y = T.tag, d = T.props, b = T.key, l = T.children, l.push(j)) : (x.push(j), y = null, d = {}, b = void 0, l = []);
2123
+ } else v ? y ? l.push(Z(h, E, void 0, void 0)) : x.push(Z(h, E, void 0, void 0)) : (y && c.push({
2124
+ tag: y,
2125
+ props: d,
2126
+ children: l,
2127
+ key: b
2128
+ }), y = h, d = E, l = []);
2129
+ } else if (typeof u[3] < "u") {
2130
+ const h = Number(u[3]), w = t[h], v = `interp-${h}`;
2131
+ f(w, v);
2132
+ } else if (u[4]) {
2133
+ const h = u[4], w = y ? l : x, v = h.split(/({{\d+}})/);
2134
+ for (const $ of v) {
2096
2135
  if (!$) continue;
2097
2136
  const _ = $.match(/^{{(\d+)}}$/);
2098
2137
  if (_) {
2099
2138
  const C = Number(_[1]), E = t[C], j = `interp-${C}`;
2100
- d(E, j);
2139
+ f(E, j);
2101
2140
  } else {
2102
- const C = `text-${x++}`;
2141
+ const C = `text-${k++}`;
2103
2142
  w.push(s($, C));
2104
2143
  }
2105
2144
  }
2106
2145
  }
2107
- const b = k.filter((p) => Q(p) && p.tag === "#text" ? typeof p.children == "string" && p.children.trim() !== "" : !0);
2108
- return b.length === 1 ? b[0] : b.length > 1 ? b : V("div", {}, "", "fallback-root");
2146
+ const m = x.filter((h) => G(h) && h.tag === "#text" ? typeof h.children == "string" && h.children.trim() !== "" : !0);
2147
+ return m.length === 1 ? m[0] : m.length > 1 ? m : Z("div", {}, "", "fallback-root");
2109
2148
  }
2110
- function W(e, ...t) {
2149
+ function I(e, ...t) {
2111
2150
  const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2112
- return gt(e, t, n);
2151
+ return ht(e, t, n);
2113
2152
  }
2114
- const Ae = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, M = (e, t) => {
2153
+ const Ae = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, D = (e, t) => {
2115
2154
  for (const r of e) {
2116
2155
  const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
2117
2156
  if (i) {
2118
2157
  const a = {};
2119
- return n.forEach((l, f) => {
2120
- a[l] = i[f + 1];
2158
+ return n.forEach((c, u) => {
2159
+ a[c] = i[u + 1];
2121
2160
  }), { route: r, params: a };
2122
2161
  }
2123
2162
  }
2124
2163
  return { route: null, params: {} };
2125
- }, de = {};
2126
- async function yt(e) {
2164
+ }, he = {};
2165
+ async function gt(e) {
2127
2166
  if (e.component) return e.component;
2128
2167
  if (e.load) {
2129
- if (de[e.path]) return de[e.path];
2168
+ if (he[e.path]) return he[e.path];
2130
2169
  try {
2131
2170
  const t = await e.load();
2132
- return de[e.path] = t.default, t.default;
2171
+ return he[e.path] = t.default, t.default;
2133
2172
  } catch {
2134
2173
  throw new Error(`Failed to load component for route: ${e.path}`);
2135
2174
  }
2136
2175
  }
2137
2176
  throw new Error(`No component or loader defined for route: ${e.path}`);
2138
2177
  }
2139
- function mt(e) {
2178
+ function yt(e) {
2140
2179
  const { routes: t, base: r = "", initialUrl: n } = e;
2141
- let o, s, i, a, l, f, u;
2142
- const h = async (k, g) => {
2143
- const d = t.find((y) => M([y], k.path).route !== null);
2144
- if (d?.beforeEnter)
2180
+ let o, s, i, a, c, u, l;
2181
+ const y = async (x, p) => {
2182
+ const f = t.find((g) => D([g], x.path).route !== null);
2183
+ if (f?.beforeEnter)
2145
2184
  try {
2146
- const y = await d.beforeEnter(k, g);
2147
- return typeof y == "string" ? (await x(y, !0), !1) : y !== !1;
2148
- } catch (y) {
2149
- return console.error("beforeEnter error", y), !1;
2185
+ const g = await f.beforeEnter(x, p);
2186
+ return typeof g == "string" ? (await k(g, !0), !1) : g !== !1;
2187
+ } catch (g) {
2188
+ return console.error("beforeEnter error", g), !1;
2150
2189
  }
2151
2190
  return !0;
2152
- }, c = async (k, g) => {
2153
- const d = t.find((y) => M([y], k.path).route !== null);
2154
- if (d?.onEnter)
2191
+ }, d = async (x, p) => {
2192
+ const f = t.find((g) => D([g], x.path).route !== null);
2193
+ if (f?.onEnter)
2155
2194
  try {
2156
- const y = await d.onEnter(k, g);
2157
- return typeof y == "string" ? (await x(y, !0), !1) : y !== !1;
2158
- } catch (y) {
2159
- return console.error("onEnter error", y), !1;
2195
+ const g = await f.onEnter(x, p);
2196
+ return typeof g == "string" ? (await k(g, !0), !1) : g !== !1;
2197
+ } catch (g) {
2198
+ return console.error("onEnter error", g), !1;
2160
2199
  }
2161
2200
  return !0;
2162
- }, v = (k, g) => {
2163
- const d = t.find((y) => M([y], k.path).route !== null);
2164
- if (d?.afterEnter)
2201
+ }, b = (x, p) => {
2202
+ const f = t.find((g) => D([g], x.path).route !== null);
2203
+ if (f?.afterEnter)
2165
2204
  try {
2166
- d.afterEnter(k, g);
2167
- } catch (y) {
2168
- console.error("afterEnter error", y);
2205
+ f.afterEnter(x, p);
2206
+ } catch (g) {
2207
+ console.error("afterEnter error", g);
2169
2208
  }
2170
- }, x = async (k, g = !1) => {
2209
+ }, k = async (x, p = !1) => {
2171
2210
  try {
2172
- const d = {
2173
- path: k.replace(r, "") || "/",
2211
+ const f = {
2212
+ path: x.replace(r, "") || "/",
2174
2213
  query: {}
2175
- }, y = M(t, d.path);
2176
- if (!y) throw new Error(`No route found for ${d.path}`);
2177
- const b = i.getState(), p = {
2178
- path: d.path,
2179
- params: y.params,
2180
- query: d.query
2214
+ }, g = D(t, f.path);
2215
+ if (!g) throw new Error(`No route found for ${f.path}`);
2216
+ const m = i.getState(), h = {
2217
+ path: f.path,
2218
+ params: g.params,
2219
+ query: f.query
2181
2220
  };
2182
- if (!await h(p, b) || !await c(p, b)) return;
2183
- typeof window < "u" && typeof document < "u" && (g ? window.history.replaceState({}, "", r + k) : window.history.pushState({}, "", r + k)), i.setState(p), v(p, b);
2184
- } catch (d) {
2185
- console.error("Navigation error:", d);
2221
+ if (!await y(h, m) || !await d(h, m)) return;
2222
+ typeof window < "u" && typeof document < "u" && (p ? window.history.replaceState({}, "", r + x) : window.history.pushState({}, "", r + x)), i.setState(h), b(h, m);
2223
+ } catch (f) {
2224
+ console.error("Navigation error:", f);
2186
2225
  }
2187
2226
  };
2188
2227
  if (typeof window < "u" && typeof document < "u") {
2189
2228
  o = () => {
2190
- const g = new URL(window.location.href), d = g.pathname.replace(r, "") || "/", y = Ae(g.search);
2191
- return { path: d, query: y };
2229
+ const p = new URL(window.location.href), f = p.pathname.replace(r, "") || "/", g = Ae(p.search);
2230
+ return { path: f, query: g };
2192
2231
  }, s = o();
2193
- const k = M(t, s.path);
2232
+ const x = D(t, s.path);
2194
2233
  i = xe({
2195
2234
  path: s.path,
2196
- params: k.params,
2235
+ params: x.params,
2197
2236
  query: s.query
2198
- }), a = async (g = !1) => {
2199
- const d = o();
2200
- await x(d.path, g);
2201
- }, window.addEventListener("popstate", () => a(!0)), l = (g) => x(g, !1), f = (g) => x(g, !0), u = () => window.history.back();
2237
+ }), a = async (p = !1) => {
2238
+ const f = o();
2239
+ await k(f.path, p);
2240
+ }, window.addEventListener("popstate", () => a(!0)), c = (p) => k(p, !1), u = (p) => k(p, !0), l = () => window.history.back();
2202
2241
  } else {
2203
2242
  o = () => {
2204
- const d = new URL(n || "/", "http://localhost"), y = d.pathname.replace(r, "") || "/", b = Ae(d.search);
2205
- return { path: y, query: b };
2243
+ const f = new URL(n || "/", "http://localhost"), g = f.pathname.replace(r, "") || "/", m = Ae(f.search);
2244
+ return { path: g, query: m };
2206
2245
  }, s = o();
2207
- const k = M(t, s.path);
2246
+ const x = D(t, s.path);
2208
2247
  i = xe({
2209
2248
  path: s.path,
2210
- params: k.params,
2249
+ params: x.params,
2211
2250
  query: s.query
2212
2251
  }), a = async () => {
2213
- const d = o();
2214
- await g(d.path);
2252
+ const f = o();
2253
+ await p(f.path);
2215
2254
  };
2216
- const g = async (d) => {
2255
+ const p = async (f) => {
2217
2256
  try {
2218
- const y = {
2219
- path: d.replace(r, "") || "/",
2257
+ const g = {
2258
+ path: f.replace(r, "") || "/",
2220
2259
  query: {}
2221
- }, b = M(t, y.path);
2222
- if (!b) throw new Error(`No route found for ${y.path}`);
2223
- const p = i.getState(), w = {
2224
- path: y.path,
2225
- params: b.params,
2226
- query: y.query
2227
- }, m = t.find(($) => M([$], w.path).route !== null);
2228
- if (m?.beforeEnter)
2260
+ }, m = D(t, g.path);
2261
+ if (!m) throw new Error(`No route found for ${g.path}`);
2262
+ const h = i.getState(), w = {
2263
+ path: g.path,
2264
+ params: m.params,
2265
+ query: g.query
2266
+ }, v = t.find(($) => D([$], w.path).route !== null);
2267
+ if (v?.beforeEnter)
2229
2268
  try {
2230
- const $ = await m.beforeEnter(w, p);
2269
+ const $ = await v.beforeEnter(w, h);
2231
2270
  if (typeof $ == "string") {
2232
- await g($);
2271
+ await p($);
2233
2272
  return;
2234
2273
  }
2235
2274
  if ($ === !1) return;
2236
2275
  } catch {
2237
2276
  return;
2238
2277
  }
2239
- if (m?.onEnter)
2278
+ if (v?.onEnter)
2240
2279
  try {
2241
- const $ = await m.onEnter(w, p);
2280
+ const $ = await v.onEnter(w, h);
2242
2281
  if (typeof $ == "string") {
2243
- await g($);
2282
+ await p($);
2244
2283
  return;
2245
2284
  }
2246
2285
  if ($ === !1) return;
2247
2286
  } catch {
2248
2287
  return;
2249
2288
  }
2250
- if (i.setState(w), m?.afterEnter)
2289
+ if (i.setState(w), v?.afterEnter)
2251
2290
  try {
2252
- m.afterEnter(w, p);
2291
+ v.afterEnter(w, h);
2253
2292
  } catch {
2254
2293
  }
2255
2294
  } catch {
2256
2295
  }
2257
2296
  };
2258
- l = async (d) => g(d), f = async (d) => g(d), u = () => {
2297
+ c = async (f) => p(f), u = async (f) => p(f), l = () => {
2259
2298
  };
2260
2299
  }
2261
2300
  return {
2262
2301
  store: i,
2263
- push: l,
2264
- replace: f,
2265
- back: u,
2302
+ push: c,
2303
+ replace: u,
2304
+ back: l,
2266
2305
  subscribe: i.subscribe,
2267
- matchRoute: (k) => M(t, k),
2306
+ matchRoute: (x) => D(t, x),
2268
2307
  getCurrent: () => i.getState(),
2269
- resolveRouteComponent: yt
2308
+ resolveRouteComponent: gt
2270
2309
  };
2271
2310
  }
2272
- function _t(e, t) {
2273
- return M(e, t);
2311
+ function St(e, t) {
2312
+ return D(e, t);
2274
2313
  }
2275
- function Ct(e) {
2276
- const t = mt(e);
2314
+ function _t(e) {
2315
+ const t = yt(e);
2277
2316
  return Ee("router-view", {
2278
2317
  async render() {
2279
- if (!t) return W`<div>Router not initialized.</div>`;
2318
+ if (!t) return I`<div>Router not initialized.</div>`;
2280
2319
  const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
2281
- if (!o.route) return W`<div>Not found</div>`;
2320
+ if (!o.route) return I`<div>Not found</div>`;
2282
2321
  try {
2283
2322
  const s = await t.resolveRouteComponent(o.route);
2284
2323
  if (typeof s == "string")
@@ -2287,9 +2326,9 @@ function Ct(e) {
2287
2326
  const i = s(), a = i instanceof Promise ? await i : i;
2288
2327
  return typeof a == "string" ? { tag: a, props: {}, children: [] } : a;
2289
2328
  }
2290
- return W`<div>Invalid route component</div>`;
2329
+ return I`<div>Invalid route component</div>`;
2291
2330
  } catch {
2292
- return W`<div>Invalid route component</div>`;
2331
+ return I`<div>Invalid route component</div>`;
2293
2332
  }
2294
2333
  },
2295
2334
  onConnected(r) {
@@ -2319,32 +2358,32 @@ function Ct(e) {
2319
2358
  },
2320
2359
  style: (r) => r.style,
2321
2360
  render: (r) => {
2322
- const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, l = r.ariaCurrentValue, f = r.tag, u = r.disabled, h = r.external, c = n.path === o, v = s ? c : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, x = c ? `aria-current="${l}"` : "", k = (r.class || "").split(/\s+/).filter(Boolean), g = {};
2323
- for (const w of k) g[w] = !0;
2324
- const d = {
2325
- ...g,
2361
+ const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, u = r.tag, l = r.disabled, y = r.external, d = n.path === o, b = s ? d : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, k = d ? `aria-current="${c}"` : "", x = (r.class || "").split(/\s+/).filter(Boolean), p = {};
2362
+ for (const w of x) p[w] = !0;
2363
+ const f = {
2364
+ ...p,
2326
2365
  // Also include the configurable names (may duplicate the above)
2327
- [a]: v,
2328
- [i]: c
2329
- }, y = f === "button", b = u ? y ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", p = h && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2330
- return W`
2331
- ${Re().when(y, W`
2366
+ [a]: b,
2367
+ [i]: d
2368
+ }, g = u === "button", m = l ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", h = y && (u === "a" || !u) ? 'target="_blank" rel="noopener noreferrer"' : "";
2369
+ return I`
2370
+ ${Be().when(g, I`
2332
2371
  <button
2333
2372
  part="button"
2334
- :class="${d}"
2335
- ${x}
2336
- ${b}
2337
- ${p}
2373
+ :class="${f}"
2374
+ ${k}
2375
+ ${m}
2376
+ ${h}
2338
2377
  @click="navigate"
2339
2378
  ><slot></slot></button>
2340
- `).otherwise(W`
2379
+ `).otherwise(I`
2341
2380
  <a
2342
2381
  part="link"
2343
2382
  href="${o}"
2344
- :class="${d}"
2345
- ${x}
2346
- ${b}
2347
- ${p}
2383
+ :class="${f}"
2384
+ ${k}
2385
+ ${m}
2386
+ ${h}
2348
2387
  @click="navigate"
2349
2388
  ><slot></slot></a>
2350
2389
  `).done()}
@@ -2360,25 +2399,25 @@ function Ct(e) {
2360
2399
  }), t;
2361
2400
  }
2362
2401
  export {
2363
- U as GlobalEventBus,
2402
+ V as GlobalEventBus,
2364
2403
  Ee as component,
2365
2404
  xe as createStore,
2366
2405
  Le as css,
2367
- vt as each,
2368
- xt as emit,
2369
- Z as eventBus,
2370
- W as html,
2371
- Ct as initRouter,
2372
- St as listen,
2373
- Re as match,
2374
- M as matchRoute,
2375
- _t as matchRouteSSR,
2376
- kt as off,
2406
+ bt as each,
2407
+ vt as emit,
2408
+ X as eventBus,
2409
+ I as html,
2410
+ _t as initRouter,
2411
+ $t as listen,
2412
+ Be as match,
2413
+ D as matchRoute,
2414
+ St as matchRouteSSR,
2415
+ xt as off,
2377
2416
  wt as on,
2378
- $t as once,
2417
+ kt as once,
2379
2418
  Ae as parseQuery,
2380
- yt as resolveRouteComponent,
2381
- mt as useRouter,
2382
- bt as when
2419
+ gt as resolveRouteComponent,
2420
+ yt as useRouter,
2421
+ mt as when
2383
2422
  };
2384
2423
  //# sourceMappingURL=custom-elements-runtime.es.js.map