@jasonshimmy/custom-elements-runtime 0.1.17 → 0.1.19

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 ft(e, t) {
2
- return Q(e ? t : [], "when-block");
1
+ function gt(e, t) {
2
+ return te(e ? t : [], "when-block");
3
3
  }
4
- function ut(e, t) {
4
+ function yt(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 Q(t(r, n), `each-${o}`);
7
+ return te(t(r, n), `each-${o}`);
8
8
  });
9
9
  }
10
- function Ae() {
10
+ function Le() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function Ae() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Te(...e);
20
+ return ze(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Te(...e) {
24
+ function ze(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, n] = e[t];
27
- if (r) return [Q(n, `whenChain-branch-${t}`)];
27
+ if (r) return [te(n, `whenChain-branch-${t}`)];
28
28
  }
29
- return [Q([], "whenChain-empty")];
29
+ return [te([], "whenChain-empty")];
30
30
  }
31
- function Q(e, t) {
31
+ function te(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 Q(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class D extends EventTarget {
39
+ class F extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class D extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return D.instance || (D.instance = new D()), D.instance;
47
+ return F.instance || (F.instance = new F()), F.instance;
48
48
  }
49
49
  // Enhanced emit method with better typing and event storm protection
50
50
  /**
@@ -160,8 +160,8 @@ class D extends EventTarget {
160
160
  this.eventCounters.clear();
161
161
  }
162
162
  }
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) {
163
+ const Z = F.getInstance(), mt = (e, t) => Z.emit(e, t), bt = (e, t) => Z.on(e, t), vt = (e, t) => Z.off(e, t), xt = (e, t) => Z.once(e, t), wt = (e, t, r) => Z.listen(e, t, r);
164
+ function ve(e) {
165
165
  let t = { ...e };
166
166
  const r = [];
167
167
  function n(a) {
@@ -179,10 +179,10 @@ function de(e) {
179
179
  }
180
180
  return { subscribe: n, getState: o, setState: s };
181
181
  }
182
- function ce(e) {
182
+ function ye(e) {
183
183
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
184
184
  }
185
- function se(e) {
185
+ function pe(e) {
186
186
  return typeof e == "string" ? e.replace(
187
187
  /[&<>"']/g,
188
188
  (t) => ({
@@ -194,32 +194,32 @@ function se(e) {
194
194
  })[t]
195
195
  ) : e;
196
196
  }
197
- function Le(e, t, r) {
197
+ function Be(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: ae(e, n)
204
+ oldValue: he(e, n)
205
205
  }), i.immediate)
206
206
  try {
207
- const a = ae(e, n);
207
+ const a = he(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 ae(e, t) {
214
+ function he(e, t) {
215
215
  return t.split(".").reduce((r, n) => r?.[n], e);
216
216
  }
217
- function je(e, t, r, n) {
217
+ function Re(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((y, p) => o(y, a[p]));
222
+ return i.length !== a.length ? !1 : i.every((y, g) => o(y, a[g]));
223
223
  const c = Object.keys(i), f = Object.keys(a);
224
224
  return c.length !== f.length ? !1 : c.every((y) => o(i[y], a[y]));
225
225
  }, s = t.get(r);
@@ -232,13 +232,13 @@ function je(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 = ae(e, i);
235
+ const c = he(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 ze(e, t, r) {
241
+ function Pe(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,76 +247,76 @@ function ze(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(ce(o));
251
- i !== null ? r[o] = se(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = se(s.default));
250
+ const i = e.getAttribute(ye(o));
251
+ i !== null ? r[o] = pe(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = pe(s.default));
252
252
  }
253
253
  });
254
254
  }
255
- function Be(e, t, r, n) {
255
+ function Oe(e, t, r, n) {
256
256
  e.onConnected && !r && (e.onConnected(t), n(!0));
257
257
  }
258
- function Re(e, t, r, n, o, s, i, a) {
258
+ function Me(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 Ne(e, t, r, n, o) {
261
+ function We(e, t, r, n, o) {
262
262
  e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
263
263
  }
264
- function N(e, t) {
264
+ function D(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
- N(r, t);
269
+ D(r, t);
270
270
  }
271
271
  }
272
- function P(e, t) {
272
+ function q(e, t) {
273
273
  return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
- function pe(e, t, r) {
275
+ function xe(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 Pe(e, t, r, n, o, s, i) {
281
+ function Ne(e, t, r, n, o, s, i) {
282
282
  if (!s) return;
283
283
  const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), y = () => {
284
- const g = s._state || s;
285
- return P(g, e);
286
- }, p = y();
284
+ const p = s._state || s;
285
+ return q(p, e);
286
+ }, g = 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")
290
- if (Array.isArray(p)) {
291
- const g = i?.getAttribute("value") || n?.value || "", u = p.includes(g);
290
+ if (Array.isArray(g)) {
291
+ const p = i?.getAttribute("value") || n?.value || "", u = g.includes(p);
292
292
  i && i.checked !== u && (r.checked = u);
293
293
  } else {
294
- const g = i?.getAttribute("true-value") || !0, u = p === g;
294
+ const p = i?.getAttribute("true-value") || !0, u = g === p;
295
295
  i && i.checked !== u && (r.checked = u);
296
296
  }
297
297
  else if (l === "radio") {
298
- const g = n?.value || "", u = p === g;
298
+ const p = n?.value || "", u = g === p;
299
299
  i && i.checked !== u && (r.checked = u);
300
300
  } else if (l === "select")
301
301
  if (i && i.hasAttribute("multiple")) {
302
- const g = i, u = Array.isArray(p) ? p : [];
302
+ const p = i, u = Array.isArray(g) ? g : [];
303
303
  setTimeout(() => {
304
- Array.from(g.options).forEach((h) => {
304
+ Array.from(p.options).forEach((h) => {
305
305
  const b = u.includes(h.value);
306
306
  h.selected !== b && (h.selected = b);
307
307
  });
308
308
  }, 0);
309
309
  } else
310
310
  setTimeout(() => {
311
- i instanceof HTMLSelectElement && i.value !== String(p) && (i.value = String(p));
311
+ i instanceof HTMLSelectElement && i.value !== String(g) && (i.value = String(g));
312
312
  }, 0);
313
313
  else {
314
- const g = String(p ?? "");
315
- (!i || i.value !== g) && (r.value = p);
314
+ const p = String(g ?? "");
315
+ (!i || i.value !== p) && (r.value = g);
316
316
  }
317
- const w = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", $ = (g) => {
318
- if (g.isComposing || o._isComposing || g.isTrusted === !1) return;
319
- const u = g.target;
317
+ const w = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", S = (p) => {
318
+ if (p.isComposing || o._isComposing || p.isTrusted === !1) return;
319
+ const u = p.target;
320
320
  if (u._modelUpdating) return;
321
321
  const h = y();
322
322
  let b = u.value;
@@ -326,8 +326,8 @@ function Pe(e, t, r, n, o, s, i) {
326
326
  if (u.checked)
327
327
  _.includes(k) || _.push(k);
328
328
  else {
329
- const S = _.indexOf(k);
330
- S > -1 && _.splice(S, 1);
329
+ const C = _.indexOf(k);
330
+ C > -1 && _.splice(C, 1);
331
331
  }
332
332
  b = _;
333
333
  } else {
@@ -345,16 +345,16 @@ function Pe(e, t, r, n, o, s, i) {
345
345
  const k = Number(b);
346
346
  isNaN(k) || (b = k);
347
347
  }
348
- const d = s._state || s, v = P(d, e);
348
+ const d = s._state || s, v = q(d, e);
349
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(() => {
350
+ const k = p.target;
351
+ k._modelUpdating = !0, xe(d, e, b), setTimeout(() => {
352
352
  k._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (o[w] = $, l === "text" || l === "textarea") {
357
- const g = () => {
356
+ if (o[w] = S, l === "text" || l === "textarea") {
357
+ const p = () => {
358
358
  o._isComposing = !0;
359
359
  }, u = (h) => {
360
360
  o._isComposing = !1;
@@ -366,17 +366,17 @@ function Pe(e, t, r, n, o, s, i) {
366
366
  const _ = Number(d);
367
367
  isNaN(_) || (d = _);
368
368
  }
369
- const v = s._state || s, m = P(v, e);
369
+ const v = s._state || s, m = q(v, e);
370
370
  (Array.isArray(d) && Array.isArray(m) ? JSON.stringify([...d].sort()) !== JSON.stringify([...m].sort()) : d !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
371
  b._modelUpdating = !1;
372
- }, 0)), pe(v, e, d), s._requestRender && s._requestRender());
372
+ }, 0)), xe(v, e, d), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
- o.compositionstart = g, o.compositionend = u;
376
+ o.compositionstart = p, o.compositionend = u;
377
377
  }
378
378
  }
379
- function Me(e, t, r, n) {
379
+ function De(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 Me(e, t, r, n) {
390
390
  return;
391
391
  }
392
392
  } catch {
393
- const o = P(n, e);
393
+ const o = q(n, e);
394
394
  r[e] = o;
395
395
  }
396
396
  }
397
397
  }
398
- function Oe(e, t, r) {
398
+ function qe(e, t, r) {
399
399
  if (!r) return;
400
- const n = P(r, e), o = t.style || "", s = n ? "" : "none";
400
+ const n = q(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 Oe(e, t, r) {
406
406
  } else
407
407
  t.style = `display: ${s}`;
408
408
  }
409
- function We(e, t, r) {
409
+ function He(e, t, r) {
410
410
  if (!r) return;
411
- const n = P(r, e);
411
+ const n = q(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 De(e, t, r) {
417
+ function Ie(e, t, r) {
418
418
  let n;
419
419
  if (typeof e == "string") {
420
420
  if (!r) return;
421
- n = P(r, e);
421
+ n = q(r, e);
422
422
  } else
423
423
  n = e;
424
424
  let o = "";
@@ -457,21 +457,21 @@ function De(e, t, r) {
457
457
  "min-height",
458
458
  "max-height"
459
459
  ];
460
- let p = String(c);
461
- typeof c == "number" && y.includes(f) && (p = `${c}px`), i.push(`${f}: ${p}`);
460
+ let g = String(c);
461
+ typeof c == "number" && y.includes(f) && (g = `${c}px`), i.push(`${f}: ${g}`);
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 we(e, t, r, n) {
468
+ function Ee(e, t, r, n) {
469
469
  const o = {}, s = { ...n || {} }, i = {};
470
470
  for (const [a, c] of Object.entries(e)) {
471
471
  const { value: f, modifiers: y } = c;
472
472
  switch (a) {
473
473
  case "model":
474
- Pe(
474
+ Ne(
475
475
  typeof f == "string" ? f : String(f),
476
476
  y,
477
477
  o,
@@ -482,45 +482,45 @@ function we(e, t, r, n) {
482
482
  );
483
483
  break;
484
484
  case "bind":
485
- Me(f, o, s, t);
485
+ De(f, o, s, t);
486
486
  break;
487
487
  case "show":
488
- Oe(f, s, t);
488
+ qe(f, s, t);
489
489
  break;
490
490
  case "class":
491
- We(f, s, t);
491
+ He(f, s, t);
492
492
  break;
493
493
  case "style":
494
- De(f, s, t);
494
+ Ie(f, s, t);
495
495
  break;
496
496
  }
497
497
  }
498
498
  return { props: o, attrs: s, listeners: i };
499
499
  }
500
- function le(e, t) {
500
+ function ge(e, t) {
501
501
  if (Array.isArray(e)) {
502
502
  const s = /* @__PURE__ */ new Set();
503
503
  return e.map((i) => {
504
504
  if (!i || typeof i != "object") return i;
505
505
  let a = i.props?.key ?? i.key;
506
506
  if (!a) {
507
- const p = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
508
- a = l ? `${t}:${p}:${l}` : `${t}:${p}`;
507
+ const g = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
508
+ a = l ? `${t}:${g}:${l}` : `${t}:${g}`;
509
509
  }
510
510
  let c = a, f = 1;
511
511
  for (; s.has(c); )
512
512
  c = `${a}#${f++}`;
513
513
  s.add(c);
514
514
  let y = i.children;
515
- return Array.isArray(y) && (y = le(y, c)), { ...i, key: c, children: y };
515
+ return Array.isArray(y) && (y = ge(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 = le(o, n)), { ...r, key: n, children: o };
520
+ return Array.isArray(o) && (o = ge(o, n)), { ...r, key: n, children: o };
521
521
  }
522
- function He(e, t, r, n) {
523
- const o = r.directives ?? {}, s = we(
522
+ function Ue(e, t, r, n) {
523
+ const o = r.directives ?? {}, s = Ee(
524
524
  o,
525
525
  n,
526
526
  e,
@@ -542,79 +542,79 @@ function He(e, t, r, n) {
542
542
  s.listeners || {}
543
543
  ))
544
544
  e.addEventListener(l, x);
545
- const y = t.attrs ?? {}, p = a;
546
- for (const l in { ...y, ...p }) {
547
- const x = y[l], w = p[l];
545
+ const y = t.attrs ?? {}, g = a;
546
+ for (const l in { ...y, ...g }) {
547
+ const x = y[l], w = g[l];
548
548
  x !== w && (w == null || w === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(w)));
549
549
  }
550
550
  }
551
- function j(e, t, r) {
551
+ function P(e, t, r) {
552
552
  if (typeof e == "string")
553
553
  return document.createTextNode(e);
554
554
  if (e.tag === "#text") {
555
- const p = document.createTextNode(
555
+ const g = document.createTextNode(
556
556
  typeof e.children == "string" ? e.children : ""
557
557
  );
558
- return e.key != null && (p.key = e.key), p;
558
+ return e.key != null && (g.key = e.key), g;
559
559
  }
560
560
  if (e.tag === "#anchor") {
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
- for (const g of l) {
566
- const u = j(g, t);
567
- $.appendChild(u);
561
+ const g = e, l = Array.isArray(g.children) ? g.children : [], x = document.createTextNode(""), w = document.createTextNode("");
562
+ g.key != null && (x.key = `${g.key}:start`, w.key = `${g.key}:end`), g._startNode = x, g._endNode = w;
563
+ const S = document.createDocumentFragment();
564
+ S.appendChild(x);
565
+ for (const p of l) {
566
+ const u = P(p, t);
567
+ S.appendChild(u);
568
568
  }
569
- return $.appendChild(w), $;
569
+ return S.appendChild(w), S;
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 = we(i, t, n, s), c = {
573
+ const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = Ee(i, t, n, s), c = {
574
574
  ...o,
575
575
  ...a.props
576
576
  }, f = {
577
577
  ...s,
578
578
  ...a.attrs
579
579
  };
580
- for (const p in f) {
581
- const l = f[p];
582
- if (typeof p != "string" || /\[object Object\]/.test(p)) {
583
- typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", p, l);
580
+ for (const g in f) {
581
+ const l = f[g];
582
+ if (typeof g != "string" || /\[object Object\]/.test(g)) {
583
+ typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", g, l);
584
584
  continue;
585
585
  }
586
- typeof l == "boolean" ? l && n.setAttribute(p, "") : l != null && n.setAttribute(p, l);
586
+ typeof l == "boolean" ? l && n.setAttribute(g, "") : l != null && n.setAttribute(g, l);
587
587
  }
588
- for (const p in c) {
589
- const l = c[p];
590
- if (typeof p != "string" || /\[object Object\]/.test(p)) {
591
- typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", p, l);
588
+ for (const g in c) {
589
+ const l = c[g];
590
+ if (typeof g != "string" || /\[object Object\]/.test(g)) {
591
+ typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", g, l);
592
592
  continue;
593
593
  }
594
- if (p === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
594
+ if (g === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
595
595
  n.value = l ?? "";
596
- else if (p === "checked" && n instanceof HTMLInputElement)
596
+ else if (g === "checked" && n instanceof HTMLInputElement)
597
597
  n.checked = !!l;
598
- else if (p.startsWith("on") && typeof l == "function")
599
- n.addEventListener(p.slice(2).toLowerCase(), l);
598
+ else if (g.startsWith("on") && typeof l == "function")
599
+ n.addEventListener(g.slice(2).toLowerCase(), l);
600
600
  else {
601
- if (p.startsWith("on") && l === void 0)
601
+ if (g.startsWith("on") && l === void 0)
602
602
  continue;
603
- l == null || l === !1 ? n.removeAttribute(p) : n.setAttribute(p, String(l));
603
+ l == null || l === !1 ? n.removeAttribute(g) : n.setAttribute(g, String(l));
604
604
  }
605
605
  }
606
- for (const [p, l] of Object.entries(
606
+ for (const [g, l] of Object.entries(
607
607
  a.listeners || {}
608
608
  ))
609
- n.addEventListener(p, l);
609
+ n.addEventListener(g, l);
610
610
  const y = e.props?.ref ?? (e.props?.props && e.props.props.ref);
611
611
  if (typeof e != "string" && y && r && (r[y] = n), Array.isArray(e.children))
612
- for (const p of e.children)
613
- n.appendChild(j(p, t, r));
612
+ for (const g of e.children)
613
+ n.appendChild(P(g, t, r));
614
614
  else typeof e.children == "string" && (n.textContent = e.children);
615
615
  return n;
616
616
  }
617
- function qe(e, t, r, n, o) {
617
+ function Fe(e, t, r, n, o) {
618
618
  if (typeof r == "string") {
619
619
  e.textContent !== r && (e.textContent = r);
620
620
  return;
@@ -630,54 +630,54 @@ function qe(e, t, r, n, o) {
630
630
  }
631
631
  const f = /* @__PURE__ */ new Set();
632
632
  let y = e.firstChild;
633
- function p(x, w) {
634
- let $ = x;
635
- for (; $ && (f.add($), $ !== w); )
636
- $ = $.nextSibling;
633
+ function g(x, w) {
634
+ let S = x;
635
+ for (; S && (f.add(S), S !== w); )
636
+ S = S.nextSibling;
637
637
  }
638
- function l(x, w, $, g) {
638
+ function l(x, w, S, p) {
639
639
  const u = [];
640
640
  let h = x.nextSibling;
641
641
  for (; h && h !== w; )
642
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)) {
643
+ const b = Array.isArray(S) ? S : [];
644
+ if (p.some((v) => v && v.key != null) || b.some((v) => v && v.key != null)) {
645
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
- for (const S of u) {
649
- const E = S.key;
650
- E != null && m.set(E, S);
646
+ for (const C of b)
647
+ C && C.key != null && v.set(C.key, C);
648
+ for (const C of u) {
649
+ const E = C.key;
650
+ E != null && m.set(E, C);
651
651
  }
652
652
  const k = /* @__PURE__ */ new Set();
653
653
  let _ = x.nextSibling;
654
- for (const S of g) {
654
+ for (const C of p) {
655
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
- S,
656
+ if (C.key != null && m.has(C.key)) {
657
+ const j = v.get(C.key);
658
+ E = Y(
659
+ m.get(C.key),
660
+ j,
661
+ C,
662
662
  n
663
663
  ), k.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
664
664
  } else
665
- E = j(S, n), e.insertBefore(E, _), k.add(E);
665
+ E = P(C, n), e.insertBefore(E, _), k.add(E);
666
666
  _ = E.nextSibling;
667
667
  }
668
- for (const S of u)
669
- !k.has(S) && e.contains(S) && e.removeChild(S);
668
+ for (const C of u)
669
+ !k.has(C) && e.contains(C) && e.removeChild(C);
670
670
  } else {
671
671
  const v = Math.min(
672
672
  b.length,
673
- g.length
673
+ p.length
674
674
  );
675
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]));
676
+ const k = b[m], _ = p[m], C = Y(u[m], k, _, n);
677
+ C !== u[m] && (e.insertBefore(C, u[m]), e.removeChild(u[m]));
678
678
  }
679
- for (let m = v; m < g.length; m++)
680
- e.insertBefore(j(g[m], n), w);
679
+ for (let m = v; m < p.length; m++)
680
+ e.insertBefore(P(p[m], n), w);
681
681
  for (let m = v; m < u.length; m++)
682
682
  e.removeChild(u[m]);
683
683
  }
@@ -685,42 +685,42 @@ function qe(e, t, r, n, o) {
685
685
  for (const x of r) {
686
686
  let w;
687
687
  if (x.tag === "#anchor") {
688
- const $ = x.key, g = `${$}:start`, u = `${$}:end`;
689
- let h = c.get(g), b = c.get(u);
688
+ const S = x.key, p = `${S}:start`, u = `${S}:end`;
689
+ let h = c.get(p), b = c.get(u);
690
690
  const d = Array.isArray(x.children) ? x.children : [];
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)) {
691
+ if (h || (h = document.createTextNode(""), h.key = p), b || (b = document.createTextNode(""), b.key = u), x._startNode = h, x._endNode = b, !e.contains(h) || !e.contains(b)) {
692
692
  e.insertBefore(h, y);
693
693
  for (const v of d)
694
- e.insertBefore(j(v, n), y);
694
+ e.insertBefore(P(v, n), y);
695
695
  e.insertBefore(b, y);
696
696
  } else
697
697
  l(
698
698
  h,
699
699
  b,
700
- a.get($)?.children,
700
+ a.get(S)?.children,
701
701
  d
702
702
  );
703
- p(h, b), y = b.nextSibling;
703
+ g(h, b), y = b.nextSibling;
704
704
  continue;
705
705
  }
706
706
  if (x.key != null && c.has(x.key)) {
707
- const $ = a.get(x.key);
708
- w = V(
707
+ const S = a.get(x.key);
708
+ w = Y(
709
709
  c.get(x.key),
710
- $,
710
+ S,
711
711
  x,
712
712
  n,
713
713
  o
714
714
  ), f.add(w), w !== y && e.contains(w) && (y && !e.contains(y) && (y = null), e.insertBefore(w, y));
715
715
  } else
716
- w = j(x, n, o), y && !e.contains(y) && (y = null), e.insertBefore(w, y), f.add(w);
716
+ w = P(x, n, o), y && !e.contains(y) && (y = null), e.insertBefore(w, y), f.add(w);
717
717
  y = w.nextSibling;
718
718
  }
719
719
  for (const x of s)
720
- !f.has(x) && e.contains(x) && (N(x, o), e.removeChild(x));
720
+ !f.has(x) && e.contains(x) && (D(x, o), e.removeChild(x));
721
721
  }
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;
722
+ function Y(e, t, r, n, o) {
723
+ if (t && typeof t != "string" && t.props?.ref && o && D(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;
@@ -734,20 +734,20 @@ function V(e, t, r, n, o) {
734
734
  i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
735
735
  const y = document.createDocumentFragment();
736
736
  y.appendChild(c);
737
- for (const p of a) {
738
- const l = j(p, n);
737
+ for (const g of a) {
738
+ const l = P(g, n);
739
739
  y.appendChild(l);
740
740
  }
741
741
  return y.appendChild(f), e.parentNode?.replaceChild(y, e), c;
742
742
  }
743
743
  if (!r) {
744
- N(e, o);
744
+ D(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
- N(e, o);
750
- const i = j(r, n, o);
749
+ D(e, o);
750
+ const i = P(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") {
@@ -756,52 +756,52 @@ function V(e, t, r, n, o) {
756
756
  const f = document.createDocumentFragment();
757
757
  f.appendChild(a);
758
758
  for (const y of i)
759
- f.appendChild(j(y, n));
759
+ f.appendChild(P(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 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;
764
+ return Ue(i, t.props || {}, r.props || {}, n), Fe(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
765
765
  }
766
- N(e, o);
767
- const s = j(r, n, o);
766
+ D(e, o);
767
+ const s = P(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 Ie(e, t, r, n) {
770
+ function Ke(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 = le(o, String(o.key ?? "root"));
777
+ }), o = ge(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 = 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));
780
+ s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = Y(i, s, o, r, n) : (a = P(o, r, n), e.replaceChild(a, i)) : (a = P(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
781
781
  const c = [];
782
782
  for (let f = 0; f < e.childNodes.length; f++) {
783
783
  const y = e.childNodes[f];
784
- y !== a && y.nodeName !== "STYLE" && (N(y, n), c.push(y));
784
+ y !== a && y.nodeName !== "STYLE" && (D(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 ke(e, ...t) {
788
+ function Ae(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 $e(e) {
794
+ function Te(e) {
795
795
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
796
796
  }
797
- let U = null;
798
- function he() {
799
- return U || (U = new CSSStyleSheet(), U.replaceSync($e(Ue))), U;
797
+ let Q = null;
798
+ function we() {
799
+ return Q || (Q = new CSSStyleSheet(), Q.replaceSync(Te(Je))), Q;
800
800
  }
801
- function Fe(e) {
801
+ function Ve(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 Ue = ke`
804
+ const Je = Ae`
805
805
  :host, *, ::before, ::after {
806
806
  all: isolate;
807
807
  box-sizing: border-box;
@@ -859,7 +859,7 @@ const Ue = ke`
859
859
  sup { top: -.5em }
860
860
  [disabled], [aria-disabled=true] { cursor: not-allowed }
861
861
  [hidden] { display: none }
862
- `, Ke = {
862
+ `, Ze = {
863
863
  gray: {
864
864
  50: "var(--color-gray-50, #f9fafb)",
865
865
  100: "var(--color-gray-100, #f3f4f6)",
@@ -994,7 +994,7 @@ const Ue = ke`
994
994
  },
995
995
  white: { DEFAULT: "var(--color-white, #ffffff)" },
996
996
  black: { DEFAULT: "var(--color-black, #000000)" }
997
- }, Y = {
997
+ }, se = {
998
998
  /* Display */
999
999
  block: "display:block;",
1000
1000
  inline: "display:inline;",
@@ -1175,7 +1175,7 @@ const Ue = ke`
1175
1175
  "z-30": "z-index:30;",
1176
1176
  "z-40": "z-index:40;",
1177
1177
  "z-50": "z-index:50;"
1178
- }, Ve = "0.25rem", ge = {
1178
+ }, Qe = "0.25rem", ke = {
1179
1179
  m: ["margin"],
1180
1180
  mx: ["margin-inline"],
1181
1181
  my: ["margin-block"],
@@ -1207,7 +1207,7 @@ const Ue = ke`
1207
1207
  "gap-x": ["column-gap"],
1208
1208
  "gap-y": ["row-gap"]
1209
1209
  };
1210
- function L(e, t) {
1210
+ function R(e, t) {
1211
1211
  let r = 0, n = 0;
1212
1212
  for (let o = 0; o < e.length; o++) {
1213
1213
  const s = e[o];
@@ -1220,21 +1220,21 @@ function L(e, t) {
1220
1220
  }
1221
1221
  return e + t;
1222
1222
  }
1223
- const G = {
1223
+ const Xe = {
1224
1224
  before: (e, t) => `${e}::before{${t}}`,
1225
1225
  after: (e, t) => `${e}::after{${t}}`,
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
+ hover: (e, t) => `${R(e, ":hover")}{${t}}`,
1227
+ focus: (e, t) => `${R(e, ":focus")}{${t}}`,
1228
+ active: (e, t) => `${R(e, ":active")}{${t}}`,
1229
+ disabled: (e, t) => `${R(e, ":disabled")}{${t}}`,
1230
+ visited: (e, t) => `${R(e, ":visited")}{${t}}`,
1231
+ checked: (e, t) => `${R(e, ":checked")}{${t}}`,
1232
+ first: (e, t) => `${R(e, ":first-child")}{${t}}`,
1233
+ last: (e, t) => `${R(e, ":last-child")}{${t}}`,
1234
+ odd: (e, t) => `${R(e, ":nth-child(odd)")}{${t}}`,
1235
+ even: (e, t) => `${R(e, ":nth-child(even)")}{${t}}`,
1236
+ "focus-within": (e, t) => `${R(e, ":focus-within")}{${t}}`,
1237
+ "focus-visible": (e, t) => `${R(e, ":focus-visible")}{${t}}`,
1238
1238
  "group-hover": (e, t) => `.group:hover ${e}{${t}}`,
1239
1239
  "group-focus": (e, t) => `.group:focus ${e}{${t}}`,
1240
1240
  "group-active": (e, t) => `.group:active ${e}{${t}}`,
@@ -1243,7 +1243,7 @@ const G = {
1243
1243
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1244
1244
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1245
1245
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1246
- }, ee = {
1246
+ }, ae = {
1247
1247
  // Responsive
1248
1248
  sm: "(min-width:640px)",
1249
1249
  md: "(min-width:768px)",
@@ -1252,23 +1252,23 @@ const G = {
1252
1252
  "2xl": "(min-width:1536px)",
1253
1253
  // Dark mode (now plain string)
1254
1254
  dark: "(prefers-color-scheme: dark)"
1255
- }, te = ["sm", "md", "lg", "xl", "2xl"];
1256
- function re(e) {
1255
+ }, le = ["sm", "md", "lg", "xl", "2xl"];
1256
+ function ce(e) {
1257
1257
  const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1258
1258
  if (n.length < 2) return null;
1259
1259
  const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
1260
- if (Number.isNaN(i) || !ge[o]) return null;
1260
+ if (Number.isNaN(i) || !ke[o]) return null;
1261
1261
  const a = t ? "-" : "";
1262
- return ge[o].map((c) => `${c}:calc(${a}${Ve} * ${i});`).join("");
1262
+ return ke[o].map((c) => `${c}:calc(${a}${Qe} * ${i});`).join("");
1263
1263
  }
1264
- function ye(e) {
1264
+ function $e(e) {
1265
1265
  const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
1266
1266
  return `${n} ${o} ${s}`;
1267
1267
  }
1268
- function Je(e) {
1268
+ function Ye(e) {
1269
1269
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1270
1270
  if (!t) return null;
1271
- const [, r, n, o = "DEFAULT"] = t, s = Ke[n]?.[o];
1271
+ const [, r, n, o = "DEFAULT"] = t, s = Ze[n]?.[o];
1272
1272
  return s ? `${{
1273
1273
  bg: "background-color",
1274
1274
  decoration: "text-decoration-color",
@@ -1283,47 +1283,56 @@ function Je(e) {
1283
1283
  stroke: "stroke-color"
1284
1284
  }[r]}:${s};` : null;
1285
1285
  }
1286
- function Ze(e) {
1286
+ function Ge(e) {
1287
1287
  const [t, r] = e.split("/");
1288
1288
  if (!r) return { base: t };
1289
1289
  const n = parseInt(r, 10);
1290
1290
  return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1291
1291
  }
1292
- function ne(e) {
1293
- const { base: t, opacity: r } = Ze(e), n = Je(t);
1292
+ function fe(e) {
1293
+ const { base: t, opacity: r } = Ge(e), n = Ye(t);
1294
1294
  if (n) {
1295
1295
  if (r !== void 0) {
1296
1296
  const s = /#([0-9a-f]{6})/i.exec(n);
1297
1297
  if (s) {
1298
- const i = ye(s[0]);
1298
+ const i = $e(s[0]);
1299
1299
  return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1300
1300
  }
1301
1301
  }
1302
1302
  return n;
1303
1303
  }
1304
- const o = J(t);
1304
+ const o = G(t);
1305
1305
  if (o && r !== void 0) {
1306
1306
  const s = /#([0-9a-f]{6})/i.exec(o);
1307
1307
  if (s) {
1308
- const i = ye(s[0]);
1308
+ const i = $e(s[0]);
1309
1309
  return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1310
1310
  }
1311
1311
  }
1312
1312
  return o;
1313
1313
  }
1314
- function oe(e) {
1314
+ function ue(e) {
1315
1315
  const t = /^opacity-(\d{1,3})$/.exec(e);
1316
1316
  if (!t) return null;
1317
1317
  const r = parseInt(t[1], 10);
1318
1318
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1319
1319
  }
1320
- function J(e) {
1320
+ function G(e) {
1321
+ if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1322
+ const o = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1323
+ if (o) {
1324
+ const s = o[1].trim();
1325
+ let i = o[2].trim();
1326
+ return i = i.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), i = i.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${i};`;
1327
+ }
1328
+ return null;
1329
+ }
1321
1330
  const t = e.indexOf("-["), r = e.endsWith("]");
1322
1331
  if (t > 0 && r) {
1323
1332
  const n = e.slice(0, t);
1324
1333
  let o = e.slice(t + 2, -1);
1325
1334
  o = o.replace(/_/g, " ");
1326
- const i = {
1335
+ const s = {
1327
1336
  bg: "background-color",
1328
1337
  text: "color",
1329
1338
  p: "padding",
@@ -1362,12 +1371,15 @@ function J(e) {
1362
1371
  weight: "font-weight",
1363
1372
  leading: "line-height",
1364
1373
  z: "z-index"
1365
- }[n] ?? n.replace(/_/g, "-");
1374
+ };
1375
+ if (n === "rotate")
1376
+ return `transform:rotate(${o});`;
1377
+ const i = s[n] ?? n.replace(/_/g, "-");
1366
1378
  if (i && o) return `${i}:${o};`;
1367
1379
  }
1368
1380
  return null;
1369
1381
  }
1370
- function me(e) {
1382
+ function et(e) {
1371
1383
  if (e.startsWith("[") && e.endsWith("]")) {
1372
1384
  const r = e.slice(1, -1);
1373
1385
  return r.includes("&") ? r : e;
@@ -1379,44 +1391,44 @@ function me(e) {
1379
1391
  }
1380
1392
  return null;
1381
1393
  }
1382
- function Qe(e) {
1394
+ function tt(e) {
1383
1395
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1384
1396
  }
1385
- function Xe(e) {
1386
- const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
1397
+ function rt(e) {
1398
+ const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1387
1399
  let n;
1388
1400
  for (; n = t.exec(e); ) {
1389
- const o = n[1].match(/(?:\[[^\]]+\]:[^\s]+|[^\s]+)/g);
1390
- o && r.push(...o);
1401
+ const o = n[2].split(/\s+/).filter(Boolean);
1402
+ o.length && r.push(...o);
1391
1403
  }
1392
1404
  return r.filter(Boolean);
1393
1405
  }
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;
1406
+ const Se = /* @__PURE__ */ new Map(), nt = 16;
1407
+ function ot(e) {
1408
+ const t = Date.now(), r = Se.get(e);
1409
+ if (r && t - r.timestamp < nt) return r.css;
1410
+ const n = rt(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1411
+ function y(p, u = !1) {
1412
+ const h = (u ? "dark|" : "") + p;
1401
1413
  if (h in f) return f[h];
1402
- const b = w(g, u);
1414
+ const b = w(p, u);
1403
1415
  return f[h] = b, b;
1404
1416
  }
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;
1417
+ function g(p) {
1418
+ const u = p.some((b) => le.includes(b)), h = p.includes("dark");
1419
+ return p.length === 0 ? 1 : !u && !h ? 2 : u && !h ? 3 : 4;
1408
1420
  }
1409
- function l(g) {
1421
+ function l(p) {
1410
1422
  const u = [];
1411
1423
  let h = "", b = 0, d = 0;
1412
- for (let v = 0; v < g.length; v++) {
1413
- const m = g[v];
1424
+ for (let v = 0; v < p.length; v++) {
1425
+ const m = p[v];
1414
1426
  m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? d++ : m === ")" && d > 0 && d--, m === ":" && b === 0 && d === 0 ? (u.push(h), h = "") : h += m;
1415
1427
  }
1416
1428
  return h && u.push(h), u;
1417
1429
  }
1418
- function x(g) {
1419
- switch (g) {
1430
+ function x(p) {
1431
+ switch (p) {
1420
1432
  case "hover":
1421
1433
  return ":hover";
1422
1434
  case "focus":
@@ -1445,104 +1457,132 @@ function Ge(e) {
1445
1457
  return null;
1446
1458
  }
1447
1459
  }
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)));
1460
+ function w(p, u = !1) {
1461
+ const h = l(p);
1462
+ (p.includes("mask-image") || p.includes("sm: hover") || p.includes("sm:hover") || p.includes("mask.svg")) && console.error("DEBUG generateRule:", p, h);
1463
+ let b = !1, d = h.find(($) => ($.startsWith("!") && (b = !0, $ = $.slice(1)), se[$] || ce($) || ue($) || fe($) || G($)));
1451
1464
  if (!d) return null;
1452
- const v = d.replace(/^!/, ""), m = Y[v] ?? re(v) ?? oe(v) ?? ne(v) ?? J(v);
1465
+ const v = d.replace(/^!/, ""), m = se[v] ?? ce(v) ?? ue(v) ?? fe(v) ?? G(v);
1453
1466
  if (!m) return null;
1454
1467
  const k = h.indexOf(d);
1455
1468
  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(/\{.*$/, ""));
1469
+ u && (_ = _.filter(($) => $ !== "dark"));
1470
+ const C = `.${tt(p)}`, E = "__SUBJECT__", j = b ? m.replace(/;$/, " !important;") : m;
1471
+ let A = E;
1472
+ const re = [];
1473
+ for (const $ of _)
1474
+ $.startsWith("group-") ? (A = `.group:${$.slice(6)} ${A}`, re.push($)) : $.startsWith("peer-") && (A = A.replace(E, `.peer:${$.slice(5)}~${E}`), re.push($));
1475
+ _ = _.filter(($) => !re.includes($));
1476
+ const ne = [], me = [];
1477
+ let N = null;
1478
+ for (const $ of _) {
1479
+ if ($ === "dark" || le.includes($)) continue;
1480
+ const M = et($);
1481
+ if (M) {
1482
+ N = M;
1483
+ continue;
1484
+ }
1485
+ const L = x($);
1486
+ if (L) {
1487
+ N ? me.push(L) : ne.push(L);
1488
+ continue;
1489
+ }
1490
+ const B = Xe[$];
1491
+ typeof B == "function" && (A = B(A, j).split("{")[0]);
1474
1492
  }
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);
1493
+ function je($, M) {
1494
+ if (!M) return $;
1495
+ let L = 0, B = 0;
1496
+ if ($.length && ($[0] === ">" || $[0] === "+" || $[0] === "~" || $[0] === " ")) {
1497
+ let T = 1;
1498
+ for (; T < $.length && $[T] === " "; ) T++;
1499
+ for (; T < $.length; T++) {
1500
+ const z = $[T];
1501
+ if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && ($[T] === ">" || $[T] === "+" || $[T] === "~" || $[T] === " "))
1502
+ return $.slice(0, T) + M + $.slice(T);
1484
1503
  }
1504
+ return $ + M;
1485
1505
  }
1506
+ for (let T = 0; T < $.length; T++) {
1507
+ const z = $[T];
1508
+ if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && (z === ">" || z === "+" || z === "~" || z === " "))
1509
+ return $.slice(0, T) + M + $.slice(T);
1510
+ }
1511
+ return $ + M;
1486
1512
  }
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)
1513
+ const oe = ne.join(""), K = me.join("");
1514
+ if (N)
1515
+ if (N.includes("&")) {
1516
+ const $ = N.indexOf("&"), M = N.slice(0, $), L = N.slice($ + 1), B = E + oe, T = A;
1517
+ if (ne.length === 0)
1518
+ A = T.replace(E, M + B + K + L);
1519
+ else {
1520
+ const z = je(L, K);
1521
+ A = T.replace(E, M + B + z);
1522
+ }
1523
+ } else
1524
+ A = A.replace(E, `${N}${E + oe}`), K && (A = A.replace(E, `${E}${K}`));
1525
+ else
1526
+ A = E + oe + K;
1527
+ A = A.replace(new RegExp(E, "g"), C);
1528
+ let O = `${A}{${j}}`;
1529
+ const ie = _.filter(($) => le.includes($)), H = ie.length ? ie[ie.length - 1] : null, be = _.includes("dark");
1530
+ return u && H ? O = `@media (prefers-color-scheme: dark) and ${ae[H]}{${O}}` : u ? O = `@media (prefers-color-scheme: dark){${O}}` : be && H ? O = `@media (prefers-color-scheme: dark) and ${ae[H]}{${O}}` : be ? O = `@media (prefers-color-scheme: dark){${O}}` : H && (O = `@media ${ae[H]}{${O}}`), O;
1531
+ }
1532
+ for (const p of o) {
1533
+ const u = l(p), h = u.find(
1534
+ (m) => se[m] || ce(m) || ue(m) || fe(m) || G(m)
1495
1535
  );
1496
1536
  if (!h) continue;
1497
- const b = u.indexOf(h), d = b >= 0 ? u.slice(0, b) : [], v = p(d);
1537
+ const b = u.indexOf(h), d = b >= 0 ? u.slice(0, b) : [], v = g(d);
1498
1538
  if (v === 4) {
1499
- const m = y(g, !0);
1539
+ const m = y(p, !0);
1500
1540
  m && c.push(m);
1501
1541
  } else {
1502
- const m = y(g);
1542
+ const m = y(p);
1503
1543
  m && (v === 1 ? s.push(m) : v === 2 ? i.push(m) : v === 3 && a.push(m));
1504
1544
  }
1505
1545
  }
1506
- const $ = [...s, ...i, ...a, ...c].join("");
1507
- return be.set(e, { css: $, timestamp: t }), $;
1546
+ const S = [...s, ...i, ...a, ...c].join("");
1547
+ return Se.set(e, { css: S, timestamp: t }), S;
1508
1548
  }
1509
- const q = [];
1510
- function et(e, t, r, n, o, s, i, a) {
1549
+ const J = [];
1550
+ function it(e, t, r, n, o, s, i, a) {
1511
1551
  if (e) {
1512
- q.push(r);
1552
+ J.push(r);
1513
1553
  try {
1514
1554
  if (t.loadingTemplate && r.isLoading) {
1515
- O(e, t.loadingTemplate(r), r, n, o);
1555
+ I(e, t.loadingTemplate(r), r, n, o);
1516
1556
  return;
1517
1557
  }
1518
1558
  if (t.errorTemplate && r.hasError) {
1519
- r.error instanceof Error && O(e, t.errorTemplate(r.error, r), r, n, o);
1559
+ r.error instanceof Error && I(e, t.errorTemplate(r.error, r), r, n, o);
1520
1560
  return;
1521
1561
  }
1522
1562
  const c = t.render(r);
1523
1563
  if (c instanceof Promise) {
1524
1564
  s(!0), c.then((f) => {
1525
- s(!1), i(null), O(e, f, r, n, o), a(e.innerHTML);
1565
+ s(!1), i(null), I(e, f, r, n, o), a(e.innerHTML);
1526
1566
  }).catch((f) => {
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);
1567
+ s(!1), i(f), t.errorTemplate && I(e, t.errorTemplate(f, r), r, n, o);
1568
+ }), t.loadingTemplate && I(e, t.loadingTemplate(r), r, n, o);
1529
1569
  return;
1530
1570
  }
1531
- O(e, c, r, n, o), a(e.innerHTML);
1571
+ I(e, c, r, n, o), a(e.innerHTML);
1532
1572
  } finally {
1533
- q.pop();
1573
+ J.pop();
1534
1574
  }
1535
1575
  }
1536
1576
  }
1537
- function O(e, t, r, n, o) {
1538
- e && (Ie(
1577
+ function I(e, t, r, n, o) {
1578
+ e && (Ke(
1539
1579
  e,
1540
1580
  Array.isArray(t) ? t : [t],
1541
1581
  r,
1542
1582
  n
1543
1583
  ), o(e.innerHTML));
1544
1584
  }
1545
- function tt(e, t, r, n, o, s, i) {
1585
+ function st(e, t, r, n, o, s, i) {
1546
1586
  if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1547
1587
  if (o(r + 1), r > 10) {
1548
1588
  console.warn("Potential infinite render loop detected. Skipping render."), i(null);
@@ -1555,32 +1595,32 @@ function tt(e, t, r, n, o, s, i) {
1555
1595
  }, 0);
1556
1596
  i(c);
1557
1597
  }
1558
- function rt(e, t, r, n, o, s) {
1598
+ function at(e, t, r, n, o, s) {
1559
1599
  if (!e) return;
1560
- const i = Ge(n);
1600
+ const i = ot(n);
1561
1601
  if (!t.style && (!i || i.trim() === "")) {
1562
- s(null), e.adoptedStyleSheets = [he()];
1602
+ s(null), e.adoptedStyleSheets = [we()];
1563
1603
  return;
1564
1604
  }
1565
1605
  let a = "";
1566
1606
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1567
- let c = Fe(`${a}
1607
+ let c = Ve(`${a}
1568
1608
  ${i}
1569
1609
  `);
1570
- c = $e(c);
1610
+ c = Te(c);
1571
1611
  let f = o;
1572
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [he(), f], s(f);
1612
+ f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [we(), f], s(f);
1573
1613
  }
1574
- const nt = /* @__PURE__ */ new Map();
1575
- function ve(e, t, r) {
1576
- let n = ce(e);
1614
+ const lt = /* @__PURE__ */ new Map();
1615
+ function _e(e, t, r) {
1616
+ let n = ye(e);
1577
1617
  n.includes("-") || (n = `cer-${n}`);
1578
1618
  let o;
1579
1619
  typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
1580
1620
  console.error(`[${n}] Error:`, s, i);
1581
- }), nt.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, ot(o));
1621
+ }), lt.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, ct(o));
1582
1622
  }
1583
- function ot(e) {
1623
+ function ct(e) {
1584
1624
  if (!e.render)
1585
1625
  throw new Error(
1586
1626
  "Component must have a render function"
@@ -1667,7 +1707,7 @@ function ot(e) {
1667
1707
  }
1668
1708
  connectedCallback() {
1669
1709
  this._runLogicWithinErrorBoundary(e, () => {
1670
- Be(
1710
+ Oe(
1671
1711
  e,
1672
1712
  this.context,
1673
1713
  this._mounted,
@@ -1679,7 +1719,7 @@ function ot(e) {
1679
1719
  }
1680
1720
  disconnectedCallback() {
1681
1721
  this._runLogicWithinErrorBoundary(e, () => {
1682
- Re(
1722
+ Me(
1683
1723
  e,
1684
1724
  this.context,
1685
1725
  this._listeners,
@@ -1703,7 +1743,7 @@ function ot(e) {
1703
1743
  }
1704
1744
  attributeChangedCallback(t, r, n) {
1705
1745
  this._runLogicWithinErrorBoundary(e, () => {
1706
- this._applyProps(e), Ne(
1746
+ this._applyProps(e), We(
1707
1747
  e,
1708
1748
  t,
1709
1749
  r,
@@ -1713,7 +1753,7 @@ function ot(e) {
1713
1753
  });
1714
1754
  }
1715
1755
  static get observedAttributes() {
1716
- return e.props ? Object.keys(e.props).map(ce) : [];
1756
+ return e.props ? Object.keys(e.props).map(ye) : [];
1717
1757
  }
1718
1758
  _applyComputed(t) {
1719
1759
  this._runLogicWithinErrorBoundary(e, () => {
@@ -1721,7 +1761,7 @@ function ot(e) {
1721
1761
  Object.defineProperty(this.context, r, {
1722
1762
  get: () => {
1723
1763
  const o = n(this.context);
1724
- return se(o);
1764
+ return pe(o);
1725
1765
  },
1726
1766
  enumerable: !0
1727
1767
  });
@@ -1731,7 +1771,7 @@ function ot(e) {
1731
1771
  // --- Render ---
1732
1772
  _render(t) {
1733
1773
  this._runLogicWithinErrorBoundary(t, () => {
1734
- et(
1774
+ it(
1735
1775
  this.shadowRoot,
1736
1776
  t,
1737
1777
  this.context,
@@ -1754,7 +1794,7 @@ function ot(e) {
1754
1794
  }
1755
1795
  _requestRender() {
1756
1796
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1757
- tt(
1797
+ st(
1758
1798
  () => this._render(this._cfg),
1759
1799
  this._lastRenderTime,
1760
1800
  this._renderCount,
@@ -1774,7 +1814,7 @@ function ot(e) {
1774
1814
  // --- Style ---
1775
1815
  _applyStyle(t, r) {
1776
1816
  this._runLogicWithinErrorBoundary(t, () => {
1777
- rt(
1817
+ at(
1778
1818
  this.shadowRoot,
1779
1819
  t,
1780
1820
  this.context,
@@ -1813,8 +1853,8 @@ function ot(e) {
1813
1853
  "splice",
1814
1854
  "sort",
1815
1855
  "reverse"
1816
- ].includes(a) ? function(...p) {
1817
- const l = f.apply(i, p);
1856
+ ].includes(a) ? function(...g) {
1857
+ const l = f.apply(i, g);
1818
1858
  if (!n._initializing) {
1819
1859
  const x = s || "root";
1820
1860
  n._triggerWatchers(x, i), n._render(t);
@@ -1860,7 +1900,7 @@ function ot(e) {
1860
1900
  }
1861
1901
  _initWatchers(t) {
1862
1902
  this._runLogicWithinErrorBoundary(t, () => {
1863
- Le(
1903
+ Be(
1864
1904
  this.context,
1865
1905
  this._watchers,
1866
1906
  t.watch || {}
@@ -1868,12 +1908,12 @@ function ot(e) {
1868
1908
  });
1869
1909
  }
1870
1910
  _triggerWatchers(t, r) {
1871
- je(this.context, this._watchers, t, r);
1911
+ Re(this.context, this._watchers, t, r);
1872
1912
  }
1873
1913
  _applyProps(t) {
1874
1914
  this._runLogicWithinErrorBoundary(t, () => {
1875
1915
  try {
1876
- ze(this, t, this.context);
1916
+ Pe(this, t, this.context);
1877
1917
  } catch (r) {
1878
1918
  this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
1879
1919
  }
@@ -1881,34 +1921,34 @@ function ot(e) {
1881
1921
  }
1882
1922
  };
1883
1923
  }
1884
- function H(e, t = {}, r, n) {
1924
+ function V(e, t = {}, r, n) {
1885
1925
  const o = n ?? t.key;
1886
1926
  return { tag: e, key: o, props: t, children: r };
1887
1927
  }
1888
- function Z(e) {
1928
+ function ee(e) {
1889
1929
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
1890
1930
  }
1891
- function K(e) {
1892
- return typeof e == "object" && e !== null && "tag" in e && !Z(e);
1931
+ function X(e) {
1932
+ return typeof e == "object" && e !== null && "tag" in e && !ee(e);
1893
1933
  }
1894
- function it(e, t) {
1934
+ function ft(e, t) {
1895
1935
  return e.key != null ? e : { ...e, key: t };
1896
1936
  }
1897
- function st(e, t = [], r = {}) {
1937
+ function ut(e, t = [], r = {}) {
1898
1938
  const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1899
1939
  let a;
1900
1940
  for (; a = i.exec(e); ) {
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;
1903
- p || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1941
+ const c = a[1], f = a[2], y = (a[4] || a[6]) ?? "", g = y.match(/^{{(\d+)}}$/);
1942
+ let l = g ? t[Number(g[1])] ?? null : y;
1943
+ g || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1904
1944
  const x = ["model", "bind", "show", "class", "style"];
1905
1945
  if (c === ":") {
1906
- const [w, ...$] = f.split(".");
1946
+ const [w, ...S] = f.split(".");
1907
1947
  if (x.includes(w)) {
1908
- const g = [...$];
1948
+ const p = [...S];
1909
1949
  s[w] = {
1910
1950
  value: l,
1911
- modifiers: g
1951
+ modifiers: p
1912
1952
  };
1913
1953
  } else
1914
1954
  o[f] = l;
@@ -1919,18 +1959,18 @@ function st(e, t = [], r = {}) {
1919
1959
  }
1920
1960
  return { props: n, attrs: o, directives: s };
1921
1961
  }
1922
- function at(e, t, r) {
1923
- const n = q.length > 0 ? q[q.length - 1] : void 0, o = r ?? n;
1962
+ function dt(e, t, r) {
1963
+ const n = J.length > 0 ? J[J.length - 1] : void 0, o = r ?? n;
1924
1964
  function s(d, v) {
1925
- return H("#text", {}, d, v);
1965
+ return V("#text", {}, d, v);
1926
1966
  }
1927
1967
  let i = "";
1928
1968
  for (let d = 0; d < e.length; d++)
1929
1969
  i += e[d], d < t.length && (i += `{{${d}}}`);
1930
1970
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
1931
- let f, y = [], p = null, l = {}, x, w = 0, $ = [];
1932
- function g(d) {
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) => {
1971
+ let f, y = [], g = null, l = {}, x, w = 0, S = [];
1972
+ function p(d) {
1973
+ !d || typeof d != "object" || ee(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
1974
  if (v === "style" && l.attrs.style) {
1935
1975
  const m = l.attrs.style.replace(
1936
1976
  /;?\s*$/,
@@ -1947,8 +1987,8 @@ function at(e, t, r) {
1947
1987
  }))) : (l.props || (l.props = {}), Object.assign(l.props, d)));
1948
1988
  }
1949
1989
  function u(d, v) {
1950
- const m = p ? y : $;
1951
- if (Z(d)) {
1990
+ const m = g ? y : S;
1991
+ if (ee(d)) {
1952
1992
  const k = d.key ?? v;
1953
1993
  let _ = d.children;
1954
1994
  m.push({
@@ -1958,20 +1998,20 @@ function at(e, t, r) {
1958
1998
  });
1959
1999
  return;
1960
2000
  }
1961
- if (K(d)) {
1962
- m.push(it(d, void 0));
2001
+ if (X(d)) {
2002
+ m.push(ft(d, void 0));
1963
2003
  return;
1964
2004
  }
1965
2005
  if (Array.isArray(d)) {
1966
2006
  if (d.length === 0) return;
1967
2007
  for (let k = 0; k < d.length; k++) {
1968
2008
  const _ = d[k];
1969
- Z(_) || K(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ? g(_) : m.push(s(String(_), `${v}-${k}`));
2009
+ ee(_) || X(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ? p(_) : m.push(s(String(_), `${v}-${k}`));
1970
2010
  }
1971
2011
  return;
1972
2012
  }
1973
2013
  if (d !== null && typeof d == "object") {
1974
- g(d);
2014
+ p(d);
1975
2015
  return;
1976
2016
  }
1977
2017
  m.push(s(String(d), v));
@@ -1997,49 +2037,49 @@ function at(e, t, r) {
1997
2037
  const d = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || h.has(d), {
1998
2038
  props: k,
1999
2039
  attrs: _,
2000
- directives: S
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(
2006
- p,
2040
+ directives: C
2041
+ } = ut(f[2] || "", t, o), E = { props: {}, attrs: {} };
2042
+ for (const j in k) E.props[j] = k[j];
2043
+ for (const j in _) E.attrs[j] = _[j];
2044
+ if (Object.keys(C).length > 0 && (E.directives = { ...C }), v) {
2045
+ const j = V(
2046
+ g,
2007
2047
  l,
2008
- y.length === 1 && K(y[0]) && y[0].tag === "#text" ? typeof y[0].children == "string" ? y[0].children : "" : y.length ? y : void 0,
2048
+ y.length === 1 && X(y[0]) && y[0].tag === "#text" ? typeof y[0].children == "string" ? y[0].children : "" : y.length ? y : void 0,
2009
2049
  x
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({
2013
- tag: p,
2050
+ ), A = c.pop();
2051
+ A ? (g = A.tag, l = A.props, x = A.key, y = A.children, y.push(j)) : (S.push(j), g = null, l = {}, x = void 0, y = []);
2052
+ } else m ? g ? y.push(V(d, E, void 0, void 0)) : S.push(V(d, E, void 0, void 0)) : (g && c.push({
2053
+ tag: g,
2014
2054
  props: l,
2015
2055
  children: y,
2016
2056
  key: x
2017
- }), p = d, l = E, y = []);
2057
+ }), g = d, l = E, y = []);
2018
2058
  } else if (typeof f[3] < "u") {
2019
2059
  const d = Number(f[3]), v = t[d], m = `interp-${d}`;
2020
2060
  u(v, m);
2021
2061
  } else if (f[4]) {
2022
- const d = f[4], v = p ? y : $, m = d.split(/({{\d+}})/);
2062
+ const d = f[4], v = g ? y : S, m = d.split(/({{\d+}})/);
2023
2063
  for (const k of m) {
2024
2064
  if (!k) continue;
2025
2065
  const _ = k.match(/^{{(\d+)}}$/);
2026
2066
  if (_) {
2027
- const S = Number(_[1]), E = t[S], A = `interp-${S}`;
2028
- u(E, A);
2067
+ const C = Number(_[1]), E = t[C], j = `interp-${C}`;
2068
+ u(E, j);
2029
2069
  } else {
2030
- const S = `text-${w++}`;
2031
- v.push(s(k, S));
2070
+ const C = `text-${w++}`;
2071
+ v.push(s(k, C));
2032
2072
  }
2033
2073
  }
2034
2074
  }
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");
2075
+ const b = S.filter((d) => X(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2076
+ return b.length === 1 ? b[0] : b.length > 1 ? b : V("div", {}, "", "fallback-root");
2037
2077
  }
2038
- function W(e, ...t) {
2078
+ function U(e, ...t) {
2039
2079
  const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2040
- return at(e, t, n);
2080
+ return dt(e, t, n);
2041
2081
  }
2042
- const xe = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, B = (e, t) => {
2082
+ const Ce = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, W = (e, t) => {
2043
2083
  for (const r of e) {
2044
2084
  const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
2045
2085
  if (i) {
@@ -2050,114 +2090,114 @@ const xe = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new
2050
2090
  }
2051
2091
  }
2052
2092
  return { route: null, params: {} };
2053
- }, ie = {};
2054
- async function lt(e) {
2093
+ }, de = {};
2094
+ async function pt(e) {
2055
2095
  if (e.component) return e.component;
2056
2096
  if (e.load) {
2057
- if (ie[e.path]) return ie[e.path];
2097
+ if (de[e.path]) return de[e.path];
2058
2098
  try {
2059
2099
  const t = await e.load();
2060
- return ie[e.path] = t.default, t.default;
2100
+ return de[e.path] = t.default, t.default;
2061
2101
  } catch {
2062
2102
  throw new Error(`Failed to load component for route: ${e.path}`);
2063
2103
  }
2064
2104
  }
2065
2105
  throw new Error(`No component or loader defined for route: ${e.path}`);
2066
2106
  }
2067
- function ct(e) {
2107
+ function ht(e) {
2068
2108
  const { routes: t, base: r = "", initialUrl: n } = e;
2069
2109
  let o, s, i, a, c, f, y;
2070
- const p = async ($, g) => {
2071
- const u = t.find((h) => B([h], $.path).route !== null);
2110
+ const g = async (S, p) => {
2111
+ const u = t.find((h) => W([h], S.path).route !== null);
2072
2112
  if (u?.beforeEnter)
2073
2113
  try {
2074
- const h = await u.beforeEnter($, g);
2114
+ const h = await u.beforeEnter(S, p);
2075
2115
  return typeof h == "string" ? (await w(h, !0), !1) : h !== !1;
2076
2116
  } catch (h) {
2077
2117
  return console.error("beforeEnter error", h), !1;
2078
2118
  }
2079
2119
  return !0;
2080
- }, l = async ($, g) => {
2081
- const u = t.find((h) => B([h], $.path).route !== null);
2120
+ }, l = async (S, p) => {
2121
+ const u = t.find((h) => W([h], S.path).route !== null);
2082
2122
  if (u?.onEnter)
2083
2123
  try {
2084
- const h = await u.onEnter($, g);
2124
+ const h = await u.onEnter(S, p);
2085
2125
  return typeof h == "string" ? (await w(h, !0), !1) : h !== !1;
2086
2126
  } catch (h) {
2087
2127
  return console.error("onEnter error", h), !1;
2088
2128
  }
2089
2129
  return !0;
2090
- }, x = ($, g) => {
2091
- const u = t.find((h) => B([h], $.path).route !== null);
2130
+ }, x = (S, p) => {
2131
+ const u = t.find((h) => W([h], S.path).route !== null);
2092
2132
  if (u?.afterEnter)
2093
2133
  try {
2094
- u.afterEnter($, g);
2134
+ u.afterEnter(S, p);
2095
2135
  } catch (h) {
2096
2136
  console.error("afterEnter error", h);
2097
2137
  }
2098
- }, w = async ($, g = !1) => {
2138
+ }, w = async (S, p = !1) => {
2099
2139
  try {
2100
2140
  const u = {
2101
- path: $.replace(r, "") || "/",
2141
+ path: S.replace(r, "") || "/",
2102
2142
  query: {}
2103
- }, h = B(t, u.path);
2143
+ }, h = W(t, u.path);
2104
2144
  if (!h) throw new Error(`No route found for ${u.path}`);
2105
2145
  const b = i.getState(), d = {
2106
2146
  path: u.path,
2107
2147
  params: h.params,
2108
2148
  query: u.query
2109
2149
  };
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);
2150
+ if (!await g(d, b) || !await l(d, b)) return;
2151
+ typeof window < "u" && typeof document < "u" && (p ? window.history.replaceState({}, "", r + S) : window.history.pushState({}, "", r + S)), i.setState(d), x(d, b);
2112
2152
  } catch (u) {
2113
2153
  console.error("Navigation error:", u);
2114
2154
  }
2115
2155
  };
2116
2156
  if (typeof window < "u" && typeof document < "u") {
2117
2157
  o = () => {
2118
- const g = new URL(window.location.href), u = g.pathname.replace(r, "") || "/", h = xe(g.search);
2158
+ const p = new URL(window.location.href), u = p.pathname.replace(r, "") || "/", h = Ce(p.search);
2119
2159
  return { path: u, query: h };
2120
2160
  }, s = o();
2121
- const $ = B(t, s.path);
2122
- i = de({
2161
+ const S = W(t, s.path);
2162
+ i = ve({
2123
2163
  path: s.path,
2124
- params: $.params,
2164
+ params: S.params,
2125
2165
  query: s.query
2126
- }), a = async (g = !1) => {
2166
+ }), a = async (p = !1) => {
2127
2167
  const u = o();
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();
2168
+ await w(u.path, p);
2169
+ }, window.addEventListener("popstate", () => a(!0)), c = (p) => w(p, !1), f = (p) => w(p, !0), y = () => window.history.back();
2130
2170
  } else {
2131
2171
  o = () => {
2132
- const u = new URL(n || "/", "http://localhost"), h = u.pathname.replace(r, "") || "/", b = xe(u.search);
2172
+ const u = new URL(n || "/", "http://localhost"), h = u.pathname.replace(r, "") || "/", b = Ce(u.search);
2133
2173
  return { path: h, query: b };
2134
2174
  }, s = o();
2135
- const $ = B(t, s.path);
2136
- i = de({
2175
+ const S = W(t, s.path);
2176
+ i = ve({
2137
2177
  path: s.path,
2138
- params: $.params,
2178
+ params: S.params,
2139
2179
  query: s.query
2140
2180
  }), a = async () => {
2141
2181
  const u = o();
2142
- await g(u.path);
2182
+ await p(u.path);
2143
2183
  };
2144
- const g = async (u) => {
2184
+ const p = async (u) => {
2145
2185
  try {
2146
2186
  const h = {
2147
2187
  path: u.replace(r, "") || "/",
2148
2188
  query: {}
2149
- }, b = B(t, h.path);
2189
+ }, b = W(t, h.path);
2150
2190
  if (!b) throw new Error(`No route found for ${h.path}`);
2151
2191
  const d = i.getState(), v = {
2152
2192
  path: h.path,
2153
2193
  params: b.params,
2154
2194
  query: h.query
2155
- }, m = t.find((k) => B([k], v.path).route !== null);
2195
+ }, m = t.find((k) => W([k], v.path).route !== null);
2156
2196
  if (m?.beforeEnter)
2157
2197
  try {
2158
2198
  const k = await m.beforeEnter(v, d);
2159
2199
  if (typeof k == "string") {
2160
- await g(k);
2200
+ await p(k);
2161
2201
  return;
2162
2202
  }
2163
2203
  if (k === !1) return;
@@ -2168,7 +2208,7 @@ function ct(e) {
2168
2208
  try {
2169
2209
  const k = await m.onEnter(v, d);
2170
2210
  if (typeof k == "string") {
2171
- await g(k);
2211
+ await p(k);
2172
2212
  return;
2173
2213
  }
2174
2214
  if (k === !1) return;
@@ -2183,7 +2223,7 @@ function ct(e) {
2183
2223
  } catch {
2184
2224
  }
2185
2225
  };
2186
- c = async (u) => g(u), f = async (u) => g(u), y = () => {
2226
+ c = async (u) => p(u), f = async (u) => p(u), y = () => {
2187
2227
  };
2188
2228
  }
2189
2229
  return {
@@ -2192,34 +2232,34 @@ function ct(e) {
2192
2232
  replace: f,
2193
2233
  back: y,
2194
2234
  subscribe: i.subscribe,
2195
- matchRoute: ($) => B(t, $),
2235
+ matchRoute: (S) => W(t, S),
2196
2236
  getCurrent: () => i.getState(),
2197
- resolveRouteComponent: lt
2237
+ resolveRouteComponent: pt
2198
2238
  };
2199
2239
  }
2200
- function mt(e, t) {
2201
- return B(e, t);
2240
+ function kt(e, t) {
2241
+ return W(e, t);
2202
2242
  }
2203
- function bt(e) {
2204
- const t = ct(e);
2205
- return ve("router-view", {
2243
+ function $t(e) {
2244
+ const t = ht(e);
2245
+ return _e("router-view", {
2206
2246
  async render() {
2207
- if (!t) return W`<div>Router not initialized.</div>`;
2247
+ if (!t) return U`<div>Router not initialized.</div>`;
2208
2248
  const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
2209
- if (!o.route) return W`<div>Not found</div>`;
2249
+ if (!o.route) return U`<div>Not found</div>`;
2210
2250
  let s = o.route.component;
2211
2251
  if (o.route.load) {
2212
2252
  const i = await o.route.load();
2213
2253
  typeof i.default == "string" && (s = i.default);
2214
2254
  }
2215
- return typeof s == "string" ? { tag: s, props: {}, children: [] } : W`<div>Invalid route component</div>`;
2255
+ return typeof s == "string" ? { tag: s, props: {}, children: [] } : U`<div>Invalid route component</div>`;
2216
2256
  },
2217
2257
  onConnected(r) {
2218
2258
  t && typeof t.subscribe == "function" && t.subscribe(() => {
2219
2259
  typeof r.requestRender == "function" && r.requestRender();
2220
2260
  });
2221
2261
  }
2222
- }), ve("router-link", {
2262
+ }), _e("router-link", {
2223
2263
  state: {},
2224
2264
  props: {
2225
2265
  to: { type: String, default: "" },
@@ -2232,7 +2272,7 @@ function bt(e) {
2232
2272
  disabled: { type: Boolean, default: !1 },
2233
2273
  external: { type: Boolean, default: !1 },
2234
2274
  class: { type: String, default: "" },
2235
- style: { type: String, default: ke`
2275
+ style: { type: String, default: Ae`
2236
2276
  [aria-disabled="true"] {
2237
2277
  pointer-events: none;
2238
2278
  opacity: 0.5;
@@ -2241,25 +2281,32 @@ function bt(e) {
2241
2281
  },
2242
2282
  style: (r) => r.style,
2243
2283
  render: (r) => {
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`
2284
+ 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, g = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, w = l ? `aria-current="${c}"` : "", S = (r.class || "").split(/\s+/).filter(Boolean), p = {};
2285
+ for (const v of S) p[v] = !0;
2286
+ const u = {
2287
+ ...p,
2288
+ // Also include the configurable names (may duplicate the above)
2289
+ [a]: x,
2290
+ [i]: l
2291
+ }, h = f === "button", b = y ? h ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", d = g && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2292
+ return U`
2293
+ ${Le().when(h, U`
2247
2294
  <button
2248
2295
  part="button"
2249
- :class="${r.class} ${w}"
2250
- ${$}
2251
- ${u}
2252
- ${h}
2296
+ :class="${u}"
2297
+ ${w}
2298
+ ${b}
2299
+ ${d}
2253
2300
  @click="navigate"
2254
2301
  ><slot></slot></button>
2255
- `).otherwise(W`
2302
+ `).otherwise(U`
2256
2303
  <a
2257
2304
  part="link"
2258
2305
  href="${o}"
2259
- :class="${r.class} ${w}"
2260
- ${$}
2261
- ${u}
2262
- ${h}
2306
+ :class="${u}"
2307
+ ${w}
2308
+ ${b}
2309
+ ${d}
2263
2310
  @click="navigate"
2264
2311
  ><slot></slot></a>
2265
2312
  `).done()}
@@ -2275,25 +2322,25 @@ function bt(e) {
2275
2322
  }), t;
2276
2323
  }
2277
2324
  export {
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
2325
+ F as GlobalEventBus,
2326
+ _e as component,
2327
+ ve as createStore,
2328
+ Ae as css,
2329
+ yt as each,
2330
+ mt as emit,
2331
+ Z as eventBus,
2332
+ U as html,
2333
+ $t as initRouter,
2334
+ wt as listen,
2335
+ Le as match,
2336
+ W as matchRoute,
2337
+ kt as matchRouteSSR,
2338
+ vt as off,
2339
+ bt as on,
2340
+ xt as once,
2341
+ Ce as parseQuery,
2342
+ pt as resolveRouteComponent,
2343
+ ht as useRouter,
2344
+ gt as when
2298
2345
  };
2299
2346
  //# sourceMappingURL=custom-elements-runtime.es.js.map