@jasonshimmy/custom-elements-runtime 0.2.0 → 0.2.1

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