@jasonshimmy/custom-elements-runtime 0.2.2 → 0.2.4

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 yt(e, t) {
2
- return te(e ? t : [], "when-block");
1
+ function vt(e, t) {
2
+ return fe(e ? t : [], "when-block");
3
3
  }
4
- function mt(e, t) {
4
+ function xt(e, t) {
5
5
  return e.map((r, o) => {
6
6
  const n = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${o}` : String(r);
7
- return te(t(r, o), `each-${n}`);
7
+ return fe(t(r, o), `each-${n}`);
8
8
  });
9
9
  }
10
- function Re() {
10
+ function Oe() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function Re() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Be(...e);
20
+ return Pe(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Be(...e) {
24
+ function Pe(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, o] = e[t];
27
- if (r) return [te(o, `whenChain-branch-${t}`)];
27
+ if (r) return [fe(o, `whenChain-branch-${t}`)];
28
28
  }
29
- return [te([], "whenChain-empty")];
29
+ return [fe([], "whenChain-empty")];
30
30
  }
31
- function te(e, t) {
31
+ function fe(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 te(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class K extends EventTarget {
39
+ class G extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,9 +44,8 @@ class K extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return K.instance || (K.instance = new K()), K.instance;
47
+ return G.instance || (G.instance = new G()), G.instance;
48
48
  }
49
- // Enhanced emit method with better typing and event storm protection
50
49
  /**
51
50
  * Emit a global event with optional data. Includes event storm protection.
52
51
  * @param eventName - Name of the event
@@ -56,20 +55,18 @@ class K extends EventTarget {
56
55
  const o = Date.now(), n = this.eventCounters.get(t);
57
56
  if (!n || o - n.window > 1e3)
58
57
  this.eventCounters.set(t, { count: 1, window: o });
59
- else if (n.count++, n.count > 50 && (console.error(`Event storm detected for "${t}": ${n.count} events in 1 second. Throttling...`), n.count > 100)) {
60
- console.warn(`Blocking further "${t}" events to prevent infinite loop`);
58
+ else if (n.count++, n.count > 50 && n.count > 100)
61
59
  return;
62
- }
63
60
  this.dispatchEvent(new CustomEvent(t, {
64
61
  detail: r,
65
62
  bubbles: !1,
66
63
  // Global events don't need to bubble
67
64
  cancelable: !0
68
65
  }));
69
- const s = this.handlers[t];
70
- s && s.forEach((i) => {
66
+ const i = this.handlers[t];
67
+ i && i.forEach((s) => {
71
68
  try {
72
- i(r);
69
+ s(r);
73
70
  } catch (a) {
74
71
  console.error(`Error in global event handler for "${t}":`, a);
75
72
  }
@@ -115,8 +112,8 @@ class K extends EventTarget {
115
112
  */
116
113
  once(t, r) {
117
114
  return new Promise((o) => {
118
- const n = this.on(t, (s) => {
119
- n(), r(s), o(s);
115
+ const n = this.on(t, (i) => {
116
+ n(), r(i), o(i);
120
117
  });
121
118
  });
122
119
  }
@@ -160,8 +157,8 @@ class K extends EventTarget {
160
157
  this.eventCounters.clear();
161
158
  }
162
159
  }
163
- const Z = K.getInstance(), bt = (e, t) => Z.emit(e, t), vt = (e, t) => Z.on(e, t), xt = (e, t) => Z.off(e, t), wt = (e, t) => Z.once(e, t), kt = (e, t, r) => Z.listen(e, t, r);
164
- function xe(e) {
160
+ const re = G.getInstance(), wt = (e, t) => re.emit(e, t), kt = (e, t) => re.on(e, t), $t = (e, t) => re.off(e, t), _t = (e, t) => re.once(e, t), St = (e, t, r) => re.listen(e, t, r);
161
+ function $e(e) {
165
162
  let t = { ...e };
166
163
  const r = [];
167
164
  function o(a) {
@@ -170,19 +167,19 @@ function xe(e) {
170
167
  function n() {
171
168
  return t;
172
169
  }
173
- function s(a) {
174
- const l = typeof a == "function" ? a(t) : a;
175
- t = { ...t, ...l }, i();
170
+ function i(a) {
171
+ const f = typeof a == "function" ? a(t) : a;
172
+ t = { ...t, ...f }, s();
176
173
  }
177
- function i() {
174
+ function s() {
178
175
  r.forEach((a) => a(t));
179
176
  }
180
- return { subscribe: o, getState: n, setState: s };
177
+ return { subscribe: o, getState: n, setState: i };
181
178
  }
182
- function me(e) {
179
+ function J(e) {
183
180
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
184
181
  }
185
- function pe(e) {
182
+ function H(e) {
186
183
  return typeof e == "string" ? e.replace(
187
184
  /[&<>"']/g,
188
185
  (t) => ({
@@ -194,247 +191,242 @@ function pe(e) {
194
191
  })[t]
195
192
  ) : e;
196
193
  }
197
- function Pe(e, t, r) {
194
+ function N(e, t) {
195
+ return typeof t == "string" ? t.split(".").reduce((r, o) => r?.[o], e) : t;
196
+ }
197
+ function se(e, t, r) {
198
+ const o = String(t).split("."), n = o.pop();
199
+ if (!n) return;
200
+ const i = o.reduce((s, a) => (s[a] == null && (s[a] = {}), s[a]), e);
201
+ i[n] = r;
202
+ }
203
+ function Ne(e, t, r) {
198
204
  if (r)
199
205
  for (const [o, n] of Object.entries(r)) {
200
- let s, i = {};
201
- if (Array.isArray(n) ? (s = n[0], i = n[1] || {}) : s = n, t.set(o, {
202
- callback: s,
203
- options: i,
204
- oldValue: he(e, o)
205
- }), i.immediate)
206
+ let i, s = {};
207
+ if (Array.isArray(n) ? (i = n[0], s = n[1] || {}) : i = n, t.set(o, {
208
+ callback: i,
209
+ options: s,
210
+ oldValue: N(e, o)
211
+ }), s.immediate)
206
212
  try {
207
- const a = he(e, o);
208
- s(a, void 0, e);
213
+ const a = N(e, o);
214
+ i(a, void 0, e);
209
215
  } catch (a) {
210
216
  console.error(`Error in immediate watcher for "${o}":`, a);
211
217
  }
212
218
  }
213
219
  }
214
- function he(e, t) {
215
- return t.split(".").reduce((r, o) => r?.[o], e);
216
- }
217
- function Oe(e, t, r, o) {
218
- const n = (i, a) => {
219
- if (i === a) return !0;
220
- if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
221
- if (Array.isArray(i) && Array.isArray(a))
222
- return i.length !== a.length ? !1 : i.every((p, y) => n(p, a[y]));
223
- const l = Object.keys(i), f = Object.keys(a);
224
- return l.length !== f.length ? !1 : l.every((p) => n(i[p], a[p]));
225
- }, s = t.get(r);
226
- if (s && !n(o, s.oldValue))
220
+ function Me(e, t, r, o) {
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((d, m) => n(d, a[m]));
226
+ const f = Object.keys(s), u = Object.keys(a);
227
+ return f.length !== u.length ? !1 : f.every((d) => n(s[d], a[d]));
228
+ }, i = t.get(r);
229
+ if (i && !n(o, i.oldValue))
227
230
  try {
228
- s.callback(o, s.oldValue, e), s.oldValue = o;
229
- } catch (i) {
230
- console.error(`Error in watcher for "${r}":`, i);
231
+ i.callback(o, i.oldValue, e), i.oldValue = o;
232
+ } catch (s) {
233
+ console.error(`Error in watcher for "${r}":`, s);
231
234
  }
232
- for (const [i, a] of t.entries())
233
- if (a.options.deep && r.startsWith(i + "."))
235
+ for (const [s, a] of t.entries())
236
+ if (a.options.deep && r.startsWith(s + "."))
234
237
  try {
235
- const l = he(e, i);
236
- n(l, a.oldValue) || (a.callback(l, a.oldValue, e), a.oldValue = l);
237
- } catch (l) {
238
- console.error(`Error in deep watcher for "${i}":`, l);
238
+ const f = N(e, s);
239
+ n(f, a.oldValue) || (a.callback(f, a.oldValue, e), a.oldValue = f);
240
+ } catch (f) {
241
+ console.error(`Error in deep watcher for "${s}":`, f);
239
242
  }
240
243
  }
241
- function Me(e, t, r) {
244
+ function We(e, t, r) {
242
245
  if (!t.props) return;
243
- function o(n, s) {
244
- return s === Boolean ? n === "true" : s === Number ? Number(n) : n;
246
+ function o(n, i) {
247
+ return i === Boolean ? n === "true" : i === Number ? Number(n) : n;
245
248
  }
246
- Object.entries(t.props).forEach(([n, s]) => {
247
- if (s.type === Function && typeof e[n] == "function")
249
+ Object.entries(t.props).forEach(([n, i]) => {
250
+ if (i.type === Function && typeof e[n] == "function")
248
251
  r[n] = e[n];
249
252
  else {
250
- const i = e.getAttribute(me(n));
251
- i !== null ? r[n] = pe(o(i, s.type)) : "default" in s && s.default !== void 0 && (r[n] = pe(s.default));
253
+ const s = e.getAttribute(J(n));
254
+ s !== null ? r[n] = H(o(s, i.type)) : "default" in i && i.default !== void 0 && (r[n] = H(i.default));
252
255
  }
253
256
  });
254
257
  }
255
- function Ne(e, t, r, o) {
258
+ function qe(e, t, r, o) {
256
259
  e.onConnected && !r && (e.onConnected(t), o(!0));
257
260
  }
258
- function We(e, t, r, o, n, s, i, a) {
259
- e.onDisconnected && e.onDisconnected(t), r.forEach((l) => l()), o(), n(), s(!1), i(null), a(!1);
261
+ function De(e, t, r, o, n, i, s, a) {
262
+ e.onDisconnected && e.onDisconnected(t), r.forEach((f) => f()), o(), n(), i(!1), s(null), a(!1);
260
263
  }
261
- function De(e, t, r, o, n) {
264
+ function Ie(e, t, r, o, n) {
262
265
  e.onAttributeChanged && e.onAttributeChanged(t, r, o, n);
263
266
  }
264
- function q(e, t) {
267
+ function V(e, t) {
265
268
  if (t && e instanceof HTMLElement) {
266
269
  for (const r in t)
267
270
  t[r] === e && delete t[r];
268
271
  for (const r of Array.from(e.childNodes))
269
- q(r, t);
270
- }
271
- }
272
- function I(e, t) {
273
- return typeof t == "string" ? t.split(".").reduce((r, o) => r?.[o], e) : t;
274
- }
275
- function we(e, t, r) {
276
- const o = t.split("."), n = o.pop();
277
- if (!n) return;
278
- const s = o.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
279
- s[n] = r;
280
- }
281
- function qe(e, t, r, o, n, s, i) {
282
- if (!s) return;
283
- const a = t.includes("lazy"), l = t.includes("trim"), f = t.includes("number"), p = () => {
284
- const h = s._state || s;
285
- return I(h, e);
286
- }, y = p();
287
- let c = "text";
288
- const w = o?.type;
289
- if (i instanceof HTMLInputElement ? c = w || i.type || "text" : i instanceof HTMLSelectElement ? c = "select" : i instanceof HTMLTextAreaElement && (c = "textarea"), c === "checkbox")
290
- if (Array.isArray(y)) {
291
- const h = i?.getAttribute("value") || o?.value || "", u = y.includes(h);
292
- i && i.checked !== u && (r.checked = u);
293
- } else {
294
- const h = i?.getAttribute("true-value") || !0, u = y === h;
295
- i && i.checked !== u && (r.checked = u);
272
+ V(r, t);
273
+ }
274
+ }
275
+ function He(e, t, r, o, n, i, s, a) {
276
+ if (!i) return;
277
+ const f = t.includes("lazy"), u = t.includes("trim"), d = t.includes("number"), m = () => N(i._state || i, e), l = m();
278
+ let h = "text";
279
+ s instanceof HTMLInputElement ? h = o?.type || s.type || "text" : s instanceof HTMLSelectElement ? h = "select" : s instanceof HTMLTextAreaElement && (h = "textarea");
280
+ const w = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement, v = w ? h === "checkbox" || h === "radio" ? "checked" : "value" : a ?? "modelValue";
281
+ if (h === "checkbox")
282
+ if (Array.isArray(l))
283
+ r[v] = l.includes(String(s?.getAttribute("value") ?? o?.value ?? ""));
284
+ else {
285
+ const x = s?.getAttribute("true-value") ?? !0;
286
+ r[v] = l === x;
296
287
  }
297
- else if (c === "radio") {
298
- const h = o?.value || "", u = y === h;
299
- i && i.checked !== u && (r.checked = u);
300
- } else if (c === "select")
301
- if (i && i.hasAttribute("multiple")) {
302
- const h = i, u = Array.isArray(y) ? y : [];
288
+ else if (h === "radio")
289
+ r[v] = l === (o?.value ?? "");
290
+ else if (h === "select")
291
+ if (s && s.hasAttribute("multiple") && s instanceof HTMLSelectElement) {
292
+ const x = Array.isArray(l) ? l.map(String) : [];
303
293
  setTimeout(() => {
304
- Array.from(h.options).forEach((g) => {
305
- const b = u.includes(g.value);
306
- g.selected !== b && (g.selected = b);
294
+ Array.from(s.options).forEach((c) => {
295
+ c.selected = x.includes(c.value);
307
296
  });
308
- }, 0);
297
+ }, 0), r[v] = Array.isArray(l) ? l : [];
309
298
  } else
310
- setTimeout(() => {
311
- i instanceof HTMLSelectElement && i.value !== String(y) && (i.value = String(y));
312
- }, 0);
299
+ r[v] = l;
313
300
  else {
314
- const h = String(y ?? "");
315
- (!i || i.value !== h) && (r.value = y);
316
- }
317
- const x = a || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", k = (h) => {
318
- if (h.isComposing || n._isComposing || h.isTrusted === !1) return;
319
- const u = h.target;
320
- if (u._modelUpdating) return;
321
- const g = p();
322
- let b = u.value;
323
- if (c === "checkbox")
324
- if (Array.isArray(g)) {
325
- const $ = u.getAttribute("value") || "", _ = [...g];
326
- if (u.checked)
327
- _.includes($) || _.push($);
301
+ r[v] = l;
302
+ try {
303
+ const x = J(v);
304
+ o && (o[x] = l);
305
+ } catch {
306
+ }
307
+ }
308
+ const b = f || h === "checkbox" || h === "radio" || h === "select" ? "change" : "input", y = (x) => {
309
+ if (x.isComposing || n._isComposing || x.isTrusted === !1) return;
310
+ const c = x.target;
311
+ if (!c || c._modelUpdating) return;
312
+ let g = c.value;
313
+ if (h === "checkbox") {
314
+ const C = m();
315
+ if (Array.isArray(C)) {
316
+ const S = c.getAttribute("value") ?? "", A = Array.from(C);
317
+ if (c.checked)
318
+ A.includes(S) || A.push(S);
328
319
  else {
329
- const C = _.indexOf($);
330
- C > -1 && _.splice(C, 1);
320
+ const T = A.indexOf(S);
321
+ T > -1 && A.splice(T, 1);
331
322
  }
332
- b = _;
323
+ g = A;
333
324
  } else {
334
- const $ = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
- b = u.checked ? $ : _;
325
+ const S = c.getAttribute("true-value") ?? !0, A = c.getAttribute("false-value") ?? !1;
326
+ g = c.checked ? S : A;
336
327
  }
337
- else if (c === "radio")
338
- b = u.getAttribute("value") || u.value;
339
- else if (c === "select" && u.multiple) {
340
- const $ = u;
341
- b = Array.from($.selectedOptions).map(
342
- (_) => _.value
343
- );
344
- } else if (l && (b = b.trim()), f) {
345
- const $ = Number(b);
346
- isNaN($) || (b = $);
328
+ } else if (h === "radio")
329
+ g = c.getAttribute("value") ?? c.value;
330
+ else if (h === "select" && c.multiple)
331
+ g = Array.from(c.selectedOptions).map((C) => C.value);
332
+ else if (u && typeof g == "string" && (g = g.trim()), d) {
333
+ const C = Number(g);
334
+ isNaN(C) || (g = C);
347
335
  }
348
- const d = s._state || s, v = I(d, e);
349
- if (Array.isArray(b) && Array.isArray(v) ? JSON.stringify([...b].sort()) !== JSON.stringify([...v].sort()) : b !== v) {
350
- const $ = h.target;
351
- $._modelUpdating = !0, we(d, e, b), setTimeout(() => {
352
- $._modelUpdating = !1;
353
- }, 0), s._requestRender && s._requestRender();
336
+ const p = i._state || i, _ = N(p, e);
337
+ if (Array.isArray(g) && Array.isArray(_) ? JSON.stringify([...g].sort()) !== JSON.stringify([..._].sort()) : g !== _) {
338
+ c._modelUpdating = !0;
339
+ try {
340
+ se(p, e, g), i._requestRender && i._requestRender();
341
+ } finally {
342
+ setTimeout(() => c._modelUpdating = !1, 0);
343
+ }
354
344
  }
355
345
  };
356
- if (n[x] = k, c === "text" || c === "textarea") {
357
- const h = () => {
358
- n._isComposing = !0;
359
- }, u = (g) => {
360
- n._isComposing = !1;
361
- const b = g.target;
362
- setTimeout(() => {
363
- if (b) {
364
- let d = b.value;
365
- if (l && (d = d.trim()), f) {
366
- const _ = Number(d);
367
- isNaN(_) || (d = _);
368
- }
369
- const v = s._state || s, m = I(v, e);
370
- (Array.isArray(d) && Array.isArray(m) ? JSON.stringify([...d].sort()) !== JSON.stringify([...m].sort()) : d !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
- b._modelUpdating = !1;
372
- }, 0)), we(v, e, d), s._requestRender && s._requestRender());
346
+ w ? n[b] = y : n[`update:${J(v)}`] = (x) => {
347
+ const c = i._state || i, g = x.detail !== void 0 ? x.detail : x.target?.value, p = N(c, e);
348
+ (Array.isArray(g) && Array.isArray(p) ? JSON.stringify([...g].sort()) !== JSON.stringify([...p].sort()) : g !== p) && (se(c, e, g), i._requestRender && i._requestRender());
349
+ }, (h === "text" || h === "textarea") && (n.compositionstart = (() => n._isComposing = !0), n.compositionend = (x) => {
350
+ n._isComposing = !1;
351
+ const c = x.target;
352
+ c && setTimeout(() => {
353
+ const g = c.value, p = i._state || i, _ = N(p, e);
354
+ let E = g;
355
+ if (u && (E = E.trim()), d) {
356
+ const S = Number(E);
357
+ isNaN(S) || (E = S);
358
+ }
359
+ if (Array.isArray(E) && Array.isArray(_) ? JSON.stringify([...E].sort()) !== JSON.stringify([..._].sort()) : E !== _) {
360
+ c._modelUpdating = !0;
361
+ try {
362
+ se(p, e, E), i._requestRender && i._requestRender();
363
+ } finally {
364
+ setTimeout(() => c._modelUpdating = !1, 0);
373
365
  }
374
- }, 0);
375
- };
376
- n.compositionstart = h, n.compositionend = u;
377
- }
366
+ }
367
+ }, 0);
368
+ });
378
369
  }
379
- function Ae(e) {
380
- return e.slice(2).charAt(0).toLowerCase() + e.slice(3);
370
+ function Le(e) {
371
+ const t = e.slice(2);
372
+ return t ? t.charAt(0).toLowerCase() + t.slice(1) : "";
381
373
  }
382
- function Ie(e, t, r, o) {
374
+ function Fe(e, t, r, o) {
383
375
  if (o) {
384
376
  if (typeof e == "object" && e !== null)
385
- for (const [n, s] of Object.entries(e))
386
- t[n] = s;
377
+ for (const [n, i] of Object.entries(e))
378
+ t[n] = i;
387
379
  else if (typeof e == "string")
388
380
  try {
389
381
  const n = JSON.parse(e);
390
382
  if (typeof n == "object" && n !== null) {
391
- for (const [s, i] of Object.entries(n))
392
- t[s] = i;
383
+ for (const [i, s] of Object.entries(n))
384
+ t[i] = s;
393
385
  return;
394
386
  }
395
387
  } catch {
396
- const n = I(o, e);
388
+ const n = N(o, e);
397
389
  r[e] = n;
398
390
  }
399
391
  }
400
392
  }
401
- function He(e, t, r) {
393
+ function Ke(e, t, r) {
402
394
  if (!r) return;
403
- const o = I(r, e), n = t.style || "", s = o ? "" : "none";
395
+ const o = N(r, e), n = t.style || "", i = o ? "" : "none";
404
396
  if (n) {
405
- const i = n.split(";").filter(Boolean), a = i.findIndex(
406
- (l) => l.trim().startsWith("display:")
397
+ const s = n.split(";").filter(Boolean), a = s.findIndex(
398
+ (f) => f.trim().startsWith("display:")
407
399
  );
408
- a >= 0 ? i[a] = `display: ${s}` : i.push(`display: ${s}`), t.style = i.join("; ");
400
+ a >= 0 ? s[a] = `display: ${i}` : s.push(`display: ${i}`), t.style = s.join("; ");
409
401
  } else
410
- t.style = `display: ${s}`;
402
+ t.style = `display: ${i}`;
411
403
  }
412
- function Fe(e, t, r) {
404
+ function Ue(e, t, r) {
413
405
  if (!r) return;
414
- const o = I(r, e);
406
+ const o = N(r, e);
415
407
  let n = [];
416
408
  typeof o == "string" ? n = [o] : Array.isArray(o) ? n = o.filter(Boolean) : typeof o == "object" && (n = Object.entries(o).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
417
- const s = t.class || "", i = s ? `${s} ${n.join(" ")}`.trim() : n.join(" ");
418
- i && (t.class = i);
409
+ const i = t.class || "", s = i ? `${i} ${n.join(" ")}`.trim() : n.join(" ");
410
+ s && (t.class = s);
419
411
  }
420
- function Ke(e, t, r) {
412
+ function Ve(e, t, r) {
421
413
  let o;
422
414
  if (typeof e == "string") {
423
415
  if (!r) return;
424
- o = I(r, e);
416
+ o = N(r, e);
425
417
  } else
426
418
  o = e;
427
419
  let n = "";
428
420
  if (typeof o == "string")
429
421
  n = o;
430
422
  else if (o && typeof o == "object") {
431
- const i = [];
432
- for (const [a, l] of Object.entries(o))
433
- if (l != null && l !== "") {
434
- const f = a.replace(
423
+ const s = [];
424
+ for (const [a, f] of Object.entries(o))
425
+ if (f != null && f !== "") {
426
+ const u = a.replace(
435
427
  /[A-Z]/g,
436
- (c) => `-${c.toLowerCase()}`
437
- ), p = [
428
+ (l) => `-${l.toLowerCase()}`
429
+ ), d = [
438
430
  "width",
439
431
  "height",
440
432
  "top",
@@ -460,359 +452,391 @@ function Ke(e, t, r) {
460
452
  "min-height",
461
453
  "max-height"
462
454
  ];
463
- let y = String(l);
464
- typeof l == "number" && p.includes(f) && (y = `${l}px`), i.push(`${f}: ${y}`);
455
+ let m = String(f);
456
+ typeof f == "number" && d.includes(u) && (m = `${f}px`), s.push(`${u}: ${m}`);
465
457
  }
466
- n = i.join("; ") + (i.length > 0 ? ";" : "");
467
- }
468
- const s = t.style || "";
469
- t.style = s + (s && !s.endsWith(";") ? "; " : "") + n;
470
- }
471
- function Te(e, t, r, o) {
472
- const n = {}, s = { ...o || {} }, i = {};
473
- for (const [a, l] of Object.entries(e)) {
474
- const { value: f, modifiers: p } = l;
458
+ n = s.join("; ") + (s.length > 0 ? ";" : "");
459
+ }
460
+ const i = t.style || "";
461
+ t.style = i + (i && !i.endsWith(";") ? "; " : "") + n;
462
+ }
463
+ function Re(e, t, r, o) {
464
+ const n = {}, i = { ...o || {} }, s = {};
465
+ for (const [a, f] of Object.entries(e)) {
466
+ const { value: u, modifiers: d, arg: m } = f;
467
+ if (a === "model" || a.startsWith("model:")) {
468
+ const l = a.split(":"), h = l.length > 1 ? l[1] : m;
469
+ He(
470
+ typeof u == "string" ? u : String(u),
471
+ d,
472
+ n,
473
+ i,
474
+ s,
475
+ t,
476
+ r,
477
+ h
478
+ );
479
+ continue;
480
+ }
475
481
  switch (a) {
476
- case "model":
477
- qe(
478
- typeof f == "string" ? f : String(f),
479
- p,
480
- n,
481
- s,
482
- i,
483
- t,
484
- r
485
- );
486
- break;
487
482
  case "bind":
488
- Ie(f, n, s, t);
483
+ Fe(u, n, i, t);
489
484
  break;
490
485
  case "show":
491
- He(f, s, t);
486
+ Ke(u, i, t);
492
487
  break;
493
488
  case "class":
494
- Fe(f, s, t);
489
+ Ue(u, i, t);
495
490
  break;
496
491
  case "style":
497
- Ke(f, s, t);
492
+ Ve(u, i, t);
498
493
  break;
499
494
  }
500
495
  }
501
- return { props: n, attrs: s, listeners: i };
496
+ return { props: n, attrs: i, listeners: s };
502
497
  }
503
- function ge(e, t) {
498
+ function ke(e, t) {
504
499
  if (Array.isArray(e)) {
505
- const s = /* @__PURE__ */ new Set();
506
- return e.map((i) => {
507
- if (!i || typeof i != "object") return i;
508
- let a = i.props?.key ?? i.key;
500
+ const i = /* @__PURE__ */ new Set();
501
+ return e.map((s) => {
502
+ if (!s || typeof s != "object") return s;
503
+ let a = s.props?.key ?? s.key;
509
504
  if (!a) {
510
- const y = i.tag || "node", c = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
511
- a = c ? `${t}:${y}:${c}` : `${t}:${y}`;
505
+ const m = s.tag || "node", l = s.props?.attrs?.id ?? s.props?.attrs?.name ?? s.props?.attrs?.["data-key"] ?? "";
506
+ a = l ? `${t}:${m}:${l}` : `${t}:${m}`;
512
507
  }
513
- let l = a, f = 1;
514
- for (; s.has(l); )
515
- l = `${a}#${f++}`;
516
- s.add(l);
517
- let p = i.children;
518
- return Array.isArray(p) && (p = ge(p, l)), { ...i, key: l, children: p };
508
+ let f = a, u = 1;
509
+ for (; i.has(f); )
510
+ f = `${a}#${u++}`;
511
+ i.add(f);
512
+ let d = s.children;
513
+ return Array.isArray(d) && (d = ke(d, f)), { ...s, key: f, children: d };
519
514
  });
520
515
  }
521
516
  const r = e;
522
517
  let o = r.props?.key ?? r.key ?? t, n = r.children;
523
- return Array.isArray(n) && (n = ge(n, o)), { ...r, key: o, children: n };
518
+ return Array.isArray(n) && (n = ke(n, o)), { ...r, key: o, children: n };
524
519
  }
525
- function Ue(e, t, r, o) {
526
- const n = r.directives ?? {}, s = Te(
520
+ function Je(e, t, r, o) {
521
+ const n = r.directives ?? {}, i = Re(
527
522
  n,
528
523
  o,
529
524
  e,
530
525
  r.attrs
531
- ), i = {
526
+ ), s = {
532
527
  ...t.props,
533
528
  ...r.props,
534
- ...s.props
529
+ ...i.props
535
530
  }, a = {
536
531
  ...t.attrs,
537
532
  ...r.attrs,
538
- ...s.attrs
539
- }, l = t.props ?? {}, f = i;
540
- for (const c in { ...l, ...f }) {
541
- const w = l[c], x = f[c];
542
- if (w !== x)
543
- if (c === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
544
- e.value !== x && (e.value = x ?? "");
545
- else if (c === "checked" && e instanceof HTMLInputElement)
546
- e.checked = !!x;
547
- else if (c.startsWith("on") && typeof x == "function") {
548
- const k = Ae(c);
549
- typeof w == "function" && e.removeEventListener(k, w), e.addEventListener(k, x);
550
- } else x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x));
551
- }
552
- for (const [c, w] of Object.entries(
553
- s.listeners || {}
533
+ ...i.attrs
534
+ }, f = t.props ?? {}, u = s;
535
+ for (const l in { ...f, ...u }) {
536
+ const h = f[l], w = u[l];
537
+ if (h !== w) {
538
+ if (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
539
+ e.value !== w && (e.value = w ?? "");
540
+ else if (l === "checked" && e instanceof HTMLInputElement)
541
+ e.checked = !!w;
542
+ else if (l.startsWith("on") && typeof w == "function") {
543
+ const $ = Le(l);
544
+ typeof h == "function" && e.removeEventListener($, h), e.addEventListener($, w);
545
+ } else if (w == null || w === !1)
546
+ e.removeAttribute(l);
547
+ else if ((r?.isCustomElement ?? t?.isCustomElement ?? !1) || l in e)
548
+ try {
549
+ e[l] = w;
550
+ } catch {
551
+ }
552
+ }
553
+ }
554
+ for (const [l, h] of Object.entries(
555
+ i.listeners || {}
554
556
  ))
555
- e.addEventListener(c, w);
556
- const p = t.attrs ?? {}, y = a;
557
- for (const c in { ...p, ...y }) {
558
- const w = p[c], x = y[c];
559
- w !== x && (x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x)));
557
+ e.addEventListener(l, h);
558
+ const d = t.attrs ?? {}, m = a;
559
+ for (const l in { ...d, ...m }) {
560
+ const h = d[l], w = m[l];
561
+ h !== w && (w == null || w === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(w)));
560
562
  }
561
563
  }
562
- function P(e, t, r) {
564
+ function M(e, t, r) {
563
565
  if (typeof e == "string")
564
566
  return document.createTextNode(e);
565
567
  if (e.tag === "#text") {
566
- const y = document.createTextNode(
568
+ const m = document.createTextNode(
567
569
  typeof e.children == "string" ? e.children : ""
568
570
  );
569
- return e.key != null && (y.key = e.key), y;
571
+ return e.key != null && (m.key = e.key), m;
570
572
  }
571
573
  if (e.tag === "#anchor") {
572
- const y = e, c = Array.isArray(y.children) ? y.children : [], w = document.createTextNode(""), x = document.createTextNode("");
573
- y.key != null && (w.key = `${y.key}:start`, x.key = `${y.key}:end`), y._startNode = w, y._endNode = x;
574
- const k = document.createDocumentFragment();
575
- k.appendChild(w);
576
- for (const h of c) {
577
- const u = P(h, t);
578
- k.appendChild(u);
574
+ const m = e, l = Array.isArray(m.children) ? m.children : [], h = document.createTextNode(""), w = document.createTextNode("");
575
+ m.key != null && (h.key = `${m.key}:start`, w.key = `${m.key}:end`), m._startNode = h, m._endNode = w;
576
+ const $ = document.createDocumentFragment();
577
+ $.appendChild(h);
578
+ for (const v of l) {
579
+ const b = M(v, t);
580
+ $.appendChild(b);
579
581
  }
580
- return k.appendChild(x), k;
582
+ return $.appendChild(w), $;
581
583
  }
582
584
  const o = document.createElement(e.tag);
583
585
  e.key != null && (o.key = e.key);
584
- const { props: n = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = Te(i, t, o, s), l = {
586
+ const { props: n = {}, attrs: i = {}, directives: s = {} } = e.props ?? {}, a = Re(s, t, o, i), f = {
585
587
  ...n,
586
588
  ...a.props
587
- }, f = {
588
- ...s,
589
+ }, u = {
590
+ ...i,
589
591
  ...a.attrs
590
592
  };
591
- for (const y in f) {
592
- const c = f[y];
593
- if (typeof y != "string" || /\[object Object\]/.test(y)) {
594
- typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", y, c);
595
- continue;
596
- }
597
- typeof c == "boolean" ? c && o.setAttribute(y, "") : c != null && o.setAttribute(y, c);
598
- }
599
- for (const y in l) {
600
- const c = l[y];
601
- if (typeof y != "string" || /\[object Object\]/.test(y)) {
602
- typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", y, c);
603
- continue;
604
- }
605
- if (y === "value" && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement))
606
- o.value = c ?? "";
607
- else if (y === "checked" && o instanceof HTMLInputElement)
608
- o.checked = !!c;
609
- else if (y.startsWith("on") && typeof c == "function")
610
- o.addEventListener(Ae(y), c);
611
- else {
612
- if (y.startsWith("on") && c === void 0)
613
- continue;
614
- c == null || c === !1 ? o.removeAttribute(y) : o.setAttribute(y, String(c));
615
- }
593
+ for (const m in u) {
594
+ const l = u[m];
595
+ typeof m != "string" || /\[object Object\]/.test(m) || (typeof l == "boolean" ? l && o.setAttribute(m, "") : l != null && o.setAttribute(m, l));
596
+ }
597
+ for (const m in f) {
598
+ const l = f[m];
599
+ if (!(typeof m != "string" || /\[object Object\]/.test(m)))
600
+ if (m === "value" && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement))
601
+ o.value = l ?? "";
602
+ else if (m === "checked" && o instanceof HTMLInputElement)
603
+ o.checked = !!l;
604
+ else if (m.startsWith("on") && typeof l == "function")
605
+ o.addEventListener(Le(m), l);
606
+ else {
607
+ if (m.startsWith("on") && l === void 0)
608
+ continue;
609
+ if (l == null || l === !1)
610
+ o.removeAttribute(m);
611
+ else if ((e.props?.isCustomElement ?? !1) || m in o)
612
+ try {
613
+ o[m] = l;
614
+ } catch {
615
+ }
616
+ }
616
617
  }
617
- for (const [y, c] of Object.entries(
618
+ for (const [m, l] of Object.entries(
618
619
  a.listeners || {}
619
620
  ))
620
- o.addEventListener(y, c);
621
- const p = e.props?.ref ?? (e.props?.props && e.props.props.ref);
622
- if (typeof e != "string" && p && r && (r[p] = o), Array.isArray(e.children))
623
- for (const y of e.children)
624
- o.appendChild(P(y, t, r));
621
+ o.addEventListener(m, l);
622
+ const d = e.props?.ref ?? (e.props?.props && e.props.props.ref);
623
+ typeof e != "string" && d && r && (r[d] = o);
624
+ try {
625
+ if (typeof o._applyProps == "function")
626
+ try {
627
+ o._applyProps(o._cfg);
628
+ } catch {
629
+ }
630
+ typeof o.requestRender == "function" ? o.requestRender() : typeof o._render == "function" && o._render(o._cfg);
631
+ } catch {
632
+ }
633
+ if (Array.isArray(e.children))
634
+ for (const m of e.children)
635
+ o.appendChild(M(m, t, r));
625
636
  else typeof e.children == "string" && (o.textContent = e.children);
626
637
  return o;
627
638
  }
628
- function Ve(e, t, r, o, n) {
639
+ function Ze(e, t, r, o, n) {
629
640
  if (typeof r == "string") {
630
641
  e.textContent !== r && (e.textContent = r);
631
642
  return;
632
643
  }
633
644
  if (!Array.isArray(r)) return;
634
- const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
635
- for (const w of i)
636
- w && w.key != null && a.set(w.key, w);
637
- const l = /* @__PURE__ */ new Map();
638
- for (const w of s) {
639
- const x = w.key;
640
- x != null && l.set(x, w);
641
- }
642
- const f = /* @__PURE__ */ new Set();
643
- let p = e.firstChild;
644
- function y(w, x) {
645
- let k = w;
646
- for (; k && (f.add(k), k !== x); )
647
- k = k.nextSibling;
648
- }
649
- function c(w, x, k, h) {
650
- const u = [];
651
- let g = w.nextSibling;
652
- for (; g && g !== x; )
653
- u.push(g), g = g.nextSibling;
654
- const b = Array.isArray(k) ? k : [];
655
- if (h.some((v) => v && v.key != null) || b.some((v) => v && v.key != null)) {
656
- const v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
657
- for (const C of b)
658
- C && C.key != null && v.set(C.key, C);
659
- for (const C of u) {
660
- const E = C.key;
661
- E != null && m.set(E, C);
645
+ const i = Array.from(e.childNodes), s = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
646
+ for (const h of s)
647
+ h && h.key != null && a.set(h.key, h);
648
+ const f = /* @__PURE__ */ new Map();
649
+ for (const h of i) {
650
+ const w = h.key;
651
+ w != null && f.set(w, h);
652
+ }
653
+ const u = /* @__PURE__ */ new Set();
654
+ let d = e.firstChild;
655
+ function m(h, w) {
656
+ let $ = h;
657
+ for (; $ && (u.add($), $ !== w); )
658
+ $ = $.nextSibling;
659
+ }
660
+ function l(h, w, $, v) {
661
+ const b = [];
662
+ let y = h.nextSibling;
663
+ for (; y && y !== w; )
664
+ b.push(y), y = y.nextSibling;
665
+ const x = Array.isArray($) ? $ : [];
666
+ if (v.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 C of x)
669
+ C && C.key != null && g.set(C.key, C);
670
+ for (const C of b) {
671
+ const S = C.key;
672
+ S != null && p.set(S, C);
662
673
  }
663
- const $ = /* @__PURE__ */ new Set();
664
- let _ = w.nextSibling;
665
- for (const C of h) {
666
- let E;
667
- if (C.key != null && m.has(C.key)) {
668
- const j = v.get(C.key);
669
- E = X(
670
- m.get(C.key),
671
- j,
674
+ const _ = /* @__PURE__ */ new Set();
675
+ let E = h.nextSibling;
676
+ for (const C of v) {
677
+ let S;
678
+ if (C.key != null && p.has(C.key)) {
679
+ const A = g.get(C.key);
680
+ S = ae(
681
+ p.get(C.key),
682
+ A,
672
683
  C,
673
684
  o
674
- ), $.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
685
+ ), _.add(S), S !== E && e.contains(S) && e.insertBefore(S, E);
675
686
  } else
676
- E = P(C, o), e.insertBefore(E, _), $.add(E);
677
- _ = E.nextSibling;
687
+ S = M(C, o), e.insertBefore(S, E), _.add(S);
688
+ E = S.nextSibling;
678
689
  }
679
- for (const C of u)
680
- !$.has(C) && e.contains(C) && e.removeChild(C);
690
+ for (const C of b)
691
+ !_.has(C) && e.contains(C) && e.removeChild(C);
681
692
  } else {
682
- const v = Math.min(
683
- b.length,
684
- h.length
693
+ const g = Math.min(
694
+ x.length,
695
+ v.length
685
696
  );
686
- for (let m = 0; m < v; m++) {
687
- const $ = b[m], _ = h[m], C = X(u[m], $, _, o);
688
- C !== u[m] && (e.insertBefore(C, u[m]), e.removeChild(u[m]));
697
+ for (let p = 0; p < g; p++) {
698
+ const _ = x[p], E = v[p], C = ae(b[p], _, E, o);
699
+ C !== b[p] && (e.insertBefore(C, b[p]), e.removeChild(b[p]));
689
700
  }
690
- for (let m = v; m < h.length; m++)
691
- e.insertBefore(P(h[m], o), x);
692
- for (let m = v; m < u.length; m++)
693
- e.removeChild(u[m]);
701
+ for (let p = g; p < v.length; p++)
702
+ e.insertBefore(M(v[p], o), w);
703
+ for (let p = g; p < b.length; p++)
704
+ e.removeChild(b[p]);
694
705
  }
695
706
  }
696
- for (const w of r) {
697
- let x;
698
- if (w.tag === "#anchor") {
699
- const k = w.key, h = `${k}:start`, u = `${k}:end`;
700
- let g = l.get(h), b = l.get(u);
701
- const d = Array.isArray(w.children) ? w.children : [];
702
- if (g || (g = document.createTextNode(""), g.key = h), b || (b = document.createTextNode(""), b.key = u), w._startNode = g, w._endNode = b, !e.contains(g) || !e.contains(b)) {
703
- e.insertBefore(g, p);
704
- for (const v of d)
705
- e.insertBefore(P(v, o), p);
706
- e.insertBefore(b, p);
707
+ for (const h of r) {
708
+ let w;
709
+ if (h.tag === "#anchor") {
710
+ const $ = h.key, v = `${$}:start`, b = `${$}:end`;
711
+ let y = f.get(v), x = f.get(b);
712
+ const c = Array.isArray(h.children) ? h.children : [];
713
+ if (y || (y = document.createTextNode(""), y.key = v), x || (x = document.createTextNode(""), x.key = b), h._startNode = y, h._endNode = x, !e.contains(y) || !e.contains(x)) {
714
+ e.insertBefore(y, d);
715
+ for (const g of c)
716
+ e.insertBefore(M(g, o), d);
717
+ e.insertBefore(x, d);
707
718
  } else
708
- c(
709
- g,
710
- b,
711
- a.get(k)?.children,
712
- d
719
+ l(
720
+ y,
721
+ x,
722
+ a.get($)?.children,
723
+ c
713
724
  );
714
- y(g, b), p = b.nextSibling;
725
+ m(y, x), d = x.nextSibling;
715
726
  continue;
716
727
  }
717
- if (w.key != null && l.has(w.key)) {
718
- const k = a.get(w.key);
719
- x = X(
720
- l.get(w.key),
721
- k,
722
- w,
728
+ if (h.key != null && f.has(h.key)) {
729
+ const $ = a.get(h.key);
730
+ w = ae(
731
+ f.get(h.key),
732
+ $,
733
+ h,
723
734
  o,
724
735
  n
725
- ), f.add(x), x !== p && e.contains(x) && (p && !e.contains(p) && (p = null), e.insertBefore(x, p));
736
+ ), u.add(w), w !== d && e.contains(w) && (d && !e.contains(d) && (d = null), e.insertBefore(w, d));
726
737
  } else
727
- x = P(w, o, n), p && !e.contains(p) && (p = null), e.insertBefore(x, p), f.add(x);
728
- p = x.nextSibling;
738
+ w = M(h, o, n), d && !e.contains(d) && (d = null), e.insertBefore(w, d), u.add(w);
739
+ d = w.nextSibling;
729
740
  }
730
- for (const w of s)
731
- !f.has(w) && e.contains(w) && (q(w, n), e.removeChild(w));
741
+ for (const h of i)
742
+ !u.has(h) && e.contains(h) && (V(h, n), e.removeChild(h));
732
743
  }
733
- function X(e, t, r, o, n) {
734
- if (t && typeof t != "string" && t.props?.ref && n && q(e, n), t === r) return e;
744
+ function ae(e, t, r, o, n) {
745
+ if (t && typeof t != "string" && t.props?.ref && n && V(e, n), t === r) return e;
735
746
  if (typeof r == "string") {
736
747
  if (e.nodeType === Node.TEXT_NODE)
737
748
  return e.textContent !== r && (e.textContent = r), e;
738
749
  {
739
- const i = document.createTextNode(r);
740
- return e.parentNode?.replaceChild(i, e), i;
750
+ const s = document.createTextNode(r);
751
+ return e.parentNode?.replaceChild(s, e), s;
741
752
  }
742
753
  }
743
754
  if (r && typeof r != "string" && r.tag === "#anchor") {
744
- const i = r, a = Array.isArray(i.children) ? i.children : [], l = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
745
- i.key != null && (l.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = l, i._endNode = f;
746
- const p = document.createDocumentFragment();
747
- p.appendChild(l);
748
- for (const y of a) {
749
- const c = P(y, o);
750
- p.appendChild(c);
755
+ const s = r, a = Array.isArray(s.children) ? s.children : [], f = s._startNode ?? document.createTextNode(""), u = s._endNode ?? document.createTextNode("");
756
+ s.key != null && (f.key = `${s.key}:start`, u.key = `${s.key}:end`), s._startNode = f, s._endNode = u;
757
+ const d = document.createDocumentFragment();
758
+ d.appendChild(f);
759
+ for (const m of a) {
760
+ const l = M(m, o);
761
+ d.appendChild(l);
751
762
  }
752
- return p.appendChild(f), e.parentNode?.replaceChild(p, e), l;
763
+ return d.appendChild(u), e.parentNode?.replaceChild(d, e), f;
753
764
  }
754
765
  if (!r) {
755
- q(e, n);
756
- const i = document.createComment("removed");
757
- return e.parentNode?.replaceChild(i, e), i;
766
+ V(e, n);
767
+ const s = document.createComment("removed");
768
+ return e.parentNode?.replaceChild(s, e), s;
758
769
  }
759
770
  if (!t || typeof t == "string") {
760
- q(e, n);
761
- const i = P(r, o, n);
762
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
771
+ V(e, n);
772
+ const s = M(r, o, n);
773
+ return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
763
774
  }
764
775
  if (r.tag === "#anchor") {
765
- const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), l = r._endNode ?? document.createTextNode("");
766
- r.key != null && (a.key = `${r.key}:start`, l.key = `${r.key}:end`), r._startNode = a, r._endNode = l;
767
- const f = document.createDocumentFragment();
768
- f.appendChild(a);
769
- for (const p of i)
770
- f.appendChild(P(p, o));
771
- return f.appendChild(l), e.parentNode?.replaceChild(f, e), a;
776
+ const s = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
777
+ 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 s)
781
+ u.appendChild(M(d, o));
782
+ return u.appendChild(f), e.parentNode?.replaceChild(u, e), a;
772
783
  }
773
784
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
774
- const i = e;
775
- return Ue(i, t.props || {}, r.props || {}, o), Ve(i, t.children, r.children, o, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), i;
785
+ const s = e;
786
+ return Je(s, t.props || {}, r.props || {}, o), Ze(s, t.children, r.children, o, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), s;
776
787
  }
777
- q(e, n);
778
- const s = P(r, o, n);
779
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
788
+ V(e, n);
789
+ const i = M(r, o, n);
790
+ return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
780
791
  }
781
- function Je(e, t, r, o) {
792
+ function Ye(e, t, r, o) {
782
793
  let n;
783
794
  Array.isArray(t) ? t.length === 1 ? (n = t[0], n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })) : n = { tag: "div", key: "__root__", children: t } : (n = t, n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })), n && typeof n == "object" && n.tag === "#anchor" && (n = {
784
795
  tag: "div",
785
796
  key: "__anchor_root__",
786
797
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
787
798
  children: [n]
788
- }), n = ge(n, String(n.key ?? "root"));
789
- const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
799
+ }), n = ke(n, String(n.key ?? "root"));
800
+ const i = e._prevVNode ?? null, s = e._prevDom ?? e.firstChild ?? null;
790
801
  let a;
791
- s && i ? typeof s != "string" && typeof n != "string" && s.tag === n.tag && s.key === n.key ? a = X(i, s, n, r, o) : (a = P(n, r, o), e.replaceChild(a, i)) : (a = P(n, r, o), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
792
- const l = [];
793
- for (let f = 0; f < e.childNodes.length; f++) {
794
- const p = e.childNodes[f];
795
- p !== a && p.nodeName !== "STYLE" && (q(p, o), l.push(p));
796
- }
797
- l.forEach((f) => e.removeChild(f)), e._prevVNode = n, e._prevDom = a;
802
+ i && s ? typeof i != "string" && typeof n != "string" && i.tag === n.tag && i.key === n.key ? a = ae(s, i, n, r, o) : (a = M(n, r, o), e.replaceChild(a, s)) : (a = M(n, r, o), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
803
+ 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, o), f.push(d));
807
+ }
808
+ f.forEach((u) => e.removeChild(u)), e._prevVNode = n, e._prevDom = a;
809
+ }
810
+ function he(e) {
811
+ if (typeof e == "string") return H(e);
812
+ if (e.tag === "#text")
813
+ return typeof e.children == "string" ? H(e.children) : "";
814
+ if (e.tag === "#anchor")
815
+ return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(he).join("");
816
+ let t = "";
817
+ e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, i]) => ` ${n}="${H(String(i))}"`).join(""));
818
+ let r = "";
819
+ e.props && (r = Object.entries(e.props).filter(([n]) => n !== "attrs" && n !== "directives" && n !== "ref" && n !== "key").map(([n, i]) => ` ${n}="${H(String(i))}"`).join(""));
820
+ const o = Array.isArray(e.children) ? e.children.filter(Boolean).map(he).join("") : typeof e.children == "string" ? H(e.children) : e.children ? he(e.children) : "";
821
+ return `<${e.tag}${t}${r}>${o}</${e.tag}>`;
798
822
  }
799
- function je(e, ...t) {
823
+ function ze(e, ...t) {
800
824
  let r = "";
801
825
  for (let o = 0; o < e.length; o++)
802
826
  r += e[o], o < t.length && (r += t[o]);
803
827
  return r;
804
828
  }
805
- function Le(e) {
829
+ function Be(e) {
806
830
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
807
831
  }
808
- let Y = null;
809
- function ke() {
810
- return Y || (Y = new CSSStyleSheet(), Y.replaceSync(Le(Ye))), Y;
832
+ let oe = null;
833
+ function _e() {
834
+ return oe || (oe = new CSSStyleSheet(), oe.replaceSync(Be(Qe))), oe;
811
835
  }
812
- function Ze(e) {
836
+ function Ge(e) {
813
837
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
814
838
  }
815
- const Ye = je`
839
+ const Qe = ze`
816
840
  :host, *, ::before, ::after {
817
841
  all: isolate;
818
842
  box-sizing: border-box;
@@ -870,7 +894,7 @@ const Ye = je`
870
894
  sup { top: -.5em }
871
895
  [disabled], [aria-disabled=true] { cursor: not-allowed }
872
896
  [hidden] { display: none }
873
- `, Qe = {
897
+ `, Xe = {
874
898
  gray: {
875
899
  50: "var(--color-gray-50, #f9fafb)",
876
900
  100: "var(--color-gray-100, #f3f4f6)",
@@ -1004,8 +1028,10 @@ const Ye = je`
1004
1028
  900: "var(--color-rose-900, #881337)"
1005
1029
  },
1006
1030
  white: { DEFAULT: "var(--color-white, #ffffff)" },
1007
- black: { DEFAULT: "var(--color-black, #000000)" }
1008
- }, se = {
1031
+ black: { DEFAULT: "var(--color-black, #000000)" },
1032
+ transparent: { DEFAULT: "var(--color-transparent, transparent)" },
1033
+ current: { DEFAULT: "var(--color-current, currentColor)" }
1034
+ }, ge = {
1009
1035
  /* Display */
1010
1036
  block: "display:block;",
1011
1037
  inline: "display:inline;",
@@ -1109,12 +1135,6 @@ const Ye = je`
1109
1135
  "rounded-md": "border-radius:0.375rem;",
1110
1136
  "rounded-lg": "border-radius:0.5rem;",
1111
1137
  "rounded-full": "border-radius:9999px;",
1112
- /* Ring (box-shadow for focus) */
1113
- "ring-0": "box-shadow:none;",
1114
- "ring-1": "box-shadow:0 0 0 1px rgba(59,130,246,0.5);",
1115
- "ring-2": "box-shadow:0 0 0 2px rgba(59,130,246,0.5);",
1116
- "ring-4": "box-shadow:0 0 0 4px rgba(59,130,246,0.5);",
1117
- "ring-8": "box-shadow:0 0 0 8px rgba(59,130,246,0.5);",
1118
1138
  /* Shadow and effects */
1119
1139
  "shadow-none": "box-shadow:0 0 #0000;",
1120
1140
  "shadow-xs": "box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);",
@@ -1123,8 +1143,6 @@ const Ye = je`
1123
1143
  "shadow-lg": "box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);",
1124
1144
  "shadow-xl": "box-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);",
1125
1145
  "shadow-2xl": "box-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);",
1126
- /* Transitions */
1127
- transition: "transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4,0,0.2,1);",
1128
1146
  /* Text Overflow & Whitespace */
1129
1147
  truncate: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",
1130
1148
  /* Visibility */
@@ -1175,10 +1193,14 @@ const Ye = je`
1175
1193
  "line-clamp-2": "display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;",
1176
1194
  "line-clamp-3": "display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;",
1177
1195
  "line-clamp-4": "display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;",
1178
- /* Transition Delay/Property */
1196
+ /* Transitions */
1197
+ transition: "transition-property:all;transition-duration:150ms;transition-timing-function:ease-in-out;",
1198
+ "transition-all": "transition-property:all;",
1179
1199
  "transition-colors": "transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;",
1200
+ "transition-shadow": "transition-property:box-shadow;",
1180
1201
  "transition-opacity": "transition-property:opacity;",
1181
1202
  "transition-transform": "transition-property:transform;",
1203
+ "transition-none": "transition-property:none;",
1182
1204
  /* Z-index */
1183
1205
  "z-0": "z-index:0;",
1184
1206
  "z-10": "z-index:10;",
@@ -1186,7 +1208,7 @@ const Ye = je`
1186
1208
  "z-30": "z-index:30;",
1187
1209
  "z-40": "z-index:40;",
1188
1210
  "z-50": "z-index:50;"
1189
- }, Xe = "0.25rem", $e = {
1211
+ }, et = "0.25rem", Se = {
1190
1212
  m: ["margin"],
1191
1213
  mx: ["margin-inline"],
1192
1214
  my: ["margin-block"],
@@ -1218,34 +1240,34 @@ const Ye = je`
1218
1240
  "gap-x": ["column-gap"],
1219
1241
  "gap-y": ["row-gap"]
1220
1242
  };
1221
- function B(e, t) {
1243
+ function P(e, t) {
1222
1244
  let r = 0, o = 0;
1223
1245
  for (let n = 0; n < e.length; n++) {
1224
- const s = e[n];
1225
- if (s === "[") r++;
1226
- else if (s === "]" && r > 0) r--;
1227
- else if (s === "(") o++;
1228
- else if (s === ")" && o > 0) o--;
1229
- else if (r === 0 && o === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1246
+ const i = e[n];
1247
+ if (i === "[") r++;
1248
+ else if (i === "]" && r > 0) r--;
1249
+ else if (i === "(") o++;
1250
+ else if (i === ")" && o > 0) o--;
1251
+ else if (r === 0 && o === 0 && (i === ">" || i === "+" || i === "~" || i === " "))
1230
1252
  return e.slice(0, n) + t + e.slice(n);
1231
1253
  }
1232
1254
  return e + t;
1233
1255
  }
1234
- const Ge = {
1256
+ const tt = {
1235
1257
  before: (e, t) => `${e}::before{${t}}`,
1236
1258
  after: (e, t) => `${e}::after{${t}}`,
1237
- hover: (e, t) => `${B(e, ":hover")}{${t}}`,
1238
- focus: (e, t) => `${B(e, ":focus")}{${t}}`,
1239
- active: (e, t) => `${B(e, ":active")}{${t}}`,
1240
- disabled: (e, t) => `${B(e, ":disabled")}{${t}}`,
1241
- visited: (e, t) => `${B(e, ":visited")}{${t}}`,
1242
- checked: (e, t) => `${B(e, ":checked")}{${t}}`,
1243
- first: (e, t) => `${B(e, ":first-child")}{${t}}`,
1244
- last: (e, t) => `${B(e, ":last-child")}{${t}}`,
1245
- odd: (e, t) => `${B(e, ":nth-child(odd)")}{${t}}`,
1246
- even: (e, t) => `${B(e, ":nth-child(even)")}{${t}}`,
1247
- "focus-within": (e, t) => `${B(e, ":focus-within")}{${t}}`,
1248
- "focus-visible": (e, t) => `${B(e, ":focus-visible")}{${t}}`,
1259
+ hover: (e, t) => `${P(e, ":hover")}{${t}}`,
1260
+ focus: (e, t) => `${P(e, ":focus")}{${t}}`,
1261
+ active: (e, t) => `${P(e, ":active")}{${t}}`,
1262
+ disabled: (e, t) => `${P(e, ":disabled")}{${t}}`,
1263
+ visited: (e, t) => `${P(e, ":visited")}{${t}}`,
1264
+ checked: (e, t) => `${P(e, ":checked")}{${t}}`,
1265
+ first: (e, t) => `${P(e, ":first-child")}{${t}}`,
1266
+ last: (e, t) => `${P(e, ":last-child")}{${t}}`,
1267
+ odd: (e, t) => `${P(e, ":nth-child(odd)")}{${t}}`,
1268
+ even: (e, t) => `${P(e, ":nth-child(even)")}{${t}}`,
1269
+ "focus-within": (e, t) => `${P(e, ":focus-within")}{${t}}`,
1270
+ "focus-visible": (e, t) => `${P(e, ":focus-visible")}{${t}}`,
1249
1271
  "group-hover": (e, t) => `.group:hover ${e}{${t}}`,
1250
1272
  "group-focus": (e, t) => `.group:focus ${e}{${t}}`,
1251
1273
  "group-active": (e, t) => `.group:active ${e}{${t}}`,
@@ -1254,7 +1276,7 @@ const Ge = {
1254
1276
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1255
1277
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1256
1278
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1257
- }, ae = {
1279
+ }, ye = {
1258
1280
  // Responsive
1259
1281
  sm: "(min-width:640px)",
1260
1282
  md: "(min-width:768px)",
@@ -1263,24 +1285,24 @@ const Ge = {
1263
1285
  "2xl": "(min-width:1536px)",
1264
1286
  // Dark mode (now plain string)
1265
1287
  dark: "(prefers-color-scheme: dark)"
1266
- }, ce = ["sm", "md", "lg", "xl", "2xl"];
1267
- function le(e) {
1288
+ }, me = ["sm", "md", "lg", "xl", "2xl"];
1289
+ function be(e) {
1268
1290
  const t = e.startsWith("-"), o = (t ? e.slice(1) : e).split("-");
1269
1291
  if (o.length < 2) return null;
1270
- const n = o.slice(0, -1).join("-"), s = o[o.length - 1], i = parseFloat(s);
1271
- if (Number.isNaN(i) || !$e[n]) return null;
1292
+ const n = o.slice(0, -1).join("-"), i = o[o.length - 1], s = parseFloat(i);
1293
+ if (Number.isNaN(s) || !Se[n]) return null;
1272
1294
  const a = t ? "-" : "";
1273
- return $e[n].map((l) => `${l}:calc(${a}${Xe} * ${i});`).join("");
1295
+ return Se[n].map((f) => `${f}:calc(${a}${et} * ${s});`).join("");
1274
1296
  }
1275
- function Se(e) {
1276
- const t = e.replace("#", ""), r = parseInt(t, 16), o = r >> 16 & 255, n = r >> 8 & 255, s = r & 255;
1277
- return `${o} ${n} ${s}`;
1297
+ function Ce(e) {
1298
+ const t = e.replace("#", ""), r = parseInt(t, 16), o = r >> 16 & 255, n = r >> 8 & 255, i = r & 255;
1299
+ return `${o} ${n} ${i}`;
1278
1300
  }
1279
- function et(e) {
1301
+ function rt(e) {
1280
1302
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1281
1303
  if (!t) return null;
1282
- const [, r, o, n = "DEFAULT"] = t, s = Qe[o]?.[n];
1283
- return s ? `${{
1304
+ const [, r, o, n = "DEFAULT"] = t, i = Xe[o]?.[n];
1305
+ return i ? `${{
1284
1306
  bg: "background-color",
1285
1307
  decoration: "text-decoration-color",
1286
1308
  text: "color",
@@ -1292,49 +1314,49 @@ function et(e) {
1292
1314
  placeholder: "placeholder-color",
1293
1315
  fill: "fill-color",
1294
1316
  stroke: "stroke-color"
1295
- }[r]}:${s};` : null;
1317
+ }[r]}:${i};` : null;
1296
1318
  }
1297
- function tt(e) {
1319
+ function nt(e) {
1298
1320
  const [t, r] = e.split("/");
1299
1321
  if (!r) return { base: t };
1300
1322
  const o = parseInt(r, 10);
1301
1323
  return isNaN(o) || o < 0 || o > 100 ? { base: t } : { base: t, opacity: o / 100 };
1302
1324
  }
1303
- function fe(e) {
1304
- const { base: t, opacity: r } = tt(e), o = et(t);
1325
+ function ve(e) {
1326
+ const { base: t, opacity: r } = nt(e), o = rt(t);
1305
1327
  if (o) {
1306
1328
  if (r !== void 0) {
1307
- const s = /#([0-9a-f]{6})/i.exec(o);
1308
- if (s) {
1309
- const i = Se(s[0]);
1310
- return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1329
+ const i = /#([0-9a-f]{6})/i.exec(o);
1330
+ if (i) {
1331
+ const s = Ce(i[0]);
1332
+ return o.replace(/#([0-9a-f]{6})/i, `rgb(${s} / ${r})`);
1311
1333
  }
1312
1334
  }
1313
1335
  return o;
1314
1336
  }
1315
- const n = G(t);
1337
+ const n = le(t);
1316
1338
  if (n && r !== void 0) {
1317
- const s = /#([0-9a-f]{6})/i.exec(n);
1318
- if (s) {
1319
- const i = Se(s[0]);
1320
- return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1339
+ const i = /#([0-9a-f]{6})/i.exec(n);
1340
+ if (i) {
1341
+ const s = Ce(i[0]);
1342
+ return n.replace(/#([0-9a-f]{6})/i, `rgb(${s} / ${r})`);
1321
1343
  }
1322
1344
  }
1323
1345
  return n;
1324
1346
  }
1325
- function ue(e) {
1347
+ function xe(e) {
1326
1348
  const t = /^opacity-(\d{1,3})$/.exec(e);
1327
1349
  if (!t) return null;
1328
1350
  const r = parseInt(t[1], 10);
1329
1351
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1330
1352
  }
1331
- function G(e) {
1353
+ function le(e) {
1332
1354
  if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1333
1355
  const n = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1334
1356
  if (n) {
1335
- const s = n[1].trim();
1336
- let i = n[2].trim();
1337
- return i = i.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), i = i.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${i};`;
1357
+ const i = n[1].trim();
1358
+ let s = n[2].trim();
1359
+ return s = s.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), s = s.replace(/^'([^']*)'$/g, '"$1"'), `${i}:${s};`;
1338
1360
  }
1339
1361
  return null;
1340
1362
  }
@@ -1343,9 +1365,10 @@ function G(e) {
1343
1365
  const o = e.slice(0, t);
1344
1366
  let n = e.slice(t + 2, -1);
1345
1367
  n = n.replace(/_/g, " ");
1346
- const s = {
1368
+ const i = {
1347
1369
  bg: "background-color",
1348
1370
  text: "color",
1371
+ shadow: "box-shadow",
1349
1372
  p: "padding",
1350
1373
  px: "padding-inline",
1351
1374
  py: "padding-block",
@@ -1364,7 +1387,9 @@ function G(e) {
1364
1387
  "border-r": "border-right",
1365
1388
  "border-x": "border-inline",
1366
1389
  "border-y": "border-block",
1367
- shadow: "box-shadow",
1390
+ transition: "transition-property",
1391
+ ease: "transition-timing-function",
1392
+ delay: "transition-delay",
1368
1393
  duration: "transition-duration",
1369
1394
  list: "list-style",
1370
1395
  break: "word-break",
@@ -1378,19 +1403,18 @@ function G(e) {
1378
1403
  basis: "flex-basis",
1379
1404
  tracking: "letter-spacing",
1380
1405
  scroll: "scroll-behavior",
1381
- delay: "transition-delay",
1382
1406
  weight: "font-weight",
1383
1407
  leading: "line-height",
1384
1408
  z: "z-index"
1385
1409
  };
1386
1410
  if (o === "rotate")
1387
1411
  return `transform:rotate(${n});`;
1388
- const i = s[o] ?? o.replace(/_/g, "-");
1389
- if (i && n) return `${i}:${n};`;
1412
+ const s = i[o] ?? o.replace(/_/g, "-");
1413
+ if (s && n) return `${s}:${n};`;
1390
1414
  }
1391
1415
  return null;
1392
1416
  }
1393
- function rt(e) {
1417
+ function ot(e) {
1394
1418
  if (e.startsWith("[") && e.endsWith("]")) {
1395
1419
  const r = e.slice(1, -1);
1396
1420
  return r.includes("&") ? r : e;
@@ -1402,10 +1426,10 @@ function rt(e) {
1402
1426
  }
1403
1427
  return null;
1404
1428
  }
1405
- function nt(e) {
1429
+ function it(e) {
1406
1430
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1407
1431
  }
1408
- function ot(e) {
1432
+ function st(e) {
1409
1433
  const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1410
1434
  let o;
1411
1435
  for (; o = t.exec(e); ) {
@@ -1414,32 +1438,32 @@ function ot(e) {
1414
1438
  }
1415
1439
  return r.filter(Boolean);
1416
1440
  }
1417
- const _e = /* @__PURE__ */ new Map(), it = 16;
1418
- function st(e) {
1419
- const t = Date.now(), r = _e.get(e);
1420
- if (r && t - r.timestamp < it) return r.css;
1421
- const o = ot(e), n = new Set(o), s = [], i = [], a = [], l = [], f = {};
1422
- function p(h, u = !1) {
1423
- const g = (u ? "dark|" : "") + h;
1424
- if (g in f) return f[g];
1425
- const b = x(h, u);
1426
- return f[g] = b, b;
1427
- }
1428
- function y(h) {
1429
- const u = h.some((b) => ce.includes(b)), g = h.includes("dark");
1430
- return h.length === 0 ? 1 : !u && !g ? 2 : u && !g ? 3 : 4;
1431
- }
1432
- function c(h) {
1433
- const u = [];
1434
- let g = "", b = 0, d = 0;
1435
- for (let v = 0; v < h.length; v++) {
1436
- const m = h[v];
1437
- m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? d++ : m === ")" && d > 0 && d--, m === ":" && b === 0 && d === 0 ? (u.push(g), g = "") : g += m;
1441
+ const Ee = /* @__PURE__ */ new Map(), at = 16;
1442
+ function lt(e) {
1443
+ const t = Date.now(), r = Ee.get(e);
1444
+ if (r && t - r.timestamp < at) return r.css;
1445
+ const o = st(e), n = new Set(o), i = [], s = [], a = [], f = [], u = {};
1446
+ function d(v, b = !1) {
1447
+ const y = (b ? "dark|" : "") + v;
1448
+ if (y in u) return u[y];
1449
+ const x = w(v, b);
1450
+ return u[y] = x, x;
1451
+ }
1452
+ function m(v) {
1453
+ const b = v.some((x) => me.includes(x)), y = v.includes("dark");
1454
+ return v.length === 0 ? 1 : !b && !y ? 2 : b && !y ? 3 : 4;
1455
+ }
1456
+ function l(v) {
1457
+ const b = [];
1458
+ let y = "", x = 0, c = 0;
1459
+ for (let g = 0; g < v.length; g++) {
1460
+ const p = v[g];
1461
+ p === "[" ? x++ : p === "]" && x > 0 ? x-- : p === "(" ? c++ : p === ")" && c > 0 && c--, p === ":" && x === 0 && c === 0 ? (b.push(y), y = "") : y += p;
1438
1462
  }
1439
- return g && u.push(g), u;
1463
+ return y && b.push(y), b;
1440
1464
  }
1441
- function w(h) {
1442
- switch (h) {
1465
+ function h(v) {
1466
+ switch (v) {
1443
1467
  case "hover":
1444
1468
  return ":hover";
1445
1469
  case "focus":
@@ -1468,206 +1492,210 @@ function st(e) {
1468
1492
  return null;
1469
1493
  }
1470
1494
  }
1471
- function x(h, u = !1) {
1472
- const g = c(h);
1473
- (h.includes("mask-image") || h.includes("sm: hover") || h.includes("sm:hover") || h.includes("mask.svg")) && console.error("DEBUG generateRule:", h, g);
1474
- let b = !1, d = g.find((S) => (S.startsWith("!") && (b = !0, S = S.slice(1)), se[S] || le(S) || ue(S) || fe(S) || G(S)));
1475
- if (!d) return null;
1476
- const v = d.replace(/^!/, ""), m = se[v] ?? le(v) ?? ue(v) ?? fe(v) ?? G(v);
1477
- if (!m) return null;
1478
- const $ = g.indexOf(d);
1479
- let _ = $ >= 0 ? g.slice(0, $) : [];
1480
- u && (_ = _.filter((S) => S !== "dark"));
1481
- const C = `.${nt(h)}`, E = "__SUBJECT__", j = b ? m.replace(/;$/, " !important;") : m;
1482
- let A = E;
1483
- const re = [];
1484
- for (const S of _)
1485
- S.startsWith("group-") ? (A = `.group:${S.slice(6)} ${A}`, re.push(S)) : S.startsWith("peer-") && (A = A.replace(E, `.peer:${S.slice(5)}~${E}`), re.push(S));
1486
- _ = _.filter((S) => !re.includes(S));
1487
- const ne = [], be = [];
1488
- let W = null;
1489
- for (const S of _) {
1490
- if (S === "dark" || ce.includes(S)) continue;
1491
- const M = rt(S);
1492
- if (M) {
1493
- W = M;
1495
+ function w(v, b = !1) {
1496
+ const y = l(v);
1497
+ let x = !1;
1498
+ const c = y.find((k) => (k.startsWith("!") && (x = !0, k = k.slice(1)), ge[k] || be(k) || xe(k) || ve(k) || le(k)));
1499
+ if (!c) return null;
1500
+ const g = c.replace(/^!/, ""), p = ge[g] ?? be(g) ?? xe(g) ?? ve(g) ?? le(g);
1501
+ if (!p) return null;
1502
+ const _ = y.indexOf(c);
1503
+ let E = _ >= 0 ? y.slice(0, _) : [];
1504
+ b && (E = E.filter((k) => k !== "dark"));
1505
+ const C = `.${it(v)}`, S = "__SUBJECT__", A = x ? p.replace(/;$/, " !important;") : p;
1506
+ let T = S;
1507
+ const Q = [];
1508
+ for (const k of E)
1509
+ k.startsWith("group-") ? (T = `.group:${k.slice(6)} ${T}`, Q.push(k)) : k.startsWith("peer-") && (T = T.replace(S, `.peer:${k.slice(5)}~${S}`), Q.push(k));
1510
+ E = E.filter((k) => !Q.includes(k));
1511
+ const X = [], de = [];
1512
+ let q = null;
1513
+ for (const k of E) {
1514
+ if (k === "dark" || me.includes(k)) continue;
1515
+ const B = ot(k);
1516
+ if (B) {
1517
+ q = B;
1494
1518
  continue;
1495
1519
  }
1496
- const L = w(S);
1497
- if (L) {
1498
- W ? be.push(L) : ne.push(L);
1520
+ const z = h(k);
1521
+ if (z) {
1522
+ q ? de.push(z) : X.push(z);
1499
1523
  continue;
1500
1524
  }
1501
- const R = Ge[S];
1502
- typeof R == "function" && (A = R(A, j).split("{")[0]);
1525
+ const O = tt[k];
1526
+ typeof O == "function" && (T = O(T, A).split("{")[0]);
1503
1527
  }
1504
- function ze(S, M) {
1505
- if (!M) return S;
1506
- let L = 0, R = 0;
1507
- if (S.length && (S[0] === ">" || S[0] === "+" || S[0] === "~" || S[0] === " ")) {
1508
- let T = 1;
1509
- for (; T < S.length && S[T] === " "; ) T++;
1510
- for (; T < S.length; T++) {
1511
- const z = S[T];
1512
- if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? R++ : z === ")" && R > 0 && R--, L === 0 && R === 0 && (S[T] === ">" || S[T] === "+" || S[T] === "~" || S[T] === " "))
1513
- return S.slice(0, T) + M + S.slice(T);
1528
+ function I(k, B) {
1529
+ if (!B) return k;
1530
+ let z = 0, O = 0;
1531
+ if (k.length && (k[0] === ">" || k[0] === "+" || k[0] === "~" || k[0] === " ")) {
1532
+ let j = 1;
1533
+ for (; j < k.length && k[j] === " "; ) j++;
1534
+ for (; j < k.length; j++) {
1535
+ const R = k[j];
1536
+ if (R === "[" ? z++ : R === "]" && z > 0 ? z-- : R === "(" ? O++ : R === ")" && O > 0 && O--, z === 0 && O === 0 && (k[j] === ">" || k[j] === "+" || k[j] === "~" || k[j] === " "))
1537
+ return k.slice(0, j) + B + k.slice(j);
1514
1538
  }
1515
- return S + M;
1539
+ return k + B;
1516
1540
  }
1517
- for (let T = 0; T < S.length; T++) {
1518
- const z = S[T];
1519
- if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? R++ : z === ")" && R > 0 && R--, L === 0 && R === 0 && (z === ">" || z === "+" || z === "~" || z === " "))
1520
- return S.slice(0, T) + M + S.slice(T);
1541
+ for (let j = 0; j < k.length; j++) {
1542
+ const R = k[j];
1543
+ if (R === "[" ? z++ : R === "]" && z > 0 ? z-- : R === "(" ? O++ : R === ")" && O > 0 && O--, z === 0 && O === 0 && (R === ">" || R === "+" || R === "~" || R === " "))
1544
+ return k.slice(0, j) + B + k.slice(j);
1521
1545
  }
1522
- return S + M;
1546
+ return k + B;
1523
1547
  }
1524
- const oe = ne.join(""), U = be.join("");
1525
- if (W)
1526
- if (W.includes("&")) {
1527
- const S = W.indexOf("&"), M = W.slice(0, S), L = W.slice(S + 1), R = E + oe, T = A;
1528
- if (ne.length === 0)
1529
- A = T.replace(E, M + R + U + L);
1548
+ const Z = X.join(""), F = de.join("");
1549
+ if (q)
1550
+ if (q.includes("&")) {
1551
+ const k = q.indexOf("&"), B = q.slice(0, k), z = q.slice(k + 1), O = S + Z, j = T;
1552
+ if (X.length === 0)
1553
+ T = j.replace(S, B + O + F + z);
1530
1554
  else {
1531
- const z = ze(L, U);
1532
- A = T.replace(E, M + R + z);
1555
+ const R = I(z, F);
1556
+ T = j.replace(S, B + O + R);
1533
1557
  }
1534
1558
  } else
1535
- A = A.replace(E, `${W}${E + oe}`), U && (A = A.replace(E, `${E}${U}`));
1559
+ T = T.replace(S, `${q}${S + Z}`), F && (T = T.replace(S, `${S}${F}`));
1536
1560
  else
1537
- A = E + oe + U;
1538
- A = A.replace(new RegExp(E, "g"), C);
1539
- let O = `${A}{${j}}`;
1540
- const ie = _.filter((S) => ce.includes(S)), H = ie.length ? ie[ie.length - 1] : null, ve = _.includes("dark");
1541
- return u && H ? O = `@media (prefers-color-scheme: dark) and ${ae[H]}{${O}}` : u ? O = `@media (prefers-color-scheme: dark){${O}}` : ve && H ? O = `@media (prefers-color-scheme: dark) and ${ae[H]}{${O}}` : ve ? O = `@media (prefers-color-scheme: dark){${O}}` : H && (O = `@media ${ae[H]}{${O}}`), O;
1542
- }
1543
- for (const h of n) {
1544
- const u = c(h), g = u.find(
1545
- (m) => se[m] || le(m) || ue(m) || fe(m) || G(m)
1561
+ T = S + Z + F;
1562
+ T = T.replace(new RegExp(S, "g"), C);
1563
+ let L = `${T}{${A}}`;
1564
+ const K = E.filter((k) => me.includes(k)), D = K.length ? K[K.length - 1] : null, ne = E.includes("dark");
1565
+ return b && D ? L = `@media (prefers-color-scheme: dark) and ${ye[D]}{${L}}` : b ? L = `@media (prefers-color-scheme: dark){${L}}` : ne && D ? L = `@media (prefers-color-scheme: dark) and ${ye[D]}{${L}}` : ne ? L = `@media (prefers-color-scheme: dark){${L}}` : D && (L = `@media ${ye[D]}{${L}}`), L;
1566
+ }
1567
+ for (const v of n) {
1568
+ const b = l(v), y = b.find(
1569
+ (p) => ge[p] || be(p) || xe(p) || ve(p) || le(p)
1546
1570
  );
1547
- if (!g) continue;
1548
- const b = u.indexOf(g), d = b >= 0 ? u.slice(0, b) : [], v = y(d);
1549
- if (v === 4) {
1550
- const m = p(h, !0);
1551
- m && l.push(m);
1571
+ if (!y) continue;
1572
+ const x = b.indexOf(y), c = x >= 0 ? b.slice(0, x) : [], g = m(c);
1573
+ if (g === 4) {
1574
+ const p = d(v, !0);
1575
+ p && f.push(p);
1552
1576
  } else {
1553
- const m = p(h);
1554
- m && (v === 1 ? s.push(m) : v === 2 ? i.push(m) : v === 3 && a.push(m));
1577
+ const p = d(v);
1578
+ p && (g === 1 ? i.push(p) : g === 2 ? s.push(p) : g === 3 && a.push(p));
1555
1579
  }
1556
1580
  }
1557
- const k = [...s, ...i, ...a, ...l].join("");
1558
- return _e.set(e, { css: k, timestamp: t }), k;
1581
+ const $ = [...i, ...s, ...a, ...f].join("");
1582
+ return Ee.set(e, { css: $, timestamp: t }), $;
1559
1583
  }
1560
- const J = [];
1561
- function at(e, t, r, o, n, s, i, a) {
1584
+ const te = [];
1585
+ function ct(e, t, r, o, n, i, s, a) {
1562
1586
  if (e) {
1563
- J.push(r);
1587
+ te.push(r);
1564
1588
  try {
1565
1589
  if (t.loadingTemplate && r.isLoading) {
1566
- F(e, t.loadingTemplate(r), r, o, n);
1590
+ Y(e, t.loadingTemplate(r), r, o, n);
1567
1591
  return;
1568
1592
  }
1569
1593
  if (t.errorTemplate && r.hasError) {
1570
- r.error instanceof Error && F(e, t.errorTemplate(r.error, r), r, o, n);
1594
+ r.error instanceof Error && Y(e, t.errorTemplate(r.error, r), r, o, n);
1571
1595
  return;
1572
1596
  }
1573
- const l = t.render(r);
1574
- if (l instanceof Promise) {
1575
- s(!0), l.then((f) => {
1576
- s(!1), i(null), F(e, f, r, o, n), a(e.innerHTML);
1577
- }).catch((f) => {
1578
- s(!1), i(f), t.errorTemplate && F(e, t.errorTemplate(f, r), r, o, n);
1579
- }), t.loadingTemplate && F(e, t.loadingTemplate(r), r, o, n);
1597
+ const f = t.render(r);
1598
+ if (f instanceof Promise) {
1599
+ i(!0), f.then((u) => {
1600
+ i(!1), s(null), Y(e, u, r, o, n), a(e.innerHTML);
1601
+ }).catch((u) => {
1602
+ i(!1), s(u), t.errorTemplate && Y(e, t.errorTemplate(u, r), r, o, n);
1603
+ }), t.loadingTemplate && Y(e, t.loadingTemplate(r), r, o, n);
1580
1604
  return;
1581
1605
  }
1582
- F(e, l, r, o, n), a(e.innerHTML);
1606
+ Y(e, f, r, o, n), a(e.innerHTML);
1583
1607
  } finally {
1584
- J.pop();
1608
+ te.pop();
1585
1609
  }
1586
1610
  }
1587
1611
  }
1588
- function F(e, t, r, o, n) {
1589
- e && (Je(
1612
+ function Y(e, t, r, o, n) {
1613
+ e && (Ye(
1590
1614
  e,
1591
1615
  Array.isArray(t) ? t : [t],
1592
1616
  r,
1593
1617
  o
1594
1618
  ), n(e.innerHTML));
1595
1619
  }
1596
- function ct(e, t, r, o, n, s, i) {
1597
- if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1620
+ function ft(e, t, r, o, n, i, s) {
1621
+ if (i !== null && clearTimeout(i), Date.now() - t < 16) {
1598
1622
  if (n(r + 1), r > 10) {
1599
- console.warn("Potential infinite render loop detected. Skipping render."), i(null);
1623
+ s(null);
1600
1624
  return;
1601
1625
  }
1602
1626
  } else
1603
1627
  n(0);
1604
- const l = setTimeout(() => {
1605
- o(Date.now()), e(), i(null);
1628
+ const f = setTimeout(() => {
1629
+ o(Date.now()), e(), s(null);
1606
1630
  }, 0);
1607
- i(l);
1631
+ s(f);
1608
1632
  }
1609
- function lt(e, t, r, o, n, s) {
1633
+ function ut(e, t, r, o, n, i) {
1610
1634
  if (!e) return;
1611
- const i = st(o);
1612
- if (!t.style && (!i || i.trim() === "")) {
1613
- s(null), e.adoptedStyleSheets = [ke()];
1635
+ const s = lt(o);
1636
+ if (!t.style && (!s || s.trim() === "")) {
1637
+ i(null), e.adoptedStyleSheets = [_e()];
1614
1638
  return;
1615
1639
  }
1616
1640
  let a = "";
1617
1641
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1618
- let l = Ze(`${a}
1619
- ${i}
1642
+ let f = Ge(`${a}
1643
+ ${s}
1620
1644
  `);
1621
- l = Le(l);
1622
- let f = n;
1623
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== l) && f.replaceSync(l), e.adoptedStyleSheets = [ke(), f], s(f);
1645
+ f = Be(f);
1646
+ let u = n;
1647
+ u || (u = new CSSStyleSheet()), (u.cssRules.length === 0 || u.toString() !== f) && u.replaceSync(f), e.adoptedStyleSheets = [_e(), u], i(u);
1624
1648
  }
1625
- const ye = /* @__PURE__ */ new Map();
1626
- function Ce(e, t, r) {
1627
- let o = me(e);
1649
+ const ue = /* @__PURE__ */ new Map(), Ae = Symbol.for("cer.registry");
1650
+ if (typeof window < "u") {
1651
+ const e = globalThis;
1652
+ e[Ae] || (e[Ae] = ue);
1653
+ }
1654
+ function Te(e, t, r) {
1655
+ let o = J(e);
1628
1656
  o.includes("-") || (o = `cer-${o}`);
1629
1657
  let n;
1630
- typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (s, i) => {
1631
- console.error(`[${o}] Error:`, s, i);
1658
+ typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (i, s) => {
1659
+ console.error(`[${o}] Error:`, i, s);
1632
1660
  });
1633
1661
  try {
1634
- const s = /* @__PURE__ */ new Set([
1662
+ const i = /* @__PURE__ */ new Set([
1635
1663
  "refs",
1636
1664
  "requestRender",
1637
1665
  "error",
1638
1666
  "hasError",
1639
1667
  "isLoading",
1640
1668
  "emit"
1641
- ]), i = [];
1669
+ ]), s = [];
1642
1670
  if (n.state && typeof n.state == "object" && Object.keys(n.state).forEach((a) => {
1643
- s.has(a) && i.push(a);
1671
+ i.has(a) && s.push(a);
1644
1672
  }), n.props && typeof n.props == "object" && Object.keys(n.props).forEach((a) => {
1645
- s.has(a) && i.push(a);
1673
+ i.has(a) && s.push(a);
1646
1674
  }), n.computed && typeof n.computed == "object" && Object.keys(n.computed).forEach((a) => {
1647
- s.has(a) && i.push(a);
1648
- }), i.length > 0) {
1649
- const a = Array.from(new Set(i));
1675
+ i.has(a) && s.push(a);
1676
+ }), s.length > 0) {
1677
+ const a = Array.from(new Set(s));
1650
1678
  console.warn(
1651
1679
  `[${o}] 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.`
1652
1680
  );
1653
1681
  }
1654
1682
  } catch {
1655
1683
  }
1656
- if (ye.set(o, n), typeof window < "u")
1684
+ if (ue.set(o, n), typeof window < "u")
1657
1685
  if (!customElements.get(o))
1658
- customElements.define(o, ft(o, n));
1686
+ customElements.define(o, dt(o, n));
1659
1687
  else
1660
1688
  try {
1661
- document.querySelectorAll(o).forEach((s) => {
1689
+ document.querySelectorAll(o).forEach((i) => {
1662
1690
  try {
1663
- typeof s._cfg < "u" && (s._cfg = n), typeof s._render == "function" && s._render(n);
1691
+ typeof i._cfg < "u" && (i._cfg = n), typeof i._render == "function" && i._render(n);
1664
1692
  } catch {
1665
1693
  }
1666
1694
  });
1667
1695
  } catch {
1668
1696
  }
1669
1697
  }
1670
- function ft(e, t) {
1698
+ function dt(e, t) {
1671
1699
  if (!t.render)
1672
1700
  throw new Error(
1673
1701
  "Component must have a render function"
@@ -1711,7 +1739,7 @@ function ft(e, t) {
1711
1739
  _templateLoading = !1;
1712
1740
  _templateError = null;
1713
1741
  constructor() {
1714
- super(), this.attachShadow({ mode: "open" }), this._cfg = ye.get(e) || t;
1742
+ super(), this.attachShadow({ mode: "open" }), this._cfg = ue.get(e) || t;
1715
1743
  const r = this._initContext(t);
1716
1744
  Object.defineProperty(r, "refs", {
1717
1745
  value: this._refs,
@@ -1723,13 +1751,13 @@ function ft(e, t) {
1723
1751
  writable: !1,
1724
1752
  enumerable: !1,
1725
1753
  configurable: !1
1726
- }), this.context = r, this._applyProps(t), Object.defineProperty(this.context, "emit", {
1727
- value: (n, s, i) => {
1754
+ }), this.context = r, Object.defineProperty(this.context, "emit", {
1755
+ value: (n, i, s) => {
1728
1756
  const a = new CustomEvent(n, {
1729
- detail: s,
1757
+ detail: i,
1730
1758
  bubbles: !0,
1731
1759
  composed: !0,
1732
- ...i || {}
1760
+ ...s || {}
1733
1761
  });
1734
1762
  return this.dispatchEvent(a), !a.defaultPrevented;
1735
1763
  },
@@ -1737,15 +1765,15 @@ function ft(e, t) {
1737
1765
  enumerable: !1,
1738
1766
  configurable: !1
1739
1767
  });
1740
- const o = ye.get(e) || t;
1768
+ const o = ue.get(e) || t;
1741
1769
  Object.keys(o).forEach((n) => {
1742
- const s = o[n];
1743
- typeof s == "function" && (this.context[n] = (...i) => s(...i, this.context));
1770
+ const i = o[n];
1771
+ typeof i == "function" && (this.context[n] = (...s) => i(...s, this.context));
1744
1772
  }), this._applyComputed(o), this._initializing = !1, this._initWatchers(o), this._render(o);
1745
1773
  }
1746
1774
  connectedCallback() {
1747
1775
  this._runLogicWithinErrorBoundary(t, () => {
1748
- Ne(
1776
+ this._applyProps(t), qe(
1749
1777
  t,
1750
1778
  this.context,
1751
1779
  this._mounted,
@@ -1757,7 +1785,7 @@ function ft(e, t) {
1757
1785
  }
1758
1786
  disconnectedCallback() {
1759
1787
  this._runLogicWithinErrorBoundary(t, () => {
1760
- We(
1788
+ De(
1761
1789
  t,
1762
1790
  this.context,
1763
1791
  this._listeners,
@@ -1781,7 +1809,7 @@ function ft(e, t) {
1781
1809
  }
1782
1810
  attributeChangedCallback(r, o, n) {
1783
1811
  this._runLogicWithinErrorBoundary(t, () => {
1784
- this._applyProps(t), De(
1812
+ this._applyProps(t), Ie(
1785
1813
  t,
1786
1814
  r,
1787
1815
  o,
@@ -1791,15 +1819,15 @@ function ft(e, t) {
1791
1819
  });
1792
1820
  }
1793
1821
  static get observedAttributes() {
1794
- return t.props ? Object.keys(t.props).map(me) : [];
1822
+ return t.props ? Object.keys(t.props).map(J) : [];
1795
1823
  }
1796
1824
  _applyComputed(r) {
1797
1825
  this._runLogicWithinErrorBoundary(t, () => {
1798
1826
  r.computed && Object.entries(r.computed).forEach(([o, n]) => {
1799
1827
  Object.defineProperty(this.context, o, {
1800
1828
  get: () => {
1801
- const s = n(this.context);
1802
- return pe(s);
1829
+ const i = n(this.context);
1830
+ return H(i);
1803
1831
  },
1804
1832
  enumerable: !0
1805
1833
  });
@@ -1809,7 +1837,7 @@ function ft(e, t) {
1809
1837
  // --- Render ---
1810
1838
  _render(r) {
1811
1839
  this._runLogicWithinErrorBoundary(r, () => {
1812
- at(
1840
+ ct(
1813
1841
  this.shadowRoot,
1814
1842
  r,
1815
1843
  this.context,
@@ -1832,7 +1860,7 @@ function ft(e, t) {
1832
1860
  }
1833
1861
  _requestRender() {
1834
1862
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1835
- ct(
1863
+ ft(
1836
1864
  () => this._render(this._cfg),
1837
1865
  this._lastRenderTime,
1838
1866
  this._renderCount,
@@ -1852,7 +1880,7 @@ function ft(e, t) {
1852
1880
  // --- Style ---
1853
1881
  _applyStyle(r, o) {
1854
1882
  this._runLogicWithinErrorBoundary(r, () => {
1855
- lt(
1883
+ ut(
1856
1884
  this.shadowRoot,
1857
1885
  r,
1858
1886
  this.context,
@@ -1879,11 +1907,11 @@ function ft(e, t) {
1879
1907
  // --- State, props, computed ---
1880
1908
  _initContext(r) {
1881
1909
  try {
1882
- let o = function(s, i = "") {
1883
- return Array.isArray(s) ? new Proxy(s, {
1884
- get(a, l, f) {
1885
- const p = Reflect.get(a, l, f);
1886
- return typeof p == "function" && typeof l == "string" && [
1910
+ let o = function(i, s = "") {
1911
+ return Array.isArray(i) ? new Proxy(i, {
1912
+ get(a, f, u) {
1913
+ const d = Reflect.get(a, f, u);
1914
+ return typeof d == "function" && typeof f == "string" && [
1887
1915
  "push",
1888
1916
  "pop",
1889
1917
  "shift",
@@ -1891,44 +1919,44 @@ function ft(e, t) {
1891
1919
  "splice",
1892
1920
  "sort",
1893
1921
  "reverse"
1894
- ].includes(l) ? function(...c) {
1895
- const w = p.apply(a, c);
1922
+ ].includes(f) ? function(...l) {
1923
+ const h = d.apply(a, l);
1896
1924
  if (!n._initializing) {
1897
- const x = i || "root";
1898
- n._triggerWatchers(x, a), n._render(r);
1925
+ const w = s || "root";
1926
+ n._triggerWatchers(w, a), n._render(r);
1899
1927
  }
1900
- return w;
1901
- } : p;
1928
+ return h;
1929
+ } : d;
1902
1930
  },
1903
- set(a, l, f) {
1904
- if (a[l] = f, !n._initializing) {
1905
- const p = i ? `${i}.${String(l)}` : String(l);
1906
- n._triggerWatchers(p, f), n._render(r);
1931
+ set(a, f, u) {
1932
+ if (a[f] = u, !n._initializing) {
1933
+ const d = s ? `${s}.${String(f)}` : String(f);
1934
+ n._triggerWatchers(d, u), n._render(r);
1907
1935
  }
1908
1936
  return !0;
1909
1937
  },
1910
- deleteProperty(a, l) {
1911
- if (delete a[l], !n._initializing) {
1912
- const f = i ? `${i}.${String(l)}` : String(l);
1913
- n._triggerWatchers(f, void 0), n._render(r);
1938
+ deleteProperty(a, f) {
1939
+ if (delete a[f], !n._initializing) {
1940
+ const u = s ? `${s}.${String(f)}` : String(f);
1941
+ n._triggerWatchers(u, void 0), n._render(r);
1914
1942
  }
1915
1943
  return !0;
1916
1944
  }
1917
- }) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
1918
- const l = i ? `${i}.${a}` : a;
1919
- s[a] = o(s[a], l);
1920
- }), new Proxy(s, {
1921
- set(a, l, f) {
1922
- const p = i ? `${i}.${String(l)}` : String(l);
1923
- return a[l] = o(f, p), n._initializing || (n._triggerWatchers(
1924
- p,
1925
- a[l]
1945
+ }) : i && typeof i == "object" ? (Object.keys(i).forEach((a) => {
1946
+ const f = s ? `${s}.${a}` : a;
1947
+ i[a] = o(i[a], f);
1948
+ }), new Proxy(i, {
1949
+ set(a, f, u) {
1950
+ const d = s ? `${s}.${String(f)}` : String(f);
1951
+ return a[f] = o(u, d), n._initializing || (n._triggerWatchers(
1952
+ d,
1953
+ a[f]
1926
1954
  ), n._render(r)), !0;
1927
1955
  },
1928
- get(a, l, f) {
1929
- return Reflect.get(a, l, f);
1956
+ get(a, f, u) {
1957
+ return Reflect.get(a, f, u);
1930
1958
  }
1931
- })) : s;
1959
+ })) : i;
1932
1960
  };
1933
1961
  const n = this;
1934
1962
  return o({ ...r.state });
@@ -1938,7 +1966,7 @@ function ft(e, t) {
1938
1966
  }
1939
1967
  _initWatchers(r) {
1940
1968
  this._runLogicWithinErrorBoundary(r, () => {
1941
- Pe(
1969
+ Ne(
1942
1970
  this.context,
1943
1971
  this._watchers,
1944
1972
  r.watch || {}
@@ -1946,12 +1974,12 @@ function ft(e, t) {
1946
1974
  });
1947
1975
  }
1948
1976
  _triggerWatchers(r, o) {
1949
- Oe(this.context, this._watchers, r, o);
1977
+ Me(this.context, this._watchers, r, o);
1950
1978
  }
1951
1979
  _applyProps(r) {
1952
1980
  this._runLogicWithinErrorBoundary(r, () => {
1953
1981
  try {
1954
- Me(this, r, this.context);
1982
+ We(this, r, this.context);
1955
1983
  } catch (o) {
1956
1984
  this._hasError = !0, r.onError && r.onError(o, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(o, this.context));
1957
1985
  }
@@ -1959,102 +1987,103 @@ function ft(e, t) {
1959
1987
  }
1960
1988
  };
1961
1989
  }
1962
- function V(e, t = {}, r, o) {
1990
+ function ee(e, t = {}, r, o) {
1963
1991
  const n = o ?? t.key;
1964
1992
  return { tag: e, key: n, props: t, children: r };
1965
1993
  }
1966
- function ee(e) {
1994
+ function ce(e) {
1967
1995
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
1968
1996
  }
1969
- function Q(e) {
1970
- return typeof e == "object" && e !== null && "tag" in e && !ee(e);
1997
+ function ie(e) {
1998
+ return typeof e == "object" && e !== null && "tag" in e && !ce(e);
1971
1999
  }
1972
- function ut(e, t) {
2000
+ function pt(e, t) {
1973
2001
  return e.key != null ? e : { ...e, key: t };
1974
2002
  }
1975
- function dt(e, t = [], r = {}) {
1976
- const o = {}, n = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2003
+ function ht(e, t = [], r = {}) {
2004
+ const o = {}, n = {}, i = {}, s = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1977
2005
  let a;
1978
- for (; a = i.exec(e); ) {
1979
- const l = a[1], f = a[2], p = (a[4] || a[6]) ?? "", y = p.match(/^{{(\d+)}}$/);
1980
- let c = y ? t[Number(y[1])] ?? null : p;
1981
- y || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
1982
- const w = ["model", "bind", "show", "class", "style"];
1983
- if (l === ":") {
1984
- const [x, ...k] = f.split(".");
1985
- if (w.includes(x)) {
1986
- const h = [...k];
1987
- s[x] = {
1988
- value: c,
1989
- modifiers: h
2006
+ for (; a = s.exec(e); ) {
2007
+ const f = a[1], u = a[2], d = (a[4] || a[6]) ?? "", m = d.match(/^{{(\d+)}}$/);
2008
+ let l = m ? t[Number(m[1])] ?? null : d;
2009
+ m || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
2010
+ const h = ["model", "bind", "show", "class", "style"];
2011
+ if (f === ":") {
2012
+ const [w, $] = u.split(":"), [v, ...b] = w.split(".");
2013
+ if (h.includes(v)) {
2014
+ const y = [...b], x = v === "model" && $ ? `model:${$}` : v;
2015
+ i[x] = {
2016
+ value: l,
2017
+ modifiers: y,
2018
+ arg: $
1990
2019
  };
1991
2020
  } else
1992
- n[f] = c;
1993
- } else if (l === "@") {
1994
- const x = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1995
- o[x] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
1996
- } else f === "ref" ? o.ref = c : n[f] = c;
1997
- }
1998
- return { props: o, attrs: n, directives: s };
1999
- }
2000
- function pt(e, t, r) {
2001
- const o = J.length > 0 ? J[J.length - 1] : void 0, n = r ?? o;
2002
- function s(d, v) {
2003
- return V("#text", {}, d, v);
2004
- }
2005
- let i = "";
2006
- for (let d = 0; d < e.length; d++)
2007
- i += e[d], d < t.length && (i += `{{${d}}}`);
2008
- const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, l = [];
2009
- let f, p = [], y = null, c = {}, w, x = 0, k = [];
2010
- function h(d) {
2011
- !d || typeof d != "object" || ee(d) || (d.props || d.attrs ? (d.props && (c.props || (c.props = {}), Object.assign(c.props, d.props)), d.attrs && (c.attrs || (c.attrs = {}), Object.keys(d.attrs).forEach((v) => {
2012
- if (v === "style" && c.attrs.style) {
2013
- const m = c.attrs.style.replace(
2021
+ n[u] = l;
2022
+ } else if (f === "@") {
2023
+ const w = "on" + u.charAt(0).toUpperCase() + u.slice(1);
2024
+ o[w] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
2025
+ } else u === "ref" ? o.ref = l : n[u] = l;
2026
+ }
2027
+ return { props: o, attrs: n, directives: i };
2028
+ }
2029
+ function gt(e, t, r) {
2030
+ const o = te.length > 0 ? te[te.length - 1] : void 0, n = r ?? o;
2031
+ function i(c, g) {
2032
+ return ee("#text", {}, c, g);
2033
+ }
2034
+ let s = "";
2035
+ for (let c = 0; c < e.length; c++)
2036
+ s += e[c], c < t.length && (s += `{{${c}}}`);
2037
+ const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, f = [];
2038
+ let u, d = [], m = null, l = {}, h, w = 0, $ = [];
2039
+ function v(c) {
2040
+ !c || typeof c != "object" || ce(c) || (c.props || c.attrs ? (c.props && (l.props || (l.props = {}), Object.assign(l.props, c.props)), c.attrs && (l.attrs || (l.attrs = {}), Object.keys(c.attrs).forEach((g) => {
2041
+ if (g === "style" && l.attrs.style) {
2042
+ const p = l.attrs.style.replace(
2014
2043
  /;?\s*$/,
2015
2044
  ""
2016
- ), $ = d.attrs.style.replace(/^;?\s*/, "");
2017
- c.attrs.style = m + "; " + $;
2018
- } else if (v === "class" && c.attrs.class) {
2019
- const m = c.attrs.class.trim().split(/\s+/).filter(Boolean), $ = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
2020
- .../* @__PURE__ */ new Set([...m, ...$])
2045
+ ), _ = c.attrs.style.replace(/^;?\s*/, "");
2046
+ l.attrs.style = p + "; " + _;
2047
+ } else if (g === "class" && l.attrs.class) {
2048
+ const p = l.attrs.class.trim().split(/\s+/).filter(Boolean), _ = c.attrs.class.trim().split(/\s+/).filter(Boolean), E = [
2049
+ .../* @__PURE__ */ new Set([...p, ..._])
2021
2050
  ];
2022
- c.attrs.class = _.join(" ");
2051
+ l.attrs.class = E.join(" ");
2023
2052
  } else
2024
- c.attrs[v] = d.attrs[v];
2025
- }))) : (c.props || (c.props = {}), Object.assign(c.props, d)));
2026
- }
2027
- function u(d, v) {
2028
- const m = y ? p : k;
2029
- if (ee(d)) {
2030
- const $ = d.key ?? v;
2031
- let _ = d.children;
2032
- m.push({
2033
- ...d,
2034
- key: $,
2035
- children: _
2053
+ l.attrs[g] = c.attrs[g];
2054
+ }))) : (l.props || (l.props = {}), Object.assign(l.props, c)));
2055
+ }
2056
+ function b(c, g) {
2057
+ const p = m ? d : $;
2058
+ if (ce(c)) {
2059
+ const _ = c.key ?? g;
2060
+ let E = c.children;
2061
+ p.push({
2062
+ ...c,
2063
+ key: _,
2064
+ children: E
2036
2065
  });
2037
2066
  return;
2038
2067
  }
2039
- if (Q(d)) {
2040
- m.push(ut(d, void 0));
2068
+ if (ie(c)) {
2069
+ p.push(pt(c, void 0));
2041
2070
  return;
2042
2071
  }
2043
- if (Array.isArray(d)) {
2044
- if (d.length === 0) return;
2045
- for (let $ = 0; $ < d.length; $++) {
2046
- const _ = d[$];
2047
- ee(_) || Q(_) || Array.isArray(_) ? u(_, `${v}-${$}`) : _ !== null && typeof _ == "object" ? h(_) : m.push(s(String(_), `${v}-${$}`));
2072
+ if (Array.isArray(c)) {
2073
+ if (c.length === 0) return;
2074
+ for (let _ = 0; _ < c.length; _++) {
2075
+ const E = c[_];
2076
+ ce(E) || ie(E) || Array.isArray(E) ? b(E, `${g}-${_}`) : E !== null && typeof E == "object" ? v(E) : p.push(i(String(E), `${g}-${_}`));
2048
2077
  }
2049
2078
  return;
2050
2079
  }
2051
- if (d !== null && typeof d == "object") {
2052
- h(d);
2080
+ if (c !== null && typeof c == "object") {
2081
+ v(c);
2053
2082
  return;
2054
2083
  }
2055
- m.push(s(String(d), v));
2084
+ p.push(i(String(c), g));
2056
2085
  }
2057
- const g = /* @__PURE__ */ new Set([
2086
+ const y = /* @__PURE__ */ new Set([
2058
2087
  "area",
2059
2088
  "base",
2060
2089
  "br",
@@ -2070,232 +2099,257 @@ function pt(e, t, r) {
2070
2099
  "track",
2071
2100
  "wbr"
2072
2101
  ]);
2073
- for (; f = a.exec(i); )
2074
- if (f[1]) {
2075
- const d = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || g.has(d), {
2076
- props: $,
2077
- attrs: _,
2102
+ for (; u = a.exec(s); )
2103
+ if (u[1]) {
2104
+ const c = u[1], g = u[0][1] === "/", p = u[0][u[0].length - 2] === "/" || y.has(c), {
2105
+ props: _,
2106
+ attrs: E,
2078
2107
  directives: C
2079
- } = dt(f[2] || "", t, n), E = { props: {}, attrs: {} };
2080
- for (const j in $) E.props[j] = $[j];
2081
- for (const j in _) E.attrs[j] = _[j];
2082
- if (Object.keys(C).length > 0 && (E.directives = { ...C }), v) {
2083
- const j = V(
2084
- y,
2085
- c,
2086
- p.length === 1 && Q(p[0]) && p[0].tag === "#text" ? typeof p[0].children == "string" ? p[0].children : "" : p.length ? p : void 0,
2087
- w
2088
- ), A = l.pop();
2089
- A ? (y = A.tag, c = A.props, w = A.key, p = A.children, p.push(j)) : (k.push(j), y = null, c = {}, w = void 0, p = []);
2090
- } else m ? y ? p.push(V(d, E, void 0, void 0)) : k.push(V(d, E, void 0, void 0)) : (y && l.push({
2091
- tag: y,
2092
- props: c,
2093
- children: p,
2094
- key: w
2095
- }), y = d, c = E, p = []);
2096
- } else if (typeof f[3] < "u") {
2097
- const d = Number(f[3]), v = t[d], m = `interp-${d}`;
2098
- u(v, m);
2099
- } else if (f[4]) {
2100
- const d = f[4], v = y ? p : k, m = d.split(/({{\d+}})/);
2101
- for (const $ of m) {
2102
- if (!$) continue;
2103
- const _ = $.match(/^{{(\d+)}}$/);
2104
- if (_) {
2105
- const C = Number(_[1]), E = t[C], j = `interp-${C}`;
2106
- u(E, j);
2108
+ } = ht(u[2] || "", t, n), S = { props: {}, attrs: {} };
2109
+ for (const A in _) S.props[A] = _[A];
2110
+ for (const A in E) S.attrs[A] = E[A];
2111
+ if (C && Object.keys(C).some((A) => A === "model" || A.startsWith("model:")))
2112
+ try {
2113
+ const A = Symbol.for("cer.registry"), T = globalThis[A], Q = !!(T && typeof T.has == "function" && T.has(c)), X = !!(n && (n.__customElements instanceof Set && n.__customElements.has(c) || Array.isArray(n.__isCustomElements) && n.__isCustomElements.includes(c)));
2114
+ if (!!(c.includes("-") || X || Q))
2115
+ for (const I of Object.keys(C)) {
2116
+ if (I !== "model" && !I.startsWith("model:")) continue;
2117
+ const Z = C[I], F = Z.arg ?? (I.includes(":") ? I.split(":", 2)[1] : void 0), L = Z.value, K = F ?? "modelValue", D = N, ne = se, k = n ? n._state || n : void 0;
2118
+ let B;
2119
+ typeof L == "string" && n ? B = D(k, L) : B = L, S.props[K] = B;
2120
+ try {
2121
+ const j = J(K);
2122
+ S.attrs || (S.attrs = {}), B !== void 0 && (S.attrs[j] = B);
2123
+ } catch {
2124
+ }
2125
+ S.isCustomElement = !0;
2126
+ const z = `update:${J(K)}`, O = "on" + z.charAt(0).toUpperCase() + z.slice(1);
2127
+ S.props[O] = function(j) {
2128
+ const R = j.detail !== void 0 ? j.detail : j.target ? j.target.value : void 0;
2129
+ if (!k) return;
2130
+ const pe = D(k, typeof L == "string" ? L : String(L));
2131
+ (Array.isArray(R) && Array.isArray(pe) ? JSON.stringify([...R].sort()) !== JSON.stringify([...pe].sort()) : R !== pe) && (ne(k, typeof L == "string" ? L : String(L), R), n?.requestRender ? n.requestRender() : n?._requestRender && n._requestRender());
2132
+ }, delete C[I];
2133
+ }
2134
+ } catch {
2135
+ }
2136
+ if (Object.keys(C).length > 0 && (S.directives = { ...C }), g) {
2137
+ const A = ee(
2138
+ m,
2139
+ l,
2140
+ d.length === 1 && ie(d[0]) && d[0].tag === "#text" ? typeof d[0].children == "string" ? d[0].children : "" : d.length ? d : void 0,
2141
+ h
2142
+ ), T = f.pop();
2143
+ T ? (m = T.tag, l = T.props, h = T.key, d = T.children, d.push(A)) : ($.push(A), m = null, l = {}, h = void 0, d = []);
2144
+ } else p ? m ? d.push(ee(c, S, void 0, void 0)) : $.push(ee(c, S, void 0, void 0)) : (m && f.push({
2145
+ tag: m,
2146
+ props: l,
2147
+ children: d,
2148
+ key: h
2149
+ }), m = c, l = S, d = []);
2150
+ } else if (typeof u[3] < "u") {
2151
+ const c = Number(u[3]), g = t[c], p = `interp-${c}`;
2152
+ b(g, p);
2153
+ } else if (u[4]) {
2154
+ const c = u[4], g = m ? d : $, p = c.split(/({{\d+}})/);
2155
+ for (const _ of p) {
2156
+ if (!_) continue;
2157
+ const E = _.match(/^{{(\d+)}}$/);
2158
+ if (E) {
2159
+ const C = Number(E[1]), S = t[C], A = `interp-${C}`;
2160
+ b(S, A);
2107
2161
  } else {
2108
- const C = `text-${x++}`;
2109
- v.push(s($, C));
2162
+ const C = `text-${w++}`;
2163
+ g.push(i(_, C));
2110
2164
  }
2111
2165
  }
2112
2166
  }
2113
- const b = k.filter((d) => Q(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2114
- return b.length === 1 ? b[0] : b.length > 1 ? b : V("div", {}, "", "fallback-root");
2167
+ const x = $.filter((c) => ie(c) && c.tag === "#text" ? typeof c.children == "string" && c.children.trim() !== "" : !0);
2168
+ return x.length === 1 ? x[0] : x.length > 1 ? x : ee("div", {}, "", "fallback-root");
2115
2169
  }
2116
- function D(e, ...t) {
2170
+ function U(e, ...t) {
2117
2171
  const r = t[t.length - 1], o = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2118
- return pt(e, t, o);
2172
+ return gt(e, t, o);
2119
2173
  }
2120
- const Ee = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, N = (e, t) => {
2174
+ const je = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, W = (e, t) => {
2121
2175
  for (const r of e) {
2122
- const o = [], n = r.path.replace(/:[^/]+/g, (a) => (o.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${n}$`), i = t.match(s);
2123
- if (i) {
2176
+ const o = [], n = r.path.replace(/:[^/]+/g, (a) => (o.push(a.slice(1)), "([^/]+)")), i = new RegExp(`^${n}$`), s = t.match(i);
2177
+ if (s) {
2124
2178
  const a = {};
2125
- return o.forEach((l, f) => {
2126
- a[l] = i[f + 1];
2179
+ return o.forEach((f, u) => {
2180
+ a[f] = s[u + 1];
2127
2181
  }), { route: r, params: a };
2128
2182
  }
2129
2183
  }
2130
2184
  return { route: null, params: {} };
2131
- }, de = {};
2132
- async function ht(e) {
2185
+ }, we = {};
2186
+ async function yt(e) {
2133
2187
  if (e.component) return e.component;
2134
2188
  if (e.load) {
2135
- if (de[e.path]) return de[e.path];
2189
+ if (we[e.path]) return we[e.path];
2136
2190
  try {
2137
2191
  const t = await e.load();
2138
- return de[e.path] = t.default, t.default;
2192
+ return we[e.path] = t.default, t.default;
2139
2193
  } catch {
2140
2194
  throw new Error(`Failed to load component for route: ${e.path}`);
2141
2195
  }
2142
2196
  }
2143
2197
  throw new Error(`No component or loader defined for route: ${e.path}`);
2144
2198
  }
2145
- function gt(e) {
2199
+ function mt(e) {
2146
2200
  const { routes: t, base: r = "", initialUrl: o } = e;
2147
- let n, s, i, a, l, f, p;
2148
- const y = async (k, h) => {
2149
- const u = t.find((g) => N([g], k.path).route !== null);
2150
- if (u?.beforeEnter)
2201
+ let n, i, s, a, f, u, d;
2202
+ const m = async ($, v) => {
2203
+ const b = t.find((y) => W([y], $.path).route !== null);
2204
+ if (b?.beforeEnter)
2151
2205
  try {
2152
- const g = await u.beforeEnter(k, h);
2153
- return typeof g == "string" ? (await x(g, !0), !1) : g !== !1;
2154
- } catch (g) {
2155
- return console.error("beforeEnter error", g), !1;
2206
+ const y = await b.beforeEnter($, v);
2207
+ return typeof y == "string" ? (await w(y, !0), !1) : y !== !1;
2208
+ } catch (y) {
2209
+ return console.error("beforeEnter error", y), !1;
2156
2210
  }
2157
2211
  return !0;
2158
- }, c = async (k, h) => {
2159
- const u = t.find((g) => N([g], k.path).route !== null);
2160
- if (u?.onEnter)
2212
+ }, l = async ($, v) => {
2213
+ const b = t.find((y) => W([y], $.path).route !== null);
2214
+ if (b?.onEnter)
2161
2215
  try {
2162
- const g = await u.onEnter(k, h);
2163
- return typeof g == "string" ? (await x(g, !0), !1) : g !== !1;
2164
- } catch (g) {
2165
- return console.error("onEnter error", g), !1;
2216
+ const y = await b.onEnter($, v);
2217
+ return typeof y == "string" ? (await w(y, !0), !1) : y !== !1;
2218
+ } catch (y) {
2219
+ return console.error("onEnter error", y), !1;
2166
2220
  }
2167
2221
  return !0;
2168
- }, w = (k, h) => {
2169
- const u = t.find((g) => N([g], k.path).route !== null);
2170
- if (u?.afterEnter)
2222
+ }, h = ($, v) => {
2223
+ const b = t.find((y) => W([y], $.path).route !== null);
2224
+ if (b?.afterEnter)
2171
2225
  try {
2172
- u.afterEnter(k, h);
2173
- } catch (g) {
2174
- console.error("afterEnter error", g);
2226
+ b.afterEnter($, v);
2227
+ } catch (y) {
2228
+ console.error("afterEnter error", y);
2175
2229
  }
2176
- }, x = async (k, h = !1) => {
2230
+ }, w = async ($, v = !1) => {
2177
2231
  try {
2178
- const u = {
2179
- path: k.replace(r, "") || "/",
2232
+ const b = {
2233
+ path: $.replace(r, "") || "/",
2180
2234
  query: {}
2181
- }, g = N(t, u.path);
2182
- if (!g) throw new Error(`No route found for ${u.path}`);
2183
- const b = i.getState(), d = {
2184
- path: u.path,
2185
- params: g.params,
2186
- query: u.query
2235
+ }, y = W(t, b.path);
2236
+ if (!y) throw new Error(`No route found for ${b.path}`);
2237
+ const x = s.getState(), c = {
2238
+ path: b.path,
2239
+ params: y.params,
2240
+ query: b.query
2187
2241
  };
2188
- if (!await y(d, b) || !await c(d, b)) return;
2189
- typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + k) : window.history.pushState({}, "", r + k)), i.setState(d), w(d, b);
2190
- } catch (u) {
2191
- console.error("Navigation error:", u);
2242
+ if (!await m(c, x) || !await l(c, x)) return;
2243
+ typeof window < "u" && typeof document < "u" && (v ? window.history.replaceState({}, "", r + $) : window.history.pushState({}, "", r + $)), s.setState(c), h(c, x);
2244
+ } catch (b) {
2245
+ console.error("Navigation error:", b);
2192
2246
  }
2193
2247
  };
2194
2248
  if (typeof window < "u" && typeof document < "u") {
2195
2249
  n = () => {
2196
- const h = new URL(window.location.href), u = h.pathname.replace(r, "") || "/", g = Ee(h.search);
2197
- return { path: u, query: g };
2198
- }, s = n();
2199
- const k = N(t, s.path);
2200
- i = xe({
2201
- path: s.path,
2202
- params: k.params,
2203
- query: s.query
2204
- }), a = async (h = !1) => {
2205
- const u = n();
2206
- await x(u.path, h);
2207
- }, window.addEventListener("popstate", () => a(!0)), l = (h) => x(h, !1), f = (h) => x(h, !0), p = () => window.history.back();
2250
+ const v = new URL(window.location.href), b = v.pathname.replace(r, "") || "/", y = je(v.search);
2251
+ return { path: b, query: y };
2252
+ }, i = n();
2253
+ const $ = W(t, i.path);
2254
+ s = $e({
2255
+ path: i.path,
2256
+ params: $.params,
2257
+ query: i.query
2258
+ }), a = async (v = !1) => {
2259
+ const b = n();
2260
+ await w(b.path, v);
2261
+ }, window.addEventListener("popstate", () => a(!0)), f = (v) => w(v, !1), u = (v) => w(v, !0), d = () => window.history.back();
2208
2262
  } else {
2209
2263
  n = () => {
2210
- const u = new URL(o || "/", "http://localhost"), g = u.pathname.replace(r, "") || "/", b = Ee(u.search);
2211
- return { path: g, query: b };
2212
- }, s = n();
2213
- const k = N(t, s.path);
2214
- i = xe({
2215
- path: s.path,
2216
- params: k.params,
2217
- query: s.query
2264
+ const b = new URL(o || "/", "http://localhost"), y = b.pathname.replace(r, "") || "/", x = je(b.search);
2265
+ return { path: y, query: x };
2266
+ }, i = n();
2267
+ const $ = W(t, i.path);
2268
+ s = $e({
2269
+ path: i.path,
2270
+ params: $.params,
2271
+ query: i.query
2218
2272
  }), a = async () => {
2219
- const u = n();
2220
- await h(u.path);
2273
+ const b = n();
2274
+ await v(b.path);
2221
2275
  };
2222
- const h = async (u) => {
2276
+ const v = async (b) => {
2223
2277
  try {
2224
- const g = {
2225
- path: u.replace(r, "") || "/",
2278
+ const y = {
2279
+ path: b.replace(r, "") || "/",
2226
2280
  query: {}
2227
- }, b = N(t, g.path);
2228
- if (!b) throw new Error(`No route found for ${g.path}`);
2229
- const d = i.getState(), v = {
2230
- path: g.path,
2231
- params: b.params,
2232
- query: g.query
2233
- }, m = t.find(($) => N([$], v.path).route !== null);
2234
- if (m?.beforeEnter)
2281
+ }, x = W(t, y.path);
2282
+ if (!x) throw new Error(`No route found for ${y.path}`);
2283
+ const c = s.getState(), g = {
2284
+ path: y.path,
2285
+ params: x.params,
2286
+ query: y.query
2287
+ }, p = t.find((_) => W([_], g.path).route !== null);
2288
+ if (p?.beforeEnter)
2235
2289
  try {
2236
- const $ = await m.beforeEnter(v, d);
2237
- if (typeof $ == "string") {
2238
- await h($);
2290
+ const _ = await p.beforeEnter(g, c);
2291
+ if (typeof _ == "string") {
2292
+ await v(_);
2239
2293
  return;
2240
2294
  }
2241
- if ($ === !1) return;
2295
+ if (_ === !1) return;
2242
2296
  } catch {
2243
2297
  return;
2244
2298
  }
2245
- if (m?.onEnter)
2299
+ if (p?.onEnter)
2246
2300
  try {
2247
- const $ = await m.onEnter(v, d);
2248
- if (typeof $ == "string") {
2249
- await h($);
2301
+ const _ = await p.onEnter(g, c);
2302
+ if (typeof _ == "string") {
2303
+ await v(_);
2250
2304
  return;
2251
2305
  }
2252
- if ($ === !1) return;
2306
+ if (_ === !1) return;
2253
2307
  } catch {
2254
2308
  return;
2255
2309
  }
2256
- if (i.setState(v), m?.afterEnter)
2310
+ if (s.setState(g), p?.afterEnter)
2257
2311
  try {
2258
- m.afterEnter(v, d);
2312
+ p.afterEnter(g, c);
2259
2313
  } catch {
2260
2314
  }
2261
2315
  } catch {
2262
2316
  }
2263
2317
  };
2264
- l = async (u) => h(u), f = async (u) => h(u), p = () => {
2318
+ f = async (b) => v(b), u = async (b) => v(b), d = () => {
2265
2319
  };
2266
2320
  }
2267
2321
  return {
2268
- store: i,
2269
- push: l,
2270
- replace: f,
2271
- back: p,
2272
- subscribe: i.subscribe,
2273
- matchRoute: (k) => N(t, k),
2274
- getCurrent: () => i.getState(),
2275
- resolveRouteComponent: ht
2322
+ store: s,
2323
+ push: f,
2324
+ replace: u,
2325
+ back: d,
2326
+ subscribe: s.subscribe,
2327
+ matchRoute: ($) => W(t, $),
2328
+ getCurrent: () => s.getState(),
2329
+ resolveRouteComponent: yt
2276
2330
  };
2277
2331
  }
2278
- function $t(e, t) {
2279
- return N(e, t);
2332
+ function Ct(e, t) {
2333
+ return W(e, t);
2280
2334
  }
2281
- function St(e) {
2282
- const t = gt(e);
2283
- return Ce("router-view", {
2335
+ function Et(e) {
2336
+ const t = mt(e);
2337
+ return Te("router-view", {
2284
2338
  async render() {
2285
- if (!t) return D`<div>Router not initialized.</div>`;
2339
+ if (!t) return U`<div>Router not initialized.</div>`;
2286
2340
  const r = t.getCurrent(), { path: o } = r, n = t.matchRoute(o);
2287
- if (!n.route) return D`<div>Not found</div>`;
2341
+ if (!n.route) return U`<div>Not found</div>`;
2288
2342
  try {
2289
- const s = await t.resolveRouteComponent(n.route);
2290
- if (typeof s == "string")
2291
- return { tag: s, props: {}, children: [] };
2292
- if (typeof s == "function") {
2293
- const i = s(), a = i instanceof Promise ? await i : i;
2343
+ const i = await t.resolveRouteComponent(n.route);
2344
+ if (typeof i == "string")
2345
+ return { tag: i, props: {}, children: [] };
2346
+ if (typeof i == "function") {
2347
+ const s = i(), a = s instanceof Promise ? await s : s;
2294
2348
  return typeof a == "string" ? { tag: a, props: {}, children: [] } : a;
2295
2349
  }
2296
- return D`<div>Invalid route component</div>`;
2350
+ return U`<div>Invalid route component</div>`;
2297
2351
  } catch {
2298
- return D`<div>Invalid route component</div>`;
2352
+ return U`<div>Invalid route component</div>`;
2299
2353
  }
2300
2354
  },
2301
2355
  onConnected(r) {
@@ -2303,7 +2357,7 @@ function St(e) {
2303
2357
  typeof r.requestRender == "function" && r.requestRender();
2304
2358
  });
2305
2359
  }
2306
- }), Ce("router-link", {
2360
+ }), Te("router-link", {
2307
2361
  state: {},
2308
2362
  props: {
2309
2363
  to: { type: String, default: "" },
@@ -2316,7 +2370,7 @@ function St(e) {
2316
2370
  disabled: { type: Boolean, default: !1 },
2317
2371
  external: { type: Boolean, default: !1 },
2318
2372
  class: { type: String, default: "" },
2319
- style: { type: String, default: je`
2373
+ style: { type: String, default: ze`
2320
2374
  [aria-disabled="true"] {
2321
2375
  pointer-events: none;
2322
2376
  opacity: 0.5;
@@ -2325,32 +2379,32 @@ function St(e) {
2325
2379
  },
2326
2380
  style: (r) => r.style,
2327
2381
  render: (r) => {
2328
- const o = t.getCurrent(), n = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, l = r.ariaCurrentValue, f = r.tag, p = r.disabled, y = r.external, c = o.path === n, w = s ? c : o && typeof o.path == "string" ? o.path.startsWith(n) : !1, x = c ? `aria-current="${l}"` : "", k = (r.class || "").split(/\s+/).filter(Boolean), h = {};
2329
- for (const v of k) h[v] = !0;
2330
- const u = {
2331
- ...h,
2382
+ const o = t.getCurrent(), n = r.to, i = r.exact, s = r.exactActiveClass, a = r.activeClass, f = r.ariaCurrentValue, u = r.tag, d = r.disabled, m = r.external, l = o.path === n, h = i ? l : o && typeof o.path == "string" ? o.path.startsWith(n) : !1, w = l ? `aria-current="${f}"` : "", $ = (r.class || "").split(/\s+/).filter(Boolean), v = {};
2383
+ for (const g of $) v[g] = !0;
2384
+ const b = {
2385
+ ...v,
2332
2386
  // Also include the configurable names (may duplicate the above)
2333
- [a]: w,
2334
- [i]: c
2335
- }, g = f === "button", b = p ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", d = y && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2336
- return D`
2337
- ${Re().when(g, D`
2387
+ [a]: h,
2388
+ [s]: l
2389
+ }, y = u === "button", x = d ? y ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", c = m && (u === "a" || !u) ? 'target="_blank" rel="noopener noreferrer"' : "";
2390
+ return U`
2391
+ ${Oe().when(y, U`
2338
2392
  <button
2339
2393
  part="button"
2340
- :class="${u}"
2394
+ :class="${b}"
2395
+ ${w}
2341
2396
  ${x}
2342
- ${b}
2343
- ${d}
2397
+ ${c}
2344
2398
  @click="navigate"
2345
2399
  ><slot></slot></button>
2346
- `).otherwise(D`
2400
+ `).otherwise(U`
2347
2401
  <a
2348
2402
  part="link"
2349
2403
  href="${n}"
2350
- :class="${u}"
2404
+ :class="${b}"
2405
+ ${w}
2351
2406
  ${x}
2352
- ${b}
2353
- ${d}
2407
+ ${c}
2354
2408
  @click="navigate"
2355
2409
  ><slot></slot></a>
2356
2410
  `).done()}
@@ -2366,25 +2420,26 @@ function St(e) {
2366
2420
  }), t;
2367
2421
  }
2368
2422
  export {
2369
- K as GlobalEventBus,
2370
- Ce as component,
2371
- xe as createStore,
2372
- je as css,
2373
- mt as each,
2374
- bt as emit,
2375
- Z as eventBus,
2376
- D as html,
2377
- St as initRouter,
2378
- kt as listen,
2379
- Re as match,
2380
- N as matchRoute,
2381
- $t as matchRouteSSR,
2382
- xt as off,
2383
- vt as on,
2384
- wt as once,
2385
- Ee as parseQuery,
2386
- ht as resolveRouteComponent,
2387
- gt as useRouter,
2388
- yt as when
2423
+ G as GlobalEventBus,
2424
+ Te as component,
2425
+ $e as createStore,
2426
+ ze as css,
2427
+ xt as each,
2428
+ wt as emit,
2429
+ re as eventBus,
2430
+ U as html,
2431
+ Et as initRouter,
2432
+ St as listen,
2433
+ Oe as match,
2434
+ W as matchRoute,
2435
+ Ct as matchRouteSSR,
2436
+ $t as off,
2437
+ kt as on,
2438
+ _t as once,
2439
+ je as parseQuery,
2440
+ he as renderToString,
2441
+ yt as resolveRouteComponent,
2442
+ mt as useRouter,
2443
+ vt as when
2389
2444
  };
2390
2445
  //# sourceMappingURL=custom-elements-runtime.es.js.map