@jasonshimmy/custom-elements-runtime 0.2.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- function xt(e, t) {
2
- return fe(e ? t : [], "when-block");
1
+ function vt(e, t) {
2
+ return pe(e ? t : [], "when-block");
3
3
  }
4
4
  function kt(e, t) {
5
5
  return e.map((r, i) => {
6
6
  const n = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${i}` : String(r);
7
- return fe(t(r, i), `each-${n}`);
7
+ return pe(t(r, i), `each-${n}`);
8
8
  });
9
9
  }
10
- function Pe() {
10
+ function ze() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function Pe() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Ne(...e);
20
+ return He(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Ne(...e) {
24
+ function He(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, i] = e[t];
27
- if (r) return [fe(i, `whenChain-branch-${t}`)];
27
+ if (r) return [pe(i, `whenChain-branch-${t}`)];
28
28
  }
29
- return [fe([], "whenChain-empty")];
29
+ return [pe([], "whenChain-empty")];
30
30
  }
31
- function fe(e, t) {
31
+ function pe(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 fe(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class G extends EventTarget {
39
+ class X extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class G extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return G.instance || (G.instance = new G()), G.instance;
47
+ return X.instance || (X.instance = new X()), X.instance;
48
48
  }
49
49
  /**
50
50
  * Emit a global event with optional data. Includes event storm protection.
@@ -63,10 +63,10 @@ class G extends EventTarget {
63
63
  // Global events don't need to bubble
64
64
  cancelable: !0
65
65
  }));
66
- const s = this.handlers[t];
67
- s && s.forEach((o) => {
66
+ const o = this.handlers[t];
67
+ o && o.forEach((s) => {
68
68
  try {
69
- o(r);
69
+ s(r);
70
70
  } catch (a) {
71
71
  console.error(`Error in global event handler for "${t}":`, a);
72
72
  }
@@ -112,8 +112,8 @@ class G extends EventTarget {
112
112
  */
113
113
  once(t, r) {
114
114
  return new Promise((i) => {
115
- const n = this.on(t, (s) => {
116
- n(), r(s), i(s);
115
+ const n = this.on(t, (o) => {
116
+ n(), r(o), i(o);
117
117
  });
118
118
  });
119
119
  }
@@ -157,7 +157,7 @@ class G extends EventTarget {
157
157
  this.eventCounters.clear();
158
158
  }
159
159
  }
160
- const re = G.getInstance(), vt = (e, t) => re.emit(e, t), $t = (e, t) => re.on(e, t), _t = (e, t) => re.off(e, t), St = (e, t) => re.once(e, t), Et = (e, t, r) => re.listen(e, t, r);
160
+ const ie = X.getInstance(), _t = (e, t) => ie.emit(e, t), $t = (e, t) => ie.on(e, t), St = (e, t) => ie.off(e, t), Et = (e, t) => ie.once(e, t), Ct = (e, t, r) => ie.listen(e, t, r);
161
161
  function $e(e) {
162
162
  let t = { ...e };
163
163
  const r = [];
@@ -167,19 +167,19 @@ function $e(e) {
167
167
  function n() {
168
168
  return t;
169
169
  }
170
- function s(a) {
170
+ function o(a) {
171
171
  const f = typeof a == "function" ? a(t) : a;
172
- t = { ...t, ...f }, o();
172
+ t = { ...t, ...f }, s();
173
173
  }
174
- function o() {
174
+ function s() {
175
175
  r.forEach((a) => a(t));
176
176
  }
177
- return { subscribe: i, getState: n, setState: s };
177
+ return { subscribe: i, getState: n, setState: o };
178
178
  }
179
- function J(e) {
179
+ function Y(e) {
180
180
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
181
181
  }
182
- function H(e) {
182
+ function J(e) {
183
183
  return typeof e == "string" ? e.replace(
184
184
  /[&<>"']/g,
185
185
  (t) => ({
@@ -191,77 +191,83 @@ function H(e) {
191
191
  })[t]
192
192
  ) : e;
193
193
  }
194
- function z(e, t) {
194
+ function W(e, t) {
195
195
  return typeof t == "string" ? t.split(".").reduce((r, i) => r?.[i], e) : t;
196
196
  }
197
- function oe(e, t, r) {
197
+ function ce(e, t, r) {
198
198
  const i = String(t).split("."), n = i.pop();
199
199
  if (!n) return;
200
- const s = i.reduce((o, a) => (o[a] == null && (o[a] = {}), o[a]), e);
201
- s[n] = r;
200
+ const o = i.reduce((s, a) => (s[a] == null && (s[a] = {}), s[a]), e);
201
+ o[n] = r;
202
202
  }
203
- function ze(e, t, r) {
203
+ function qe(e, t, r) {
204
204
  if (r)
205
205
  for (const [i, n] of Object.entries(r)) {
206
- let s, o = {};
207
- if (Array.isArray(n) ? (s = n[0], o = n[1] || {}) : s = n, t.set(i, {
208
- callback: s,
209
- options: o,
210
- oldValue: z(e, i)
211
- }), o.immediate)
206
+ let o, s = {};
207
+ if (Array.isArray(n) ? (o = n[0], s = n[1] || {}) : o = n, t.set(i, {
208
+ callback: o,
209
+ options: s,
210
+ oldValue: W(e, i)
211
+ }), s.immediate)
212
212
  try {
213
- const a = z(e, i);
214
- s(a, void 0, e);
213
+ const a = W(e, i);
214
+ o(a, void 0, e);
215
215
  } catch (a) {
216
216
  console.error(`Error in immediate watcher for "${i}":`, a);
217
217
  }
218
218
  }
219
219
  }
220
- function Me(e, t, r, i) {
221
- const n = (o, a) => {
222
- if (o === a) return !0;
223
- if (typeof o != typeof a || typeof o != "object" || o === null || a === null) return !1;
224
- if (Array.isArray(o) && Array.isArray(a))
225
- return o.length !== a.length ? !1 : o.every((d, y) => n(d, a[y]));
226
- const f = Object.keys(o), u = Object.keys(a);
227
- return f.length !== u.length ? !1 : f.every((d) => n(o[d], a[d]));
228
- }, s = t.get(r);
229
- if (s && !n(i, s.oldValue))
220
+ function Ie(e, t, r, i) {
221
+ const n = (s, a) => {
222
+ if (s === a) return !0;
223
+ if (typeof s != typeof a || typeof s != "object" || s === null || a === null) return !1;
224
+ if (Array.isArray(s) && Array.isArray(a))
225
+ return s.length !== a.length ? !1 : s.every((h, C) => n(h, a[C]));
226
+ const f = Object.keys(s), p = Object.keys(a);
227
+ return f.length !== p.length ? !1 : f.every((h) => n(s[h], a[h]));
228
+ }, o = t.get(r);
229
+ if (o && !n(i, o.oldValue))
230
230
  try {
231
- s.callback(i, s.oldValue, e), s.oldValue = i;
232
- } catch (o) {
233
- console.error(`Error in watcher for "${r}":`, o);
231
+ o.callback(i, o.oldValue, e), o.oldValue = i;
232
+ } catch (s) {
233
+ console.error(`Error in watcher for "${r}":`, s);
234
234
  }
235
- for (const [o, a] of t.entries())
236
- if (a.options.deep && r.startsWith(o + "."))
235
+ for (const [s, a] of t.entries())
236
+ if (a.options.deep && r.startsWith(s + "."))
237
237
  try {
238
- const f = z(e, o);
238
+ const f = W(e, s);
239
239
  n(f, a.oldValue) || (a.callback(f, a.oldValue, e), a.oldValue = f);
240
240
  } catch (f) {
241
- console.error(`Error in deep watcher for "${o}":`, f);
241
+ console.error(`Error in deep watcher for "${s}":`, f);
242
242
  }
243
243
  }
244
- function We(e, t, r) {
244
+ function Ne(e, t, r) {
245
245
  if (!t.props) return;
246
- function i(n, s) {
247
- return s === Boolean ? n === "true" : s === Number ? Number(n) : n;
246
+ function i(n, o) {
247
+ return o === Boolean ? n === "true" : o === Number ? Number(n) : n;
248
248
  }
249
- Object.entries(t.props).forEach(([n, s]) => {
250
- if (s.type === Function && typeof e[n] == "function")
249
+ Object.entries(t.props).forEach(([n, o]) => {
250
+ if (o.type === Function && typeof e[n] == "function")
251
251
  r[n] = e[n];
252
252
  else {
253
- const o = e.getAttribute(J(n));
254
- o !== null ? r[n] = H(i(o, s.type)) : "default" in s && s.default !== void 0 && (r[n] = H(s.default));
253
+ const s = Y(n), a = e.getAttribute(s);
254
+ if (typeof e[n] < "u")
255
+ try {
256
+ r[n] = J(i(e[n], o.type));
257
+ } catch {
258
+ r[n] = e[n];
259
+ }
260
+ else a !== null ? r[n] = J(i(a, o.type)) : "default" in o && o.default !== void 0 && (r[n] = J(o.default));
255
261
  }
256
262
  });
257
263
  }
258
- function qe(e, t, r, i) {
264
+ function We(e, t, r, i) {
259
265
  e.onConnected && !r && (e.onConnected(t), i(!0));
260
266
  }
261
- function De(e, t, r, i, n, s, o, a) {
262
- e.onDisconnected && e.onDisconnected(t), r.forEach((f) => f()), i(), n(), s(!1), o(null), a(!1);
267
+ function De(e, t, r, i, n, o, s, a) {
268
+ e.onDisconnected && e.onDisconnected(t), r.forEach((f) => f()), i(), n(), o(!1), s(null), a(!1);
263
269
  }
264
- function Ie(e, t, r, i, n) {
270
+ function Ue(e, t, r, i, n) {
265
271
  e.onAttributeChanged && e.onAttributeChanged(t, r, i, n);
266
272
  }
267
273
  function V(e, t) {
@@ -272,94 +278,94 @@ function V(e, t) {
272
278
  V(r, t);
273
279
  }
274
280
  }
275
- function He(e, t, r, i, n, s, o, a) {
276
- if (!s) return;
277
- const f = t.includes("lazy"), u = t.includes("trim"), d = t.includes("number"), y = () => z(s._state || s, e), c = y();
278
- let h = "text";
279
- o instanceof HTMLInputElement ? h = i?.type || o.type || "text" : o instanceof HTMLSelectElement ? h = "select" : o instanceof HTMLTextAreaElement && (h = "textarea");
280
- const k = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, w = k ? h === "checkbox" || h === "radio" ? "checked" : "value" : a ?? "modelValue";
281
- if (h === "checkbox")
282
- if (Array.isArray(c))
283
- r[w] = c.includes(String(o?.getAttribute("value") ?? i?.value ?? ""));
281
+ function Fe(e, t, r, i, n, o, s, a) {
282
+ if (!o) return;
283
+ const f = t.includes("lazy"), p = t.includes("trim"), h = t.includes("number"), C = () => W(o._state || o, e), u = C();
284
+ let c = "text";
285
+ s instanceof HTMLInputElement ? c = i?.type || s.type || "text" : s instanceof HTMLSelectElement ? c = "select" : s instanceof HTMLTextAreaElement && (c = "textarea");
286
+ const w = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement, d = w ? c === "checkbox" || c === "radio" ? "checked" : "value" : a ?? "modelValue";
287
+ if (c === "checkbox")
288
+ if (Array.isArray(u))
289
+ r[d] = u.includes(String(s?.getAttribute("value") ?? i?.value ?? ""));
284
290
  else {
285
- const x = o?.getAttribute("true-value") ?? !0;
286
- r[w] = c === x;
291
+ const x = s?.getAttribute("true-value") ?? !0;
292
+ r[d] = u === x;
287
293
  }
288
- else if (h === "radio")
289
- r[w] = c === (i?.value ?? "");
290
- else if (h === "select")
291
- if (o && o.hasAttribute("multiple") && o instanceof HTMLSelectElement) {
292
- const x = Array.isArray(c) ? c.map(String) : [];
294
+ else if (c === "radio")
295
+ r[d] = u === (i?.value ?? "");
296
+ else if (c === "select")
297
+ if (s && s.hasAttribute("multiple") && s instanceof HTMLSelectElement) {
298
+ const x = Array.isArray(u) ? u.map(String) : [];
293
299
  setTimeout(() => {
294
- Array.from(o.options).forEach((l) => {
300
+ Array.from(s.options).forEach((l) => {
295
301
  l.selected = x.includes(l.value);
296
302
  });
297
- }, 0), r[w] = Array.isArray(c) ? c : [];
303
+ }, 0), r[d] = Array.isArray(u) ? u : [];
298
304
  } else
299
- r[w] = c;
305
+ r[d] = u;
300
306
  else {
301
- r[w] = c;
307
+ r[d] = u;
302
308
  try {
303
- const x = J(w);
304
- i && (i[x] = c);
309
+ const x = Y(d);
310
+ i && (i[x] = u);
305
311
  } catch {
306
312
  }
307
313
  }
308
- const b = f || h === "checkbox" || h === "radio" || h === "select" ? "change" : "input", m = (x) => {
314
+ const g = f || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", m = (x) => {
309
315
  if (x.isComposing || n._isComposing || x.isTrusted === !1) return;
310
316
  const l = x.target;
311
317
  if (!l || l._modelUpdating) return;
312
- let g = l.value;
313
- if (h === "checkbox") {
314
- const E = y();
315
- if (Array.isArray(E)) {
316
- const S = l.getAttribute("value") ?? "", A = Array.from(E);
318
+ let b = l.value;
319
+ if (c === "checkbox") {
320
+ const S = C();
321
+ if (Array.isArray(S)) {
322
+ const A = l.getAttribute("value") ?? "", $ = Array.from(S);
317
323
  if (l.checked)
318
- A.includes(S) || A.push(S);
324
+ $.includes(A) || $.push(A);
319
325
  else {
320
- const j = A.indexOf(S);
321
- j > -1 && A.splice(j, 1);
326
+ const T = $.indexOf(A);
327
+ T > -1 && $.splice(T, 1);
322
328
  }
323
- g = A;
329
+ b = $;
324
330
  } else {
325
- const S = l.getAttribute("true-value") ?? !0, A = l.getAttribute("false-value") ?? !1;
326
- g = l.checked ? S : A;
331
+ const A = l.getAttribute("true-value") ?? !0, $ = l.getAttribute("false-value") ?? !1;
332
+ b = l.checked ? A : $;
327
333
  }
328
- } else if (h === "radio")
329
- g = l.getAttribute("value") ?? l.value;
330
- else if (h === "select" && l.multiple)
331
- g = Array.from(l.selectedOptions).map((E) => E.value);
332
- else if (u && typeof g == "string" && (g = g.trim()), d) {
333
- const E = Number(g);
334
- isNaN(E) || (g = E);
334
+ } else if (c === "radio")
335
+ b = l.getAttribute("value") ?? l.value;
336
+ else if (c === "select" && l.multiple)
337
+ b = Array.from(l.selectedOptions).map((S) => S.value);
338
+ else if (p && typeof b == "string" && (b = b.trim()), h) {
339
+ const S = Number(b);
340
+ isNaN(S) || (b = S);
335
341
  }
336
- const p = s._state || s, _ = z(p, e);
337
- if (Array.isArray(g) && Array.isArray(_) ? JSON.stringify([...g].sort()) !== JSON.stringify([..._].sort()) : g !== _) {
342
+ const y = o._state || o, _ = W(y, e);
343
+ if (Array.isArray(b) && Array.isArray(_) ? JSON.stringify([...b].sort()) !== JSON.stringify([..._].sort()) : b !== _) {
338
344
  l._modelUpdating = !0;
339
345
  try {
340
- oe(p, e, g), s._requestRender && s._requestRender();
346
+ ce(y, e, b), o._requestRender && o._requestRender();
341
347
  } finally {
342
348
  setTimeout(() => l._modelUpdating = !1, 0);
343
349
  }
344
350
  }
345
351
  };
346
- k ? n[b] = m : n[`update:${J(w)}`] = (x) => {
347
- const l = s._state || s, g = x.detail !== void 0 ? x.detail : x.target?.value, p = z(l, e);
348
- (Array.isArray(g) && Array.isArray(p) ? JSON.stringify([...g].sort()) !== JSON.stringify([...p].sort()) : g !== p) && (oe(l, e, g), s._requestRender && s._requestRender());
349
- }, (h === "text" || h === "textarea") && (n.compositionstart = (() => n._isComposing = !0), n.compositionend = (x) => {
352
+ w ? n[g] = m : n[`update:${Y(d)}`] = (x) => {
353
+ const l = o._state || o, b = x.detail !== void 0 ? x.detail : x.target?.value, y = W(l, e);
354
+ (Array.isArray(b) && Array.isArray(y) ? JSON.stringify([...b].sort()) !== JSON.stringify([...y].sort()) : b !== y) && (ce(l, e, b), o._requestRender && o._requestRender());
355
+ }, (c === "text" || c === "textarea") && (n.compositionstart = (() => n._isComposing = !0), n.compositionend = (x) => {
350
356
  n._isComposing = !1;
351
357
  const l = x.target;
352
358
  l && setTimeout(() => {
353
- const g = l.value, p = s._state || s, _ = z(p, e);
354
- let C = g;
355
- if (u && (C = C.trim()), d) {
356
- const S = Number(C);
357
- isNaN(S) || (C = S);
359
+ const b = l.value, y = o._state || o, _ = W(y, e);
360
+ let E = b;
361
+ if (p && (E = E.trim()), h) {
362
+ const A = Number(E);
363
+ isNaN(A) || (E = A);
358
364
  }
359
- if (Array.isArray(C) && Array.isArray(_) ? JSON.stringify([...C].sort()) !== JSON.stringify([..._].sort()) : C !== _) {
365
+ if (Array.isArray(E) && Array.isArray(_) ? JSON.stringify([...E].sort()) !== JSON.stringify([..._].sort()) : E !== _) {
360
366
  l._modelUpdating = !0;
361
367
  try {
362
- oe(p, e, C), s._requestRender && s._requestRender();
368
+ ce(y, e, E), o._requestRender && o._requestRender();
363
369
  } finally {
364
370
  setTimeout(() => l._modelUpdating = !1, 0);
365
371
  }
@@ -367,66 +373,66 @@ function He(e, t, r, i, n, s, o, a) {
367
373
  }, 0);
368
374
  });
369
375
  }
370
- function Le(e) {
376
+ function Me(e) {
371
377
  const t = e.slice(2);
372
378
  return t ? t.charAt(0).toLowerCase() + t.slice(1) : "";
373
379
  }
374
- function Fe(e, t, r, i) {
380
+ function Ke(e, t, r, i) {
375
381
  if (i) {
376
382
  if (typeof e == "object" && e !== null)
377
- for (const [n, s] of Object.entries(e))
378
- t[n] = s;
383
+ for (const [n, o] of Object.entries(e))
384
+ t[n] = o;
379
385
  else if (typeof e == "string")
380
386
  try {
381
387
  const n = JSON.parse(e);
382
388
  if (typeof n == "object" && n !== null) {
383
- for (const [s, o] of Object.entries(n))
384
- t[s] = o;
389
+ for (const [o, s] of Object.entries(n))
390
+ t[o] = s;
385
391
  return;
386
392
  }
387
393
  } catch {
388
- const n = z(i, e);
394
+ const n = W(i, e);
389
395
  r[e] = n;
390
396
  }
391
397
  }
392
398
  }
393
- function Ke(e, t, r) {
399
+ function Je(e, t, r) {
394
400
  if (!r) return;
395
- const i = z(r, e), n = t.style || "", s = i ? "" : "none";
401
+ const i = W(r, e), n = t.style || "", o = i ? "" : "none";
396
402
  if (n) {
397
- const o = n.split(";").filter(Boolean), a = o.findIndex(
403
+ const s = n.split(";").filter(Boolean), a = s.findIndex(
398
404
  (f) => f.trim().startsWith("display:")
399
405
  );
400
- a >= 0 ? o[a] = `display: ${s}` : o.push(`display: ${s}`), t.style = o.join("; ");
406
+ a >= 0 ? s[a] = `display: ${o}` : s.push(`display: ${o}`), t.style = s.join("; ");
401
407
  } else
402
- t.style = `display: ${s}`;
408
+ t.style = `display: ${o}`;
403
409
  }
404
- function Ue(e, t, r) {
410
+ function Ge(e, t, r) {
405
411
  if (!r) return;
406
- const i = z(r, e);
412
+ const i = W(r, e);
407
413
  let n = [];
408
414
  typeof i == "string" ? n = [i] : Array.isArray(i) ? n = i.filter(Boolean) : typeof i == "object" && (n = Object.entries(i).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
409
- const s = t.class || "", o = s ? `${s} ${n.join(" ")}`.trim() : n.join(" ");
410
- o && (t.class = o);
415
+ const o = t.class || "", s = o ? `${o} ${n.join(" ")}`.trim() : n.join(" ");
416
+ s && (t.class = s);
411
417
  }
412
- function Ve(e, t, r) {
418
+ function Ze(e, t, r) {
413
419
  let i;
414
420
  if (typeof e == "string") {
415
421
  if (!r) return;
416
- i = z(r, e);
422
+ i = W(r, e);
417
423
  } else
418
424
  i = e;
419
425
  let n = "";
420
426
  if (typeof i == "string")
421
427
  n = i;
422
428
  else if (i && typeof i == "object") {
423
- const o = [];
429
+ const s = [];
424
430
  for (const [a, f] of Object.entries(i))
425
431
  if (f != null && f !== "") {
426
- const u = a.replace(
432
+ const p = a.replace(
427
433
  /[A-Z]/g,
428
- (c) => `-${c.toLowerCase()}`
429
- ), d = [
434
+ (u) => `-${u.toLowerCase()}`
435
+ ), h = [
430
436
  "width",
431
437
  "height",
432
438
  "top",
@@ -452,175 +458,287 @@ function Ve(e, t, r) {
452
458
  "min-height",
453
459
  "max-height"
454
460
  ];
455
- let y = String(f);
456
- typeof f == "number" && d.includes(u) && (y = `${f}px`), o.push(`${u}: ${y}`);
461
+ let C = String(f);
462
+ typeof f == "number" && h.includes(p) && (C = `${f}px`), s.push(`${p}: ${C}`);
457
463
  }
458
- n = o.join("; ") + (o.length > 0 ? ";" : "");
464
+ n = s.join("; ") + (s.length > 0 ? ";" : "");
459
465
  }
460
- const s = t.style || "";
461
- t.style = s + (s && !s.endsWith(";") ? "; " : "") + n;
466
+ const o = t.style || "";
467
+ t.style = o + (o && !o.endsWith(";") ? "; " : "") + n;
462
468
  }
463
- function Re(e, t, r, i) {
464
- const n = {}, s = { ...i || {} }, o = {};
469
+ function Oe(e, t, r, i) {
470
+ const n = {}, o = { ...i || {} }, s = {};
465
471
  for (const [a, f] of Object.entries(e)) {
466
- const { value: u, modifiers: d, arg: y } = f;
472
+ const { value: p, modifiers: h, arg: C } = f;
467
473
  if (a === "model" || a.startsWith("model:")) {
468
- const c = a.split(":"), h = c.length > 1 ? c[1] : y;
469
- He(
470
- typeof u == "string" ? u : String(u),
471
- d,
474
+ const u = a.split(":"), c = u.length > 1 ? u[1] : C;
475
+ Fe(
476
+ typeof p == "string" ? p : String(p),
477
+ h,
472
478
  n,
473
- s,
474
479
  o,
480
+ s,
475
481
  t,
476
482
  r,
477
- h
483
+ c
478
484
  );
479
485
  continue;
480
486
  }
481
487
  switch (a) {
482
488
  case "bind":
483
- Fe(u, n, s, t);
489
+ Ke(p, n, o, t);
484
490
  break;
485
491
  case "show":
486
- Ke(u, s, t);
492
+ Je(p, o, t);
487
493
  break;
488
494
  case "class":
489
- Ue(u, s, t);
495
+ Ge(p, o, t);
490
496
  break;
491
497
  case "style":
492
- Ve(u, s, t);
498
+ Ze(p, o, t);
493
499
  break;
494
500
  }
495
501
  }
496
- return { props: n, attrs: s, listeners: o };
502
+ return { props: n, attrs: o, listeners: s };
497
503
  }
498
- function ve(e, t) {
504
+ function _e(e, t) {
499
505
  if (Array.isArray(e)) {
500
- const s = /* @__PURE__ */ new Set();
501
- return e.map((o) => {
502
- if (!o || typeof o != "object") return o;
503
- let a = o.props?.key ?? o.key;
506
+ const o = /* @__PURE__ */ new Set();
507
+ return e.map((s) => {
508
+ if (!s || typeof s != "object") return s;
509
+ let a = s.props?.key ?? s.key;
504
510
  if (!a) {
505
- const y = o.tag || "node", c = o.props?.attrs?.id ?? o.props?.attrs?.name ?? o.props?.attrs?.["data-key"] ?? "";
506
- a = c ? `${t}:${y}:${c}` : `${t}:${y}`;
511
+ const C = s.tag || "node", c = [
512
+ // attrs (kebab-case)
513
+ s.props?.attrs?.id,
514
+ s.props?.attrs?.name,
515
+ s.props?.attrs?.["data-key"],
516
+ // promoted JS props (camelCase or original)
517
+ s.props?.props?.id,
518
+ s.props?.props?.name,
519
+ s.props?.props?.dataKey,
520
+ s.props?.props?.["data-key"]
521
+ ].find((w) => w != null) ?? "";
522
+ a = c ? `${t}:${C}:${c}` : `${t}:${C}`;
507
523
  }
508
- let f = a, u = 1;
509
- for (; s.has(f); )
510
- f = `${a}#${u++}`;
511
- s.add(f);
512
- let d = o.children;
513
- return Array.isArray(d) && (d = ve(d, f)), { ...o, key: f, children: d };
524
+ let f = a, p = 1;
525
+ for (; o.has(f); )
526
+ f = `${a}#${p++}`;
527
+ o.add(f);
528
+ let h = s.children;
529
+ return Array.isArray(h) && (h = _e(h, f)), { ...s, key: f, children: h };
514
530
  });
515
531
  }
516
532
  const r = e;
517
533
  let i = r.props?.key ?? r.key ?? t, n = r.children;
518
- return Array.isArray(n) && (n = ve(n, i)), { ...r, key: i, children: n };
534
+ return Array.isArray(n) && (n = _e(n, i)), { ...r, key: i, children: n };
519
535
  }
