@jasonshimmy/custom-elements-runtime 0.1.10 → 0.1.12

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.
@@ -17,11 +17,11 @@ function $e() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return _e(...e);
20
+ return Se(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function _e(...e) {
24
+ function Se(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, n] = e[t];
27
27
  if (r) return [Y(n, `whenChain-branch-${t}`)];
@@ -194,7 +194,7 @@ function oe(e) {
194
194
  })[t]
195
195
  ) : e;
196
196
  }
197
- function Se(e, t, r) {
197
+ function _e(e, t, r) {
198
198
  if (r)
199
199
  for (const [n, o] of Object.entries(r)) {
200
200
  let s, i = {};
@@ -219,9 +219,9 @@ function Ce(e, t, r, n) {
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((p, g) => o(p, a[g]));
222
+ return i.length !== a.length ? !1 : i.every((h, g) => o(h, a[g]));
223
223
  const c = Object.keys(i), f = Object.keys(a);
224
- return c.length !== f.length ? !1 : c.every((p) => o(i[p], a[p]));
224
+ return c.length !== f.length ? !1 : c.every((h) => o(i[h], a[h]));
225
225
  }, s = t.get(r);
226
226
  if (s && !o(n, s.oldValue))
227
227
  try {
@@ -238,7 +238,7 @@ function Ce(e, t, r, n) {
238
238
  console.error(`Error in deep watcher for "${i}":`, c);
239
239
  }
240
240
  }
241
- function Ae(e, t, r) {
241
+ function Ee(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;
@@ -252,7 +252,7 @@ function Ae(e, t, r) {
252
252
  }
253
253
  });
254
254
  }
255
- function Ee(e, t, r, n) {
255
+ function Ae(e, t, r, n) {
256
256
  e.onConnected && !r && (e.onConnected(t), n(!0));
257
257
  }
258
258
  function Te(e, t, r, n, o, s, i, a) {
@@ -270,7 +270,7 @@ function M(e, t) {
270
270
  }
271
271
  }
272
272
  function O(e, t) {
273
- return t.split(".").reduce((r, n) => r?.[n], e);
273
+ return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
275
  function fe(e, t, r) {
276
276
  const n = t.split("."), o = n.pop();
@@ -280,30 +280,30 @@ function fe(e, t, r) {
280
280
  }
281
281
  function Le(e, t, r, n, o, s, i) {
282
282
  if (!s) return;
283
- const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), p = () => {
284
- const h = s._state || s;
285
- return O(h, e);
286
- }, g = p();
283
+ const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), h = () => {
284
+ const p = s._state || s;
285
+ return O(p, e);
286
+ }, g = h();
287
287
  let l = "text";
288
- const b = n?.type;
289
- if (i instanceof HTMLInputElement ? l = b || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
288
+ const x = n?.type;
289
+ if (i instanceof HTMLInputElement ? l = x || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
290
290
  if (Array.isArray(g)) {
291
- const h = i?.getAttribute("value") || n?.value || "", d = g.includes(h);
292
- i && i.checked !== d && (r.checked = d);
291
+ const p = i?.getAttribute("value") || n?.value || "", u = g.includes(p);
292
+ i && i.checked !== u && (r.checked = u);
293
293
  } else {
294
- const h = i?.getAttribute("true-value") || !0, d = g === h;
295
- i && i.checked !== d && (r.checked = d);
294
+ const p = i?.getAttribute("true-value") || !0, u = g === p;
295
+ i && i.checked !== u && (r.checked = u);
296
296
  }
297
297
  else if (l === "radio") {
298
- const h = n?.value || "", d = g === h;
299
- i && i.checked !== d && (r.checked = d);
298
+ const p = n?.value || "", u = g === p;
299
+ i && i.checked !== u && (r.checked = u);
300
300
  } else if (l === "select")
301
301
  if (i && i.hasAttribute("multiple")) {
302
- const h = i, d = Array.isArray(g) ? g : [];
302
+ const p = i, u = Array.isArray(g) ? g : [];
303
303
  setTimeout(() => {
304
- Array.from(h.options).forEach((v) => {
305
- const x = d.includes(v.value);
306
- v.selected !== x && (v.selected = x);
304
+ Array.from(p.options).forEach((y) => {
305
+ const b = u.includes(y.value);
306
+ y.selected !== b && (y.selected = b);
307
307
  });
308
308
  }, 0);
309
309
  } else
@@ -311,69 +311,69 @@ function Le(e, t, r, n, o, s, i) {
311
311
  i instanceof HTMLSelectElement && i.value !== String(g) && (i.value = String(g));
312
312
  }, 0);
313
313
  else {
314
- const h = String(g ?? "");
315
- (!i || i.value !== h) && (r.value = g);
316
- }
317
- const y = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", m = (h) => {
318
- if (h.isComposing || o._isComposing || h.isTrusted === !1) return;
319
- const d = h.target;
320
- if (d._modelUpdating) return;
321
- const v = p();
322
- let x = d.value;
314
+ const p = String(g ?? "");
315
+ (!i || i.value !== p) && (r.value = g);
316
+ }
317
+ const m = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", v = (p) => {
318
+ if (p.isComposing || o._isComposing || p.isTrusted === !1) return;
319
+ const u = p.target;
320
+ if (u._modelUpdating) return;
321
+ const y = h();
322
+ let b = u.value;
323
323
  if (l === "checkbox")
324
- if (Array.isArray(v)) {
325
- const _ = d.getAttribute("value") || "", S = [...v];
326
- if (d.checked)
327
- S.includes(_) || S.push(_);
324
+ if (Array.isArray(y)) {
325
+ const k = u.getAttribute("value") || "", _ = [...y];
326
+ if (u.checked)
327
+ _.includes(k) || _.push(k);
328
328
  else {
329
- const C = S.indexOf(_);
330
- C > -1 && S.splice(C, 1);
329
+ const C = _.indexOf(k);
330
+ C > -1 && _.splice(C, 1);
331
331
  }
332
- x = S;
332
+ b = _;
333
333
  } else {
334
- const _ = d.getAttribute("true-value") || !0, S = d.getAttribute("false-value") || !1;
335
- x = d.checked ? _ : S;
334
+ const k = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
+ b = u.checked ? k : _;
336
336
  }
337
337
  else if (l === "radio")
338
- x = d.getAttribute("value") || d.value;
339
- else if (l === "select" && d.multiple) {
340
- const _ = d;
341
- x = Array.from(_.selectedOptions).map(
342
- (S) => S.value
338
+ b = u.getAttribute("value") || u.value;
339
+ else if (l === "select" && u.multiple) {
340
+ const k = u;
341
+ b = Array.from(k.selectedOptions).map(
342
+ (_) => _.value
343
343
  );
344
- } else if (c && (x = x.trim()), f) {
345
- const _ = Number(x);
346
- isNaN(_) || (x = _);
344
+ } else if (c && (b = b.trim()), f) {
345
+ const k = Number(b);
346
+ isNaN(k) || (b = k);
347
347
  }
348
- const u = s._state || s, $ = O(u, e);
349
- if (Array.isArray(x) && Array.isArray($) ? JSON.stringify([...x].sort()) !== JSON.stringify([...$].sort()) : x !== $) {
350
- const _ = h.target;
351
- _._modelUpdating = !0, fe(u, e, x), setTimeout(() => {
352
- _._modelUpdating = !1;
348
+ const d = s._state || s, $ = O(d, e);
349
+ if (Array.isArray(b) && Array.isArray($) ? JSON.stringify([...b].sort()) !== JSON.stringify([...$].sort()) : b !== $) {
350
+ const k = p.target;
351
+ k._modelUpdating = !0, fe(d, e, b), setTimeout(() => {
352
+ k._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (o[y] = m, l === "text" || l === "textarea") {
357
- const h = () => {
356
+ if (o[m] = v, l === "text" || l === "textarea") {
357
+ const p = () => {
358
358
  o._isComposing = !0;
359
- }, d = (v) => {
359
+ }, u = (y) => {
360
360
  o._isComposing = !1;
361
- const x = v.target;
361
+ const b = y.target;
362
362
  setTimeout(() => {
363
- if (x) {
364
- let u = x.value;
365
- if (c && (u = u.trim()), f) {
366
- const S = Number(u);
367
- isNaN(S) || (u = S);
363
+ if (b) {
364
+ let d = b.value;
365
+ if (c && (d = d.trim()), f) {
366
+ const _ = Number(d);
367
+ isNaN(_) || (d = _);
368
368
  }
369
369
  const $ = s._state || s, w = O($, e);
370
- (Array.isArray(u) && Array.isArray(w) ? JSON.stringify([...u].sort()) !== JSON.stringify([...w].sort()) : u !== w) && (x && (x._modelUpdating = !0, setTimeout(() => {
371
- x._modelUpdating = !1;
372
- }, 0)), fe($, e, u), s._requestRender && s._requestRender());
370
+ (Array.isArray(d) && Array.isArray(w) ? JSON.stringify([...d].sort()) !== JSON.stringify([...w].sort()) : d !== w) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
+ b._modelUpdating = !1;
372
+ }, 0)), fe($, e, d), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
- o.compositionstart = h, o.compositionend = d;
376
+ o.compositionstart = p, o.compositionend = u;
377
377
  }
378
378
  }
379
379
  function Be(e, t, r, n) {
@@ -403,7 +403,7 @@ function Re(e, t, r) {
403
403
  if (!r) return;
404
404
  const n = O(r, e);
405
405
  let o = [];
406
- typeof n == "string" ? o = [n] : Array.isArray(n) ? o = n.filter(Boolean) : typeof n == "object" && (o = Object.entries(n).filter(([, a]) => !!a).map(([a]) => a));
406
+ 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)));
407
407
  const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
408
408
  i && (t.class = i);
409
409
  }
@@ -424,7 +424,7 @@ function Ne(e, t, r) {
424
424
  const f = a.replace(
425
425
  /[A-Z]/g,
426
426
  (l) => `-${l.toLowerCase()}`
427
- ), p = [
427
+ ), h = [
428
428
  "width",
429
429
  "height",
430
430
  "top",
@@ -451,7 +451,7 @@ function Ne(e, t, r) {
451
451
  "max-height"
452
452
  ];
453
453
  let g = String(c);
454
- typeof c == "number" && p.includes(f) && (g = `${c}px`), i.push(`${f}: ${g}`);
454
+ typeof c == "number" && h.includes(f) && (g = `${c}px`), i.push(`${f}: ${g}`);
455
455
  }
456
456
  o = i.join("; ") + (i.length > 0 ? ";" : "");
457
457
  }
@@ -461,12 +461,12 @@ function Ne(e, t, r) {
461
461
  function be(e, t, r, n) {
462
462
  const o = {}, s = { ...n || {} }, i = {};
463
463
  for (const [a, c] of Object.entries(e)) {
464
- const { value: f, modifiers: p } = c;
464
+ const { value: f, modifiers: h } = c;
465
465
  switch (a) {
466
466
  case "model":
467
467
  Le(
468
468
  typeof f == "string" ? f : String(f),
469
- p,
469
+ h,
470
470
  o,
471
471
  s,
472
472
  i,
@@ -504,8 +504,8 @@ function se(e, t) {
504
504
  for (; s.has(c); )
505
505
  c = `${a}#${f++}`;
506
506
  s.add(c);
507
- let p = i.children;
508
- return Array.isArray(p) && (p = se(p, c)), { ...i, key: c, children: p };
507
+ let h = i.children;
508
+ return Array.isArray(h) && (h = se(h, c)), { ...i, key: c, children: h };
509
509
  });
510
510
  }
511
511
  const r = e;
@@ -528,17 +528,17 @@ function Me(e, t, r, n) {
528
528
  ...s.attrs
529
529
  }, c = t.props ?? {}, f = i;
530
530
  for (const l in { ...c, ...f }) {
531
- const b = c[l], y = f[l];
532
- b !== y && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== y && (e.value = y ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!y : l.startsWith("on") && typeof y == "function" ? (typeof b == "function" && e.removeEventListener(l.slice(2).toLowerCase(), b), e.addEventListener(l.slice(2).toLowerCase(), y)) : y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
531
+ const x = c[l], m = f[l];
532
+ x !== m && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== m && (e.value = m ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!m : l.startsWith("on") && typeof m == "function" ? (typeof x == "function" && e.removeEventListener(l.slice(2).toLowerCase(), x), e.addEventListener(l.slice(2).toLowerCase(), m)) : m == null || m === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(m)));
533
533
  }
534
- for (const [l, b] of Object.entries(
534
+ for (const [l, x] of Object.entries(
535
535
  s.listeners || {}
536
536
  ))
537
- e.addEventListener(l, b);
538
- const p = t.attrs ?? {}, g = a;
539
- for (const l in { ...p, ...g }) {
540
- const b = p[l], y = g[l];
541
- b !== y && (y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
537
+ e.addEventListener(l, x);
538
+ const h = t.attrs ?? {}, g = a;
539
+ for (const l in { ...h, ...g }) {
540
+ const x = h[l], m = g[l];
541
+ x !== m && (m == null || m === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(m)));
542
542
  }
543
543
  }
544
544
  function L(e, t, r) {
@@ -551,15 +551,15 @@ function L(e, t, r) {
551
551
  return e.key != null && (g.key = e.key), g;
552
552
  }
553
553
  if (e.tag === "#anchor") {
554
- const g = e, l = Array.isArray(g.children) ? g.children : [], b = document.createTextNode(""), y = document.createTextNode("");
555
- g.key != null && (b.key = `${g.key}:start`, y.key = `${g.key}:end`), g._startNode = b, g._endNode = y;
556
- const m = document.createDocumentFragment();
557
- m.appendChild(b);
558
- for (const h of l) {
559
- const d = L(h, t);
560
- m.appendChild(d);
554
+ const g = e, l = Array.isArray(g.children) ? g.children : [], x = document.createTextNode(""), m = document.createTextNode("");
555
+ g.key != null && (x.key = `${g.key}:start`, m.key = `${g.key}:end`), g._startNode = x, g._endNode = m;
556
+ const v = document.createDocumentFragment();
557
+ v.appendChild(x);
558
+ for (const p of l) {
559
+ const u = L(p, t);
560
+ v.appendChild(u);
561
561
  }
562
- return m.appendChild(y), m;
562
+ return v.appendChild(m), v;
563
563
  }
564
564
  const n = document.createElement(e.tag);
565
565
  e.key != null && (n.key = e.key);
@@ -592,8 +592,8 @@ function L(e, t, r) {
592
592
  a.listeners || {}
593
593
  ))
594
594
  n.addEventListener(g, l);
595
- const p = e.props?.ref ?? (e.props?.props && e.props.props.ref);
596
- if (typeof e != "string" && p && r && (r[p] = n), Array.isArray(e.children))
595
+ const h = e.props?.ref ?? (e.props?.props && e.props.props.ref);
596
+ if (typeof e != "string" && h && r && (r[h] = n), Array.isArray(e.children))
597
597
  for (const g of e.children)
598
598
  n.appendChild(L(g, t, r));
599
599
  else typeof e.children == "string" && (n.textContent = e.children);
@@ -606,103 +606,103 @@ function Oe(e, t, r, n, o) {
606
606
  }
607
607
  if (!Array.isArray(r)) return;
608
608
  const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
609
- for (const b of i)
610
- b && b.key != null && a.set(b.key, b);
609
+ for (const x of i)
610
+ x && x.key != null && a.set(x.key, x);
611
611
  const c = /* @__PURE__ */ new Map();
612
- for (const b of s) {
613
- const y = b.key;
614
- y != null && c.set(y, b);
612
+ for (const x of s) {
613
+ const m = x.key;
614
+ m != null && c.set(m, x);
615
615
  }
616
616
  const f = /* @__PURE__ */ new Set();
617
- let p = e.firstChild;
618
- function g(b, y) {
619
- let m = b;
620
- for (; m && (f.add(m), m !== y); )
621
- m = m.nextSibling;
622
- }
623
- function l(b, y, m, h) {
624
- const d = [];
625
- let v = b.nextSibling;
626
- for (; v && v !== y; )
627
- d.push(v), v = v.nextSibling;
628
- const x = Array.isArray(m) ? m : [];
629
- if (h.some(($) => $ && $.key != null) || x.some(($) => $ && $.key != null)) {
617
+ let h = e.firstChild;
618
+ function g(x, m) {
619
+ let v = x;
620
+ for (; v && (f.add(v), v !== m); )
621
+ v = v.nextSibling;
622
+ }
623
+ function l(x, m, v, p) {
624
+ const u = [];
625
+ let y = x.nextSibling;
626
+ for (; y && y !== m; )
627
+ u.push(y), y = y.nextSibling;
628
+ const b = Array.isArray(v) ? v : [];
629
+ if (p.some(($) => $ && $.key != null) || b.some(($) => $ && $.key != null)) {
630
630
  const $ = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
631
- for (const C of x)
631
+ for (const C of b)
632
632
  C && C.key != null && $.set(C.key, C);
633
- for (const C of d) {
634
- const k = C.key;
635
- k != null && w.set(k, C);
633
+ for (const C of u) {
634
+ const S = C.key;
635
+ S != null && w.set(S, C);
636
636
  }
637
- const _ = /* @__PURE__ */ new Set();
638
- let S = b.nextSibling;
639
- for (const C of h) {
640
- let k;
637
+ const k = /* @__PURE__ */ new Set();
638
+ let _ = x.nextSibling;
639
+ for (const C of p) {
640
+ let S;
641
641
  if (C.key != null && w.has(C.key)) {
642
642
  const B = $.get(C.key);
643
- k = Q(
643
+ S = Q(
644
644
  w.get(C.key),
645
645
  B,
646
646
  C,
647
647
  n
648
- ), _.add(k), k !== S && e.contains(k) && e.insertBefore(k, S);
648
+ ), k.add(S), S !== _ && e.contains(S) && e.insertBefore(S, _);
649
649
  } else
650
- k = L(C, n), e.insertBefore(k, S), _.add(k);
651
- S = k.nextSibling;
650
+ S = L(C, n), e.insertBefore(S, _), k.add(S);
651
+ _ = S.nextSibling;
652
652
  }
653
- for (const C of d)
654
- !_.has(C) && e.contains(C) && e.removeChild(C);
653
+ for (const C of u)
654
+ !k.has(C) && e.contains(C) && e.removeChild(C);
655
655
  } else {
656
656
  const $ = Math.min(
657
- x.length,
658
- h.length
657
+ b.length,
658
+ p.length
659
659
  );
660
660
  for (let w = 0; w < $; w++) {
661
- const _ = x[w], S = h[w], C = Q(d[w], _, S, n);
662
- C !== d[w] && (e.insertBefore(C, d[w]), e.removeChild(d[w]));
661
+ const k = b[w], _ = p[w], C = Q(u[w], k, _, n);
662
+ C !== u[w] && (e.insertBefore(C, u[w]), e.removeChild(u[w]));
663
663
  }
664
- for (let w = $; w < h.length; w++)
665
- e.insertBefore(L(h[w], n), y);
666
- for (let w = $; w < d.length; w++)
667
- e.removeChild(d[w]);
664
+ for (let w = $; w < p.length; w++)
665
+ e.insertBefore(L(p[w], n), m);
666
+ for (let w = $; w < u.length; w++)
667
+ e.removeChild(u[w]);
668
668
  }
669
669
  }
670
- for (const b of r) {
671
- let y;
672
- if (b.tag === "#anchor") {
673
- const m = b.key, h = `${m}:start`, d = `${m}:end`;
674
- let v = c.get(h), x = c.get(d);
675
- const u = Array.isArray(b.children) ? b.children : [];
676
- if (v || (v = document.createTextNode(""), v.key = h), x || (x = document.createTextNode(""), x.key = d), b._startNode = v, b._endNode = x, !e.contains(v) || !e.contains(x)) {
677
- e.insertBefore(v, p);
678
- for (const $ of u)
679
- e.insertBefore(L($, n), p);
680
- e.insertBefore(x, p);
670
+ for (const x of r) {
671
+ let m;
672
+ if (x.tag === "#anchor") {
673
+ const v = x.key, p = `${v}:start`, u = `${v}:end`;
674
+ let y = c.get(p), b = c.get(u);
675
+ const d = Array.isArray(x.children) ? x.children : [];
676
+ if (y || (y = document.createTextNode(""), y.key = p), b || (b = document.createTextNode(""), b.key = u), x._startNode = y, x._endNode = b, !e.contains(y) || !e.contains(b)) {
677
+ e.insertBefore(y, h);
678
+ for (const $ of d)
679
+ e.insertBefore(L($, n), h);
680
+ e.insertBefore(b, h);
681
681
  } else
682
682
  l(
683
- v,
684
- x,
685
- a.get(m)?.children,
686
- u
683
+ y,
684
+ b,
685
+ a.get(v)?.children,
686
+ d
687
687
  );
688
- g(v, x), p = x.nextSibling;
688
+ g(y, b), h = b.nextSibling;
689
689
  continue;
690
690
  }
691
- if (b.key != null && c.has(b.key)) {
692
- const m = a.get(b.key);
693
- y = Q(
694
- c.get(b.key),
695
- m,
696
- b,
691
+ if (x.key != null && c.has(x.key)) {
692
+ const v = a.get(x.key);
693
+ m = Q(
694
+ c.get(x.key),
695
+ v,
696
+ x,
697
697
  n,
698
698
  o
699
- ), f.add(y), y !== p && e.contains(y) && (p && !e.contains(p) && (p = null), e.insertBefore(y, p));
699
+ ), f.add(m), m !== h && e.contains(m) && (h && !e.contains(h) && (h = null), e.insertBefore(m, h));
700
700
  } else
701
- y = L(b, n, o), p && !e.contains(p) && (p = null), e.insertBefore(y, p), f.add(y);
702
- p = y.nextSibling;
701
+ m = L(x, n, o), h && !e.contains(h) && (h = null), e.insertBefore(m, h), f.add(m);
702
+ h = m.nextSibling;
703
703
  }
704
- for (const b of s)
705
- !f.has(b) && e.contains(b) && (M(b, o), e.removeChild(b));
704
+ for (const x of s)
705
+ !f.has(x) && e.contains(x) && (M(x, o), e.removeChild(x));
706
706
  }
707
707
  function Q(e, t, r, n, o) {
708
708
  if (t && typeof t != "string" && t.props?.ref && o && M(e, o), t === r) return e;
@@ -717,13 +717,13 @@ function Q(e, t, r, n, o) {
717
717
  if (r && typeof r != "string" && r.tag === "#anchor") {
718
718
  const i = r, a = Array.isArray(i.children) ? i.children : [], c = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
719
719
  i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
720
- const p = document.createDocumentFragment();
721
- p.appendChild(c);
720
+ const h = document.createDocumentFragment();
721
+ h.appendChild(c);
722
722
  for (const g of a) {
723
723
  const l = L(g, n);
724
- p.appendChild(l);
724
+ h.appendChild(l);
725
725
  }
726
- return p.appendChild(f), e.parentNode?.replaceChild(p, e), c;
726
+ return h.appendChild(f), e.parentNode?.replaceChild(h, e), c;
727
727
  }
728
728
  if (!r) {
729
729
  M(e, o);
@@ -740,8 +740,8 @@ function Q(e, t, r, n, o) {
740
740
  r.key != null && (a.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = a, r._endNode = c;
741
741
  const f = document.createDocumentFragment();
742
742
  f.appendChild(a);
743
- for (const p of i)
744
- f.appendChild(L(p, n));
743
+ for (const h of i)
744
+ f.appendChild(L(h, n));
745
745
  return f.appendChild(c), e.parentNode?.replaceChild(f, e), a;
746
746
  }
747
747
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
@@ -765,8 +765,8 @@ function Pe(e, t, r, n) {
765
765
  s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = Q(i, s, o, r, n) : (a = L(o, r, n), e.replaceChild(a, i)) : (a = L(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
766
766
  const c = [];
767
767
  for (let f = 0; f < e.childNodes.length; f++) {
768
- const p = e.childNodes[f];
769
- p !== a && p.nodeName !== "STYLE" && (M(p, n), c.push(p));
768
+ const h = e.childNodes[f];
769
+ h !== a && h.nodeName !== "STYLE" && (M(h, n), c.push(h));
770
770
  }
771
771
  c.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
772
772
  }
@@ -1348,57 +1348,57 @@ function Ze(e) {
1348
1348
  const t = Date.now(), r = ge.get(e);
1349
1349
  if (r && t - r.timestamp < Qe) return r.css;
1350
1350
  const n = Je(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1351
- function p(y, m = !1) {
1352
- const h = (m ? "dark|" : "") + y;
1353
- if (h in f) return f[h];
1354
- const d = l(y, m);
1355
- return f[h] = d, d;
1356
- }
1357
- function g(y) {
1358
- const m = y.some((d) => ee.includes(d)), h = y.includes("dark");
1359
- return y.length === 0 ? 1 : !m && !h ? 2 : m && !h ? 3 : 4;
1360
- }
1361
- function l(y, m = !1) {
1362
- const h = y.split(":"), d = h.find(
1363
- (k) => G[k] || te(k) || re(k) || Z(k)
1351
+ function h(m, v = !1) {
1352
+ const p = (v ? "dark|" : "") + m;
1353
+ if (p in f) return f[p];
1354
+ const u = l(m, v);
1355
+ return f[p] = u, u;
1356
+ }
1357
+ function g(m) {
1358
+ const v = m.some((u) => ee.includes(u)), p = m.includes("dark");
1359
+ return m.length === 0 ? 1 : !v && !p ? 2 : v && !p ? 3 : 4;
1360
+ }
1361
+ function l(m, v = !1) {
1362
+ const p = m.split(":"), u = p.find(
1363
+ (S) => G[S] || te(S) || re(S) || Z(S)
1364
1364
  );
1365
- if (!d) return null;
1366
- const v = G[d] ?? te(d) ?? re(d) ?? Z(d);
1367
- if (!v) return null;
1368
- let x = `.${Ue(y)}`, u = v;
1369
- const $ = h.indexOf(d);
1370
- let w = $ >= 0 ? h.slice(0, $) : [];
1371
- m && (w = w.filter((k) => k !== "dark"));
1372
- const _ = w.filter((k) => ee.includes(k)), S = _.length ? _[_.length - 1] : null;
1373
- for (const k of w) {
1374
- const B = Ve(k);
1365
+ if (!u) return null;
1366
+ const y = G[u] ?? te(u) ?? re(u) ?? Z(u);
1367
+ if (!y) return null;
1368
+ let b = `.${Ue(m)}`, d = y;
1369
+ const $ = p.indexOf(u);
1370
+ let w = $ >= 0 ? p.slice(0, $) : [];
1371
+ v && (w = w.filter((S) => S !== "dark"));
1372
+ const k = w.filter((S) => ee.includes(S)), _ = k.length ? k[k.length - 1] : null;
1373
+ for (const S of w) {
1374
+ const B = Ve(S);
1375
1375
  if (B) {
1376
- x = `${B}${x}`;
1376
+ b = `${B}${b}`;
1377
1377
  continue;
1378
1378
  }
1379
- if (ee.includes(k)) continue;
1380
- const A = Ie[k];
1381
- typeof A == "function" && (x = A(x, u).replace(/\{.*$/, ""));
1379
+ if (ee.includes(S)) continue;
1380
+ const E = Ie[S];
1381
+ typeof E == "function" && (b = E(b, d).replace(/\{.*$/, ""));
1382
1382
  }
1383
- let C = `${x}{${u}}`;
1384
- return m && S ? C = `@media (prefers-color-scheme: dark) and ${pe[S]}{${C}}` : m ? C = `@media (prefers-color-scheme: dark){${C}}` : S && (C = `@media ${pe[S]}{${C}}`), C;
1383
+ let C = `${b}{${d}}`;
1384
+ return v && _ ? C = `@media (prefers-color-scheme: dark) and ${pe[_]}{${C}}` : v ? C = `@media (prefers-color-scheme: dark){${C}}` : _ && (C = `@media ${pe[_]}{${C}}`), C;
1385
1385
  }
1386
- for (const y of o) {
1387
- const m = y.split(":"), h = m.find(
1388
- (u) => G[u] || te(u) || re(u) || Z(u)
1386
+ for (const m of o) {
1387
+ const v = m.split(":"), p = v.find(
1388
+ (d) => G[d] || te(d) || re(d) || Z(d)
1389
1389
  );
1390
- if (!h) continue;
1391
- const d = m.indexOf(h), v = d >= 0 ? m.slice(0, d) : [], x = g(v);
1392
- if (x === 4) {
1393
- const u = p(y, !0);
1394
- u && c.push(u);
1390
+ if (!p) continue;
1391
+ const u = v.indexOf(p), y = u >= 0 ? v.slice(0, u) : [], b = g(y);
1392
+ if (b === 4) {
1393
+ const d = h(m, !0);
1394
+ d && c.push(d);
1395
1395
  } else {
1396
- const u = p(y);
1397
- u && (x === 1 ? s.push(u) : x === 2 ? i.push(u) : x === 3 && a.push(u));
1396
+ const d = h(m);
1397
+ d && (b === 1 ? s.push(d) : b === 2 ? i.push(d) : b === 3 && a.push(d));
1398
1398
  }
1399
1399
  }
1400
- const b = [...s, ...i, ...a, ...c].join("");
1401
- return ge.set(e, { css: b, timestamp: t }), b;
1400
+ const x = [...s, ...i, ...a, ...c].join("");
1401
+ return ge.set(e, { css: x, timestamp: t }), x;
1402
1402
  }
1403
1403
  const F = [];
1404
1404
  function Xe(e, t, r, n, o, s, i, a) {
@@ -1561,7 +1561,7 @@ function tt(e) {
1561
1561
  }
1562
1562
  connectedCallback() {
1563
1563
  this._runLogicWithinErrorBoundary(e, () => {
1564
- Ee(
1564
+ Ae(
1565
1565
  e,
1566
1566
  this.context,
1567
1567
  this._mounted,
@@ -1710,8 +1710,8 @@ function tt(e) {
1710
1710
  ].includes(a) ? function(...g) {
1711
1711
  const l = f.apply(i, g);
1712
1712
  if (!n._initializing) {
1713
- const b = s || "root";
1714
- n._triggerWatchers(b, i), n._render(t);
1713
+ const x = s || "root";
1714
+ n._triggerWatchers(x, i), n._render(t);
1715
1715
  }
1716
1716
  return l;
1717
1717
  } : f;
@@ -1754,7 +1754,7 @@ function tt(e) {
1754
1754
  }
1755
1755
  _initWatchers(t) {
1756
1756
  this._runLogicWithinErrorBoundary(t, () => {
1757
- Se(
1757
+ _e(
1758
1758
  this.context,
1759
1759
  this._watchers,
1760
1760
  t.watch || {}
@@ -1767,7 +1767,7 @@ function tt(e) {
1767
1767
  _applyProps(t) {
1768
1768
  this._runLogicWithinErrorBoundary(t, () => {
1769
1769
  try {
1770
- Ae(this, t, this.context);
1770
+ Ee(this, t, this.context);
1771
1771
  } catch (r) {
1772
1772
  this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
1773
1773
  }
@@ -1792,90 +1792,90 @@ function nt(e, t = [], r = {}) {
1792
1792
  const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1793
1793
  let a;
1794
1794
  for (; a = i.exec(e); ) {
1795
- const c = a[1], f = a[2], p = (a[4] || a[6]) ?? "", g = p.match(/^{{(\d+)}}$/);
1796
- let l = g ? t[Number(g[1])] ?? null : p;
1797
- if (g || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l))), c === ":")
1798
- typeof l == "boolean" ? o[f] = l : l != null && (typeof r[l] < "u" ? n[f] = r[l] : n[f] = l);
1799
- else if (c === "@") {
1800
- const b = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1801
- n[b] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1802
- } else if (c === "#") {
1803
- const [b, ...y] = f.split("."), m = [...y];
1804
- let h = l, d = [...m];
1805
- if (b === "model" && typeof h == "string" && h.includes(".")) {
1806
- const v = ["trim", "number", "lazy"], x = h.split(".");
1807
- let u = h;
1795
+ const c = a[1], f = a[2], h = (a[4] || a[6]) ?? "", g = h.match(/^{{(\d+)}}$/);
1796
+ let l = g ? t[Number(g[1])] ?? null : h;
1797
+ if (g || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l))), c === ":" && f === "class" || c === "#") {
1798
+ const [x, ...m] = f.split("."), v = [...m];
1799
+ let p = l, u = [...v];
1800
+ if (x === "model" && typeof p == "string" && p.includes(".")) {
1801
+ const y = ["trim", "number", "lazy"], b = p.split(".");
1802
+ let d = p;
1808
1803
  const $ = [];
1809
- for (let w = x.length - 1; w > 0 && v.includes(x[w]); w--)
1810
- $.unshift(x[w]), u = x.slice(0, w).join(".");
1811
- h = u, d.push(...$);
1804
+ for (let w = b.length - 1; w > 0 && y.includes(b[w]); w--)
1805
+ $.unshift(b[w]), d = b.slice(0, w).join(".");
1806
+ p = d, u.push(...$);
1812
1807
  }
1813
- s[b] = {
1814
- value: h,
1815
- modifiers: d
1808
+ s[x] = {
1809
+ value: p,
1810
+ modifiers: u
1816
1811
  };
1812
+ } else if (c === ":")
1813
+ typeof l == "boolean" ? o[f] = l : l != null && (typeof r[l] < "u" ? n[f] = r[l] : n[f] = l);
1814
+ else if (c === "@") {
1815
+ const x = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1816
+ n[x] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1817
1817
  } else f === "ref" ? n.ref = l : o[f] = l;
1818
1818
  }
1819
1819
  return { props: n, attrs: o, directives: s };
1820
1820
  }
1821
1821
  function ot(e, t, r) {
1822
1822
  const n = F.length > 0 ? F[F.length - 1] : void 0, o = r ?? n;
1823
- function s(u, $) {
1824
- return I("#text", {}, u, $);
1823
+ function s(d, $) {
1824
+ return I("#text", {}, d, $);
1825
1825
  }
1826
1826
  let i = "";
1827
- for (let u = 0; u < e.length; u++)
1828
- i += e[u], u < t.length && (i += `{{${u}}}`);
1827
+ for (let d = 0; d < e.length; d++)
1828
+ i += e[d], d < t.length && (i += `{{${d}}}`);
1829
1829
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
1830
- let f, p = [], g = null, l = {}, b, y = 0, m = [];
1831
- function h(u) {
1832
- !u || typeof u != "object" || X(u) || (u.props || u.attrs ? (u.props && (l.props || (l.props = {}), Object.assign(l.props, u.props)), u.attrs && (l.attrs || (l.attrs = {}), Object.keys(u.attrs).forEach(($) => {
1830
+ let f, h = [], g = null, l = {}, x, m = 0, v = [];
1831
+ function p(d) {
1832
+ !d || typeof d != "object" || X(d) || (d.props || d.attrs ? (d.props && (l.props || (l.props = {}), Object.assign(l.props, d.props)), d.attrs && (l.attrs || (l.attrs = {}), Object.keys(d.attrs).forEach(($) => {
1833
1833
  if ($ === "style" && l.attrs.style) {
1834
1834
  const w = l.attrs.style.replace(
1835
1835
  /;?\s*$/,
1836
1836
  ""
1837
- ), _ = u.attrs.style.replace(/^;?\s*/, "");
1838
- l.attrs.style = w + "; " + _;
1837
+ ), k = d.attrs.style.replace(/^;?\s*/, "");
1838
+ l.attrs.style = w + "; " + k;
1839
1839
  } else if ($ === "class" && l.attrs.class) {
1840
- const w = l.attrs.class.trim().split(/\s+/).filter(Boolean), _ = u.attrs.class.trim().split(/\s+/).filter(Boolean), S = [
1841
- .../* @__PURE__ */ new Set([...w, ..._])
1840
+ const w = l.attrs.class.trim().split(/\s+/).filter(Boolean), k = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1841
+ .../* @__PURE__ */ new Set([...w, ...k])
1842
1842
  ];
1843
- l.attrs.class = S.join(" ");
1843
+ l.attrs.class = _.join(" ");
1844
1844
  } else
1845
- l.attrs[$] = u.attrs[$];
1846
- }))) : (l.props || (l.props = {}), Object.assign(l.props, u)));
1847
- }
1848
- function d(u, $) {
1849
- const w = g ? p : m;
1850
- if (X(u)) {
1851
- const _ = u.key ?? $;
1852
- let S = u.children;
1845
+ l.attrs[$] = d.attrs[$];
1846
+ }))) : (l.props || (l.props = {}), Object.assign(l.props, d)));
1847
+ }
1848
+ function u(d, $) {
1849
+ const w = g ? h : v;
1850
+ if (X(d)) {
1851
+ const k = d.key ?? $;
1852
+ let _ = d.children;
1853
1853
  w.push({
1854
- ...u,
1855
- key: _,
1856
- children: S
1854
+ ...d,
1855
+ key: k,
1856
+ children: _
1857
1857
  });
1858
1858
  return;
1859
1859
  }
1860
- if (J(u)) {
1861
- w.push(rt(u, void 0));
1860
+ if (J(d)) {
1861
+ w.push(rt(d, void 0));
1862
1862
  return;
1863
1863
  }
1864
- if (Array.isArray(u)) {
1865
- if (u.length === 0) return;
1866
- for (let _ = 0; _ < u.length; _++) {
1867
- const S = u[_];
1868
- X(S) || J(S) || Array.isArray(S) ? d(S, `${$}-${_}`) : S !== null && typeof S == "object" ? h(S) : w.push(s(String(S), `${$}-${_}`));
1864
+ if (Array.isArray(d)) {
1865
+ if (d.length === 0) return;
1866
+ for (let k = 0; k < d.length; k++) {
1867
+ const _ = d[k];
1868
+ X(_) || J(_) || Array.isArray(_) ? u(_, `${$}-${k}`) : _ !== null && typeof _ == "object" ? p(_) : w.push(s(String(_), `${$}-${k}`));
1869
1869
  }
1870
1870
  return;
1871
1871
  }
1872
- if (u !== null && typeof u == "object") {
1873
- h(u);
1872
+ if (d !== null && typeof d == "object") {
1873
+ p(d);
1874
1874
  return;
1875
1875
  }
1876
- w.push(s(String(u), $));
1876
+ w.push(s(String(d), $));
1877
1877
  }
1878
- const v = /* @__PURE__ */ new Set([
1878
+ const y = /* @__PURE__ */ new Set([
1879
1879
  "area",
1880
1880
  "base",
1881
1881
  "br",
@@ -1893,54 +1893,54 @@ function ot(e, t, r) {
1893
1893
  ]);
1894
1894
  for (; f = a.exec(i); )
1895
1895
  if (f[1]) {
1896
- const u = f[1], $ = f[0][1] === "/", w = f[0][f[0].length - 2] === "/" || v.has(u), {
1897
- props: _,
1898
- attrs: S,
1896
+ const d = f[1], $ = f[0][1] === "/", w = f[0][f[0].length - 2] === "/" || y.has(d), {
1897
+ props: k,
1898
+ attrs: _,
1899
1899
  directives: C
1900
- } = nt(f[2] || "", t, o), k = { props: {}, attrs: {} };
1901
- for (const A in _) k.props[A] = _[A];
1902
- for (const A in S) k.attrs[A] = S[A];
1903
- for (const [A, T] of Object.entries(C)) {
1904
- if (A === "bind")
1900
+ } = nt(f[2] || "", t, o), S = { props: {}, attrs: {} };
1901
+ for (const E in k) S.props[E] = k[E];
1902
+ for (const E in _) S.attrs[E] = _[E];
1903
+ for (const [E, T] of Object.entries(C)) {
1904
+ if (E === "bind")
1905
1905
  if (typeof T.value == "object" && T.value !== null)
1906
- for (const [E, j] of Object.entries(T.value))
1907
- typeof j == "boolean" ? k.attrs[E] = j : j != null && (k.attrs[E] = String(j));
1908
- else T.value != null && (k.attrs[A] = String(T.value));
1909
- if (["show", "class", "style"].includes(A) && (k.directives || (k.directives = {}), k.directives[A] = T), A === "show") {
1910
- const E = !!T.value;
1911
- k.attrs.style = (k.attrs.style || "") + (E ? "" : "; display: none !important");
1912
- } else if (A === "class") {
1913
- const E = T.value;
1906
+ for (const [A, j] of Object.entries(T.value))
1907
+ typeof j == "boolean" ? S.attrs[A] = j : j != null && (S.attrs[A] = String(j));
1908
+ else T.value != null && (S.attrs[E] = String(T.value));
1909
+ if (["show", "class", "style"].includes(E) && (S.directives || (S.directives = {}), S.directives[E] = T), E === "show") {
1910
+ const A = !!T.value;
1911
+ S.attrs.style = (S.attrs.style || "") + (A ? "" : "; display: none !important");
1912
+ } else if (E === "class") {
1913
+ const A = T.value;
1914
1914
  let j = [];
1915
- if (typeof E == "string")
1916
- j = E.split(/\s+/).filter(Boolean);
1917
- else if (Array.isArray(E)) {
1918
- for (const z of E)
1919
- if (typeof z == "string")
1920
- j.push(...z.split(/\s+/).filter(Boolean));
1921
- else if (z && typeof z == "object")
1922
- for (const [R, V] of Object.entries(z))
1923
- V && j.push(...R.split(/\s+/).filter(Boolean));
1924
- } else if (E && typeof E == "object")
1925
- for (const [z, R] of Object.entries(E))
1926
- R && j.push(...z.split(/\s+/).filter(Boolean));
1927
- const H = k.attrs.class || "", q = [
1915
+ if (typeof A == "string")
1916
+ j = A.split(/\s+/).filter(Boolean);
1917
+ else if (Array.isArray(A)) {
1918
+ for (const R of A)
1919
+ if (typeof R == "string")
1920
+ j.push(...R.split(/\s+/).filter(Boolean));
1921
+ else if (R && typeof R == "object")
1922
+ for (const [N, V] of Object.entries(R))
1923
+ V && j.push(...N.split(/\s+/).filter(Boolean));
1924
+ } else if (A && typeof A == "object")
1925
+ for (const [R, N] of Object.entries(A))
1926
+ N && j.push(...R.split(/\s+/).filter(Boolean));
1927
+ const H = S.attrs.class || "", q = [
1928
1928
  .../* @__PURE__ */ new Set([
1929
1929
  ...H.split(/\s+/).filter(Boolean),
1930
1930
  ...j
1931
1931
  ])
1932
1932
  ];
1933
- k.attrs.class = q.join(" ");
1934
- } else if (A === "style") {
1935
- const E = T.value;
1933
+ S.attrs.class = q.join(" ");
1934
+ } else if (E === "style") {
1935
+ const A = T.value;
1936
1936
  let j = "";
1937
- if (typeof E == "string")
1938
- j = E;
1939
- else if (E && typeof E == "object") {
1937
+ if (typeof A == "string")
1938
+ j = A;
1939
+ else if (A && typeof A == "object") {
1940
1940
  const q = [];
1941
- for (const [z, R] of Object.entries(E))
1942
- if (R != null && R !== "") {
1943
- const V = z.replace(
1941
+ for (const [R, N] of Object.entries(A))
1942
+ if (N != null && N !== "") {
1943
+ const V = R.replace(
1944
1944
  /[A-Z]/g,
1945
1945
  (ke) => `-${ke.toLowerCase()}`
1946
1946
  ), we = [
@@ -1969,57 +1969,57 @@ function ot(e, t, r) {
1969
1969
  "min-height",
1970
1970
  "max-height"
1971
1971
  ];
1972
- let le = String(R);
1973
- typeof R == "number" && we.includes(V) && (le = `${R}px`), q.push(`${V}: ${le}`);
1972
+ let le = String(N);
1973
+ typeof N == "number" && we.includes(V) && (le = `${N}px`), q.push(`${V}: ${le}`);
1974
1974
  }
1975
1975
  j = q.join("; ") + (q.length > 0 ? ";" : "");
1976
1976
  }
1977
- const H = k.attrs.style || "";
1978
- k.attrs.style = H + (H && !H.endsWith(";") ? "; " : "") + j;
1977
+ const H = S.attrs.style || "";
1978
+ S.attrs.style = H + (H && !H.endsWith(";") ? "; " : "") + j;
1979
1979
  }
1980
1980
  }
1981
1981
  const B = {};
1982
- for (const [A, T] of Object.entries(C))
1983
- ["bind", "show", "class", "style"].includes(A) || (B[A] = T);
1984
- if (Object.keys(B).length > 0 && (k.directives = B), $) {
1985
- const A = I(
1982
+ for (const [E, T] of Object.entries(C))
1983
+ ["bind", "show", "class", "style"].includes(E) || (B[E] = T);
1984
+ if (Object.keys(B).length > 0 && (S.directives = B), $) {
1985
+ const E = I(
1986
1986
  g,
1987
1987
  l,
1988
- p.length === 1 && J(p[0]) && p[0].tag === "#text" ? typeof p[0].children == "string" ? p[0].children : "" : p.length ? p : void 0,
1989
- b
1988
+ h.length === 1 && J(h[0]) && h[0].tag === "#text" ? typeof h[0].children == "string" ? h[0].children : "" : h.length ? h : void 0,
1989
+ x
1990
1990
  ), T = c.pop();
1991
- T ? (g = T.tag, l = T.props, b = T.key, p = T.children, p.push(A)) : (m.push(A), g = null, l = {}, b = void 0, p = []);
1992
- } else w ? g ? p.push(I(u, k, void 0, void 0)) : m.push(I(u, k, void 0, void 0)) : (g && c.push({
1991
+ T ? (g = T.tag, l = T.props, x = T.key, h = T.children, h.push(E)) : (v.push(E), g = null, l = {}, x = void 0, h = []);
1992
+ } else w ? g ? h.push(I(d, S, void 0, void 0)) : v.push(I(d, S, void 0, void 0)) : (g && c.push({
1993
1993
  tag: g,
1994
1994
  props: l,
1995
- children: p,
1996
- key: b
1997
- }), g = u, l = k, p = []);
1995
+ children: h,
1996
+ key: x
1997
+ }), g = d, l = S, h = []);
1998
1998
  } else if (typeof f[3] < "u") {
1999
- const u = Number(f[3]), $ = t[u], w = `interp-${u}`;
2000
- d($, w);
1999
+ const d = Number(f[3]), $ = t[d], w = `interp-${d}`;
2000
+ u($, w);
2001
2001
  } else if (f[4]) {
2002
- const u = f[4], $ = g ? p : m, w = u.split(/({{\d+}})/);
2003
- for (const _ of w) {
2004
- if (!_) continue;
2005
- const S = _.match(/^{{(\d+)}}$/);
2006
- if (S) {
2007
- const C = Number(S[1]), k = t[C], B = `interp-${C}`;
2008
- d(k, B);
2002
+ const d = f[4], $ = g ? h : v, w = d.split(/({{\d+}})/);
2003
+ for (const k of w) {
2004
+ if (!k) continue;
2005
+ const _ = k.match(/^{{(\d+)}}$/);
2006
+ if (_) {
2007
+ const C = Number(_[1]), S = t[C], B = `interp-${C}`;
2008
+ u(S, B);
2009
2009
  } else {
2010
- const C = `text-${y++}`;
2011
- $.push(s(_, C));
2010
+ const C = `text-${m++}`;
2011
+ $.push(s(k, C));
2012
2012
  }
2013
2013
  }
2014
2014
  }
2015
- const x = m.filter((u) => J(u) && u.tag === "#text" ? typeof u.children == "string" && u.children.trim() !== "" : !0);
2016
- return x.length === 1 ? x[0] : x.length > 1 ? x : I("div", {}, "", "fallback-root");
2015
+ const b = v.filter((d) => J(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2016
+ return b.length === 1 ? b[0] : b.length > 1 ? b : I("div", {}, "", "fallback-root");
2017
2017
  }
2018
2018
  function W(e, ...t) {
2019
2019
  const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2020
2020
  return ot(e, t, n);
2021
2021
  }
2022
- const me = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, N = (e, t) => {
2022
+ const me = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, z = (e, t) => {
2023
2023
  for (const r of e) {
2024
2024
  const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
2025
2025
  if (i) {
@@ -2046,96 +2046,139 @@ async function it(e) {
2046
2046
  }
2047
2047
  function st(e) {
2048
2048
  const { routes: t, base: r = "", initialUrl: n } = e;
2049
- let o, s, i, a, c, f, p;
2050
- const g = async (m, h) => {
2051
- const d = t.find((v) => N([v], m.path).route !== null);
2052
- if (d?.beforeEnter)
2049
+ let o, s, i, a, c, f, h;
2050
+ const g = async (v, p) => {
2051
+ const u = t.find((y) => z([y], v.path).route !== null);
2052
+ if (u?.beforeEnter)
2053
2053
  try {
2054
- const v = await d.beforeEnter(m, h);
2055
- return typeof v == "string" ? (await y(v, !0), !1) : v !== !1;
2056
- } catch (v) {
2057
- return console.error("beforeEnter error", v), !1;
2054
+ const y = await u.beforeEnter(v, p);
2055
+ return typeof y == "string" ? (await m(y, !0), !1) : y !== !1;
2056
+ } catch (y) {
2057
+ return console.error("beforeEnter error", y), !1;
2058
2058
  }
2059
2059
  return !0;
2060
- }, l = async (m, h) => {
2061
- const d = t.find((v) => N([v], m.path).route !== null);
2062
- if (d?.onEnter)
2060
+ }, l = async (v, p) => {
2061
+ const u = t.find((y) => z([y], v.path).route !== null);
2062
+ if (u?.onEnter)
2063
2063
  try {
2064
- const v = await d.onEnter(m, h);
2065
- return typeof v == "string" ? (await y(v, !0), !1) : v !== !1;
2066
- } catch (v) {
2067
- return console.error("onEnter error", v), !1;
2064
+ const y = await u.onEnter(v, p);
2065
+ return typeof y == "string" ? (await m(y, !0), !1) : y !== !1;
2066
+ } catch (y) {
2067
+ return console.error("onEnter error", y), !1;
2068
2068
  }
2069
2069
  return !0;
2070
- }, b = (m, h) => {
2071
- const d = t.find((v) => N([v], m.path).route !== null);
2072
- if (d?.afterEnter)
2070
+ }, x = (v, p) => {
2071
+ const u = t.find((y) => z([y], v.path).route !== null);
2072
+ if (u?.afterEnter)
2073
2073
  try {
2074
- d.afterEnter(m, h);
2075
- } catch (v) {
2076
- console.error("afterEnter error", v);
2074
+ u.afterEnter(v, p);
2075
+ } catch (y) {
2076
+ console.error("afterEnter error", y);
2077
2077
  }
2078
- }, y = async (m, h = !1) => {
2078
+ }, m = async (v, p = !1) => {
2079
2079
  try {
2080
- const d = {
2081
- path: m.replace(r, "") || "/",
2080
+ const u = {
2081
+ path: v.replace(r, "") || "/",
2082
2082
  query: {}
2083
- }, v = N(t, d.path);
2084
- if (!v) throw new Error(`No route found for ${d.path}`);
2085
- const x = i.getState(), u = {
2086
- path: d.path,
2087
- params: v.params,
2088
- query: d.query
2083
+ }, y = z(t, u.path);
2084
+ if (!y) throw new Error(`No route found for ${u.path}`);
2085
+ const b = i.getState(), d = {
2086
+ path: u.path,
2087
+ params: y.params,
2088
+ query: u.query
2089
2089
  };
2090
- if (!await g(u, x) || !await l(u, x)) return;
2091
- typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + m) : window.history.pushState({}, "", r + m)), i.setState(u), b(u, x);
2092
- } catch (d) {
2093
- console.error("Navigation error:", d);
2090
+ if (!await g(d, b) || !await l(d, b)) return;
2091
+ typeof window < "u" && typeof document < "u" && (p ? window.history.replaceState({}, "", r + v) : window.history.pushState({}, "", r + v)), i.setState(d), x(d, b);
2092
+ } catch (u) {
2093
+ console.error("Navigation error:", u);
2094
2094
  }
2095
2095
  };
2096
2096
  if (typeof window < "u" && typeof document < "u") {
2097
2097
  o = () => {
2098
- const h = new URL(window.location.href), d = h.pathname.replace(r, "") || "/", v = me(h.search);
2099
- return { path: d, query: v };
2098
+ const p = new URL(window.location.href), u = p.pathname.replace(r, "") || "/", y = me(p.search);
2099
+ return { path: u, query: y };
2100
2100
  }, s = o();
2101
- const m = N(t, s.path);
2101
+ const v = z(t, s.path);
2102
2102
  i = ce({
2103
2103
  path: s.path,
2104
- params: m.params,
2104
+ params: v.params,
2105
2105
  query: s.query
2106
- }), a = async (h = !1) => {
2107
- const d = o();
2108
- await y(d.path, h);
2109
- }, window.addEventListener("popstate", () => a(!0)), c = (h) => y(h, !1), f = (h) => y(h, !0), p = () => window.history.back();
2106
+ }), a = async (p = !1) => {
2107
+ const u = o();
2108
+ await m(u.path, p);
2109
+ }, window.addEventListener("popstate", () => a(!0)), c = (p) => m(p, !1), f = (p) => m(p, !0), h = () => window.history.back();
2110
2110
  } else {
2111
2111
  o = () => {
2112
- const h = new URL(n || "/", "http://localhost"), d = h.pathname.replace(r, "") || "/", v = me(h.search);
2113
- return { path: d, query: v };
2112
+ const u = new URL(n || "/", "http://localhost"), y = u.pathname.replace(r, "") || "/", b = me(u.search);
2113
+ return { path: y, query: b };
2114
2114
  }, s = o();
2115
- const m = N(t, s.path);
2115
+ const v = z(t, s.path);
2116
2116
  i = ce({
2117
2117
  path: s.path,
2118
- params: m.params,
2118
+ params: v.params,
2119
2119
  query: s.query
2120
2120
  }), a = async () => {
2121
- }, c = async () => {
2122
- }, f = async () => {
2123
- }, p = () => {
2121
+ const u = o();
2122
+ await p(u.path);
2123
+ };
2124
+ const p = async (u) => {
2125
+ try {
2126
+ const y = {
2127
+ path: u.replace(r, "") || "/",
2128
+ query: {}
2129
+ }, b = z(t, y.path);
2130
+ if (!b) throw new Error(`No route found for ${y.path}`);
2131
+ const d = i.getState(), $ = {
2132
+ path: y.path,
2133
+ params: b.params,
2134
+ query: y.query
2135
+ }, w = t.find((k) => z([k], $.path).route !== null);
2136
+ if (w?.beforeEnter)
2137
+ try {
2138
+ const k = await w.beforeEnter($, d);
2139
+ if (typeof k == "string") {
2140
+ await p(k);
2141
+ return;
2142
+ }
2143
+ if (k === !1) return;
2144
+ } catch {
2145
+ return;
2146
+ }
2147
+ if (w?.onEnter)
2148
+ try {
2149
+ const k = await w.onEnter($, d);
2150
+ if (typeof k == "string") {
2151
+ await p(k);
2152
+ return;
2153
+ }
2154
+ if (k === !1) return;
2155
+ } catch {
2156
+ return;
2157
+ }
2158
+ if (i.setState($), w?.afterEnter)
2159
+ try {
2160
+ w.afterEnter($, d);
2161
+ } catch {
2162
+ }
2163
+ } catch {
2164
+ }
2165
+ };
2166
+ c = async (u) => p(u), f = async (u) => p(u), h = () => {
2124
2167
  };
2125
2168
  }
2126
2169
  return {
2127
2170
  store: i,
2128
2171
  push: c,
2129
2172
  replace: f,
2130
- back: p,
2173
+ back: h,
2131
2174
  subscribe: i.subscribe,
2132
- matchRoute: (m) => N(t, m),
2175
+ matchRoute: (v) => z(t, v),
2133
2176
  getCurrent: () => i.getState(),
2134
2177
  resolveRouteComponent: it
2135
2178
  };
2136
2179
  }
2137
2180
  function ht(e, t) {
2138
- return N(e, t);
2181
+ return z(e, t);
2139
2182
  }
2140
2183
  function gt(e) {
2141
2184
  const t = st(e);
@@ -2168,6 +2211,7 @@ function gt(e) {
2168
2211
  ariaCurrentValue: { type: String, default: "page" },
2169
2212
  disabled: { type: Boolean, default: !1 },
2170
2213
  external: { type: Boolean, default: !1 },
2214
+ class: { type: String, default: "" },
2171
2215
  style: { type: String, default: ve`
2172
2216
  [aria-disabled="true"] {
2173
2217
  pointer-events: none;
@@ -2177,37 +2221,36 @@ function gt(e) {
2177
2221
  },
2178
2222
  style: (r) => r.style,
2179
2223
  render: (r) => {
2180
- const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, p = r.disabled, g = r.external, l = n.path === o, b = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, y = l ? i : b ? a : "", m = l ? `aria-current="${c}"` : "", h = f === "button", d = p ? h ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", v = g && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2224
+ const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, h = r.disabled, g = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, m = l ? i : x ? a : "", v = l ? `aria-current="${c}"` : "", p = f === "button", u = h ? p ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", y = g && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2181
2225
  return W`
2182
- ${$e().when(h, W`
2226
+ ${$e().when(p, W`
2183
2227
  <button
2184
2228
  part="button"
2185
- class="${y}"
2186
- ${m}
2187
- ${d}
2229
+ :class="${r.class} ${m}"
2188
2230
  ${v}
2189
- data-on-click="navigate"
2231
+ ${u}
2232
+ ${y}
2233
+ @click="navigate"
2190
2234
  ><slot></slot></button>
2191
2235
  `).otherwise(W`
2192
2236
  <a
2193
2237
  part="link"
2194
2238
  href="${o}"
2195
- class="${y}"
2196
- ${m}
2197
- ${d}
2239
+ :class="${r.class} ${m}"
2198
2240
  ${v}
2199
- data-on-click="navigate"
2241
+ ${u}
2242
+ ${y}
2243
+ @click="navigate"
2200
2244
  ><slot></slot></a>
2201
2245
  `).done()}
2202
2246
  `;
2203
2247
  },
2204
2248
  navigate: (r, n) => {
2205
- const { disabled: o, external: s, tag: i, replace: a, to: c } = n.props;
2206
- if (o) {
2249
+ if (n.disabled) {
2207
2250
  r.preventDefault();
2208
2251
  return;
2209
2252
  }
2210
- s && (i === "a" || !i) || (r.preventDefault(), a ? t.replace(c) : t.push(c));
2253
+ n.external && (n.tag === "a" || !n.tag) || (r.preventDefault(), n.replace ? t.replace(n.to) : t.push(n.to));
2211
2254
  }
2212
2255
  }), t;
2213
2256
  }
@@ -2223,7 +2266,7 @@ export {
2223
2266
  gt as initRouter,
2224
2267
  pt as listen,
2225
2268
  $e as match,
2226
- N as matchRoute,
2269
+ z as matchRoute,
2227
2270
  ht as matchRouteSSR,
2228
2271
  ut as off,
2229
2272
  ft as on,