@jasonshimmy/custom-elements-runtime 0.1.15 → 0.1.17

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 Xe(e, t) {
2
- return F(e ? t : [], "when-block");
1
+ function ft(e, t) {
2
+ return Q(e ? t : [], "when-block");
3
3
  }
4
- function Ye(e, t) {
4
+ function ut(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 F(t(r, n), `each-${o}`);
7
+ return Q(t(r, n), `each-${o}`);
8
8
  });
9
9
  }
10
- function pe() {
10
+ function Ae() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function pe() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return he(...e);
20
+ return Te(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function he(...e) {
24
+ function Te(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, n] = e[t];
27
- if (r) return [F(n, `whenChain-branch-${t}`)];
27
+ if (r) return [Q(n, `whenChain-branch-${t}`)];
28
28
  }
29
- return [F([], "whenChain-empty")];
29
+ return [Q([], "whenChain-empty")];
30
30
  }
31
- function F(e, t) {
31
+ function Q(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 F(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class N extends EventTarget {
39
+ class D extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class N extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return N.instance || (N.instance = new N()), N.instance;
47
+ return D.instance || (D.instance = new D()), D.instance;
48
48
  }
49
49
  // Enhanced emit method with better typing and event storm protection
50
50
  /**
@@ -160,8 +160,8 @@ class N extends EventTarget {
160
160
  this.eventCounters.clear();
161
161
  }
162
162
  }
163
- const P = N.getInstance(), Ge = (e, t) => P.emit(e, t), et = (e, t) => P.on(e, t), tt = (e, t) => P.off(e, t), rt = (e, t) => P.once(e, t), nt = (e, t, r) => P.listen(e, t, r);
164
- function te(e) {
163
+ const I = D.getInstance(), dt = (e, t) => I.emit(e, t), pt = (e, t) => I.on(e, t), ht = (e, t) => I.off(e, t), gt = (e, t) => I.once(e, t), yt = (e, t, r) => I.listen(e, t, r);
164
+ function de(e) {
165
165
  let t = { ...e };
166
166
  const r = [];
167
167
  function n(a) {
@@ -179,10 +179,10 @@ function te(e) {
179
179
  }
180
180
  return { subscribe: n, getState: o, setState: s };
181
181
  }
182
- function ee(e) {
182
+ function ce(e) {
183
183
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
184
184
  }
185
- function X(e) {
185
+ function se(e) {
186
186
  return typeof e == "string" ? e.replace(
187
187
  /[&<>"']/g,
188
188
  (t) => ({
@@ -194,34 +194,34 @@ function X(e) {
194
194
  })[t]
195
195
  ) : e;
196
196
  }
197
- function ge(e, t, r) {
197
+ function Le(e, t, r) {
198
198
  if (r)
199
199
  for (const [n, o] of Object.entries(r)) {
200
200
  let s, i = {};
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: Y(e, n)
204
+ oldValue: ae(e, n)
205
205
  }), i.immediate)
206
206
  try {
207
- const a = Y(e, n);
207
+ const a = ae(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 Y(e, t) {
214
+ function ae(e, t) {
215
215
  return t.split(".").reduce((r, n) => r?.[n], e);
216
216
  }
217
- function ye(e, t, r, n) {
217
+ function je(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((h, p) => o(h, a[p]));
222
+ return i.length !== a.length ? !1 : i.every((y, p) => o(y, a[p]));
223
223
  const c = Object.keys(i), f = Object.keys(a);
224
- return c.length !== f.length ? !1 : c.every((h) => o(i[h], a[h]));
224
+ return c.length !== f.length ? !1 : c.every((y) => o(i[y], a[y]));
225
225
  }, s = t.get(r);
226
226
  if (s && !o(n, s.oldValue))
227
227
  try {
@@ -232,13 +232,13 @@ function ye(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 c = Y(e, i);
235
+ const c = ae(e, i);
236
236
  o(c, a.oldValue) || (a.callback(c, a.oldValue, e), a.oldValue = c);
237
237
  } catch (c) {
238
238
  console.error(`Error in deep watcher for "${i}":`, c);
239
239
  }
240
240
  }
241
- function me(e, t, r) {
241
+ function ze(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,43 +247,43 @@ 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(ee(o));
251
- i !== null ? r[o] = X(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = X(s.default));
250
+ const i = e.getAttribute(ce(o));
251
+ i !== null ? r[o] = se(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = se(s.default));
252
252
  }
253
253
  });
254
254
  }
255
- function be(e, t, r, n) {
255
+ function Be(e, t, r, n) {
256
256
  e.onConnected && !r && (e.onConnected(t), n(!0));
257
257
  }
258
- function ve(e, t, r, n, o, s, i, a) {
258
+ function Re(e, t, r, n, o, s, i, a) {
259
259
  e.onDisconnected && e.onDisconnected(t), r.forEach((c) => c()), n(), o(), s(!1), i(null), a(!1);
260
260
  }
261
- function xe(e, t, r, n, o) {
261
+ function Ne(e, t, r, n, o) {
262
262
  e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
263
263
  }
264
- function j(e, t) {
264
+ function N(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
- j(r, t);
269
+ N(r, t);
270
270
  }
271
271
  }
272
- function z(e, t) {
272
+ function P(e, t) {
273
273
  return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
- function re(e, t, r) {
275
+ function pe(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 we(e, t, r, n, o, s, i) {
281
+ function Pe(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"), h = () => {
283
+ const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), y = () => {
284
284
  const g = s._state || s;
285
- return z(g, e);
286
- }, p = h();
285
+ return P(g, e);
286
+ }, p = y();
287
287
  let l = "text";
288
288
  const x = n?.type;
289
289
  if (i instanceof HTMLInputElement ? l = x || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
@@ -301,9 +301,9 @@ function we(e, t, r, n, o, s, i) {
301
301
  if (i && i.hasAttribute("multiple")) {
302
302
  const g = i, u = Array.isArray(p) ? p : [];
303
303
  setTimeout(() => {
304
- Array.from(g.options).forEach((m) => {
305
- const v = u.includes(m.value);
306
- m.selected !== v && (m.selected = v);
304
+ Array.from(g.options).forEach((h) => {
305
+ const b = u.includes(h.value);
306
+ h.selected !== b && (h.selected = b);
307
307
  });
308
308
  }, 0);
309
309
  } else
@@ -314,69 +314,69 @@ function we(e, t, r, n, o, s, i) {
314
314
  const g = String(p ?? "");
315
315
  (!i || i.value !== g) && (r.value = p);
316
316
  }
317
- const y = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", b = (g) => {
317
+ const w = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", $ = (g) => {
318
318
  if (g.isComposing || o._isComposing || g.isTrusted === !1) return;
319
319
  const u = g.target;
320
320
  if (u._modelUpdating) return;
321
- const m = h();
322
- let v = u.value;
321
+ const h = y();
322
+ let b = u.value;
323
323
  if (l === "checkbox")
324
- if (Array.isArray(m)) {
325
- const w = u.getAttribute("value") || "", _ = [...m];
324
+ if (Array.isArray(h)) {
325
+ const k = u.getAttribute("value") || "", _ = [...h];
326
326
  if (u.checked)
327
- _.includes(w) || _.push(w);
327
+ _.includes(k) || _.push(k);
328
328
  else {
329
- const S = _.indexOf(w);
329
+ const S = _.indexOf(k);
330
330
  S > -1 && _.splice(S, 1);
331
331
  }
332
- v = _;
332
+ b = _;
333
333
  } else {
334
- const w = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
- v = u.checked ? w : _;
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
- v = u.getAttribute("value") || u.value;
338
+ b = u.getAttribute("value") || u.value;
339
339
  else if (l === "select" && u.multiple) {
340
- const w = u;
341
- v = Array.from(w.selectedOptions).map(
340
+ const k = u;
341
+ b = Array.from(k.selectedOptions).map(
342
342
  (_) => _.value
343
343
  );
344
- } else if (c && (v = v.trim()), f) {
345
- const w = Number(v);
346
- isNaN(w) || (v = w);
344
+ } else if (c && (b = b.trim()), f) {
345
+ const k = Number(b);
346
+ isNaN(k) || (b = k);
347
347
  }
348
- const d = s._state || s, $ = z(d, e);
349
- if (Array.isArray(v) && Array.isArray($) ? JSON.stringify([...v].sort()) !== JSON.stringify([...$].sort()) : v !== $) {
350
- const w = g.target;
351
- w._modelUpdating = !0, re(d, e, v), setTimeout(() => {
352
- w._modelUpdating = !1;
348
+ const d = s._state || s, v = P(d, e);
349
+ if (Array.isArray(b) && Array.isArray(v) ? JSON.stringify([...b].sort()) !== JSON.stringify([...v].sort()) : b !== v) {
350
+ const k = g.target;
351
+ k._modelUpdating = !0, pe(d, e, b), setTimeout(() => {
352
+ k._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (o[y] = b, l === "text" || l === "textarea") {
356
+ if (o[w] = $, l === "text" || l === "textarea") {
357
357
  const g = () => {
358
358
  o._isComposing = !0;
359
- }, u = (m) => {
359
+ }, u = (h) => {
360
360
  o._isComposing = !1;
361
- const v = m.target;
361
+ const b = h.target;
362
362
  setTimeout(() => {
363
- if (v) {
364
- let d = v.value;
363
+ if (b) {
364
+ let d = b.value;
365
365
  if (c && (d = d.trim()), f) {
366
366
  const _ = Number(d);
367
367
  isNaN(_) || (d = _);
368
368
  }
369
- const $ = s._state || s, k = z($, e);
370
- (Array.isArray(d) && Array.isArray(k) ? JSON.stringify([...d].sort()) !== JSON.stringify([...k].sort()) : d !== k) && (v && (v._modelUpdating = !0, setTimeout(() => {
371
- v._modelUpdating = !1;
372
- }, 0)), re($, e, d), s._requestRender && s._requestRender());
369
+ const v = s._state || s, m = P(v, e);
370
+ (Array.isArray(d) && Array.isArray(m) ? JSON.stringify([...d].sort()) !== JSON.stringify([...m].sort()) : d !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
+ b._modelUpdating = !1;
372
+ }, 0)), pe(v, e, d), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
376
  o.compositionstart = g, o.compositionend = u;
377
377
  }
378
378
  }
379
- function ke(e, t, r, n) {
379
+ function Me(e, t, r, n) {
380
380
  if (n) {
381
381
  if (typeof e == "object" && e !== null)
382
382
  for (const [o, s] of Object.entries(e))
@@ -390,14 +390,14 @@ function ke(e, t, r, n) {
390
390
  return;
391
391
  }
392
392
  } catch {
393
- const o = z(n, e);
393
+ const o = P(n, e);
394
394
  r[e] = o;
395
395
  }
396
396
  }
397
397
  }
398
- function $e(e, t, r) {
398
+ function Oe(e, t, r) {
399
399
  if (!r) return;
400
- const n = z(r, e), o = t.style || "", s = n ? "" : "none";
400
+ const n = P(r, e), o = t.style || "", s = n ? "" : "none";
401
401
  if (o) {
402
402
  const i = o.split(";").filter(Boolean), a = i.findIndex(
403
403
  (c) => c.trim().startsWith("display:")
@@ -406,19 +406,19 @@ function $e(e, t, r) {
406
406
  } else
407
407
  t.style = `display: ${s}`;
408
408
  }
409
- function _e(e, t, r) {
409
+ function We(e, t, r) {
410
410
  if (!r) return;
411
- const n = z(r, e);
411
+ const n = P(r, e);
412
412
  let o = [];
413
413
  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)));
414
414
  const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
415
415
  i && (t.class = i);
416
416
  }
417
- function Se(e, t, r) {
417
+ function De(e, t, r) {
418
418
  let n;
419
419
  if (typeof e == "string") {
420
420
  if (!r) return;
421
- n = z(r, e);
421
+ n = P(r, e);
422
422
  } else
423
423
  n = e;
424
424
  let o = "";
@@ -431,7 +431,7 @@ function Se(e, t, r) {
431
431
  const f = a.replace(
432
432
  /[A-Z]/g,
433
433
  (l) => `-${l.toLowerCase()}`
434
- ), h = [
434
+ ), y = [
435
435
  "width",
436
436
  "height",
437
437
  "top",
@@ -458,22 +458,22 @@ function Se(e, t, r) {
458
458
  "max-height"
459
459
  ];
460
460
  let p = String(c);
461
- typeof c == "number" && h.includes(f) && (p = `${c}px`), i.push(`${f}: ${p}`);
461
+ typeof c == "number" && y.includes(f) && (p = `${c}px`), i.push(`${f}: ${p}`);
462
462
  }
463
463
  o = i.join("; ") + (i.length > 0 ? ";" : "");
464
464
  }
465
465
  const s = t.style || "";
466
466
  t.style = s + (s && !s.endsWith(";") ? "; " : "") + o;
467
467
  }
468
- function fe(e, t, r, n) {
468
+ function we(e, t, r, n) {
469
469
  const o = {}, s = { ...n || {} }, i = {};
470
470
  for (const [a, c] of Object.entries(e)) {
471
- const { value: f, modifiers: h } = c;
471
+ const { value: f, modifiers: y } = c;
472
472
  switch (a) {
473
473
  case "model":
474
- we(
474
+ Pe(
475
475
  typeof f == "string" ? f : String(f),
476
- h,
476
+ y,
477
477
  o,
478
478
  s,
479
479
  i,
@@ -482,22 +482,22 @@ function fe(e, t, r, n) {
482
482
  );
483
483
  break;
484
484
  case "bind":
485
- ke(f, o, s, t);
485
+ Me(f, o, s, t);
486
486
  break;
487
487
  case "show":
488
- $e(f, s, t);
488
+ Oe(f, s, t);
489
489
  break;
490
490
  case "class":
491
- _e(f, s, t);
491
+ We(f, s, t);
492
492
  break;
493
493
  case "style":
494
- Se(f, s, t);
494
+ De(f, s, t);
495
495
  break;
496
496
  }
497
497
  }
498
498
  return { props: o, attrs: s, listeners: i };
499
499
  }
500
- function G(e, t) {
500
+ function le(e, t) {
501
501
  if (Array.isArray(e)) {
502
502
  const s = /* @__PURE__ */ new Set();
503
503
  return e.map((i) => {
@@ -511,16 +511,16 @@ function G(e, t) {
511
511
  for (; s.has(c); )
512
512
  c = `${a}#${f++}`;
513
513
  s.add(c);
514
- let h = i.children;
515
- return Array.isArray(h) && (h = G(h, c)), { ...i, key: c, children: h };
514
+ let y = i.children;
515
+ return Array.isArray(y) && (y = le(y, c)), { ...i, key: c, children: y };
516
516
  });
517
517
  }
518
518
  const r = e;
519
519
  let n = r.props?.key ?? r.key ?? t, o = r.children;
520
- return Array.isArray(o) && (o = G(o, n)), { ...r, key: n, children: o };
520
+ return Array.isArray(o) && (o = le(o, n)), { ...r, key: n, children: o };
521
521
  }
522
- function Ce(e, t, r, n) {
523
- const o = r.directives ?? {}, s = fe(
522
+ function He(e, t, r, n) {
523
+ const o = r.directives ?? {}, s = we(
524
524
  o,
525
525
  n,
526
526
  e,
@@ -535,20 +535,20 @@ function Ce(e, t, r, n) {
535
535
  ...s.attrs
536
536
  }, c = t.props ?? {}, f = i;
537
537
  for (const l in { ...c, ...f }) {
538
- const x = c[l], y = f[l];
539
- x !== 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 x == "function" && e.removeEventListener(l.slice(2).toLowerCase(), x), e.addEventListener(l.slice(2).toLowerCase(), y)) : y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
538
+ const x = c[l], w = f[l];
539
+ x !== w && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== w && (e.value = w ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!w : l.startsWith("on") && typeof w == "function" ? (typeof x == "function" && e.removeEventListener(l.slice(2).toLowerCase(), x), e.addEventListener(l.slice(2).toLowerCase(), w)) : w == null || w === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(w)));
540
540
  }
541
541
  for (const [l, x] of Object.entries(
542
542
  s.listeners || {}
543
543
  ))
544
544
  e.addEventListener(l, x);
545
- const h = t.attrs ?? {}, p = a;
546
- for (const l in { ...h, ...p }) {
547
- const x = h[l], y = p[l];
548
- x !== y && (y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
545
+ const y = t.attrs ?? {}, p = a;
546
+ for (const l in { ...y, ...p }) {
547
+ const x = y[l], w = p[l];
548
+ x !== w && (w == null || w === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(w)));
549
549
  }
550
550
  }
551
- function A(e, t, r) {
551
+ function j(e, t, r) {
552
552
  if (typeof e == "string")
553
553
  return document.createTextNode(e);
554
554
  if (e.tag === "#text") {
@@ -558,19 +558,19 @@ function A(e, t, r) {
558
558
  return e.key != null && (p.key = e.key), p;
559
559
  }
560
560
  if (e.tag === "#anchor") {
561
- const p = e, l = Array.isArray(p.children) ? p.children : [], x = document.createTextNode(""), y = document.createTextNode("");
562
- p.key != null && (x.key = `${p.key}:start`, y.key = `${p.key}:end`), p._startNode = x, p._endNode = y;
563
- const b = document.createDocumentFragment();
564
- b.appendChild(x);
561
+ const p = e, l = Array.isArray(p.children) ? p.children : [], x = document.createTextNode(""), w = document.createTextNode("");
562
+ p.key != null && (x.key = `${p.key}:start`, w.key = `${p.key}:end`), p._startNode = x, p._endNode = w;
563
+ const $ = document.createDocumentFragment();
564
+ $.appendChild(x);
565
565
  for (const g of l) {
566
- const u = A(g, t);
567
- b.appendChild(u);
566
+ const u = j(g, t);
567
+ $.appendChild(u);
568
568
  }
569
- return b.appendChild(y), b;
569
+ return $.appendChild(w), $;
570
570
  }
571
571
  const n = document.createElement(e.tag);
572
572
  e.key != null && (n.key = e.key);
573
- const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = fe(i, t, n, s), c = {
573
+ const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = we(i, t, n, s), c = {
574
574
  ...o,
575
575
  ...a.props
576
576
  }, f = {
@@ -607,14 +607,14 @@ function A(e, t, r) {
607
607
  a.listeners || {}
608
608
  ))
609
609
  n.addEventListener(p, l);
610
- const h = e.props?.ref ?? (e.props?.props && e.props.props.ref);
611
- if (typeof e != "string" && h && r && (r[h] = n), Array.isArray(e.children))
610
+ const y = e.props?.ref ?? (e.props?.props && e.props.props.ref);
611
+ if (typeof e != "string" && y && r && (r[y] = n), Array.isArray(e.children))
612
612
  for (const p of e.children)
613
- n.appendChild(A(p, t, r));
613
+ n.appendChild(j(p, t, r));
614
614
  else typeof e.children == "string" && (n.textContent = e.children);
615
615
  return n;
616
616
  }
617
- function Ee(e, t, r, n, o) {
617
+ function qe(e, t, r, n, o) {
618
618
  if (typeof r == "string") {
619
619
  e.textContent !== r && (e.textContent = r);
620
620
  return;
@@ -625,102 +625,102 @@ function Ee(e, t, r, n, o) {
625
625
  x && x.key != null && a.set(x.key, x);
626
626
  const c = /* @__PURE__ */ new Map();
627
627
  for (const x of s) {
628
- const y = x.key;
629
- y != null && c.set(y, x);
628
+ const w = x.key;
629
+ w != null && c.set(w, x);
630
630
  }
631
631
  const f = /* @__PURE__ */ new Set();
632
- let h = e.firstChild;
633
- function p(x, y) {
634
- let b = x;
635
- for (; b && (f.add(b), b !== y); )
636
- b = b.nextSibling;
632
+ let y = e.firstChild;
633
+ function p(x, w) {
634
+ let $ = x;
635
+ for (; $ && (f.add($), $ !== w); )
636
+ $ = $.nextSibling;
637
637
  }
638
- function l(x, y, b, g) {
638
+ function l(x, w, $, g) {
639
639
  const u = [];
640
- let m = x.nextSibling;
641
- for (; m && m !== y; )
642
- u.push(m), m = m.nextSibling;
643
- const v = Array.isArray(b) ? b : [];
644
- if (g.some(($) => $ && $.key != null) || v.some(($) => $ && $.key != null)) {
645
- const $ = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
646
- for (const S of v)
647
- S && S.key != null && $.set(S.key, S);
640
+ let h = x.nextSibling;
641
+ for (; h && h !== w; )
642
+ u.push(h), h = h.nextSibling;
643
+ const b = Array.isArray($) ? $ : [];
644
+ if (g.some((v) => v && v.key != null) || b.some((v) => v && v.key != null)) {
645
+ const v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
646
+ for (const S of b)
647
+ S && S.key != null && v.set(S.key, S);
648
648
  for (const S of u) {
649
- const C = S.key;
650
- C != null && k.set(C, S);
649
+ const E = S.key;
650
+ E != null && m.set(E, S);
651
651
  }
652
- const w = /* @__PURE__ */ new Set();
652
+ const k = /* @__PURE__ */ new Set();
653
653
  let _ = x.nextSibling;
654
654
  for (const S of g) {
655
- let C;
656
- if (S.key != null && k.has(S.key)) {
657
- const E = $.get(S.key);
658
- C = H(
659
- k.get(S.key),
660
- E,
655
+ let E;
656
+ if (S.key != null && m.has(S.key)) {
657
+ const A = v.get(S.key);
658
+ E = V(
659
+ m.get(S.key),
660
+ A,
661
661
  S,
662
662
  n
663
- ), w.add(C), C !== _ && e.contains(C) && e.insertBefore(C, _);
663
+ ), k.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
664
664
  } else
665
- C = A(S, n), e.insertBefore(C, _), w.add(C);
666
- _ = C.nextSibling;
665
+ E = j(S, n), e.insertBefore(E, _), k.add(E);
666
+ _ = E.nextSibling;
667
667
  }
668
668
  for (const S of u)
669
- !w.has(S) && e.contains(S) && e.removeChild(S);
669
+ !k.has(S) && e.contains(S) && e.removeChild(S);
670
670
  } else {
671
- const $ = Math.min(
672
- v.length,
671
+ const v = Math.min(
672
+ b.length,
673
673
  g.length
674
674
  );
675
- for (let k = 0; k < $; k++) {
676
- const w = v[k], _ = g[k], S = H(u[k], w, _, n);
677
- S !== u[k] && (e.insertBefore(S, u[k]), e.removeChild(u[k]));
675
+ for (let m = 0; m < v; m++) {
676
+ const k = b[m], _ = g[m], S = V(u[m], k, _, n);
677
+ S !== u[m] && (e.insertBefore(S, u[m]), e.removeChild(u[m]));
678
678
  }
679
- for (let k = $; k < g.length; k++)
680
- e.insertBefore(A(g[k], n), y);
681
- for (let k = $; k < u.length; k++)
682
- e.removeChild(u[k]);
679
+ for (let m = v; m < g.length; m++)
680
+ e.insertBefore(j(g[m], n), w);
681
+ for (let m = v; m < u.length; m++)
682
+ e.removeChild(u[m]);
683
683
  }
684
684
  }
685
685
  for (const x of r) {
686
- let y;
686
+ let w;
687
687
  if (x.tag === "#anchor") {
688
- const b = x.key, g = `${b}:start`, u = `${b}:end`;
689
- let m = c.get(g), v = c.get(u);
688
+ const $ = x.key, g = `${$}:start`, u = `${$}:end`;
689
+ let h = c.get(g), b = c.get(u);
690
690
  const d = Array.isArray(x.children) ? x.children : [];
691
- if (m || (m = document.createTextNode(""), m.key = g), v || (v = document.createTextNode(""), v.key = u), x._startNode = m, x._endNode = v, !e.contains(m) || !e.contains(v)) {
692
- e.insertBefore(m, h);
693
- for (const $ of d)
694
- e.insertBefore(A($, n), h);
695
- e.insertBefore(v, h);
691
+ if (h || (h = document.createTextNode(""), h.key = g), b || (b = document.createTextNode(""), b.key = u), x._startNode = h, x._endNode = b, !e.contains(h) || !e.contains(b)) {
692
+ e.insertBefore(h, y);
693
+ for (const v of d)
694
+ e.insertBefore(j(v, n), y);
695
+ e.insertBefore(b, y);
696
696
  } else
697
697
  l(
698
- m,
699
- v,
700
- a.get(b)?.children,
698
+ h,
699
+ b,
700
+ a.get($)?.children,
701
701
  d
702
702
  );
703
- p(m, v), h = v.nextSibling;
703
+ p(h, b), y = b.nextSibling;
704
704
  continue;
705
705
  }
706
706
  if (x.key != null && c.has(x.key)) {
707
- const b = a.get(x.key);
708
- y = H(
707
+ const $ = a.get(x.key);
708
+ w = V(
709
709
  c.get(x.key),
710
- b,
710
+ $,
711
711
  x,
712
712
  n,
713
713
  o
714
- ), f.add(y), y !== h && e.contains(y) && (h && !e.contains(h) && (h = null), e.insertBefore(y, h));
714
+ ), f.add(w), w !== y && e.contains(w) && (y && !e.contains(y) && (y = null), e.insertBefore(w, y));
715
715
  } else
716
- y = A(x, n, o), h && !e.contains(h) && (h = null), e.insertBefore(y, h), f.add(y);
717
- h = y.nextSibling;
716
+ w = j(x, n, o), y && !e.contains(y) && (y = null), e.insertBefore(w, y), f.add(w);
717
+ y = w.nextSibling;
718
718
  }
719
719
  for (const x of s)
720
- !f.has(x) && e.contains(x) && (j(x, o), e.removeChild(x));
720
+ !f.has(x) && e.contains(x) && (N(x, o), e.removeChild(x));
721
721
  }
722
- function H(e, t, r, n, o) {
723
- if (t && typeof t != "string" && t.props?.ref && o && j(e, o), t === r) return e;
722
+ function V(e, t, r, n, o) {
723
+ if (t && typeof t != "string" && t.props?.ref && o && N(e, o), t === r) return e;
724
724
  if (typeof r == "string") {
725
725
  if (e.nodeType === Node.TEXT_NODE)
726
726
  return e.textContent !== r && (e.textContent = r), e;
@@ -732,22 +732,22 @@ function H(e, t, r, n, o) {
732
732
  if (r && typeof r != "string" && r.tag === "#anchor") {
733
733
  const i = r, a = Array.isArray(i.children) ? i.children : [], c = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
734
734
  i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
735
- const h = document.createDocumentFragment();
736
- h.appendChild(c);
735
+ const y = document.createDocumentFragment();
736
+ y.appendChild(c);
737
737
  for (const p of a) {
738
- const l = A(p, n);
739
- h.appendChild(l);
738
+ const l = j(p, n);
739
+ y.appendChild(l);
740
740
  }
741
- return h.appendChild(f), e.parentNode?.replaceChild(h, e), c;
741
+ return y.appendChild(f), e.parentNode?.replaceChild(y, e), c;
742
742
  }
743
743
  if (!r) {
744
- j(e, o);
744
+ N(e, o);
745
745
  const i = document.createComment("removed");
746
746
  return e.parentNode?.replaceChild(i, e), i;
747
747
  }
748
748
  if (!t || typeof t == "string") {
749
- j(e, o);
750
- const i = A(r, n, o);
749
+ N(e, o);
750
+ const i = j(r, n, o);
751
751
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
752
752
  }
753
753
  if (r.tag === "#anchor") {
@@ -755,53 +755,53 @@ function H(e, t, r, n, o) {
755
755
  r.key != null && (a.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = a, r._endNode = c;
756
756
  const f = document.createDocumentFragment();
757
757
  f.appendChild(a);
758
- for (const h of i)
759
- f.appendChild(A(h, n));
758
+ for (const y of i)
759
+ f.appendChild(j(y, n));
760
760
  return f.appendChild(c), e.parentNode?.replaceChild(f, e), a;
761
761
  }
762
762
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
763
763
  const i = e;
764
- return Ce(i, t.props || {}, r.props || {}, n), Ee(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
764
+ return He(i, t.props || {}, r.props || {}, n), qe(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
765
765
  }
766
- j(e, o);
767
- const s = A(r, n, o);
766
+ N(e, o);
767
+ const s = j(r, n, o);
768
768
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
769
769
  }
770
- function Ae(e, t, r, n) {
770
+ function Ie(e, t, r, n) {
771
771
  let o;
772
772
  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 = {
773
773
  tag: "div",
774
774
  key: "__anchor_root__",
775
775
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
776
776
  children: [o]
777
- }), o = G(o, String(o.key ?? "root"));
777
+ }), o = le(o, String(o.key ?? "root"));
778
778
  const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
779
779
  let a;
780
- s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = H(i, s, o, r, n) : (a = A(o, r, n), e.replaceChild(a, i)) : (a = A(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
780
+ s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = V(i, s, o, r, n) : (a = j(o, r, n), e.replaceChild(a, i)) : (a = j(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
781
781
  const c = [];
782
782
  for (let f = 0; f < e.childNodes.length; f++) {
783
- const h = e.childNodes[f];
784
- h !== a && h.nodeName !== "STYLE" && (j(h, n), c.push(h));
783
+ const y = e.childNodes[f];
784
+ y !== a && y.nodeName !== "STYLE" && (N(y, n), c.push(y));
785
785
  }
786
786
  c.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
787
787
  }
788
- function ue(e, ...t) {
788
+ function ke(e, ...t) {
789
789
  let r = "";
790
790
  for (let n = 0; n < e.length; n++)
791
791
  r += e[n], n < t.length && (r += t[n]);
792
792
  return r;
793
793
  }
794
- function de(e) {
794
+ function $e(e) {
795
795
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
796
796
  }
797
- let W = null;
798
- function ne() {
799
- return W || (W = new CSSStyleSheet(), W.replaceSync(de(Le))), W;
797
+ let U = null;
798
+ function he() {
799
+ return U || (U = new CSSStyleSheet(), U.replaceSync($e(Ue))), U;
800
800
  }
801
- function Te(e) {
801
+ function Fe(e) {
802
802
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
803
803
  }
804
- const Le = ue`
804
+ const Ue = ke`
805
805
  :host, *, ::before, ::after {
806
806
  all: isolate;
807
807
  box-sizing: border-box;
@@ -859,7 +859,7 @@ const Le = ue`
859
859
  sup { top: -.5em }
860
860
  [disabled], [aria-disabled=true] { cursor: not-allowed }
861
861
  [hidden] { display: none }
862
- `, je = {
862
+ `, Ke = {
863
863
  gray: {
864
864
  50: "var(--color-gray-50, #f9fafb)",
865
865
  100: "var(--color-gray-100, #f3f4f6)",
@@ -994,7 +994,7 @@ const Le = ue`
994
994
  },
995
995
  white: { DEFAULT: "var(--color-white, #ffffff)" },
996
996
  black: { DEFAULT: "var(--color-black, #000000)" }
997
- }, K = {
997
+ }, Y = {
998
998
  /* Display */
999
999
  block: "display:block;",
1000
1000
  inline: "display:inline;",
@@ -1175,7 +1175,7 @@ const Le = ue`
1175
1175
  "z-30": "z-index:30;",
1176
1176
  "z-40": "z-index:40;",
1177
1177
  "z-50": "z-index:50;"
1178
- }, ze = "0.25rem", oe = {
1178
+ }, Ve = "0.25rem", ge = {
1179
1179
  m: ["margin"],
1180
1180
  mx: ["margin-inline"],
1181
1181
  my: ["margin-block"],
@@ -1206,33 +1206,44 @@ const Le = ue`
1206
1206
  gap: ["gap"],
1207
1207
  "gap-x": ["column-gap"],
1208
1208
  "gap-y": ["row-gap"]
1209
- }, Re = {
1210
- // State variants
1209
+ };
1210
+ function L(e, t) {
1211
+ let r = 0, n = 0;
1212
+ for (let o = 0; o < e.length; o++) {
1213
+ const s = e[o];
1214
+ if (s === "[") r++;
1215
+ else if (s === "]" && r > 0) r--;
1216
+ else if (s === "(") n++;
1217
+ else if (s === ")" && n > 0) n--;
1218
+ else if (r === 0 && n === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1219
+ return e.slice(0, o) + t + e.slice(o);
1220
+ }
1221
+ return e + t;
1222
+ }
1223
+ const G = {
1211
1224
  before: (e, t) => `${e}::before{${t}}`,
1212
1225
  after: (e, t) => `${e}::after{${t}}`,
1213
- hover: (e, t) => `${e}:hover{${t}}`,
1214
- focus: (e, t) => `${e}:focus{${t}}`,
1215
- active: (e, t) => `${e}:active{${t}}`,
1216
- disabled: (e, t) => `${e}:disabled{${t}}`,
1217
- visited: (e, t) => `${e}:visited{${t}}`,
1218
- checked: (e, t) => `${e}:checked{${t}}`,
1219
- first: (e, t) => `${e}:first-child{${t}}`,
1220
- last: (e, t) => `${e}:last-child{${t}}`,
1221
- odd: (e, t) => `${e}:nth-child(odd){${t}}`,
1222
- even: (e, t) => `${e}:nth-child(even){${t}}`,
1223
- "focus-within": (e, t) => `${e}:focus-within{${t}}`,
1224
- "focus-visible": (e, t) => `${e}:focus-visible{${t}}`,
1225
- // Group variants
1226
+ hover: (e, t) => `${L(e, ":hover")}{${t}}`,
1227
+ focus: (e, t) => `${L(e, ":focus")}{${t}}`,
1228
+ active: (e, t) => `${L(e, ":active")}{${t}}`,
1229
+ disabled: (e, t) => `${L(e, ":disabled")}{${t}}`,
1230
+ visited: (e, t) => `${L(e, ":visited")}{${t}}`,
1231
+ checked: (e, t) => `${L(e, ":checked")}{${t}}`,
1232
+ first: (e, t) => `${L(e, ":first-child")}{${t}}`,
1233
+ last: (e, t) => `${L(e, ":last-child")}{${t}}`,
1234
+ odd: (e, t) => `${L(e, ":nth-child(odd)")}{${t}}`,
1235
+ even: (e, t) => `${L(e, ":nth-child(even)")}{${t}}`,
1236
+ "focus-within": (e, t) => `${L(e, ":focus-within")}{${t}}`,
1237
+ "focus-visible": (e, t) => `${L(e, ":focus-visible")}{${t}}`,
1226
1238
  "group-hover": (e, t) => `.group:hover ${e}{${t}}`,
1227
1239
  "group-focus": (e, t) => `.group:focus ${e}{${t}}`,
1228
1240
  "group-active": (e, t) => `.group:active ${e}{${t}}`,
1229
1241
  "group-disabled": (e, t) => `.group:disabled ${e}{${t}}`,
1230
- // Peer variants
1231
1242
  "peer-hover": (e, t) => `.peer:hover ~ ${e}{${t}}`,
1232
1243
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1233
1244
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1234
1245
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1235
- }, ie = {
1246
+ }, ee = {
1236
1247
  // Responsive
1237
1248
  sm: "(min-width:640px)",
1238
1249
  md: "(min-width:768px)",
@@ -1241,23 +1252,23 @@ const Le = ue`
1241
1252
  "2xl": "(min-width:1536px)",
1242
1253
  // Dark mode (now plain string)
1243
1254
  dark: "(prefers-color-scheme: dark)"
1244
- }, U = ["sm", "md", "lg", "xl", "2xl"];
1245
- function V(e) {
1255
+ }, te = ["sm", "md", "lg", "xl", "2xl"];
1256
+ function re(e) {
1246
1257
  const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1247
1258
  if (n.length < 2) return null;
1248
1259
  const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
1249
- if (Number.isNaN(i) || !oe[o]) return null;
1260
+ if (Number.isNaN(i) || !ge[o]) return null;
1250
1261
  const a = t ? "-" : "";
1251
- return oe[o].map((c) => `${c}:calc(${a}${ze} * ${i});`).join("");
1262
+ return ge[o].map((c) => `${c}:calc(${a}${Ve} * ${i});`).join("");
1252
1263
  }
1253
- function se(e) {
1264
+ function ye(e) {
1254
1265
  const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
1255
1266
  return `${n} ${o} ${s}`;
1256
1267
  }
1257
- function Be(e) {
1268
+ function Je(e) {
1258
1269
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1259
1270
  if (!t) return null;
1260
- const [, r, n, o = "DEFAULT"] = t, s = je[n]?.[o];
1271
+ const [, r, n, o = "DEFAULT"] = t, s = Ke[n]?.[o];
1261
1272
  return s ? `${{
1262
1273
  bg: "background-color",
1263
1274
  decoration: "text-decoration-color",
@@ -1272,41 +1283,41 @@ function Be(e) {
1272
1283
  stroke: "stroke-color"
1273
1284
  }[r]}:${s};` : null;
1274
1285
  }
1275
- function Ne(e) {
1286
+ function Ze(e) {
1276
1287
  const [t, r] = e.split("/");
1277
1288
  if (!r) return { base: t };
1278
1289
  const n = parseInt(r, 10);
1279
1290
  return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1280
1291
  }
1281
- function J(e) {
1282
- const { base: t, opacity: r } = Ne(e), n = Be(t);
1292
+ function ne(e) {
1293
+ const { base: t, opacity: r } = Ze(e), n = Je(t);
1283
1294
  if (n) {
1284
1295
  if (r !== void 0) {
1285
1296
  const s = /#([0-9a-f]{6})/i.exec(n);
1286
1297
  if (s) {
1287
- const i = se(s[0]);
1298
+ const i = ye(s[0]);
1288
1299
  return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1289
1300
  }
1290
1301
  }
1291
1302
  return n;
1292
1303
  }
1293
- const o = q(t);
1304
+ const o = J(t);
1294
1305
  if (o && r !== void 0) {
1295
1306
  const s = /#([0-9a-f]{6})/i.exec(o);
1296
1307
  if (s) {
1297
- const i = se(s[0]);
1308
+ const i = ye(s[0]);
1298
1309
  return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1299
1310
  }
1300
1311
  }
1301
1312
  return o;
1302
1313
  }
1303
- function Q(e) {
1314
+ function oe(e) {
1304
1315
  const t = /^opacity-(\d{1,3})$/.exec(e);
1305
1316
  if (!t) return null;
1306
1317
  const r = parseInt(t[1], 10);
1307
1318
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1308
1319
  }
1309
- function q(e) {
1320
+ function J(e) {
1310
1321
  const t = e.indexOf("-["), r = e.endsWith("]");
1311
1322
  if (t > 0 && r) {
1312
1323
  const n = e.slice(0, t);
@@ -1356,13 +1367,22 @@ function q(e) {
1356
1367
  }
1357
1368
  return null;
1358
1369
  }
1359
- function Me(e) {
1360
- return e.startsWith("[") && e.endsWith("]") ? e : e.indexOf("-[") > 0 && e.endsWith("]") ? e.replace(/_/g, "-") : null;
1370
+ function me(e) {
1371
+ if (e.startsWith("[") && e.endsWith("]")) {
1372
+ const r = e.slice(1, -1);
1373
+ return r.includes("&") ? r : e;
1374
+ }
1375
+ const t = e.indexOf("-[");
1376
+ if (t > 0 && e.endsWith("]")) {
1377
+ const r = e.slice(t + 2, -1).replace(/_/g, "-");
1378
+ return r.includes("&") ? r : e.replace(/_/g, "-");
1379
+ }
1380
+ return null;
1361
1381
  }
1362
- function Oe(e) {
1382
+ function Qe(e) {
1363
1383
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1364
1384
  }
1365
- function Pe(e) {
1385
+ function Xe(e) {
1366
1386
  const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
1367
1387
  let n;
1368
1388
  for (; n = t.exec(e); ) {
@@ -1371,100 +1391,158 @@ function Pe(e) {
1371
1391
  }
1372
1392
  return r.filter(Boolean);
1373
1393
  }
1374
- const ae = /* @__PURE__ */ new Map(), We = 16;
1375
- function De(e) {
1376
- const t = Date.now(), r = ae.get(e);
1377
- if (r && t - r.timestamp < We) return r.css;
1378
- const n = Pe(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1379
- function h(y, b = !1) {
1380
- const g = (b ? "dark|" : "") + y;
1381
- if (g in f) return f[g];
1382
- const u = l(y, b);
1383
- return f[g] = u, u;
1384
- }
1385
- function p(y) {
1386
- const b = y.some((u) => U.includes(u)), g = y.includes("dark");
1387
- return y.length === 0 ? 1 : !b && !g ? 2 : b && !g ? 3 : 4;
1388
- }
1389
- function l(y, b = !1) {
1390
- const g = y.split(":"), u = g.find(
1391
- (C) => K[C] || V(C) || Q(C) || J(C) || q(C)
1392
- );
1393
- if (!u) return null;
1394
- const m = K[u] ?? V(u) ?? Q(u) ?? J(u) ?? q(u);
1394
+ const be = /* @__PURE__ */ new Map(), Ye = 16;
1395
+ function Ge(e) {
1396
+ const t = Date.now(), r = be.get(e);
1397
+ if (r && t - r.timestamp < Ye) return r.css;
1398
+ const n = Xe(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1399
+ function y(g, u = !1) {
1400
+ const h = (u ? "dark|" : "") + g;
1401
+ if (h in f) return f[h];
1402
+ const b = w(g, u);
1403
+ return f[h] = b, b;
1404
+ }
1405
+ function p(g) {
1406
+ const u = g.some((b) => te.includes(b)), h = g.includes("dark");
1407
+ return g.length === 0 ? 1 : !u && !h ? 2 : u && !h ? 3 : 4;
1408
+ }
1409
+ function l(g) {
1410
+ const u = [];
1411
+ let h = "", b = 0, d = 0;
1412
+ for (let v = 0; v < g.length; v++) {
1413
+ const m = g[v];
1414
+ m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? d++ : m === ")" && d > 0 && d--, m === ":" && b === 0 && d === 0 ? (u.push(h), h = "") : h += m;
1415
+ }
1416
+ return h && u.push(h), u;
1417
+ }
1418
+ function x(g) {
1419
+ switch (g) {
1420
+ case "hover":
1421
+ return ":hover";
1422
+ case "focus":
1423
+ return ":focus";
1424
+ case "active":
1425
+ return ":active";
1426
+ case "visited":
1427
+ return ":visited";
1428
+ case "disabled":
1429
+ return ":disabled";
1430
+ case "checked":
1431
+ return ":checked";
1432
+ case "first":
1433
+ return ":first-child";
1434
+ case "last":
1435
+ return ":last-child";
1436
+ case "odd":
1437
+ return ":nth-child(odd)";
1438
+ case "even":
1439
+ return ":nth-child(even)";
1440
+ case "focus-within":
1441
+ return ":focus-within";
1442
+ case "focus-visible":
1443
+ return ":focus-visible";
1444
+ default:
1445
+ return null;
1446
+ }
1447
+ }
1448
+ function w(g, u = !1) {
1449
+ const h = l(g);
1450
+ let b = !1, d = h.find((C) => (C.startsWith("!") && (b = !0, C = C.slice(1)), Y[C] || re(C) || oe(C) || ne(C) || J(C)));
1451
+ if (!d) return null;
1452
+ const v = d.replace(/^!/, ""), m = Y[v] ?? re(v) ?? oe(v) ?? ne(v) ?? J(v);
1395
1453
  if (!m) return null;
1396
- let v = `.${Oe(y)}`, d = m;
1397
- const $ = g.indexOf(u);
1398
- let k = $ >= 0 ? g.slice(0, $) : [];
1399
- b && (k = k.filter((C) => C !== "dark"));
1400
- const w = k.filter((C) => U.includes(C)), _ = w.length ? w[w.length - 1] : null;
1401
- for (const C of k) {
1402
- const E = Me(C);
1403
- if (E) {
1404
- v = `${E}${v}`;
1405
- continue;
1454
+ const k = h.indexOf(d);
1455
+ let _ = k >= 0 ? h.slice(0, k) : [];
1456
+ u && (_ = _.filter((C) => C !== "dark"));
1457
+ const S = _.find((C) => me(C)), E = `.${Qe(g)}`, A = "__TW_SUBJECT__";
1458
+ let T, F = b ? m.replace(/;$/, " !important;") : m;
1459
+ if (S) {
1460
+ const C = me(S);
1461
+ C ? C.includes("&") ? T = C.replace(/&/g, A) : T = `${C}${A}` : T = A;
1462
+ } else
1463
+ T = A;
1464
+ const _e = _.filter((C) => C.startsWith("peer-")), Se = _.filter((C) => C.startsWith("group-")), Ce = _.filter(
1465
+ (C) => !C.startsWith("group-") && !C.startsWith("peer-") && !te.includes(C) && C !== "dark" && C !== S
1466
+ );
1467
+ for (const C of _e) {
1468
+ const R = G[C];
1469
+ typeof R == "function" && (T = R(T, F).replace(/\{.*$/, ""));
1470
+ }
1471
+ for (const C of Se) {
1472
+ const R = G[C];
1473
+ typeof R == "function" && (T = R(T, F).replace(/\{.*$/, ""));
1474
+ }
1475
+ for (const C of Ce) {
1476
+ const R = x(C);
1477
+ if (R)
1478
+ T = T.replace(A, A + R);
1479
+ else {
1480
+ const ue = G[C];
1481
+ if (typeof ue == "function") {
1482
+ const Ee = ue(A, F).replace(/\{.*$/, "");
1483
+ T = T.replace(A, Ee);
1484
+ }
1406
1485
  }
1407
- if (U.includes(C)) continue;
1408
- const L = Re[C];
1409
- typeof L == "function" && (v = L(v, d).replace(/\{.*$/, ""));
1410
1486
  }
1411
- let S = `${v}{${d}}`;
1412
- return b && _ ? S = `@media (prefers-color-scheme: dark) and ${ie[_]}{${S}}` : b ? S = `@media (prefers-color-scheme: dark){${S}}` : _ && (S = `@media ${ie[_]}{${S}}`), S;
1413
- }
1414
- for (const y of o) {
1415
- const b = y.split(":"), g = b.find(
1416
- (d) => K[d] || V(d) || Q(d) || J(d) || q(d)
1487
+ T = T.replace(new RegExp(A, "g"), E);
1488
+ let z = `${T}{${F}}`;
1489
+ const X = _.filter((C) => te.includes(C)), M = X.length ? X[X.length - 1] : null, fe = _.includes("dark");
1490
+ return u && M ? z = `@media (prefers-color-scheme: dark) and ${ee[M]}{${z}}` : u ? z = `@media (prefers-color-scheme: dark){${z}}` : fe && M ? z = `@media (prefers-color-scheme: dark) and ${ee[M]}{${z}}` : fe ? z = `@media (prefers-color-scheme: dark){${z}}` : M && (z = `@media ${ee[M]}{${z}}`), z;
1491
+ }
1492
+ for (const g of o) {
1493
+ const u = l(g), h = u.find(
1494
+ (m) => Y[m] || re(m) || oe(m) || ne(m) || J(m)
1417
1495
  );
1418
- if (!g) continue;
1419
- const u = b.indexOf(g), m = u >= 0 ? b.slice(0, u) : [], v = p(m);
1496
+ if (!h) continue;
1497
+ const b = u.indexOf(h), d = b >= 0 ? u.slice(0, b) : [], v = p(d);
1420
1498
  if (v === 4) {
1421
- const d = h(y, !0);
1422
- d && c.push(d);
1499
+ const m = y(g, !0);
1500
+ m && c.push(m);
1423
1501
  } else {
1424
- const d = h(y);
1425
- d && (v === 1 ? s.push(d) : v === 2 ? i.push(d) : v === 3 && a.push(d));
1502
+ const m = y(g);
1503
+ m && (v === 1 ? s.push(m) : v === 2 ? i.push(m) : v === 3 && a.push(m));
1426
1504
  }
1427
1505
  }
1428
- const x = [...s, ...i, ...a, ...c].join("");
1429
- return ae.set(e, { css: x, timestamp: t }), x;
1506
+ const $ = [...s, ...i, ...a, ...c].join("");
1507
+ return be.set(e, { css: $, timestamp: t }), $;
1430
1508
  }
1431
- const O = [];
1432
- function He(e, t, r, n, o, s, i, a) {
1509
+ const q = [];
1510
+ function et(e, t, r, n, o, s, i, a) {
1433
1511
  if (e) {
1434
- O.push(r);
1512
+ q.push(r);
1435
1513
  try {
1436
1514
  if (t.loadingTemplate && r.isLoading) {
1437
- R(e, t.loadingTemplate(r), r, n, o);
1515
+ O(e, t.loadingTemplate(r), r, n, o);
1438
1516
  return;
1439
1517
  }
1440
1518
  if (t.errorTemplate && r.hasError) {
1441
- r.error instanceof Error && R(e, t.errorTemplate(r.error, r), r, n, o);
1519
+ r.error instanceof Error && O(e, t.errorTemplate(r.error, r), r, n, o);
1442
1520
  return;
1443
1521
  }
1444
1522
  const c = t.render(r);
1445
1523
  if (c instanceof Promise) {
1446
1524
  s(!0), c.then((f) => {
1447
- s(!1), i(null), R(e, f, r, n, o), a(e.innerHTML);
1525
+ s(!1), i(null), O(e, f, r, n, o), a(e.innerHTML);
1448
1526
  }).catch((f) => {
1449
- s(!1), i(f), t.errorTemplate && R(e, t.errorTemplate(f, r), r, n, o);
1450
- }), t.loadingTemplate && R(e, t.loadingTemplate(r), r, n, o);
1527
+ s(!1), i(f), t.errorTemplate && O(e, t.errorTemplate(f, r), r, n, o);
1528
+ }), t.loadingTemplate && O(e, t.loadingTemplate(r), r, n, o);
1451
1529
  return;
1452
1530
  }
1453
- R(e, c, r, n, o), a(e.innerHTML);
1531
+ O(e, c, r, n, o), a(e.innerHTML);
1454
1532
  } finally {
1455
- O.pop();
1533
+ q.pop();
1456
1534
  }
1457
1535
  }
1458
1536
  }
1459
- function R(e, t, r, n, o) {
1460
- e && (Ae(
1537
+ function O(e, t, r, n, o) {
1538
+ e && (Ie(
1461
1539
  e,
1462
1540
  Array.isArray(t) ? t : [t],
1463
1541
  r,
1464
1542
  n
1465
1543
  ), o(e.innerHTML));
1466
1544
  }
1467
- function qe(e, t, r, n, o, s, i) {
1545
+ function tt(e, t, r, n, o, s, i) {
1468
1546
  if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1469
1547
  if (o(r + 1), r > 10) {
1470
1548
  console.warn("Potential infinite render loop detected. Skipping render."), i(null);
@@ -1477,32 +1555,32 @@ function qe(e, t, r, n, o, s, i) {
1477
1555
  }, 0);
1478
1556
  i(c);
1479
1557
  }
1480
- function Ie(e, t, r, n, o, s) {
1558
+ function rt(e, t, r, n, o, s) {
1481
1559
  if (!e) return;
1482
- const i = De(n);
1560
+ const i = Ge(n);
1483
1561
  if (!t.style && (!i || i.trim() === "")) {
1484
- s(null), e.adoptedStyleSheets = [ne()];
1562
+ s(null), e.adoptedStyleSheets = [he()];
1485
1563
  return;
1486
1564
  }
1487
1565
  let a = "";
1488
1566
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1489
- let c = Te(`${a}
1567
+ let c = Fe(`${a}
1490
1568
  ${i}
1491
1569
  `);
1492
- c = de(c);
1570
+ c = $e(c);
1493
1571
  let f = o;
1494
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [ne(), f], s(f);
1572
+ f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [he(), f], s(f);
1495
1573
  }
1496
- const Fe = /* @__PURE__ */ new Map();
1497
- function le(e, t, r) {
1498
- let n = ee(e);
1574
+ const nt = /* @__PURE__ */ new Map();
1575
+ function ve(e, t, r) {
1576
+ let n = ce(e);
1499
1577
  n.includes("-") || (n = `cer-${n}`);
1500
1578
  let o;
1501
1579
  typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
1502
1580
  console.error(`[${n}] Error:`, s, i);
1503
- }), Fe.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, Ke(o));
1581
+ }), nt.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, ot(o));
1504
1582
  }
1505
- function Ke(e) {
1583
+ function ot(e) {
1506
1584
  if (!e.render)
1507
1585
  throw new Error(
1508
1586
  "Component must have a render function"
@@ -1589,7 +1667,7 @@ function Ke(e) {
1589
1667
  }
1590
1668
  connectedCallback() {
1591
1669
  this._runLogicWithinErrorBoundary(e, () => {
1592
- be(
1670
+ Be(
1593
1671
  e,
1594
1672
  this.context,
1595
1673
  this._mounted,
@@ -1601,7 +1679,7 @@ function Ke(e) {
1601
1679
  }
1602
1680
  disconnectedCallback() {
1603
1681
  this._runLogicWithinErrorBoundary(e, () => {
1604
- ve(
1682
+ Re(
1605
1683
  e,
1606
1684
  this.context,
1607
1685
  this._listeners,
@@ -1625,7 +1703,7 @@ function Ke(e) {
1625
1703
  }
1626
1704
  attributeChangedCallback(t, r, n) {
1627
1705
  this._runLogicWithinErrorBoundary(e, () => {
1628
- this._applyProps(e), xe(
1706
+ this._applyProps(e), Ne(
1629
1707
  e,
1630
1708
  t,
1631
1709
  r,
@@ -1635,7 +1713,7 @@ function Ke(e) {
1635
1713
  });
1636
1714
  }
1637
1715
  static get observedAttributes() {
1638
- return e.props ? Object.keys(e.props).map(ee) : [];
1716
+ return e.props ? Object.keys(e.props).map(ce) : [];
1639
1717
  }
1640
1718
  _applyComputed(t) {
1641
1719
  this._runLogicWithinErrorBoundary(e, () => {
@@ -1643,7 +1721,7 @@ function Ke(e) {
1643
1721
  Object.defineProperty(this.context, r, {
1644
1722
  get: () => {
1645
1723
  const o = n(this.context);
1646
- return X(o);
1724
+ return se(o);
1647
1725
  },
1648
1726
  enumerable: !0
1649
1727
  });
@@ -1653,7 +1731,7 @@ function Ke(e) {
1653
1731
  // --- Render ---
1654
1732
  _render(t) {
1655
1733
  this._runLogicWithinErrorBoundary(t, () => {
1656
- He(
1734
+ et(
1657
1735
  this.shadowRoot,
1658
1736
  t,
1659
1737
  this.context,
@@ -1676,7 +1754,7 @@ function Ke(e) {
1676
1754
  }
1677
1755
  _requestRender() {
1678
1756
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1679
- qe(
1757
+ tt(
1680
1758
  () => this._render(this._cfg),
1681
1759
  this._lastRenderTime,
1682
1760
  this._renderCount,
@@ -1696,7 +1774,7 @@ function Ke(e) {
1696
1774
  // --- Style ---
1697
1775
  _applyStyle(t, r) {
1698
1776
  this._runLogicWithinErrorBoundary(t, () => {
1699
- Ie(
1777
+ rt(
1700
1778
  this.shadowRoot,
1701
1779
  t,
1702
1780
  this.context,
@@ -1782,7 +1860,7 @@ function Ke(e) {
1782
1860
  }
1783
1861
  _initWatchers(t) {
1784
1862
  this._runLogicWithinErrorBoundary(t, () => {
1785
- ge(
1863
+ Le(
1786
1864
  this.context,
1787
1865
  this._watchers,
1788
1866
  t.watch || {}
@@ -1790,12 +1868,12 @@ function Ke(e) {
1790
1868
  });
1791
1869
  }
1792
1870
  _triggerWatchers(t, r) {
1793
- ye(this.context, this._watchers, t, r);
1871
+ je(this.context, this._watchers, t, r);
1794
1872
  }
1795
1873
  _applyProps(t) {
1796
1874
  this._runLogicWithinErrorBoundary(t, () => {
1797
1875
  try {
1798
- me(this, t, this.context);
1876
+ ze(this, t, this.context);
1799
1877
  } catch (r) {
1800
1878
  this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
1801
1879
  }
@@ -1803,92 +1881,92 @@ function Ke(e) {
1803
1881
  }
1804
1882
  };
1805
1883
  }
1806
- function M(e, t = {}, r, n) {
1884
+ function H(e, t = {}, r, n) {
1807
1885
  const o = n ?? t.key;
1808
1886
  return { tag: e, key: o, props: t, children: r };
1809
1887
  }
1810
- function I(e) {
1888
+ function Z(e) {
1811
1889
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
1812
1890
  }
1813
- function D(e) {
1814
- return typeof e == "object" && e !== null && "tag" in e && !I(e);
1891
+ function K(e) {
1892
+ return typeof e == "object" && e !== null && "tag" in e && !Z(e);
1815
1893
  }
1816
- function Ue(e, t) {
1894
+ function it(e, t) {
1817
1895
  return e.key != null ? e : { ...e, key: t };
1818
1896
  }
1819
- function Ve(e, t = [], r = {}) {
1897
+ function st(e, t = [], r = {}) {
1820
1898
  const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1821
1899
  let a;
1822
1900
  for (; a = i.exec(e); ) {
1823
- const c = a[1], f = a[2], h = (a[4] || a[6]) ?? "", p = h.match(/^{{(\d+)}}$/);
1824
- let l = p ? t[Number(p[1])] ?? null : h;
1901
+ const c = a[1], f = a[2], y = (a[4] || a[6]) ?? "", p = y.match(/^{{(\d+)}}$/);
1902
+ let l = p ? t[Number(p[1])] ?? null : y;
1825
1903
  p || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1826
1904
  const x = ["model", "bind", "show", "class", "style"];
1827
1905
  if (c === ":") {
1828
- const [y, ...b] = f.split(".");
1829
- if (x.includes(y)) {
1830
- const g = [...b];
1831
- s[y] = {
1906
+ const [w, ...$] = f.split(".");
1907
+ if (x.includes(w)) {
1908
+ const g = [...$];
1909
+ s[w] = {
1832
1910
  value: l,
1833
1911
  modifiers: g
1834
1912
  };
1835
1913
  } else
1836
1914
  o[f] = l;
1837
1915
  } else if (c === "@") {
1838
- const y = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1839
- n[y] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1916
+ const w = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1917
+ n[w] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1840
1918
  } else f === "ref" ? n.ref = l : o[f] = l;
1841
1919
  }
1842
1920
  return { props: n, attrs: o, directives: s };
1843
1921
  }
1844
- function Je(e, t, r) {
1845
- const n = O.length > 0 ? O[O.length - 1] : void 0, o = r ?? n;
1846
- function s(d, $) {
1847
- return M("#text", {}, d, $);
1922
+ function at(e, t, r) {
1923
+ const n = q.length > 0 ? q[q.length - 1] : void 0, o = r ?? n;
1924
+ function s(d, v) {
1925
+ return H("#text", {}, d, v);
1848
1926
  }
1849
1927
  let i = "";
1850
1928
  for (let d = 0; d < e.length; d++)
1851
1929
  i += e[d], d < t.length && (i += `{{${d}}}`);
1852
1930
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
1853
- let f, h = [], p = null, l = {}, x, y = 0, b = [];
1931
+ let f, y = [], p = null, l = {}, x, w = 0, $ = [];
1854
1932
  function g(d) {
1855
- !d || typeof d != "object" || I(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(($) => {
1856
- if ($ === "style" && l.attrs.style) {
1857
- const k = l.attrs.style.replace(
1933
+ !d || typeof d != "object" || Z(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((v) => {
1934
+ if (v === "style" && l.attrs.style) {
1935
+ const m = l.attrs.style.replace(
1858
1936
  /;?\s*$/,
1859
1937
  ""
1860
- ), w = d.attrs.style.replace(/^;?\s*/, "");
1861
- l.attrs.style = k + "; " + w;
1862
- } else if ($ === "class" && l.attrs.class) {
1863
- const k = l.attrs.class.trim().split(/\s+/).filter(Boolean), w = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1864
- .../* @__PURE__ */ new Set([...k, ...w])
1938
+ ), k = d.attrs.style.replace(/^;?\s*/, "");
1939
+ l.attrs.style = m + "; " + k;
1940
+ } else if (v === "class" && l.attrs.class) {
1941
+ const m = l.attrs.class.trim().split(/\s+/).filter(Boolean), k = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1942
+ .../* @__PURE__ */ new Set([...m, ...k])
1865
1943
  ];
1866
1944
  l.attrs.class = _.join(" ");
1867
1945
  } else
1868
- l.attrs[$] = d.attrs[$];
1946
+ l.attrs[v] = d.attrs[v];
1869
1947
  }))) : (l.props || (l.props = {}), Object.assign(l.props, d)));
1870
1948
  }
1871
- function u(d, $) {
1872
- const k = p ? h : b;
1873
- if (I(d)) {
1874
- const w = d.key ?? $;
1949
+ function u(d, v) {
1950
+ const m = p ? y : $;
1951
+ if (Z(d)) {
1952
+ const k = d.key ?? v;
1875
1953
  let _ = d.children;
1876
- k.push({
1954
+ m.push({
1877
1955
  ...d,
1878
- key: w,
1956
+ key: k,
1879
1957
  children: _
1880
1958
  });
1881
1959
  return;
1882
1960
  }
1883
- if (D(d)) {
1884
- k.push(Ue(d, void 0));
1961
+ if (K(d)) {
1962
+ m.push(it(d, void 0));
1885
1963
  return;
1886
1964
  }
1887
1965
  if (Array.isArray(d)) {
1888
1966
  if (d.length === 0) return;
1889
- for (let w = 0; w < d.length; w++) {
1890
- const _ = d[w];
1891
- I(_) || D(_) || Array.isArray(_) ? u(_, `${$}-${w}`) : _ !== null && typeof _ == "object" ? g(_) : k.push(s(String(_), `${$}-${w}`));
1967
+ for (let k = 0; k < d.length; k++) {
1968
+ const _ = d[k];
1969
+ Z(_) || K(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ? g(_) : m.push(s(String(_), `${v}-${k}`));
1892
1970
  }
1893
1971
  return;
1894
1972
  }
@@ -1896,9 +1974,9 @@ function Je(e, t, r) {
1896
1974
  g(d);
1897
1975
  return;
1898
1976
  }
1899
- k.push(s(String(d), $));
1977
+ m.push(s(String(d), v));
1900
1978
  }
1901
- const m = /* @__PURE__ */ new Set([
1979
+ const h = /* @__PURE__ */ new Set([
1902
1980
  "area",
1903
1981
  "base",
1904
1982
  "br",
@@ -1916,52 +1994,52 @@ function Je(e, t, r) {
1916
1994
  ]);
1917
1995
  for (; f = a.exec(i); )
1918
1996
  if (f[1]) {
1919
- const d = f[1], $ = f[0][1] === "/", k = f[0][f[0].length - 2] === "/" || m.has(d), {
1920
- props: w,
1997
+ const d = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || h.has(d), {
1998
+ props: k,
1921
1999
  attrs: _,
1922
2000
  directives: S
1923
- } = Ve(f[2] || "", t, o), C = { props: {}, attrs: {} };
1924
- for (const E in w) C.props[E] = w[E];
1925
- for (const E in _) C.attrs[E] = _[E];
1926
- if (Object.keys(S).length > 0 && (C.directives = { ...S }), $) {
1927
- const E = M(
2001
+ } = st(f[2] || "", t, o), E = { props: {}, attrs: {} };
2002
+ for (const A in k) E.props[A] = k[A];
2003
+ for (const A in _) E.attrs[A] = _[A];
2004
+ if (Object.keys(S).length > 0 && (E.directives = { ...S }), v) {
2005
+ const A = H(
1928
2006
  p,
1929
2007
  l,
1930
- h.length === 1 && D(h[0]) && h[0].tag === "#text" ? typeof h[0].children == "string" ? h[0].children : "" : h.length ? h : void 0,
2008
+ y.length === 1 && K(y[0]) && y[0].tag === "#text" ? typeof y[0].children == "string" ? y[0].children : "" : y.length ? y : void 0,
1931
2009
  x
1932
- ), L = c.pop();
1933
- L ? (p = L.tag, l = L.props, x = L.key, h = L.children, h.push(E)) : (b.push(E), p = null, l = {}, x = void 0, h = []);
1934
- } else k ? p ? h.push(M(d, C, void 0, void 0)) : b.push(M(d, C, void 0, void 0)) : (p && c.push({
2010
+ ), T = c.pop();
2011
+ T ? (p = T.tag, l = T.props, x = T.key, y = T.children, y.push(A)) : ($.push(A), p = null, l = {}, x = void 0, y = []);
2012
+ } else m ? p ? y.push(H(d, E, void 0, void 0)) : $.push(H(d, E, void 0, void 0)) : (p && c.push({
1935
2013
  tag: p,
1936
2014
  props: l,
1937
- children: h,
2015
+ children: y,
1938
2016
  key: x
1939
- }), p = d, l = C, h = []);
2017
+ }), p = d, l = E, y = []);
1940
2018
  } else if (typeof f[3] < "u") {
1941
- const d = Number(f[3]), $ = t[d], k = `interp-${d}`;
1942
- u($, k);
2019
+ const d = Number(f[3]), v = t[d], m = `interp-${d}`;
2020
+ u(v, m);
1943
2021
  } else if (f[4]) {
1944
- const d = f[4], $ = p ? h : b, k = d.split(/({{\d+}})/);
1945
- for (const w of k) {
1946
- if (!w) continue;
1947
- const _ = w.match(/^{{(\d+)}}$/);
2022
+ const d = f[4], v = p ? y : $, m = d.split(/({{\d+}})/);
2023
+ for (const k of m) {
2024
+ if (!k) continue;
2025
+ const _ = k.match(/^{{(\d+)}}$/);
1948
2026
  if (_) {
1949
- const S = Number(_[1]), C = t[S], E = `interp-${S}`;
1950
- u(C, E);
2027
+ const S = Number(_[1]), E = t[S], A = `interp-${S}`;
2028
+ u(E, A);
1951
2029
  } else {
1952
- const S = `text-${y++}`;
1953
- $.push(s(w, S));
2030
+ const S = `text-${w++}`;
2031
+ v.push(s(k, S));
1954
2032
  }
1955
2033
  }
1956
2034
  }
1957
- const v = b.filter((d) => D(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
1958
- return v.length === 1 ? v[0] : v.length > 1 ? v : M("div", {}, "", "fallback-root");
2035
+ const b = $.filter((d) => K(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2036
+ return b.length === 1 ? b[0] : b.length > 1 ? b : H("div", {}, "", "fallback-root");
1959
2037
  }
1960
- function B(e, ...t) {
2038
+ function W(e, ...t) {
1961
2039
  const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
1962
- return Je(e, t, n);
2040
+ return at(e, t, n);
1963
2041
  }
1964
- const ce = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, T = (e, t) => {
2042
+ const xe = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, B = (e, t) => {
1965
2043
  for (const r of e) {
1966
2044
  const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
1967
2045
  if (i) {
@@ -1972,92 +2050,92 @@ const ce = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new
1972
2050
  }
1973
2051
  }
1974
2052
  return { route: null, params: {} };
1975
- }, Z = {};
1976
- async function Qe(e) {
2053
+ }, ie = {};
2054
+ async function lt(e) {
1977
2055
  if (e.component) return e.component;
1978
2056
  if (e.load) {
1979
- if (Z[e.path]) return Z[e.path];
2057
+ if (ie[e.path]) return ie[e.path];
1980
2058
  try {
1981
2059
  const t = await e.load();
1982
- return Z[e.path] = t.default, t.default;
2060
+ return ie[e.path] = t.default, t.default;
1983
2061
  } catch {
1984
2062
  throw new Error(`Failed to load component for route: ${e.path}`);
1985
2063
  }
1986
2064
  }
1987
2065
  throw new Error(`No component or loader defined for route: ${e.path}`);
1988
2066
  }
1989
- function Ze(e) {
2067
+ function ct(e) {
1990
2068
  const { routes: t, base: r = "", initialUrl: n } = e;
1991
- let o, s, i, a, c, f, h;
1992
- const p = async (b, g) => {
1993
- const u = t.find((m) => T([m], b.path).route !== null);
2069
+ let o, s, i, a, c, f, y;
2070
+ const p = async ($, g) => {
2071
+ const u = t.find((h) => B([h], $.path).route !== null);
1994
2072
  if (u?.beforeEnter)
1995
2073
  try {
1996
- const m = await u.beforeEnter(b, g);
1997
- return typeof m == "string" ? (await y(m, !0), !1) : m !== !1;
1998
- } catch (m) {
1999
- return console.error("beforeEnter error", m), !1;
2074
+ const h = await u.beforeEnter($, g);
2075
+ return typeof h == "string" ? (await w(h, !0), !1) : h !== !1;
2076
+ } catch (h) {
2077
+ return console.error("beforeEnter error", h), !1;
2000
2078
  }
2001
2079
  return !0;
2002
- }, l = async (b, g) => {
2003
- const u = t.find((m) => T([m], b.path).route !== null);
2080
+ }, l = async ($, g) => {
2081
+ const u = t.find((h) => B([h], $.path).route !== null);
2004
2082
  if (u?.onEnter)
2005
2083
  try {
2006
- const m = await u.onEnter(b, g);
2007
- return typeof m == "string" ? (await y(m, !0), !1) : m !== !1;
2008
- } catch (m) {
2009
- return console.error("onEnter error", m), !1;
2084
+ const h = await u.onEnter($, g);
2085
+ return typeof h == "string" ? (await w(h, !0), !1) : h !== !1;
2086
+ } catch (h) {
2087
+ return console.error("onEnter error", h), !1;
2010
2088
  }
2011
2089
  return !0;
2012
- }, x = (b, g) => {
2013
- const u = t.find((m) => T([m], b.path).route !== null);
2090
+ }, x = ($, g) => {
2091
+ const u = t.find((h) => B([h], $.path).route !== null);
2014
2092
  if (u?.afterEnter)
2015
2093
  try {
2016
- u.afterEnter(b, g);
2017
- } catch (m) {
2018
- console.error("afterEnter error", m);
2094
+ u.afterEnter($, g);
2095
+ } catch (h) {
2096
+ console.error("afterEnter error", h);
2019
2097
  }
2020
- }, y = async (b, g = !1) => {
2098
+ }, w = async ($, g = !1) => {
2021
2099
  try {
2022
2100
  const u = {
2023
- path: b.replace(r, "") || "/",
2101
+ path: $.replace(r, "") || "/",
2024
2102
  query: {}
2025
- }, m = T(t, u.path);
2026
- if (!m) throw new Error(`No route found for ${u.path}`);
2027
- const v = i.getState(), d = {
2103
+ }, h = B(t, u.path);
2104
+ if (!h) throw new Error(`No route found for ${u.path}`);
2105
+ const b = i.getState(), d = {
2028
2106
  path: u.path,
2029
- params: m.params,
2107
+ params: h.params,
2030
2108
  query: u.query
2031
2109
  };
2032
- if (!await p(d, v) || !await l(d, v)) return;
2033
- typeof window < "u" && typeof document < "u" && (g ? window.history.replaceState({}, "", r + b) : window.history.pushState({}, "", r + b)), i.setState(d), x(d, v);
2110
+ if (!await p(d, b) || !await l(d, b)) return;
2111
+ typeof window < "u" && typeof document < "u" && (g ? window.history.replaceState({}, "", r + $) : window.history.pushState({}, "", r + $)), i.setState(d), x(d, b);
2034
2112
  } catch (u) {
2035
2113
  console.error("Navigation error:", u);
2036
2114
  }
2037
2115
  };
2038
2116
  if (typeof window < "u" && typeof document < "u") {
2039
2117
  o = () => {
2040
- const g = new URL(window.location.href), u = g.pathname.replace(r, "") || "/", m = ce(g.search);
2041
- return { path: u, query: m };
2118
+ const g = new URL(window.location.href), u = g.pathname.replace(r, "") || "/", h = xe(g.search);
2119
+ return { path: u, query: h };
2042
2120
  }, s = o();
2043
- const b = T(t, s.path);
2044
- i = te({
2121
+ const $ = B(t, s.path);
2122
+ i = de({
2045
2123
  path: s.path,
2046
- params: b.params,
2124
+ params: $.params,
2047
2125
  query: s.query
2048
2126
  }), a = async (g = !1) => {
2049
2127
  const u = o();
2050
- await y(u.path, g);
2051
- }, window.addEventListener("popstate", () => a(!0)), c = (g) => y(g, !1), f = (g) => y(g, !0), h = () => window.history.back();
2128
+ await w(u.path, g);
2129
+ }, window.addEventListener("popstate", () => a(!0)), c = (g) => w(g, !1), f = (g) => w(g, !0), y = () => window.history.back();
2052
2130
  } else {
2053
2131
  o = () => {
2054
- const u = new URL(n || "/", "http://localhost"), m = u.pathname.replace(r, "") || "/", v = ce(u.search);
2055
- return { path: m, query: v };
2132
+ const u = new URL(n || "/", "http://localhost"), h = u.pathname.replace(r, "") || "/", b = xe(u.search);
2133
+ return { path: h, query: b };
2056
2134
  }, s = o();
2057
- const b = T(t, s.path);
2058
- i = te({
2135
+ const $ = B(t, s.path);
2136
+ i = de({
2059
2137
  path: s.path,
2060
- params: b.params,
2138
+ params: $.params,
2061
2139
  query: s.query
2062
2140
  }), a = async () => {
2063
2141
  const u = o();
@@ -2065,83 +2143,83 @@ function Ze(e) {
2065
2143
  };
2066
2144
  const g = async (u) => {
2067
2145
  try {
2068
- const m = {
2146
+ const h = {
2069
2147
  path: u.replace(r, "") || "/",
2070
2148
  query: {}
2071
- }, v = T(t, m.path);
2072
- if (!v) throw new Error(`No route found for ${m.path}`);
2073
- const d = i.getState(), $ = {
2074
- path: m.path,
2075
- params: v.params,
2076
- query: m.query
2077
- }, k = t.find((w) => T([w], $.path).route !== null);
2078
- if (k?.beforeEnter)
2149
+ }, b = B(t, h.path);
2150
+ if (!b) throw new Error(`No route found for ${h.path}`);
2151
+ const d = i.getState(), v = {
2152
+ path: h.path,
2153
+ params: b.params,
2154
+ query: h.query
2155
+ }, m = t.find((k) => B([k], v.path).route !== null);
2156
+ if (m?.beforeEnter)
2079
2157
  try {
2080
- const w = await k.beforeEnter($, d);
2081
- if (typeof w == "string") {
2082
- await g(w);
2158
+ const k = await m.beforeEnter(v, d);
2159
+ if (typeof k == "string") {
2160
+ await g(k);
2083
2161
  return;
2084
2162
  }
2085
- if (w === !1) return;
2163
+ if (k === !1) return;
2086
2164
  } catch {
2087
2165
  return;
2088
2166
  }
2089
- if (k?.onEnter)
2167
+ if (m?.onEnter)
2090
2168
  try {
2091
- const w = await k.onEnter($, d);
2092
- if (typeof w == "string") {
2093
- await g(w);
2169
+ const k = await m.onEnter(v, d);
2170
+ if (typeof k == "string") {
2171
+ await g(k);
2094
2172
  return;
2095
2173
  }
2096
- if (w === !1) return;
2174
+ if (k === !1) return;
2097
2175
  } catch {
2098
2176
  return;
2099
2177
  }
2100
- if (i.setState($), k?.afterEnter)
2178
+ if (i.setState(v), m?.afterEnter)
2101
2179
  try {
2102
- k.afterEnter($, d);
2180
+ m.afterEnter(v, d);
2103
2181
  } catch {
2104
2182
  }
2105
2183
  } catch {
2106
2184
  }
2107
2185
  };
2108
- c = async (u) => g(u), f = async (u) => g(u), h = () => {
2186
+ c = async (u) => g(u), f = async (u) => g(u), y = () => {
2109
2187
  };
2110
2188
  }
2111
2189
  return {
2112
2190
  store: i,
2113
2191
  push: c,
2114
2192
  replace: f,
2115
- back: h,
2193
+ back: y,
2116
2194
  subscribe: i.subscribe,
2117
- matchRoute: (b) => T(t, b),
2195
+ matchRoute: ($) => B(t, $),
2118
2196
  getCurrent: () => i.getState(),
2119
- resolveRouteComponent: Qe
2197
+ resolveRouteComponent: lt
2120
2198
  };
2121
2199
  }
2122
- function ot(e, t) {
2123
- return T(e, t);
2200
+ function mt(e, t) {
2201
+ return B(e, t);
2124
2202
  }
2125
- function it(e) {
2126
- const t = Ze(e);
2127
- return le("router-view", {
2203
+ function bt(e) {
2204
+ const t = ct(e);
2205
+ return ve("router-view", {
2128
2206
  async render() {
2129
- if (!t) return B`<div>Router not initialized.</div>`;
2207
+ if (!t) return W`<div>Router not initialized.</div>`;
2130
2208
  const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
2131
- if (!o.route) return B`<div>Not found</div>`;
2209
+ if (!o.route) return W`<div>Not found</div>`;
2132
2210
  let s = o.route.component;
2133
2211
  if (o.route.load) {
2134
2212
  const i = await o.route.load();
2135
2213
  typeof i.default == "string" && (s = i.default);
2136
2214
  }
2137
- return typeof s == "string" ? { tag: s, props: {}, children: [] } : B`<div>Invalid route component</div>`;
2215
+ return typeof s == "string" ? { tag: s, props: {}, children: [] } : W`<div>Invalid route component</div>`;
2138
2216
  },
2139
2217
  onConnected(r) {
2140
2218
  t && typeof t.subscribe == "function" && t.subscribe(() => {
2141
2219
  typeof r.requestRender == "function" && r.requestRender();
2142
2220
  });
2143
2221
  }
2144
- }), le("router-link", {
2222
+ }), ve("router-link", {
2145
2223
  state: {},
2146
2224
  props: {
2147
2225
  to: { type: String, default: "" },
@@ -2154,7 +2232,7 @@ function it(e) {
2154
2232
  disabled: { type: Boolean, default: !1 },
2155
2233
  external: { type: Boolean, default: !1 },
2156
2234
  class: { type: String, default: "" },
2157
- style: { type: String, default: ue`
2235
+ style: { type: String, default: ke`
2158
2236
  [aria-disabled="true"] {
2159
2237
  pointer-events: none;
2160
2238
  opacity: 0.5;
@@ -2163,25 +2241,25 @@ function it(e) {
2163
2241
  },
2164
2242
  style: (r) => r.style,
2165
2243
  render: (r) => {
2166
- 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, p = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, y = l ? i : x ? a : "", b = l ? `aria-current="${c}"` : "", g = f === "button", u = h ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", m = p && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2167
- return B`
2168
- ${pe().when(g, B`
2244
+ const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, y = r.disabled, p = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, w = l ? i : x ? a : "", $ = l ? `aria-current="${c}"` : "", g = f === "button", u = y ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", h = p && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2245
+ return W`
2246
+ ${Ae().when(g, W`
2169
2247
  <button
2170
2248
  part="button"
2171
- :class="${r.class} ${y}"
2172
- ${b}
2249
+ :class="${r.class} ${w}"
2250
+ ${$}
2173
2251
  ${u}
2174
- ${m}
2252
+ ${h}
2175
2253
  @click="navigate"
2176
2254
  ><slot></slot></button>
2177
- `).otherwise(B`
2255
+ `).otherwise(W`
2178
2256
  <a
2179
2257
  part="link"
2180
2258
  href="${o}"
2181
- :class="${r.class} ${y}"
2182
- ${b}
2259
+ :class="${r.class} ${w}"
2260
+ ${$}
2183
2261
  ${u}
2184
- ${m}
2262
+ ${h}
2185
2263
  @click="navigate"
2186
2264
  ><slot></slot></a>
2187
2265
  `).done()}
@@ -2197,25 +2275,25 @@ function it(e) {
2197
2275
  }), t;
2198
2276
  }
2199
2277
  export {
2200
- N as GlobalEventBus,
2201
- le as component,
2202
- te as createStore,
2203
- ue as css,
2204
- Ye as each,
2205
- Ge as emit,
2206
- P as eventBus,
2207
- B as html,
2208
- it as initRouter,
2209
- nt as listen,
2210
- pe as match,
2211
- T as matchRoute,
2212
- ot as matchRouteSSR,
2213
- tt as off,
2214
- et as on,
2215
- rt as once,
2216
- ce as parseQuery,
2217
- Qe as resolveRouteComponent,
2218
- Ze as useRouter,
2219
- Xe as when
2278
+ D as GlobalEventBus,
2279
+ ve as component,
2280
+ de as createStore,
2281
+ ke as css,
2282
+ ut as each,
2283
+ dt as emit,
2284
+ I as eventBus,
2285
+ W as html,
2286
+ bt as initRouter,
2287
+ yt as listen,
2288
+ Ae as match,
2289
+ B as matchRoute,
2290
+ mt as matchRouteSSR,
2291
+ ht as off,
2292
+ pt as on,
2293
+ gt as once,
2294
+ xe as parseQuery,
2295
+ lt as resolveRouteComponent,
2296
+ ct as useRouter,
2297
+ ft as when
2220
2298
  };
2221
2299
  //# sourceMappingURL=custom-elements-runtime.es.js.map