520
- function Je(e, t, r, i) {
521
- const n = r.directives ?? {}, s = Re(
536
+ function Se(e, t, r, i) {
537
+ const n = r.directives ?? {}, o = Oe(
522
538
  n,
523
539
  i,
524
540
  e,
525
541
  r.attrs
526
- ), o = {
542
+ ), s = {
527
543
  ...t.props,
528
544
  ...r.props,
529
- ...s.props
545
+ ...o.props
530
546
  }, a = {
531
547
  ...t.attrs,
532
548
  ...r.attrs,
533
- ...s.attrs
534
- }, f = t.props ?? {}, u = o;
535
- for (const c in { ...f, ...u }) {
536
- const h = f[c], k = u[c];
537
- if (h !== k) {
538
- if (c === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
539
- e.value !== k && (e.value = k ?? "");
540
- else if (c === "checked" && e instanceof HTMLInputElement)
541
- e.checked = !!k;
542
- else if (c.startsWith("on") && typeof k == "function") {
543
- const $ = Le(c);
544
- typeof h == "function" && e.removeEventListener($, h), e.addEventListener($, k);
545
- } else if (k == null || k === !1)
546
- e.removeAttribute(c);
547
- else if ((r?.isCustomElement ?? t?.isCustomElement ?? !1) || c in e)
549
+ ...o.attrs
550
+ }, f = t.props ?? {}, p = s, h = r?.isCustomElement ?? t?.isCustomElement ?? !1;
551
+ let C = !1;
552
+ for (const w in { ...f, ...p }) {
553
+ const v = f[w], d = p[w];
554
+ if (v !== d) {
555
+ if (C = !0, w === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
556
+ e.value !== d && (e.value = d ?? "");
557
+ else if (w === "checked" && e instanceof HTMLInputElement)
558
+ e.checked = !!d;
559
+ else if (w.startsWith("on") && typeof d == "function") {
560
+ const g = Me(w);
561
+ typeof v == "function" && e.removeEventListener(g, v), e.addEventListener(g, d);
562
+ } else if (d == null || d === !1)
563
+ e.removeAttribute(w);
564
+ else if ((r?.isCustomElement ?? t?.isCustomElement ?? !1) || w in e)
548
565
  try {
549
- e[c] = k;
566
+ e[w] = d;
550
567
  } catch {
551
568
  }
552
569
  }
553
570
  }
554
- for (const [c, h] of Object.entries(
555
- s.listeners || {}
571
+ for (const [w, v] of Object.entries(
572
+ o.listeners || {}
556
573
  ))
557
- e.addEventListener(c, h);
558
- const d = t.attrs ?? {}, y = a;
559
- for (const c in { ...d, ...y }) {
560
- const h = d[c], k = y[c];
561
- h !== k && (k == null || k === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(k)));
574
+ e.addEventListener(w, v);
575
+ const u = t.attrs ?? {}, c = a;
576
+ for (const w in { ...u, ...c }) {
577
+ const v = u[w], d = c[w];
578
+ if (v !== d)
579
+ if (C = !0, d == null || d === !1) {
580
+ if (e.removeAttribute(w), w === "value") {
581
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)
582
+ try {
583
+ e.value = "";
584
+ } catch {
585
+ }
586
+ else if (e instanceof HTMLSelectElement)
587
+ try {
588
+ e.value = "";
589
+ } catch {
590
+ }
591
+ else if (e instanceof HTMLProgressElement)
592
+ try {
593
+ e.value = 0;
594
+ } catch {
595
+ }
596
+ }
597
+ if (w === "checked" && e instanceof HTMLInputElement)
598
+ try {
599
+ e.checked = !1;
600
+ } catch {
601
+ }
602
+ if (w === "disabled")
603
+ try {
604
+ e.disabled = !1;
605
+ } catch {
606
+ }
607
+ } else {
608
+ if (w === "value") {
609
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
610
+ try {
611
+ e.value = d ?? "";
612
+ } catch {
613
+ e.setAttribute(w, String(d));
614
+ }
615
+ continue;
616
+ } else if (e instanceof HTMLSelectElement) {
617
+ try {
618
+ e.value = d ?? "";
619
+ } catch {
620
+ }
621
+ continue;
622
+ } else if (e instanceof HTMLProgressElement) {
623
+ try {
624
+ e.value = Number(d);
625
+ } catch {
626
+ }
627
+ continue;
628
+ }
629
+ }
630
+ if (w === "checked" && e instanceof HTMLInputElement) {
631
+ try {
632
+ e.checked = !!d;
633
+ } catch {
634
+ }
635
+ continue;
636
+ }
637
+ if (!(e.namespaceURI === "http://www.w3.org/2000/svg") && w in e)
638
+ try {
639
+ e[w] = d;
640
+ } catch {
641
+ e.setAttribute(w, String(d));
642
+ }
643
+ else
644
+ e.setAttribute(w, String(d));
645
+ }
562
646
  }
647
+ if (h && C)
648
+ try {
649
+ if (typeof e._applyProps == "function")
650
+ try {
651
+ e._applyProps(e._cfg);
652
+ } catch {
653
+ }
654
+ typeof e.requestRender == "function" ? e.requestRender() : typeof e._render == "function" && e._render(e._cfg);
655
+ } catch {
656
+ }
563
657
  }
564
- function M(e, t, r) {
658
+ function D(e, t, r) {
565
659
  if (typeof e == "string")
566
660
  return document.createTextNode(e);
567
661
  if (e.tag === "#text") {
568
- const y = document.createTextNode(
662
+ const u = document.createTextNode(
569
663
  typeof e.children == "string" ? e.children : ""
570
664
  );
571
- return e.key != null && (y.key = e.key), y;
665
+ return e.key != null && (u.key = e.key), u;
572
666
  }
573
667
  if (e.tag === "#anchor") {
574
- const y = e, c = Array.isArray(y.children) ? y.children : [], h = document.createTextNode(""), k = document.createTextNode("");
575
- y.key != null && (h.key = `${y.key}:start`, k.key = `${y.key}:end`), y._startNode = h, y._endNode = k;
576
- const $ = document.createDocumentFragment();
577
- $.appendChild(h);
578
- for (const w of c) {
579
- const b = M(w, t);
580
- $.appendChild(b);
668
+ const u = e, c = Array.isArray(u.children) ? u.children : [], w = document.createTextNode(""), v = document.createTextNode("");
669
+ u.key != null && (w.key = `${u.key}:start`, v.key = `${u.key}:end`), u._startNode = w, u._endNode = v;
670
+ const d = document.createDocumentFragment();
671
+ d.appendChild(w);
672
+ for (const g of c) {
673
+ const m = D(g, t);
674
+ d.appendChild(m);
581
675
  }
582
- return $.appendChild(k), $;
676
+ return d.appendChild(v), d;
583
677
  }
584
678
  const i = document.createElement(e.tag);
585
679
  e.key != null && (i.key = e.key);
586
- const { props: n = {}, attrs: s = {}, directives: o = {} } = e.props ?? {}, a = Re(o, t, i, s), f = {
680
+ const { props: n = {}, attrs: o = {}, directives: s = {} } = e.props ?? {}, a = Oe(s, t, i, o), f = {
587
681
  ...n,
588
682
  ...a.props
589
- }, u = {
590
- ...s,
683
+ }, p = {
684
+ ...o,
591
685
  ...a.attrs
592
- };
593
- for (const y in u) {
594
- const c = u[y];
595
- typeof y != "string" || /\[object Object\]/.test(y) || (typeof c == "boolean" ? c && i.setAttribute(y, "") : c != null && i.setAttribute(y, c));
596
- }
597
- for (const y in f) {
598
- const c = f[y];
599
- if (!(typeof y != "string" || /\[object Object\]/.test(y)))
600
- if (y === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement))
686
+ }, h = i.namespaceURI === "http://www.w3.org/2000/svg";
687
+ for (const u in p) {
688
+ const c = p[u];
689
+ if (!(typeof u != "string" || /\[object Object\]/.test(u))) {
690
+ if (typeof c == "boolean")
691
+ c && i.setAttribute(u, "");
692
+ else if (c != null)
693
+ if (!h && u === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement || i instanceof HTMLProgressElement))
694
+ try {
695
+ i instanceof HTMLProgressElement ? i.value = Number(c) : i.value = c ?? "";
696
+ } catch {
697
+ i.setAttribute(u, String(c));
698
+ }
699
+ else if (!h && u === "checked" && i instanceof HTMLInputElement)
700
+ try {
701
+ i.checked = !!c;
702
+ } catch {
703
+ i.setAttribute(u, String(c));
704
+ }
705
+ else if (!h && u in i)
706
+ try {
707
+ i[u] = c;
708
+ } catch {
709
+ i.setAttribute(u, String(c));
710
+ }
711
+ else
712
+ i.setAttribute(u, String(c));
713
+ }
714
+ }
715
+ for (const u in f) {
716
+ const c = f[u];
717
+ if (!(typeof u != "string" || /\[object Object\]/.test(u)))
718
+ if (u === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement))
601
719
  i.value = c ?? "";
602
- else if (y === "checked" && i instanceof HTMLInputElement)
720
+ else if (u === "checked" && i instanceof HTMLInputElement)
603
721
  i.checked = !!c;
604
- else if (y.startsWith("on") && typeof c == "function")
605
- i.addEventListener(Le(y), c);
722
+ else if (u.startsWith("on") && typeof c == "function")
723
+ i.addEventListener(Me(u), c);
606
724
  else {
607
- if (y.startsWith("on") && c === void 0)
725
+ if (u.startsWith("on") && c === void 0)
608
726
  continue;
609
727
  if (c == null || c === !1)
610
- i.removeAttribute(y);
611
- else if ((e.props?.isCustomElement ?? !1) || y in i)
728
+ i.removeAttribute(u);
729
+ else if ((e.props?.isCustomElement ?? !1) || u in i)
612
730
  try {
613
- i[y] = c;
731
+ i[u] = c;
614
732
  } catch {
615
733
  }
616
734
  }
617
735
  }
618
- for (const [y, c] of Object.entries(
736
+ for (const [u, c] of Object.entries(
619
737
  a.listeners || {}
620
738
  ))
621
- i.addEventListener(y, c);
622
- const d = e.props?.ref ?? (e.props?.props && e.props.props.ref);
623
- typeof e != "string" && d && r && (r[d] = i);
739
+ i.addEventListener(u, c);
740
+ const C = e.props?.ref ?? (e.props?.props && e.props.props.ref);
741
+ typeof e != "string" && C && r && (r[C] = i);
624
742
  try {
625
743
  if (typeof i._applyProps == "function")
626
744
  try {
@@ -631,163 +749,177 @@ function M(e, t, r) {
631
749
  } catch {
632
750
  }
633
751
  if (Array.isArray(e.children))
634
- for (const y of e.children)
635
- i.appendChild(M(y, t, r));
752
+ for (const u of e.children)
753
+ i.appendChild(D(u, t, r));
636
754
  else typeof e.children == "string" && (i.textContent = e.children);
755
+ try {
756
+ if (i instanceof HTMLSelectElement && p && p.hasOwnProperty("value"))
757
+ try {
758
+ i.value = p.value ?? "";
759
+ } catch {
760
+ }
761
+ } catch {
762
+ }
637
763
  return i;
638
764
  }
639
- function Ze(e, t, r, i, n) {
765
+ function Ve(e, t, r, i, n) {
640
766
  if (typeof r == "string") {
641
767
  e.textContent !== r && (e.textContent = r);
642
768
  return;
643
769
  }
644
770
  if (!Array.isArray(r)) return;
645
- const s = Array.from(e.childNodes), o = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
646
- for (const h of o)
647
- h && h.key != null && a.set(h.key, h);
771
+ const o = Array.from(e.childNodes), s = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
772
+ for (const c of s)
773
+ c && c.key != null && a.set(c.key, c);
648
774
  const f = /* @__PURE__ */ new Map();
649
- for (const h of s) {
650
- const k = h.key;
651
- k != null && f.set(k, h);
652
- }
653
- const u = /* @__PURE__ */ new Set();
654
- let d = e.firstChild;
655
- function y(h, k) {
656
- let $ = h;
657
- for (; $ && (u.add($), $ !== k); )
658
- $ = $.nextSibling;
659
- }
660
- function c(h, k, $, w) {
661
- const b = [];
662
- let m = h.nextSibling;
663
- for (; m && m !== k; )
664
- b.push(m), m = m.nextSibling;
665
- const x = Array.isArray($) ? $ : [];
666
- if (w.some((g) => g && g.key != null) || x.some((g) => g && g.key != null)) {
667
- const g = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
668
- for (const E of x)
669
- E && E.key != null && g.set(E.key, E);
670
- for (const E of b) {
671
- const S = E.key;
672
- S != null && p.set(S, E);
775
+ for (const c of o) {
776
+ const w = c.key;
777
+ w != null && f.set(w, c);
778
+ }
779
+ const p = /* @__PURE__ */ new Set();
780
+ let h = e.firstChild;
781
+ function C(c, w) {
782
+ let v = c;
783
+ for (; v && (p.add(v), v !== w); )
784
+ v = v.nextSibling;
785
+ }
786
+ function u(c, w, v, d) {
787
+ const g = [];
788
+ let m = c.nextSibling;
789
+ for (; m && m !== w; )
790
+ g.push(m), m = m.nextSibling;
791
+ const x = Array.isArray(v) ? v : [];
792
+ if (d.some((b) => b && b.key != null) || x.some((b) => b && b.key != null)) {
793
+ const b = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
794
+ for (const S of x)
795
+ S && S.key != null && b.set(S.key, S);
796
+ for (const S of g) {
797
+ const A = S.key;
798
+ A != null && y.set(A, S);
673
799
  }
674
800
  const _ = /* @__PURE__ */ new Set();
675
- let C = h.nextSibling;
676
- for (const E of w) {
677
- let S;
678
- if (E.key != null && p.has(E.key)) {
679
- const A = g.get(E.key);
680
- S = ae(
681
- p.get(E.key),
682
- A,
683
- E,
801
+ let E = c.nextSibling;
802
+ for (const S of d) {
803
+ let A;
804
+ if (S.key != null && y.has(S.key)) {
805
+ const $ = b.get(S.key);
806
+ A = le(
807
+ y.get(S.key),
808
+ $,
809
+ S,
684
810
  i
685
- ), _.add(S), S !== C && e.contains(S) && e.insertBefore(S, C);
811
+ ), _.add(A), A !== E && e.contains(A) && e.insertBefore(A, E);
686
812
  } else
687
- S = M(E, i), e.insertBefore(S, C), _.add(S);
688
- C = S.nextSibling;
813
+ A = D(S, i), e.insertBefore(A, E), _.add(A);
814
+ E = A.nextSibling;
689
815
  }
690
- for (const E of b)
691
- !_.has(E) && e.contains(E) && e.removeChild(E);
816
+ for (const S of g)
817
+ !_.has(S) && e.contains(S) && e.removeChild(S);
692
818
  } else {
693
- const g = Math.min(
819
+ const b = Math.min(
694
820
  x.length,
695
- w.length
821
+ d.length
696
822
  );
697
- for (let p = 0; p < g; p++) {
698
- const _ = x[p], C = w[p], E = ae(b[p], _, C, i);
699
- E !== b[p] && (e.insertBefore(E, b[p]), e.removeChild(b[p]));
823
+ for (let y = 0; y < b; y++) {
824
+ const _ = x[y], E = d[y], S = le(g[y], _, E, i);
825
+ S !== g[y] && (e.insertBefore(S, g[y]), e.removeChild(g[y]));
700
826
  }
701
- for (let p = g; p < w.length; p++)
702
- e.insertBefore(M(w[p], i), k);
703
- for (let p = g; p < b.length; p++)
704
- e.removeChild(b[p]);
827
+ for (let y = b; y < d.length; y++)
828
+ e.insertBefore(D(d[y], i), w);
829
+ for (let y = b; y < g.length; y++)
830
+ e.removeChild(g[y]);
705
831
  }
706
832
  }
707
- for (const h of r) {
708
- let k;
709
- if (h.tag === "#anchor") {
710
- const $ = h.key, w = `${$}:start`, b = `${$}:end`;
711
- let m = f.get(w), x = f.get(b);
712
- const l = Array.isArray(h.children) ? h.children : [];
713
- if (m || (m = document.createTextNode(""), m.key = w), x || (x = document.createTextNode(""), x.key = b), h._startNode = m, h._endNode = x, !e.contains(m) || !e.contains(x)) {
714
- e.insertBefore(m, d);
715
- for (const g of l)
716
- e.insertBefore(M(g, i), d);
717
- e.insertBefore(x, d);
833
+ for (const c of r) {
834
+ let w;
835
+ if (c.tag === "#anchor") {
836
+ const v = c.key, d = `${v}:start`, g = `${v}:end`;
837
+ let m = f.get(d), x = f.get(g);
838
+ const l = Array.isArray(c.children) ? c.children : [];
839
+ if (m || (m = document.createTextNode(""), m.key = d), x || (x = document.createTextNode(""), x.key = g), c._startNode = m, c._endNode = x, !e.contains(m) || !e.contains(x)) {
840
+ e.insertBefore(m, h);
841
+ for (const b of l)
842
+ e.insertBefore(D(b, i), h);
843
+ e.insertBefore(x, h);
718
844
  } else
719
- c(
845
+ u(
720
846
  m,
721
847
  x,
722
- a.get($)?.children,
848
+ a.get(v)?.children,
723
849
  l
724
850
  );
725
- y(m, x), d = x.nextSibling;
851
+ C(m, x), h = x.nextSibling;
726
852
  continue;
727
853
  }
728
- if (h.key != null && f.has(h.key)) {
729
- const $ = a.get(h.key);
730
- k = ae(
731
- f.get(h.key),
732
- $,
733
- h,
854
+ if (c.key != null && f.has(c.key)) {
855
+ const v = a.get(c.key);
856
+ w = le(
857
+ f.get(c.key),
858
+ v,
859
+ c,
734
860
  i,
735
861
  n
736
- ), u.add(k), k !== d && e.contains(k) && (d && !e.contains(d) && (d = null), e.insertBefore(k, d));
862
+ ), p.add(w), w !== h && e.contains(w) && (h && !e.contains(h) && (h = null), e.insertBefore(w, h));
737
863
  } else
738
- k = M(h, i, n), d && !e.contains(d) && (d = null), e.insertBefore(k, d), u.add(k);
739
- d = k.nextSibling;
864
+ w = D(c, i, n), h && !e.contains(h) && (h = null), e.insertBefore(w, h), p.add(w);
865
+ h = w.nextSibling;
740
866
  }
741
- for (const h of s)
742
- !u.has(h) && e.contains(h) && (V(h, n), e.removeChild(h));
867
+ for (const c of o)
868
+ !p.has(c) && e.contains(c) && (V(c, n), e.removeChild(c));
743
869
  }
744
- function ae(e, t, r, i, n) {
870
+ function le(e, t, r, i, n) {
745
871
  if (t && typeof t != "string" && t.props?.ref && n && V(e, n), t === r) return e;
746
872
  if (typeof r == "string") {
747
873
  if (e.nodeType === Node.TEXT_NODE)
748
874
  return e.textContent !== r && (e.textContent = r), e;
749
875
  {
750
- const o = document.createTextNode(r);
751
- return e.parentNode?.replaceChild(o, e), o;
876
+ const s = document.createTextNode(r);
877
+ return e.parentNode?.replaceChild(s, e), s;
752
878
  }
753
879
  }
754
880
  if (r && typeof r != "string" && r.tag === "#anchor") {
755
- const o = r, a = Array.isArray(o.children) ? o.children : [], f = o._startNode ?? document.createTextNode(""), u = o._endNode ?? document.createTextNode("");
756
- o.key != null && (f.key = `${o.key}:start`, u.key = `${o.key}:end`), o._startNode = f, o._endNode = u;
757
- const d = document.createDocumentFragment();
758
- d.appendChild(f);
759
- for (const y of a) {
760
- const c = M(y, i);
761
- d.appendChild(c);
881
+ const s = r, a = Array.isArray(s.children) ? s.children : [], f = s._startNode ?? document.createTextNode(""), p = s._endNode ?? document.createTextNode("");
882
+ s.key != null && (f.key = `${s.key}:start`, p.key = `${s.key}:end`), s._startNode = f, s._endNode = p;
883
+ const h = document.createDocumentFragment();
884
+ h.appendChild(f);
885
+ for (const C of a) {
886
+ const u = D(C, i);
887
+ h.appendChild(u);
762
888
  }
763
- return d.appendChild(u), e.parentNode?.replaceChild(d, e), f;
889
+ return h.appendChild(p), e.parentNode?.replaceChild(h, e), f;
764
890
  }
765
891
  if (!r) {
766
892
  V(e, n);
767
- const o = document.createComment("removed");
768
- return e.parentNode?.replaceChild(o, e), o;
893
+ const s = document.createComment("removed");
894
+ return e.parentNode?.replaceChild(s, e), s;
769
895
  }
770
896
  if (!t || typeof t == "string") {
771
897
  V(e, n);
772
- const o = M(r, i, n);
773
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), e.parentNode?.replaceChild(o, e), o;
898
+ const s = D(r, i, n);
899
+ return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
774
900
  }
775
901
  if (r.tag === "#anchor") {
776
- const o = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
902
+ const s = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
777
903
  r.key != null && (a.key = `${r.key}:start`, f.key = `${r.key}:end`), r._startNode = a, r._endNode = f;
778
- const u = document.createDocumentFragment();
779
- u.appendChild(a);
780
- for (const d of o)
781
- u.appendChild(M(d, i));
782
- return u.appendChild(f), e.parentNode?.replaceChild(u, e), a;
904
+ const p = document.createDocumentFragment();
905
+ p.appendChild(a);
906
+ for (const h of s)
907
+ p.appendChild(D(h, i));
908
+ return p.appendChild(f), e.parentNode?.replaceChild(p, e), a;
783
909
  }
784
910
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
785
- const o = e;
786
- return Je(o, t.props || {}, r.props || {}, i), Ze(o, t.children, r.children, i, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), o;
911
+ const s = e;
912
+ return Se(s, t.props || {}, r.props || {}, i), Ve(s, t.children, r.children, i, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), s;
787
913
  }
914
+ if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && (t.tag && String(t.tag).includes("-") || r.props && r.props.isCustomElement || t.props && t.props.isCustomElement))
915
+ try {
916
+ const a = e;
917
+ return Se(a, t.props || {}, r.props || {}, i), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = a), a;
918
+ } catch {
919
+ }
788
920
  V(e, n);
789
- const s = M(r, i, n);
790
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
921
+ const o = D(r, i, n);
922
+ return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), e.parentNode?.replaceChild(o, e), o;
791
923
  }
792
924
  function Ye(e, t, r, i) {
793
925
  let n;
@@ -796,31 +928,31 @@ function Ye(e, t, r, i) {
796
928
  key: "__anchor_root__",
797
929
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
798
930
  children: [n]
799
- }), n = ve(n, String(n.key ?? "root"));
800
- const s = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
931
+ }), n = _e(n, String(n.key ?? "root"));
932
+ const o = e._prevVNode ?? null, s = e._prevDom ?? e.firstChild ?? null;
801
933
  let a;
802
- s && o ? typeof s != "string" && typeof n != "string" && s.tag === n.tag && s.key === n.key ? a = ae(o, s, n, r, i) : (a = M(n, r, i), e.replaceChild(a, o)) : (a = M(n, r, i), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
934
+ o && s ? typeof o != "string" && typeof n != "string" && o.tag === n.tag && o.key === n.key ? a = le(s, o, n, r, i) : (a = D(n, r, i), e.replaceChild(a, s)) : (a = D(n, r, i), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
803
935
  const f = [];
804
- for (let u = 0; u < e.childNodes.length; u++) {
805
- const d = e.childNodes[u];
806
- d !== a && d.nodeName !== "STYLE" && (V(d, i), f.push(d));
936
+ for (let p = 0; p < e.childNodes.length; p++) {
937
+ const h = e.childNodes[p];
938
+ h !== a && h.nodeName !== "STYLE" && (V(h, i), f.push(h));
807
939
  }
808
- f.forEach((u) => e.removeChild(u)), e._prevVNode = n, e._prevDom = a;
940
+ f.forEach((p) => e.removeChild(p)), e._prevVNode = n, e._prevDom = a;
809
941
  }
810
- function he(e) {
811
- if (typeof e == "string") return H(e);
942
+ function ge(e) {
943
+ if (typeof e == "string") return J(e);
812
944
  if (e.tag === "#text")
813
- return typeof e.children == "string" ? H(e.children) : "";
945
+ return typeof e.children == "string" ? J(e.children) : "";
814
946
  if (e.tag === "#anchor")
815
- return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(he).join("");
947
+ return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(ge).join("");
816
948
  let t = "";
817
- e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, s]) => ` ${n}="${H(String(s))}"`).join(""));
949
+ e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, o]) => ` ${n}="${J(String(o))}"`).join(""));
818
950
  let r = "";
819
- e.props && (r = Object.entries(e.props).filter(([n]) => n !== "attrs" && n !== "directives" && n !== "ref" && n !== "key").map(([n, s]) => ` ${n}="${H(String(s))}"`).join(""));
820
- const i = Array.isArray(e.children) ? e.children.filter(Boolean).map(he).join("") : typeof e.children == "string" ? H(e.children) : e.children ? he(e.children) : "";
951
+ e.props && (r = Object.entries(e.props).filter(([n]) => n !== "attrs" && n !== "directives" && n !== "ref" && n !== "key").map(([n, o]) => ` ${n}="${J(String(o))}"`).join(""));
952
+ const i = Array.isArray(e.children) ? e.children.filter(Boolean).map(ge).join("") : typeof e.children == "string" ? J(e.children) : e.children ? ge(e.children) : "";
821
953
  return `<${e.tag}${t}${r}>${i}</${e.tag}>`;
822
954
  }
823
- function Oe(e, ...t) {
955
+ function Pe(e, ...t) {
824
956
  let r = "";
825
957
  for (let i = 0; i < e.length; i++)
826
958
  r += e[i], i < t.length && (r += t[i]);
@@ -829,14 +961,14 @@ function Oe(e, ...t) {
829
961
  function Be(e) {
830
962
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
831
963
  }
832
- let ie = null;
833
- function _e() {
834
- return ie || (ie = new CSSStyleSheet(), ie.replaceSync(Be(Qe))), ie;
964
+ let oe = null;
965
+ function Ee() {
966
+ return oe || (oe = new CSSStyleSheet(), oe.replaceSync(Be(Xe))), oe;
835
967
  }
836
- function Ge(e) {
968
+ function Qe(e) {
837
969
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
838
970
  }
839
- const Qe = Oe`
971
+ const Xe = Pe`
840
972
  :host, *, ::before, ::after {
841
973
  all: isolate;
842
974
  box-sizing: border-box;
@@ -894,7 +1026,7 @@ const Qe = Oe`
894
1026
  sup { top: -.5em }
895
1027
  [disabled], [aria-disabled=true] { cursor: not-allowed }
896
1028
  [hidden] { display: none }
897
- `, Xe = {
1029
+ `, et = {
898
1030
  neutral: {
899
1031
  50: "#fafafa",
900
1032
  100: "#f4f4f5",
@@ -990,8 +1122,8 @@ const Qe = Oe`
990
1122
  black: { DEFAULT: "#000000" },
991
1123
  transparent: { DEFAULT: "transparent" },
992
1124
  current: { DEFAULT: "currentColor" }
993
- }, et = Object.fromEntries(
994
- Object.entries(Xe).map(([e, t]) => [
1125
+ }, tt = Object.fromEntries(
1126
+ Object.entries(et).map(([e, t]) => [
995
1127
  e,
996
1128
  Object.fromEntries(
997
1129
  Object.entries(t).map(([r, i]) => [
@@ -1000,7 +1132,7 @@ const Qe = Oe`
1000
1132
  ])
1001
1133
  )
1002
1134
  ])
1003
- ), ge = {
1135
+ ), me = {
1004
1136
  /* Display */
1005
1137
  block: "display:block;",
1006
1138
  inline: "display:inline;",
@@ -1215,7 +1347,7 @@ const Qe = Oe`
1215
1347
  "z-30": "z-index:30;",
1216
1348
  "z-40": "z-index:40;",
1217
1349
  "z-50": "z-index:50;"
1218
- }, tt = "0.25rem", Se = {
1350
+ }, rt = "0.25rem", Ce = {
1219
1351
  m: ["margin"],
1220
1352
  mx: ["margin-inline"],
1221
1353
  my: ["margin-block"],
@@ -1250,17 +1382,17 @@ const Qe = Oe`
1250
1382
  function N(e, t) {
1251
1383
  let r = 0, i = 0;
1252
1384
  for (let n = 0; n < e.length; n++) {
1253
- const s = e[n];
1254
- if (s === "[") r++;
1255
- else if (s === "]" && r > 0) r--;
1256
- else if (s === "(") i++;
1257
- else if (s === ")" && i > 0) i--;
1258
- else if (r === 0 && i === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1385
+ const o = e[n];
1386
+ if (o === "[") r++;
1387
+ else if (o === "]" && r > 0) r--;
1388
+ else if (o === "(") i++;
1389
+ else if (o === ")" && i > 0) i--;
1390
+ else if (r === 0 && i === 0 && (o === ">" || o === "+" || o === "~" || o === " "))
1259
1391
  return e.slice(0, n) + t + e.slice(n);
1260
1392
  }
1261
1393
  return e + t;
1262
1394
  }
1263
- const rt = {
1395
+ const nt = {
1264
1396
  before: (e, t) => `${e}::before{${t}}`,
1265
1397
  after: (e, t) => `${e}::after{${t}}`,
1266
1398
  hover: (e, t) => `${N(e, ":hover")}{${t}}`,
@@ -1283,7 +1415,7 @@ const rt = {
1283
1415
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1284
1416
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1285
1417
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1286
- }, me = {
1418
+ }, ye = {
1287
1419
  // Responsive
1288
1420
  sm: "(min-width:640px)",
1289
1421
  md: "(min-width:768px)",
@@ -1292,25 +1424,25 @@ const rt = {
1292
1424
  "2xl": "(min-width:1536px)",
1293
1425
  // Dark mode (now plain string)
1294
1426
  dark: "(prefers-color-scheme: dark)"
1295
- }, ye = ["sm", "md", "lg", "xl", "2xl"];
1296
- function be(e) {
1427
+ }, be = ["sm", "md", "lg", "xl", "2xl"];
1428
+ function we(e) {
1297
1429
  const t = e.startsWith("-"), i = (t ? e.slice(1) : e).split("-");
1298
1430
  if (i.length < 2) return null;
1299
- const n = i.slice(0, -1).join("-"), s = i[i.length - 1], o = parseFloat(s);
1300
- if (Number.isNaN(o) || !Se[n]) return null;
1431
+ const n = i.slice(0, -1).join("-"), o = i[i.length - 1], s = parseFloat(o);
1432
+ if (Number.isNaN(s) || !Ce[n]) return null;
1301
1433
  const a = t ? "-" : "";
1302
- return Se[n].map((f) => `${f}:calc(${a}${tt} * ${o});`).join("");
1434
+ return Ce[n].map((f) => `${f}:calc(${a}${rt} * ${s});`).join("");
1303
1435
  }
1304
- function Ee(e) {
1305
- const t = e.replace("#", ""), r = parseInt(t, 16), i = r >> 16 & 255, n = r >> 8 & 255, s = r & 255;
1306
- return `${i} ${n} ${s}`;
1436
+ function Ae(e) {
1437
+ const t = e.replace("#", ""), r = parseInt(t, 16), i = r >> 16 & 255, n = r >> 8 & 255, o = r & 255;
1438
+ return `${i} ${n} ${o}`;
1307
1439
  }
1308
- function nt(e) {
1440
+ function it(e) {
1309
1441
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1310
1442
  if (!t) return null;
1311
- const [, r, i, n = "DEFAULT"] = t, s = et[i]?.[n];
1312
- if (!s) return null;
1313
- if (r === "shadow") return `--ce-shadow-color:${s};`;
1443
+ const [, r, i, n = "DEFAULT"] = t, o = tt[i]?.[n];
1444
+ if (!o) return null;
1445
+ if (r === "shadow") return `--ce-shadow-color:${o};`;
1314
1446
  const a = {
1315
1447
  bg: "background-color",
1316
1448
  decoration: "text-decoration-color",
@@ -1322,49 +1454,49 @@ function nt(e) {
1322
1454
  fill: "fill",
1323
1455
  stroke: "stroke"
1324
1456
  }[r];
1325
- return a ? `${a}:${s};` : null;
1457
+ return a ? `${a}:${o};` : null;
1326
1458
  }
1327
- function it(e) {
1459
+ function st(e) {
1328
1460
  const [t, r] = e.split("/");
1329
1461
  if (!r) return { base: t };
1330
1462
  const i = parseInt(r, 10);
1331
1463
  return isNaN(i) || i < 0 || i > 100 ? { base: t } : { base: t, opacity: i / 100 };
1332
1464
  }
1333
- function we(e) {
1334
- const { base: t, opacity: r } = it(e), i = nt(t);
1465
+ function xe(e) {
1466
+ const { base: t, opacity: r } = st(e), i = it(t);
1335
1467
  if (i) {
1336
1468
  if (r !== void 0) {
1337
- const s = /#([0-9a-f]{6})/i.exec(i);
1338
- if (s) {
1339
- const o = Ee(s[0]);
1340
- return i.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
1469
+ const o = /#([0-9a-f]{6})/i.exec(i);
1470
+ if (o) {
1471
+ const s = Ae(o[0]);
1472
+ return i.replace(/#([0-9a-f]{6})/i, `rgb(${s} / ${r})`);
1341
1473
  }
1342
1474
  }
1343
1475
  return i;
1344
1476
  }
1345
- const n = ce(t);
1477
+ const n = fe(t);
1346
1478
  if (n && r !== void 0) {
1347
- const s = /#([0-9a-f]{6})/i.exec(n);
1348
- if (s) {
1349
- const o = Ee(s[0]);
1350
- return n.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
1479
+ const o = /#([0-9a-f]{6})/i.exec(n);
1480
+ if (o) {
1481
+ const s = Ae(o[0]);
1482
+ return n.replace(/#([0-9a-f]{6})/i, `rgb(${s} / ${r})`);
1351
1483
  }
1352
1484
  }
1353
1485
  return n;
1354
1486
  }
1355
- function xe(e) {
1487
+ function ve(e) {
1356
1488
  const t = /^opacity-(\d{1,3})$/.exec(e);
1357
1489
  if (!t) return null;
1358
1490
  const r = parseInt(t[1], 10);
1359
1491
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1360
1492
  }
1361
- function ce(e) {
1493
+ function fe(e) {
1362
1494
  if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1363
1495
  const n = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1364
1496
  if (n) {
1365
- const s = n[1].trim();
1366
- let o = n[2].trim();
1367
- return o = o.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), o = o.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${o};`;
1497
+ const o = n[1].trim();
1498
+ let s = n[2].trim();
1499
+ return s = s.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), s = s.replace(/^'([^']*)'$/g, '"$1"'), `${o}:${s};`;
1368
1500
  }
1369
1501
  return null;
1370
1502
  }
@@ -1373,7 +1505,7 @@ function ce(e) {
1373
1505
  const i = e.slice(0, t);
1374
1506
  let n = e.slice(t + 2, -1);
1375
1507
  n = n.replace(/_/g, " ");
1376
- const s = {
1508
+ const o = {
1377
1509
  bg: "background-color",
1378
1510
  text: "color",
1379
1511
  shadow: "box-shadow",
@@ -1417,12 +1549,12 @@ function ce(e) {
1417
1549
  };
1418
1550
  if (i === "rotate")
1419
1551
  return `transform:rotate(${n});`;
1420
- const o = s[i] ?? i.replace(/_/g, "-");
1421
- if (o && n) return `${o}:${n};`;
1552
+ const s = o[i] ?? i.replace(/_/g, "-");
1553
+ if (s && n) return `${s}:${n};`;
1422
1554
  }
1423
1555
  return null;
1424
1556
  }
1425
- function st(e) {
1557
+ function ot(e) {
1426
1558
  if (e.startsWith("[") && e.endsWith("]")) {
1427
1559
  const r = e.slice(1, -1);
1428
1560
  return r.includes("&") ? r : e;
@@ -1434,10 +1566,10 @@ function st(e) {
1434
1566
  }
1435
1567
  return null;
1436
1568
  }
1437
- function ot(e) {
1569
+ function at(e) {
1438
1570
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1439
1571
  }
1440
- function at(e) {
1572
+ function ct(e) {
1441
1573
  const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1442
1574
  let i;
1443
1575
  for (; i = t.exec(e); ) {
@@ -1446,32 +1578,32 @@ function at(e) {
1446
1578
  }
1447
1579
  return r.filter(Boolean);
1448
1580
  }
1449
- const Ce = /* @__PURE__ */ new Map(), ct = 16;
1450
- function lt(e) {
1451
- const t = Date.now(), r = Ce.get(e);
1452
- if (r && t - r.timestamp < ct) return r.css;
1453
- const i = at(e), n = new Set(i), s = [], o = [], a = [], f = [], u = {};
1454
- function d(w, b = !1) {
1455
- const m = (b ? "dark|" : "") + w;
1456
- if (m in u) return u[m];
1457
- const x = k(w, b);
1458
- return u[m] = x, x;
1459
- }
1460
- function y(w) {
1461
- const b = w.some((x) => ye.includes(x)), m = w.includes("dark");
1462
- return w.length === 0 ? 1 : !b && !m ? 2 : b && !m ? 3 : 4;
1463
- }
1464
- function c(w) {
1465
- const b = [];
1581
+ const Te = /* @__PURE__ */ new Map(), lt = 16;
1582
+ function ft(e) {
1583
+ const t = Date.now(), r = Te.get(e);
1584
+ if (r && t - r.timestamp < lt) return r.css;
1585
+ const i = ct(e), n = new Set(i), o = [], s = [], a = [], f = [], p = {};
1586
+ function h(d, g = !1) {
1587
+ const m = (g ? "dark|" : "") + d;
1588
+ if (m in p) return p[m];
1589
+ const x = w(d, g);
1590
+ return p[m] = x, x;
1591
+ }
1592
+ function C(d) {
1593
+ const g = d.some((x) => be.includes(x)), m = d.includes("dark");
1594
+ return d.length === 0 ? 1 : !g && !m ? 2 : g && !m ? 3 : 4;
1595
+ }
1596
+ function u(d) {
1597
+ const g = [];
1466
1598
  let m = "", x = 0, l = 0;
1467
- for (let g = 0; g < w.length; g++) {
1468
- const p = w[g];
1469
- p === "[" ? x++ : p === "]" && x > 0 ? x-- : p === "(" ? l++ : p === ")" && l > 0 && l--, p === ":" && x === 0 && l === 0 ? (b.push(m), m = "") : m += p;
1599
+ for (let b = 0; b < d.length; b++) {
1600
+ const y = d[b];
1601
+ y === "[" ? x++ : y === "]" && x > 0 ? x-- : y === "(" ? l++ : y === ")" && l > 0 && l--, y === ":" && x === 0 && l === 0 ? (g.push(m), m = "") : m += y;
1470
1602
  }
1471
- return m && b.push(m), b;
1603
+ return m && g.push(m), g;
1472
1604
  }
1473
- function h(w) {
1474
- switch (w) {
1605
+ function c(d) {
1606
+ switch (d) {
1475
1607
  case "hover":
1476
1608
  return ":hover";
1477
1609
  case "focus":
@@ -1500,124 +1632,124 @@ function lt(e) {
1500
1632
  return null;
1501
1633
  }
1502
1634
  }
1503
- function k(w, b = !1) {
1504
- const m = c(w);
1635
+ function w(d, g = !1) {
1636
+ const m = u(d);
1505
1637
  let x = !1;
1506
- const l = m.find((v) => (v.startsWith("!") && (x = !0, v = v.slice(1)), ge[v] || be(v) || xe(v) || we(v) || ce(v)));
1638
+ const l = m.find((k) => (k.startsWith("!") && (x = !0, k = k.slice(1)), me[k] || we(k) || ve(k) || xe(k) || fe(k)));
1507
1639
  if (!l) return null;
1508
- const g = l.replace(/^!/, ""), p = ge[g] ?? be(g) ?? xe(g) ?? we(g) ?? ce(g);
1509
- if (!p) return null;
1640
+ const b = l.replace(/^!/, ""), y = me[b] ?? we(b) ?? ve(b) ?? xe(b) ?? fe(b);
1641
+ if (!y) return null;
1510
1642
  const _ = m.indexOf(l);
1511
- let C = _ >= 0 ? m.slice(0, _) : [];
1512
- b && (C = C.filter((v) => v !== "dark"));
1513
- const E = `.${ot(w)}`, S = "__SUBJECT__", A = x ? p.replace(/;$/, " !important;") : p;
1514
- let j = S;
1515
- const Q = [];
1516
- for (const v of C)
1517
- v.startsWith("group-") ? (j = `.group:${v.slice(6)} ${j}`, Q.push(v)) : v.startsWith("peer-") && (j = j.replace(S, `.peer:${v.slice(5)}~${S}`), Q.push(v));
1518
- C = C.filter((v) => !Q.includes(v));
1519
- const X = [], de = [];
1520
- let q = null;
1521
- for (const v of C) {
1522
- if (v === "dark" || ye.includes(v)) continue;
1523
- const B = st(v);
1524
- if (B) {
1525
- q = B;
1643
+ let E = _ >= 0 ? m.slice(0, _) : [];
1644
+ g && (E = E.filter((k) => k !== "dark"));
1645
+ const S = `.${at(d)}`, A = "__SUBJECT__", $ = x ? y.replace(/;$/, " !important;") : y;
1646
+ let T = A;
1647
+ const B = [];
1648
+ for (const k of E)
1649
+ k.startsWith("group-") ? (T = `.group:${k.slice(6)} ${T}`, B.push(k)) : k.startsWith("peer-") && (T = T.replace(A, `.peer:${k.slice(5)}~${A}`), B.push(k));
1650
+ E = E.filter((k) => !B.includes(k));
1651
+ const G = [], ee = [];
1652
+ let M = null;
1653
+ for (const k of E) {
1654
+ if (k === "dark" || be.includes(k)) continue;
1655
+ const P = ot(k);
1656
+ if (P) {
1657
+ M = P;
1526
1658
  continue;
1527
1659
  }
1528
- const O = h(v);
1529
- if (O) {
1530
- q ? de.push(O) : X.push(O);
1660
+ const R = c(k);
1661
+ if (R) {
1662
+ M ? ee.push(R) : G.push(R);
1531
1663
  continue;
1532
1664
  }
1533
- const P = rt[v];
1534
- typeof P == "function" && (j = P(j, A).split("{")[0]);
1665
+ const O = nt[k];
1666
+ typeof O == "function" && (T = O(T, $).split("{")[0]);
1535
1667
  }
1536
- function I(v, B) {
1537
- if (!B) return v;
1538
- let O = 0, P = 0;
1539
- if (v.length && (v[0] === ">" || v[0] === "+" || v[0] === "~" || v[0] === " ")) {
1540
- let T = 1;
1541
- for (; T < v.length && v[T] === " "; ) T++;
1542
- for (; T < v.length; T++) {
1543
- const R = v[T];
1544
- if (R === "[" ? O++ : R === "]" && O > 0 ? O-- : R === "(" ? P++ : R === ")" && P > 0 && P--, O === 0 && P === 0 && (v[T] === ">" || v[T] === "+" || v[T] === "~" || v[T] === " "))
1545
- return v.slice(0, T) + B + v.slice(T);
1668
+ function U(k, P) {
1669
+ if (!P) return k;
1670
+ let R = 0, O = 0;
1671
+ if (k.length && (k[0] === ">" || k[0] === "+" || k[0] === "~" || k[0] === " ")) {
1672
+ let j = 1;
1673
+ for (; j < k.length && k[j] === " "; ) j++;
1674
+ for (; j < k.length; j++) {
1675
+ const L = k[j];
1676
+ if (L === "[" ? R++ : L === "]" && R > 0 ? R-- : L === "(" ? O++ : L === ")" && O > 0 && O--, R === 0 && O === 0 && (k[j] === ">" || k[j] === "+" || k[j] === "~" || k[j] === " "))
1677
+ return k.slice(0, j) + P + k.slice(j);
1546
1678
  }
1547
- return v + B;
1679
+ return k + P;
1548
1680
  }
1549
- for (let T = 0; T < v.length; T++) {
1550
- const R = v[T];
1551
- if (R === "[" ? O++ : R === "]" && O > 0 ? O-- : R === "(" ? P++ : R === ")" && P > 0 && P--, O === 0 && P === 0 && (R === ">" || R === "+" || R === "~" || R === " "))
1552
- return v.slice(0, T) + B + v.slice(T);
1681
+ for (let j = 0; j < k.length; j++) {
1682
+ const L = k[j];
1683
+ if (L === "[" ? R++ : L === "]" && R > 0 ? R-- : L === "(" ? O++ : L === ")" && O > 0 && O--, R === 0 && O === 0 && (L === ">" || L === "+" || L === "~" || L === " "))
1684
+ return k.slice(0, j) + P + k.slice(j);
1553
1685
  }
1554
- return v + B;
1686
+ return k + P;
1555
1687
  }
1556
- const Z = X.join(""), F = de.join("");
1557
- if (q)
1558
- if (q.includes("&")) {
1559
- const v = q.indexOf("&"), B = q.slice(0, v), O = q.slice(v + 1), P = S + Z, T = j;
1560
- if (X.length === 0)
1561
- j = T.replace(S, B + P + F + O);
1688
+ const q = G.join(""), I = ee.join("");
1689
+ if (M)
1690
+ if (M.includes("&")) {
1691
+ const k = M.indexOf("&"), P = M.slice(0, k), R = M.slice(k + 1), O = A + q, j = T;
1692
+ if (G.length === 0)
1693
+ T = j.replace(A, P + O + I + R);
1562
1694
  else {
1563
- const R = I(O, F);
1564
- j = T.replace(S, B + P + R);
1695
+ const L = U(R, I);
1696
+ T = j.replace(A, P + O + L);
1565
1697
  }
1566
1698
  } else
1567
- j = j.replace(S, `${q}${S + Z}`), F && (j = j.replace(S, `${S}${F}`));
1699
+ T = T.replace(A, `${M}${A + q}`), I && (T = T.replace(A, `${A}${I}`));
1568
1700
  else
1569
- j = S + Z + F;
1570
- j = j.replace(new RegExp(S, "g"), E);
1571
- let L = `${j}{${A}}`;
1572
- const K = C.filter((v) => ye.includes(v)), D = K.length ? K[K.length - 1] : null, ne = C.includes("dark");
1573
- return b && D ? L = `@media (prefers-color-scheme: dark) and ${me[D]}{${L}}` : b ? L = `@media (prefers-color-scheme: dark){${L}}` : ne && D ? L = `@media (prefers-color-scheme: dark) and ${me[D]}{${L}}` : ne ? L = `@media (prefers-color-scheme: dark){${L}}` : D && (L = `@media ${me[D]}{${L}}`), L;
1574
- }
1575
- for (const w of n) {
1576
- const b = c(w), m = b.find(
1577
- (p) => ge[p] || be(p) || xe(p) || we(p) || ce(p)
1701
+ T = A + q + I;
1702
+ T = T.replace(new RegExp(A, "g"), S);
1703
+ let z = `${T}{${$}}`;
1704
+ const H = E.filter((k) => be.includes(k)), F = H.length ? H[H.length - 1] : null, te = E.includes("dark");
1705
+ return g && F ? z = `@media (prefers-color-scheme: dark) and ${ye[F]}{${z}}` : g ? z = `@media (prefers-color-scheme: dark){${z}}` : te && F ? z = `@media (prefers-color-scheme: dark) and ${ye[F]}{${z}}` : te ? z = `@media (prefers-color-scheme: dark){${z}}` : F && (z = `@media ${ye[F]}{${z}}`), z;
1706
+ }
1707
+ for (const d of n) {
1708
+ const g = u(d), m = g.find(
1709
+ (y) => me[y] || we(y) || ve(y) || xe(y) || fe(y)
1578
1710
  );
1579
1711
  if (!m) continue;
1580
- const x = b.indexOf(m), l = x >= 0 ? b.slice(0, x) : [], g = y(l);
1581
- if (g === 4) {
1582
- const p = d(w, !0);
1583
- p && f.push(p);
1712
+ const x = g.indexOf(m), l = x >= 0 ? g.slice(0, x) : [], b = C(l);
1713
+ if (b === 4) {
1714
+ const y = h(d, !0);
1715
+ y && f.push(y);
1584
1716
  } else {
1585
- const p = d(w);
1586
- p && (g === 1 ? s.push(p) : g === 2 ? o.push(p) : g === 3 && a.push(p));
1717
+ const y = h(d);
1718
+ y && (b === 1 ? o.push(y) : b === 2 ? s.push(y) : b === 3 && a.push(y));
1587
1719
  }
1588
1720
  }
1589
- const $ = [...s, ...o, ...a, ...f].join("");
1590
- return Ce.set(e, { css: $, timestamp: t }), $;
1721
+ const v = [...o, ...s, ...a, ...f].join("");
1722
+ return Te.set(e, { css: v, timestamp: t }), v;
1591
1723
  }
1592
- const te = [];
1593
- function ft(e, t, r, i, n, s, o, a) {
1724
+ const ne = [];
1725
+ function ut(e, t, r, i, n, o, s, a) {
1594
1726
  if (e) {
1595
- te.push(r);
1727
+ ne.push(r);
1596
1728
  try {
1597
1729
  if (t.loadingTemplate && r.isLoading) {
1598
- Y(e, t.loadingTemplate(r), r, i, n);
1730
+ Q(e, t.loadingTemplate(r), r, i, n);
1599
1731
  return;
1600
1732
  }
1601
1733
  if (t.errorTemplate && r.hasError) {
1602
- r.error instanceof Error && Y(e, t.errorTemplate(r.error, r), r, i, n);
1734
+ r.error instanceof Error && Q(e, t.errorTemplate(r.error, r), r, i, n);
1603
1735
  return;
1604
1736
  }
1605
1737
  const f = t.render(r);
1606
1738
  if (f instanceof Promise) {
1607
- s(!0), f.then((u) => {
1608
- s(!1), o(null), Y(e, u, r, i, n), a(e.innerHTML);
1609
- }).catch((u) => {
1610
- s(!1), o(u), t.errorTemplate && Y(e, t.errorTemplate(u, r), r, i, n);
1611
- }), t.loadingTemplate && Y(e, t.loadingTemplate(r), r, i, n);
1739
+ o(!0), f.then((p) => {
1740
+ o(!1), s(null), Q(e, p, r, i, n), a(e.innerHTML);
1741
+ }).catch((p) => {
1742
+ o(!1), s(p), t.errorTemplate && Q(e, t.errorTemplate(p, r), r, i, n);
1743
+ }), t.loadingTemplate && Q(e, t.loadingTemplate(r), r, i, n);
1612
1744
  return;
1613
1745
  }
1614
- Y(e, f, r, i, n), a(e.innerHTML);
1746
+ Q(e, f, r, i, n), a(e.innerHTML);
1615
1747
  } finally {
1616
- te.pop();
1748
+ ne.pop();
1617
1749
  }
1618
1750
  }
1619
1751
  }
1620
- function Y(e, t, r, i, n) {
1752
+ function Q(e, t, r, i, n) {
1621
1753
  e && (Ye(
1622
1754
  e,
1623
1755
  Array.isArray(t) ? t : [t],
@@ -1625,85 +1757,85 @@ function Y(e, t, r, i, n) {
1625
1757
  i
1626
1758
  ), n(e.innerHTML));
1627
1759
  }
1628
- function ut(e, t, r, i, n, s, o) {
1629
- if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1760
+ function pt(e, t, r, i, n, o, s) {
1761
+ if (o !== null && clearTimeout(o), Date.now() - t < 16) {
1630
1762
  if (n(r + 1), r > 10) {
1631
- o(null);
1763
+ s(null);
1632
1764
  return;
1633
1765
  }
1634
1766
  } else
1635
1767
  n(0);
1636
1768
  const f = setTimeout(() => {
1637
- i(Date.now()), e(), o(null);
1769
+ i(Date.now()), e(), s(null);
1638
1770
  }, 0);
1639
- o(f);
1771
+ s(f);
1640
1772
  }
1641
- function dt(e, t, r, i, n, s) {
1773
+ function dt(e, t, r, i, n, o) {
1642
1774
  if (!e) return;
1643
- const o = lt(i);
1644
- if (!t.style && (!o || o.trim() === "")) {
1645
- s(null), e.adoptedStyleSheets = [_e()];
1775
+ const s = ft(i);
1776
+ if (!t.style && (!s || s.trim() === "")) {
1777
+ o(null), e.adoptedStyleSheets = [Ee()];
1646
1778
  return;
1647
1779
  }
1648
1780
  let a = "";
1649
1781
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1650
- let f = Ge(`${a}
1651
- ${o}
1782
+ let f = Qe(`${a}
1783
+ ${s}
1652
1784
  `);
1653
1785
  f = Be(f);
1654
- let u = n;
1655
- u || (u = new CSSStyleSheet()), (u.cssRules.length === 0 || u.toString() !== f) && u.replaceSync(f), e.adoptedStyleSheets = [_e(), u], s(u);
1786
+ let p = n;
1787
+ p || (p = new CSSStyleSheet()), (p.cssRules.length === 0 || p.toString() !== f) && p.replaceSync(f), e.adoptedStyleSheets = [Ee(), p], o(p);
1656
1788
  }
1657
- const ue = /* @__PURE__ */ new Map(), Ae = Symbol.for("cer.registry");
1789
+ const de = /* @__PURE__ */ new Map(), je = Symbol.for("cer.registry");
1658
1790
  if (typeof window < "u") {
1659
1791
  const e = globalThis;
1660
- e[Ae] || (e[Ae] = ue);
1792
+ e[je] || (e[je] = de);
1661
1793
  }
1662
- function je(e, t, r) {
1663
- let i = J(e);
1794
+ function Le(e, t, r) {
1795
+ let i = Y(e);
1664
1796
  i.includes("-") || (i = `cer-${i}`);
1665
1797
  let n;
1666
- typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (s, o) => {
1667
- console.error(`[${i}] Error:`, s, o);
1798
+ typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (o, s) => {
1799
+ console.error(`[${i}] Error:`, o, s);
1668
1800
  });
1669
1801
  try {
1670
- const s = /* @__PURE__ */ new Set([
1802
+ const o = /* @__PURE__ */ new Set([
1671
1803
  "refs",
1672
1804
  "requestRender",
1673
1805
  "error",
1674
1806
  "hasError",
1675
1807
  "isLoading",
1676
1808
  "emit"
1677
- ]), o = [];
1809
+ ]), s = [];
1678
1810
  if (n.state && typeof n.state == "object" && Object.keys(n.state).forEach((a) => {
1679
- s.has(a) && o.push(a);
1811
+ o.has(a) && s.push(a);
1680
1812
  }), n.props && typeof n.props == "object" && Object.keys(n.props).forEach((a) => {
1681
- s.has(a) && o.push(a);
1813
+ o.has(a) && s.push(a);
1682
1814
  }), n.computed && typeof n.computed == "object" && Object.keys(n.computed).forEach((a) => {
1683
- s.has(a) && o.push(a);
1684
- }), o.length > 0) {
1685
- const a = Array.from(new Set(o));
1815
+ o.has(a) && s.push(a);
1816
+ }), s.length > 0) {
1817
+ const a = Array.from(new Set(s));
1686
1818
  console.warn(
1687
1819
  `[${i}] Reserved runtime context keys used in component config: ${a.join(", ")}. These names are provided by the runtime (for example: refs, error, emit). Rename your state/prop/computed keys (e.g. 'error' -> 'errorMessage') to avoid collisions and TypeScript type conflicts.`
1688
1820
  );
1689
1821
  }
1690
1822
  } catch {
1691
1823
  }
1692
- if (ue.set(i, n), typeof window < "u")
1824
+ if (de.set(i, n), typeof window < "u")
1693
1825
  if (!customElements.get(i))
1694
- customElements.define(i, pt(i, n));
1826
+ customElements.define(i, ht(i, n));
1695
1827
  else
1696
1828
  try {
1697
- document.querySelectorAll(i).forEach((s) => {
1829
+ document.querySelectorAll(i).forEach((o) => {
1698
1830
  try {
1699
- typeof s._cfg < "u" && (s._cfg = n), typeof s._render == "function" && s._render(n);
1831
+ typeof o._cfg < "u" && (o._cfg = n), typeof o._render == "function" && o._render(n);
1700
1832
  } catch {
1701
1833
  }
1702
1834
  });
1703
1835
  } catch {
1704
1836
  }
1705
1837
  }
1706
- function pt(e, t) {
1838
+ function ht(e, t) {
1707
1839
  if (!t.render)
1708
1840
  throw new Error(
1709
1841
  "Component must have a render function"
@@ -1747,7 +1879,7 @@ function pt(e, t) {
1747
1879
  _templateLoading = !1;
1748
1880
  _templateError = null;
1749
1881
  constructor() {
1750
- super(), this.attachShadow({ mode: "open" }), this._cfg = ue.get(e) || t;
1882
+ super(), this.attachShadow({ mode: "open" }), this._cfg = de.get(e) || t;
1751
1883
  const r = this._initContext(t);
1752
1884
  Object.defineProperty(r, "refs", {
1753
1885
  value: this._refs,
@@ -1760,12 +1892,12 @@ function pt(e, t) {
1760
1892
  enumerable: !1,
1761
1893
  configurable: !1
1762
1894
  }), this.context = r, Object.defineProperty(this.context, "emit", {
1763
- value: (n, s, o) => {
1895
+ value: (n, o, s) => {
1764
1896
  const a = new CustomEvent(n, {
1765
- detail: s,
1897
+ detail: o,
1766
1898
  bubbles: !0,
1767
1899
  composed: !0,
1768
- ...o || {}
1900
+ ...s || {}
1769
1901
  });
1770
1902
  return this.dispatchEvent(a), !a.defaultPrevented;
1771
1903
  },
@@ -1773,15 +1905,15 @@ function pt(e, t) {
1773
1905
  enumerable: !1,
1774
1906
  configurable: !1
1775
1907
  });
1776
- const i = ue.get(e) || t;
1908
+ const i = de.get(e) || t;
1777
1909
  Object.keys(i).forEach((n) => {
1778
- const s = i[n];
1779
- typeof s == "function" && (this.context[n] = (...o) => s(...o, this.context));
1910
+ const o = i[n];
1911
+ typeof o == "function" && (this.context[n] = (...s) => o(...s, this.context));
1780
1912
  }), this._applyComputed(i), this._initializing = !1, this._initWatchers(i), this._render(i);
1781
1913
  }
1782
1914
  connectedCallback() {
1783
1915
  this._runLogicWithinErrorBoundary(t, () => {
1784
- this._applyProps(t), qe(
1916
+ this._applyProps(t), We(
1785
1917
  t,
1786
1918
  this.context,
1787
1919
  this._mounted,
@@ -1817,7 +1949,7 @@ function pt(e, t) {
1817
1949
  }
1818
1950
  attributeChangedCallback(r, i, n) {
1819
1951
  this._runLogicWithinErrorBoundary(t, () => {
1820
- this._applyProps(t), Ie(
1952
+ this._applyProps(t), Ue(
1821
1953
  t,
1822
1954
  r,
1823
1955
  i,
@@ -1827,15 +1959,15 @@ function pt(e, t) {
1827
1959
  });
1828
1960
  }
1829
1961
  static get observedAttributes() {
1830
- return t.props ? Object.keys(t.props).map(J) : [];
1962
+ return t.props ? Object.keys(t.props).map(Y) : [];
1831
1963
  }
1832
1964
  _applyComputed(r) {
1833
1965
  this._runLogicWithinErrorBoundary(t, () => {
1834
1966
  r.computed && Object.entries(r.computed).forEach(([i, n]) => {
1835
1967
  Object.defineProperty(this.context, i, {
1836
1968
  get: () => {
1837
- const s = n(this.context);
1838
- return H(s);
1969
+ const o = n(this.context);
1970
+ return J(o);
1839
1971
  },
1840
1972
  enumerable: !0
1841
1973
  });
@@ -1845,7 +1977,7 @@ function pt(e, t) {
1845
1977
  // --- Render ---
1846
1978
  _render(r) {
1847
1979
  this._runLogicWithinErrorBoundary(r, () => {
1848
- ft(
1980
+ ut(
1849
1981
  this.shadowRoot,
1850
1982
  r,
1851
1983
  this.context,
@@ -1868,7 +2000,7 @@ function pt(e, t) {
1868
2000
  }
1869
2001
  _requestRender() {
1870
2002
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1871
- ut(
2003
+ pt(
1872
2004
  () => this._render(this._cfg),
1873
2005
  this._lastRenderTime,
1874
2006
  this._renderCount,
@@ -1915,11 +2047,11 @@ function pt(e, t) {
1915
2047
  // --- State, props, computed ---
1916
2048
  _initContext(r) {
1917
2049
  try {
1918
- let i = function(s, o = "") {
1919
- return Array.isArray(s) ? new Proxy(s, {
1920
- get(a, f, u) {
1921
- const d = Reflect.get(a, f, u);
1922
- return typeof d == "function" && typeof f == "string" && [
2050
+ let i = function(o, s = "") {
2051
+ return Array.isArray(o) ? new Proxy(o, {
2052
+ get(a, f, p) {
2053
+ const h = Reflect.get(a, f, p);
2054
+ return typeof h == "function" && typeof f == "string" && [
1923
2055
  "push",
1924
2056
  "pop",
1925
2057
  "shift",
@@ -1927,44 +2059,44 @@ function pt(e, t) {
1927
2059
  "splice",
1928
2060
  "sort",
1929
2061
  "reverse"
1930
- ].includes(f) ? function(...c) {
1931
- const h = d.apply(a, c);
2062
+ ].includes(f) ? function(...u) {
2063
+ const c = h.apply(a, u);
1932
2064
  if (!n._initializing) {
1933
- const k = o || "root";
1934
- n._triggerWatchers(k, a), n._render(r);
2065
+ const w = s || "root";
2066
+ n._triggerWatchers(w, a), n._render(r);
1935
2067
  }
1936
- return h;
1937
- } : d;
2068
+ return c;
2069
+ } : h;
1938
2070
  },
1939
- set(a, f, u) {
1940
- if (a[f] = u, !n._initializing) {
1941
- const d = o ? `${o}.${String(f)}` : String(f);
1942
- n._triggerWatchers(d, u), n._render(r);
2071
+ set(a, f, p) {
2072
+ if (a[f] = p, !n._initializing) {
2073
+ const h = s ? `${s}.${String(f)}` : String(f);
2074
+ n._triggerWatchers(h, p), n._render(r);
1943
2075
  }
1944
2076
  return !0;
1945
2077
  },
1946
2078
  deleteProperty(a, f) {
1947
2079
  if (delete a[f], !n._initializing) {
1948
- const u = o ? `${o}.${String(f)}` : String(f);
1949
- n._triggerWatchers(u, void 0), n._render(r);
2080
+ const p = s ? `${s}.${String(f)}` : String(f);
2081
+ n._triggerWatchers(p, void 0), n._render(r);
1950
2082
  }
1951
2083
  return !0;
1952
2084
  }
1953
- }) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
1954
- const f = o ? `${o}.${a}` : a;
1955
- s[a] = i(s[a], f);
1956
- }), new Proxy(s, {
1957
- set(a, f, u) {
1958
- const d = o ? `${o}.${String(f)}` : String(f);
1959
- return a[f] = i(u, d), n._initializing || (n._triggerWatchers(
1960
- d,
2085
+ }) : o && typeof o == "object" ? (Object.keys(o).forEach((a) => {
2086
+ const f = s ? `${s}.${a}` : a;
2087
+ o[a] = i(o[a], f);
2088
+ }), new Proxy(o, {
2089
+ set(a, f, p) {
2090
+ const h = s ? `${s}.${String(f)}` : String(f);
2091
+ return a[f] = i(p, h), n._initializing || (n._triggerWatchers(
2092
+ h,
1961
2093
  a[f]
1962
2094
  ), n._render(r)), !0;
1963
2095
  },
1964
- get(a, f, u) {
1965
- return Reflect.get(a, f, u);
2096
+ get(a, f, p) {
2097
+ return Reflect.get(a, f, p);
1966
2098
  }
1967
- })) : s;
2099
+ })) : o;
1968
2100
  };
1969
2101
  const n = this;
1970
2102
  return i({ ...r.state });
@@ -1974,7 +2106,7 @@ function pt(e, t) {
1974
2106
  }
1975
2107
  _initWatchers(r) {
1976
2108
  this._runLogicWithinErrorBoundary(r, () => {
1977
- ze(
2109
+ qe(
1978
2110
  this.context,
1979
2111
  this._watchers,
1980
2112
  r.watch || {}
@@ -1982,12 +2114,12 @@ function pt(e, t) {
1982
2114
  });
1983
2115
  }
1984
2116
  _triggerWatchers(r, i) {
1985
- Me(this.context, this._watchers, r, i);
2117
+ Ie(this.context, this._watchers, r, i);
1986
2118
  }
1987
2119
  _applyProps(r) {
1988
2120
  this._runLogicWithinErrorBoundary(r, () => {
1989
2121
  try {
1990
- We(this, r, this.context);
2122
+ Ne(this, r, this.context);
1991
2123
  } catch (i) {
1992
2124
  this._hasError = !0, r.onError && r.onError(i, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(i, this.context));
1993
2125
  }
@@ -1995,101 +2127,101 @@ function pt(e, t) {
1995
2127
  }
1996
2128
  };
1997
2129
  }
1998
- function ee(e, t = {}, r, i) {
2130
+ function re(e, t = {}, r, i) {
1999
2131
  const n = i ?? t.key;
2000
2132
  return { tag: e, key: n, props: t, children: r };
2001
2133
  }
2002
- function le(e) {
2134
+ function ue(e) {
2003
2135
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
2004
2136
  }
2005
- function se(e) {
2006
- return typeof e == "object" && e !== null && "tag" in e && !le(e);
2137
+ function ae(e) {
2138
+ return typeof e == "object" && e !== null && "tag" in e && !ue(e);
2007
2139
  }
2008
- function ht(e, t) {
2140
+ function gt(e, t) {
2009
2141
  return e.key != null ? e : { ...e, key: t };
2010
2142
  }
2011
- function gt(e, t = [], r = {}) {
2012
- const i = {}, n = {}, s = {}, o = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2013
- let a;
2014
- for (; a = o.exec(e); ) {
2015
- const f = a[1], u = a[2], d = (a[4] || a[6]) ?? "", y = d.match(/^{{(\d+)}}$/);
2016
- let c = y ? t[Number(y[1])] ?? null : d;
2017
- y || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
2018
- const h = ["model", "bind", "show", "class", "style"];
2019
- if (f === ":") {
2020
- const [k, $] = u.split(":"), [w, ...b] = k.split(".");
2021
- if (h.includes(w)) {
2022
- const m = [...b], x = w === "model" && $ ? `model:${$}` : w;
2023
- s[x] = {
2143
+ function mt(e, t = [], r = {}) {
2144
+ const i = {}, n = {}, o = {}, s = [], a = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2145
+ let f;
2146
+ for (; f = a.exec(e); ) {
2147
+ const p = f[1], h = f[2], C = (f[4] || f[6]) ?? "", u = C.match(/^{{(\d+)}}$/);
2148
+ let c = u ? t[Number(u[1])] ?? null : C;
2149
+ u || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
2150
+ const w = ["model", "bind", "show", "class", "style"];
2151
+ if (p === ":") {
2152
+ const [v, d] = h.split(":"), [g, ...m] = v.split(".");
2153
+ if (w.includes(g)) {
2154
+ const x = [...m], l = g === "model" && d ? `model:${d}` : g;
2155
+ o[l] = {
2024
2156
  value: c,
2025
- modifiers: m,
2026
- arg: $
2157
+ modifiers: x,
2158
+ arg: d
2027
2159
  };
2028
2160
  } else
2029
- n[u] = c;
2030
- } else if (f === "@") {
2031
- const k = "on" + u.charAt(0).toUpperCase() + u.slice(1);
2032
- i[k] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
2033
- } else u === "ref" ? i.ref = c : n[u] = c;
2161
+ n[h] = c, s.push(h);
2162
+ } else if (p === "@") {
2163
+ const v = "on" + h.charAt(0).toUpperCase() + h.slice(1);
2164
+ i[v] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
2165
+ } else h === "ref" ? i.ref = c : n[h] = c;
2034
2166
  }
2035
- return { props: i, attrs: n, directives: s };
2167
+ return { props: i, attrs: n, directives: o, bound: s };
2036
2168
  }
2037
- function mt(e, t, r) {
2038
- const i = te.length > 0 ? te[te.length - 1] : void 0, n = r ?? i;
2039
- function s(l, g) {
2040
- return ee("#text", {}, l, g);
2169
+ function yt(e, t, r) {
2170
+ const i = ne.length > 0 ? ne[ne.length - 1] : void 0, n = r ?? i;
2171
+ function o(l, b) {
2172
+ return re("#text", {}, l, b);
2041
2173
  }
2042
- let o = "";
2174
+ let s = "";
2043
2175
  for (let l = 0; l < e.length; l++)
2044
- o += e[l], l < t.length && (o += `{{${l}}}`);
2176
+ s += e[l], l < t.length && (s += `{{${l}}}`);
2045
2177
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, f = [];
2046
- let u, d = [], y = null, c = {}, h, k = 0, $ = [];
2047
- function w(l) {
2048
- !l || typeof l != "object" || le(l) || (l.props || l.attrs ? (l.props && (c.props || (c.props = {}), Object.assign(c.props, l.props)), l.attrs && (c.attrs || (c.attrs = {}), Object.keys(l.attrs).forEach((g) => {
2049
- if (g === "style" && c.attrs.style) {
2050
- const p = c.attrs.style.replace(
2178
+ let p, h = [], C = null, u = {}, c, w = 0, v = [];
2179
+ function d(l) {
2180
+ !l || typeof l != "object" || ue(l) || (l.props || l.attrs ? (l.props && (u.props || (u.props = {}), Object.assign(u.props, l.props)), l.attrs && (u.attrs || (u.attrs = {}), Object.keys(l.attrs).forEach((b) => {
2181
+ if (b === "style" && u.attrs.style) {
2182
+ const y = u.attrs.style.replace(
2051
2183
  /;?\s*$/,
2052
2184
  ""
2053
2185
  ), _ = l.attrs.style.replace(/^;?\s*/, "");
2054
- c.attrs.style = p + "; " + _;
2055
- } else if (g === "class" && c.attrs.class) {
2056
- const p = c.attrs.class.trim().split(/\s+/).filter(Boolean), _ = l.attrs.class.trim().split(/\s+/).filter(Boolean), C = [
2057
- .../* @__PURE__ */ new Set([...p, ..._])
2186
+ u.attrs.style = y + "; " + _;
2187
+ } else if (b === "class" && u.attrs.class) {
2188
+ const y = u.attrs.class.trim().split(/\s+/).filter(Boolean), _ = l.attrs.class.trim().split(/\s+/).filter(Boolean), E = [
2189
+ .../* @__PURE__ */ new Set([...y, ..._])
2058
2190
  ];
2059
- c.attrs.class = C.join(" ");
2191
+ u.attrs.class = E.join(" ");
2060
2192
  } else
2061
- c.attrs[g] = l.attrs[g];
2062
- }))) : (c.props || (c.props = {}), Object.assign(c.props, l)));
2063
- }
2064
- function b(l, g) {
2065
- const p = y ? d : $;
2066
- if (le(l)) {
2067
- const _ = l.key ?? g;
2068
- let C = l.children;
2069
- p.push({
2193
+ u.attrs[b] = l.attrs[b];
2194
+ }))) : (u.props || (u.props = {}), Object.assign(u.props, l)));
2195
+ }
2196
+ function g(l, b) {
2197
+ const y = C ? h : v;
2198
+ if (ue(l)) {
2199
+ const _ = l.key ?? b;
2200
+ let E = l.children;
2201
+ y.push({
2070
2202
  ...l,
2071
2203
  key: _,
2072
- children: C
2204
+ children: E
2073
2205
  });
2074
2206
  return;
2075
2207
  }
2076
- if (se(l)) {
2077
- p.push(ht(l, void 0));
2208
+ if (ae(l)) {
2209
+ y.push(gt(l, void 0));
2078
2210
  return;
2079
2211
  }
2080
2212
  if (Array.isArray(l)) {
2081
2213
  if (l.length === 0) return;
2082
2214
  for (let _ = 0; _ < l.length; _++) {
2083
- const C = l[_];
2084
- le(C) || se(C) || Array.isArray(C) ? b(C, `${g}-${_}`) : C !== null && typeof C == "object" ? w(C) : p.push(s(String(C), `${g}-${_}`));
2215
+ const E = l[_];
2216
+ ue(E) || ae(E) || Array.isArray(E) ? g(E, `${b}-${_}`) : E !== null && typeof E == "object" ? d(E) : y.push(o(String(E), `${b}-${_}`));
2085
2217
  }
2086
2218
  return;
2087
2219
  }
2088
2220
  if (l !== null && typeof l == "object") {
2089
- w(l);
2221
+ d(l);
2090
2222
  return;
2091
2223
  }
2092
- p.push(s(String(l), g));
2224
+ y.push(o(String(l), b));
2093
2225
  }
2094
2226
  const m = /* @__PURE__ */ new Set([
2095
2227
  "area",
@@ -2107,91 +2239,122 @@ function mt(e, t, r) {
2107
2239
  "track",
2108
2240
  "wbr"
2109
2241
  ]);
2110
- for (; u = a.exec(o); )
2111
- if (u[1]) {
2112
- const l = u[1], g = u[0][1] === "/", p = u[0][u[0].length - 2] === "/" || m.has(l), {
2242
+ for (; p = a.exec(s); )
2243
+ if (p[1]) {
2244
+ const l = p[1], b = p[0][1] === "/", y = p[0][p[0].length - 2] === "/" || m.has(l), {
2113
2245
  props: _,
2114
- attrs: C,
2115
- directives: E
2116
- } = gt(u[2] || "", t, n), S = { props: {}, attrs: {} };
2117
- for (const A in _) S.props[A] = _[A];
2118
- for (const A in C) S.attrs[A] = C[A];
2119
- if (E && Object.keys(E).some((A) => A === "model" || A.startsWith("model:")))
2246
+ attrs: E,
2247
+ directives: S,
2248
+ bound: A
2249
+ } = mt(p[2] || "", t, n), $ = { props: {}, attrs: {} };
2250
+ for (const T in _) $.props[T] = _[T];
2251
+ for (const T in E) $.attrs[T] = E[T];
2252
+ if ($.attrs && Object.prototype.hasOwnProperty.call($.attrs, "key") && !($.props && Object.prototype.hasOwnProperty.call($.props, "key")))
2120
2253
  try {
2121
- const A = Symbol.for("cer.registry"), j = globalThis[A], Q = !!(j && typeof j.has == "function" && j.has(l)), X = !!(n && (n.__customElements instanceof Set && n.__customElements.has(l) || Array.isArray(n.__isCustomElements) && n.__isCustomElements.includes(l)));
2122
- if (!!(l.includes("-") || X || Q))
2123
- for (const I of Object.keys(E)) {
2124
- if (I !== "model" && !I.startsWith("model:")) continue;
2125
- const Z = E[I], F = Z.arg ?? (I.includes(":") ? I.split(":", 2)[1] : void 0), L = Z.value, K = F ?? "modelValue", D = z, ne = oe, v = n ? n._state || n : void 0;
2126
- let B;
2127
- typeof L == "string" && n ? B = D(v, L) : B = L, S.props[K] = B;
2254
+ $.props.key = $.attrs.key;
2255
+ } catch {
2256
+ }
2257
+ try {
2258
+ const T = {
2259
+ input: ["value", "checked", "disabled", "readonly", "required", "placeholder", "maxlength", "minlength"],
2260
+ textarea: ["value", "disabled", "readonly", "required", "placeholder", "maxlength", "minlength"],
2261
+ select: ["value", "disabled", "required", "multiple"],
2262
+ option: ["selected", "disabled", "value"],
2263
+ video: ["muted", "autoplay", "controls", "loop", "playsinline"],
2264
+ audio: ["muted", "autoplay", "controls", "loop"],
2265
+ img: ["src", "alt", "width", "height"],
2266
+ button: ["type", "name", "value", "disabled", "autofocus", "form"]
2267
+ }, B = l.toLowerCase(), G = T[B] ?? [];
2268
+ if ($.attrs)
2269
+ for (const M of G)
2270
+ A && A.includes(M) && M in $.attrs && !($.props && M in $.props) && ($.props[M] = $.attrs[M], delete $.attrs[M]);
2271
+ if ((l.includes("-") || !!n?.__customElements?.has?.(l)) && A && $.attrs) {
2272
+ const M = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
2273
+ for (const U of A)
2274
+ if (U in $.attrs && !($.props && U in $.props)) {
2275
+ const q = U.includes("-") ? U.split("-").map((I, z) => z === 0 ? I : I.charAt(0).toUpperCase() + I.slice(1)).join("") : U;
2276
+ $.props[q] = $.attrs[U], M.has(U) || delete $.attrs[U];
2277
+ }
2278
+ $.isCustomElement = !0;
2279
+ }
2280
+ } catch {
2281
+ }
2282
+ if (S && Object.keys(S).some((T) => T === "model" || T.startsWith("model:")))
2283
+ try {
2284
+ const T = Symbol.for("cer.registry"), B = globalThis[T], G = !!(B && typeof B.has == "function" && B.has(l)), ee = !!(n && (n.__customElements instanceof Set && n.__customElements.has(l) || Array.isArray(n.__isCustomElements) && n.__isCustomElements.includes(l)));
2285
+ if (!!(l.includes("-") || ee || G))
2286
+ for (const q of Object.keys(S)) {
2287
+ if (q !== "model" && !q.startsWith("model:")) continue;
2288
+ const I = S[q], z = I.arg ?? (q.includes(":") ? q.split(":", 2)[1] : void 0), H = I.value, F = z ?? "modelValue", te = W, k = ce, P = n ? n._state || n : void 0;
2289
+ let R;
2290
+ typeof H == "string" && n ? R = te(P, H) : R = H, $.props[F] = R;
2128
2291
  try {
2129
- const T = J(K);
2130
- S.attrs || (S.attrs = {}), B !== void 0 && (S.attrs[T] = B);
2292
+ const L = Y(F);
2293
+ $.attrs || ($.attrs = {}), R !== void 0 && ($.attrs[L] = R);
2131
2294
  } catch {
2132
2295
  }
2133
- S.isCustomElement = !0;
2134
- const O = `update:${J(K)}`, P = "on" + O.charAt(0).toUpperCase() + O.slice(1);
2135
- S.props[P] = function(T) {
2136
- const R = T.detail !== void 0 ? T.detail : T.target ? T.target.value : void 0;
2137
- if (!v) return;
2138
- const pe = D(v, typeof L == "string" ? L : String(L));
2139
- (Array.isArray(R) && Array.isArray(pe) ? JSON.stringify([...R].sort()) !== JSON.stringify([...pe].sort()) : R !== pe) && (ne(v, typeof L == "string" ? L : String(L), R), n?.requestRender ? n.requestRender() : n?._requestRender && n._requestRender());
2140
- }, delete E[I];
2296
+ $.isCustomElement = !0;
2297
+ const O = `update:${Y(F)}`, j = "on" + O.charAt(0).toUpperCase() + O.slice(1);
2298
+ $.props[j] = function(L) {
2299
+ const se = L.detail !== void 0 ? L.detail : L.target ? L.target.value : void 0;
2300
+ if (!P) return;
2301
+ const he = te(P, typeof H == "string" ? H : String(H));
2302
+ (Array.isArray(se) && Array.isArray(he) ? JSON.stringify([...se].sort()) !== JSON.stringify([...he].sort()) : se !== he) && (k(P, typeof H == "string" ? H : String(H), se), n?.requestRender ? n.requestRender() : n?._requestRender && n._requestRender());
2303
+ }, delete S[q];
2141
2304
  }
2142
2305
  } catch {
2143
2306
  }
2144
- if (Object.keys(E).length > 0 && (S.directives = { ...E }), g) {
2145
- const A = ee(
2146
- y,
2147
- c,
2148
- d.length === 1 && se(d[0]) && d[0].tag === "#text" ? typeof d[0].children == "string" ? d[0].children : "" : d.length ? d : void 0,
2149
- h
2150
- ), j = f.pop();
2151
- j ? (y = j.tag, c = j.props, h = j.key, d = j.children, d.push(A)) : ($.push(A), y = null, c = {}, h = void 0, d = []);
2152
- } else p ? y ? d.push(ee(l, S, void 0, void 0)) : $.push(ee(l, S, void 0, void 0)) : (y && f.push({
2153
- tag: y,
2154
- props: c,
2155
- children: d,
2156
- key: h
2157
- }), y = l, c = S, d = []);
2158
- } else if (typeof u[3] < "u") {
2159
- const l = Number(u[3]), g = t[l], p = `interp-${l}`;
2160
- b(g, p);
2161
- } else if (u[4]) {
2162
- const l = u[4], g = y ? d : $, p = l.split(/({{\d+}})/);
2163
- for (const _ of p) {
2307
+ if (Object.keys(S).length > 0 && ($.directives = { ...S }), b) {
2308
+ const T = re(
2309
+ C,
2310
+ u,
2311
+ h.length === 1 && ae(h[0]) && h[0].tag === "#text" ? typeof h[0].children == "string" ? h[0].children : "" : h.length ? h : void 0,
2312
+ c
2313
+ ), B = f.pop();
2314
+ B ? (C = B.tag, u = B.props, c = B.key, h = B.children, h.push(T)) : (v.push(T), C = null, u = {}, c = void 0, h = []);
2315
+ } else y ? C ? h.push(re(l, $, void 0, void 0)) : v.push(re(l, $, void 0, void 0)) : (C && f.push({
2316
+ tag: C,
2317
+ props: u,
2318
+ children: h,
2319
+ key: c
2320
+ }), C = l, u = $, h = []);
2321
+ } else if (typeof p[3] < "u") {
2322
+ const l = Number(p[3]), b = t[l], y = `interp-${l}`;
2323
+ g(b, y);
2324
+ } else if (p[4]) {
2325
+ const l = p[4], b = C ? h : v, y = l.split(/({{\d+}})/);
2326
+ for (const _ of y) {
2164
2327
  if (!_) continue;
2165
- const C = _.match(/^{{(\d+)}}$/);
2166
- if (C) {
2167
- const E = Number(C[1]), S = t[E], A = `interp-${E}`;
2168
- b(S, A);
2328
+ const E = _.match(/^{{(\d+)}}$/);
2329
+ if (E) {
2330
+ const S = Number(E[1]), A = t[S], $ = `interp-${S}`;
2331
+ g(A, $);
2169
2332
  } else {
2170
- const E = `text-${k++}`;
2171
- g.push(s(_, E));
2333
+ const S = `text-${w++}`;
2334
+ b.push(o(_, S));
2172
2335
  }
2173
2336
  }
2174
2337
  }
2175
- const x = $.filter((l) => se(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0);
2176
- return x.length === 1 ? x[0] : x.length > 1 ? x : ee("div", {}, "", "fallback-root");
2338
+ const x = v.filter((l) => ae(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0);
2339
+ return x.length === 1 ? x[0] : x.length > 1 ? x : re("div", {}, "", "fallback-root");
2177
2340
  }
2178
- function U(e, ...t) {
2341
+ function Z(e, ...t) {
2179
2342
  const r = t[t.length - 1], i = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2180
- return mt(e, t, i);
2343
+ return yt(e, t, i);
2181
2344
  }
2182
- const Te = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, W = (e, t) => {
2345
+ const Re = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, K = (e, t) => {
2183
2346
  for (const r of e) {
2184
- const i = [], n = r.path.replace(/:[^/]+/g, (a) => (i.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${n}$`), o = t.match(s);
2185
- if (o) {
2347
+ const i = [], n = r.path.replace(/:[^/]+/g, (a) => (i.push(a.slice(1)), "([^/]+)")), o = new RegExp(`^${n}$`), s = t.match(o);
2348
+ if (s) {
2186
2349
  const a = {};
2187
- return i.forEach((f, u) => {
2188
- a[f] = o[u + 1];
2350
+ return i.forEach((f, p) => {
2351
+ a[f] = s[p + 1];
2189
2352
  }), { route: r, params: a };
2190
2353
  }
2191
2354
  }
2192
2355
  return { route: null, params: {} };
2193
2356
  }, ke = {};
2194
- async function yt(e) {
2357
+ async function bt(e) {
2195
2358
  if (e.component) return e.component;
2196
2359
  if (e.load) {
2197
2360
  if (ke[e.path]) return ke[e.path];
@@ -2204,160 +2367,160 @@ async function yt(e) {
2204
2367
  }
2205
2368
  throw new Error(`No component or loader defined for route: ${e.path}`);
2206
2369
  }
2207
- function bt(e) {
2370
+ function wt(e) {
2208
2371
  const { routes: t, base: r = "", initialUrl: i } = e;
2209
- let n, s, o, a, f, u, d;
2210
- const y = async ($, w) => {
2211
- const b = t.find((m) => W([m], $.path).route !== null);
2212
- if (b?.beforeEnter)
2372
+ let n, o, s, a, f, p, h;
2373
+ const C = async (v, d) => {
2374
+ const g = t.find((m) => K([m], v.path).route !== null);
2375
+ if (g?.beforeEnter)
2213
2376
  try {
2214
- const m = await b.beforeEnter($, w);
2215
- return typeof m == "string" ? (await k(m, !0), !1) : m !== !1;
2377
+ const m = await g.beforeEnter(v, d);
2378
+ return typeof m == "string" ? (await w(m, !0), !1) : m !== !1;
2216
2379
  } catch (m) {
2217
2380
  return console.error("beforeEnter error", m), !1;
2218
2381
  }
2219
2382
  return !0;
2220
- }, c = async ($, w) => {
2221
- const b = t.find((m) => W([m], $.path).route !== null);
2222
- if (b?.onEnter)
2383
+ }, u = async (v, d) => {
2384
+ const g = t.find((m) => K([m], v.path).route !== null);
2385
+ if (g?.onEnter)
2223
2386
  try {
2224
- const m = await b.onEnter($, w);
2225
- return typeof m == "string" ? (await k(m, !0), !1) : m !== !1;
2387
+ const m = await g.onEnter(v, d);
2388
+ return typeof m == "string" ? (await w(m, !0), !1) : m !== !1;
2226
2389
  } catch (m) {
2227
2390
  return console.error("onEnter error", m), !1;
2228
2391
  }
2229
2392
  return !0;
2230
- }, h = ($, w) => {
2231
- const b = t.find((m) => W([m], $.path).route !== null);
2232
- if (b?.afterEnter)
2393
+ }, c = (v, d) => {
2394
+ const g = t.find((m) => K([m], v.path).route !== null);
2395
+ if (g?.afterEnter)
2233
2396
  try {
2234
- b.afterEnter($, w);
2397
+ g.afterEnter(v, d);
2235
2398
  } catch (m) {
2236
2399
  console.error("afterEnter error", m);
2237
2400
  }
2238
- }, k = async ($, w = !1) => {
2401
+ }, w = async (v, d = !1) => {
2239
2402
  try {
2240
- const b = {
2241
- path: $.replace(r, "") || "/",
2403
+ const g = {
2404
+ path: v.replace(r, "") || "/",
2242
2405
  query: {}
2243
- }, m = W(t, b.path);
2244
- if (!m) throw new Error(`No route found for ${b.path}`);
2245
- const x = o.getState(), l = {
2246
- path: b.path,
2406
+ }, m = K(t, g.path);
2407
+ if (!m) throw new Error(`No route found for ${g.path}`);
2408
+ const x = s.getState(), l = {
2409
+ path: g.path,
2247
2410
  params: m.params,
2248
- query: b.query
2411
+ query: g.query
2249
2412
  };
2250
- if (!await y(l, x) || !await c(l, x)) return;
2251
- typeof window < "u" && typeof document < "u" && (w ? window.history.replaceState({}, "", r + $) : window.history.pushState({}, "", r + $)), o.setState(l), h(l, x);
2252
- } catch (b) {
2253
- console.error("Navigation error:", b);
2413
+ if (!await C(l, x) || !await u(l, x)) return;
2414
+ typeof window < "u" && typeof document < "u" && (d ? window.history.replaceState({}, "", r + v) : window.history.pushState({}, "", r + v)), s.setState(l), c(l, x);
2415
+ } catch (g) {
2416
+ console.error("Navigation error:", g);
2254
2417
  }
2255
2418
  };
2256
2419
  if (typeof window < "u" && typeof document < "u") {
2257
2420
  n = () => {
2258
- const w = new URL(window.location.href), b = w.pathname.replace(r, "") || "/", m = Te(w.search);
2259
- return { path: b, query: m };
2260
- }, s = n();
2261
- const $ = W(t, s.path);
2262
- o = $e({
2263
- path: s.path,
2264
- params: $.params,
2265
- query: s.query
2266
- }), a = async (w = !1) => {
2267
- const b = n();
2268
- await k(b.path, w);
2269
- }, window.addEventListener("popstate", () => a(!0)), f = (w) => k(w, !1), u = (w) => k(w, !0), d = () => window.history.back();
2421
+ const d = new URL(window.location.href), g = d.pathname.replace(r, "") || "/", m = Re(d.search);
2422
+ return { path: g, query: m };
2423
+ }, o = n();
2424
+ const v = K(t, o.path);
2425
+ s = $e({
2426
+ path: o.path,
2427
+ params: v.params,
2428
+ query: o.query
2429
+ }), a = async (d = !1) => {
2430
+ const g = n();
2431
+ await w(g.path, d);
2432
+ }, window.addEventListener("popstate", () => a(!0)), f = (d) => w(d, !1), p = (d) => w(d, !0), h = () => window.history.back();
2270
2433
  } else {
2271
2434
  n = () => {
2272
- const b = new URL(i || "/", "http://localhost"), m = b.pathname.replace(r, "") || "/", x = Te(b.search);
2435
+ const g = new URL(i || "/", "http://localhost"), m = g.pathname.replace(r, "") || "/", x = Re(g.search);
2273
2436
  return { path: m, query: x };
2274
- }, s = n();
2275
- const $ = W(t, s.path);
2276
- o = $e({
2277
- path: s.path,
2278
- params: $.params,
2279
- query: s.query
2437
+ }, o = n();
2438
+ const v = K(t, o.path);
2439
+ s = $e({
2440
+ path: o.path,
2441
+ params: v.params,
2442
+ query: o.query
2280
2443
  }), a = async () => {
2281
- const b = n();
2282
- await w(b.path);
2444
+ const g = n();
2445
+ await d(g.path);
2283
2446
  };
2284
- const w = async (b) => {
2447
+ const d = async (g) => {
2285
2448
  try {
2286
2449
  const m = {
2287
- path: b.replace(r, "") || "/",
2450
+ path: g.replace(r, "") || "/",
2288
2451
  query: {}
2289
- }, x = W(t, m.path);
2452
+ }, x = K(t, m.path);
2290
2453
  if (!x) throw new Error(`No route found for ${m.path}`);
2291
- const l = o.getState(), g = {
2454
+ const l = s.getState(), b = {
2292
2455
  path: m.path,
2293
2456
  params: x.params,
2294
2457
  query: m.query
2295
- }, p = t.find((_) => W([_], g.path).route !== null);
2296
- if (p?.beforeEnter)
2458
+ }, y = t.find((_) => K([_], b.path).route !== null);
2459
+ if (y?.beforeEnter)
2297
2460
  try {
2298
- const _ = await p.beforeEnter(g, l);
2461
+ const _ = await y.beforeEnter(b, l);
2299
2462
  if (typeof _ == "string") {
2300
- await w(_);
2463
+ await d(_);
2301
2464
  return;
2302
2465
  }
2303
2466
  if (_ === !1) return;
2304
2467
  } catch {
2305
2468
  return;
2306
2469
  }
2307
- if (p?.onEnter)
2470
+ if (y?.onEnter)
2308
2471
  try {
2309
- const _ = await p.onEnter(g, l);
2472
+ const _ = await y.onEnter(b, l);
2310
2473
  if (typeof _ == "string") {
2311
- await w(_);
2474
+ await d(_);
2312
2475
  return;
2313
2476
  }
2314
2477
  if (_ === !1) return;
2315
2478
  } catch {
2316
2479
  return;
2317
2480
  }
2318
- if (o.setState(g), p?.afterEnter)
2481
+ if (s.setState(b), y?.afterEnter)
2319
2482
  try {
2320
- p.afterEnter(g, l);
2483
+ y.afterEnter(b, l);
2321
2484
  } catch {
2322
2485
  }
2323
2486
  } catch {
2324
2487
  }
2325
2488
  };
2326
- f = async (b) => w(b), u = async (b) => w(b), d = () => {
2489
+ f = async (g) => d(g), p = async (g) => d(g), h = () => {
2327
2490
  };
2328
2491
  }
2329
2492
  return {
2330
- store: o,
2493
+ store: s,
2331
2494
  push: f,
2332
- replace: u,
2333
- back: d,
2334
- subscribe: o.subscribe,
2335
- matchRoute: ($) => W(t, $),
2336
- getCurrent: () => o.getState(),
2337
- resolveRouteComponent: yt
2495
+ replace: p,
2496
+ back: h,
2497
+ subscribe: s.subscribe,
2498
+ matchRoute: (v) => K(t, v),
2499
+ getCurrent: () => s.getState(),
2500
+ resolveRouteComponent: bt
2338
2501
  };
2339
2502
  }
2340
- function Ct(e, t) {
2341
- return W(e, t);
2503
+ function At(e, t) {
2504
+ return K(e, t);
2342
2505
  }
2343
- function At(e) {
2344
- const t = bt(e);
2345
- return je("router-view", {
2506
+ function Tt(e) {
2507
+ const t = wt(e);
2508
+ return Le("router-view", {
2346
2509
  async render() {
2347
- if (!t) return U`<div>Router not initialized.</div>`;
2510
+ if (!t) return Z`<div>Router not initialized.</div>`;
2348
2511
  const r = t.getCurrent(), { path: i } = r, n = t.matchRoute(i);
2349
- if (!n.route) return U`<div>Not found</div>`;
2512
+ if (!n.route) return Z`<div>Not found</div>`;
2350
2513
  try {
2351
- const s = await t.resolveRouteComponent(n.route);
2352
- if (typeof s == "string")
2353
- return { tag: s, props: {}, children: [] };
2354
- if (typeof s == "function") {
2355
- const o = s(), a = o instanceof Promise ? await o : o;
2514
+ const o = await t.resolveRouteComponent(n.route);
2515
+ if (typeof o == "string")
2516
+ return { tag: o, props: {}, children: [] };
2517
+ if (typeof o == "function") {
2518
+ const s = o(), a = s instanceof Promise ? await s : s;
2356
2519
  return typeof a == "string" ? { tag: a, props: {}, children: [] } : a;
2357
2520
  }
2358
- return U`<div>Invalid route component</div>`;
2521
+ return Z`<div>Invalid route component</div>`;
2359
2522
  } catch {
2360
- return U`<div>Invalid route component</div>`;
2523
+ return Z`<div>Invalid route component</div>`;
2361
2524
  }
2362
2525
  },
2363
2526
  onConnected(r) {
@@ -2365,7 +2528,7 @@ function At(e) {
2365
2528
  typeof r.requestRender == "function" && r.requestRender();
2366
2529
  });
2367
2530
  }
2368
- }), je("router-link", {
2531
+ }), Le("router-link", {
2369
2532
  state: {},
2370
2533
  props: {
2371
2534
  to: { type: String, default: "" },
@@ -2378,7 +2541,7 @@ function At(e) {
2378
2541
  disabled: { type: Boolean, default: !1 },
2379
2542
  external: { type: Boolean, default: !1 },
2380
2543
  class: { type: String, default: "" },
2381
- style: { type: String, default: Oe`
2544
+ style: { type: String, default: Pe`
2382
2545
  [aria-disabled="true"] {
2383
2546
  pointer-events: none;
2384
2547
  opacity: 0.5;
@@ -2387,30 +2550,30 @@ function At(e) {
2387
2550
  },
2388
2551
  style: (r) => r.style,
2389
2552
  render: (r) => {
2390
- const i = t.getCurrent(), n = r.to, s = r.exact, o = r.exactActiveClass, a = r.activeClass, f = r.ariaCurrentValue, u = r.tag, d = r.disabled, y = r.external, c = i.path === n, h = s ? c : i && typeof i.path == "string" ? i.path.startsWith(n) : !1, k = c ? `aria-current="${f}"` : "", $ = (r.class || "").split(/\s+/).filter(Boolean), w = {};
2391
- for (const g of $) w[g] = !0;
2392
- const b = {
2393
- ...w,
2553
+ const i = t.getCurrent(), n = r.to, o = r.exact, s = r.exactActiveClass, a = r.activeClass, f = r.ariaCurrentValue, p = r.tag, h = r.disabled, C = r.external, u = i.path === n, c = o ? u : i && typeof i.path == "string" ? i.path.startsWith(n) : !1, w = u ? `aria-current="${f}"` : "", v = (r.class || "").split(/\s+/).filter(Boolean), d = {};
2554
+ for (const b of v) d[b] = !0;
2555
+ const g = {
2556
+ ...d,
2394
2557
  // Also include the configurable names (may duplicate the above)
2395
- [a]: h,
2396
- [o]: c
2397
- }, m = u === "button", x = d ? m ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", l = y && (u === "a" || !u) ? 'target="_blank" rel="noopener noreferrer"' : "";
2398
- return U`
2399
- ${Pe().when(m, U`
2558
+ [a]: c,
2559
+ [s]: u
2560
+ }, m = p === "button", x = h ? m ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", l = C && (p === "a" || !p) ? 'target="_blank" rel="noopener noreferrer"' : "";
2561
+ return Z`
2562
+ ${ze().when(m, Z`
2400
2563
  <button
2401
2564
  part="button"
2402
- :class="${b}"
2403
- ${k}
2565
+ :class="${g}"
2566
+ ${w}
2404
2567
  ${x}
2405
2568
  ${l}
2406
2569
  @click="navigate"
2407
2570
  ><slot></slot></button>
2408
- `).otherwise(U`
2571
+ `).otherwise(Z`
2409
2572
  <a
2410
2573
  part="link"
2411
2574
  href="${n}"
2412
- :class="${b}"
2413
- ${k}
2575
+ :class="${g}"
2576
+ ${w}
2414
2577
  ${x}
2415
2578
  ${l}
2416
2579
  @click="navigate"
@@ -2428,26 +2591,26 @@ function At(e) {
2428
2591
  }), t;
2429
2592
  }
2430
2593
  export {
2431
- G as GlobalEventBus,
2432
- je as component,
2594
+ X as GlobalEventBus,
2595
+ Le as component,
2433
2596
  $e as createStore,
2434
- Oe as css,
2597
+ Pe as css,
2435
2598
  kt as each,
2436
- vt as emit,
2437
- re as eventBus,
2438
- U as html,
2439
- At as initRouter,
2440
- Et as listen,
2441
- Pe as match,
2442
- W as matchRoute,
2443
- Ct as matchRouteSSR,
2444
- _t as off,
2599
+ _t as emit,
2600
+ ie as eventBus,
2601
+ Z as html,
2602
+ Tt as initRouter,
2603
+ Ct as listen,
2604
+ ze as match,
2605
+ K as matchRoute,
2606
+ At as matchRouteSSR,
2607
+ St as off,
2445
2608
  $t as on,
2446
- St as once,
2447
- Te as parseQuery,
2448
- he as renderToString,
2449
- yt as resolveRouteComponent,
2450
- bt as useRouter,
2451
- xt as when
2609
+ Et as once,
2610
+ Re as parseQuery,
2611
+ ge as renderToString,
2612
+ bt as resolveRouteComponent,
2613
+ wt as useRouter,
2614
+ vt as when
2452
2615
  };
2453
2616
  //# sourceMappingURL=custom-elements-runtime.es.js.map