@jasonshimmy/custom-elements-runtime 0.1.23 → 0.1.25

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 gt(e, t) {
1
+ function yt(e, t) {
2
2
  return te(e ? t : [], "when-block");
3
3
  }
4
- function yt(e, t) {
5
- return e.map((r, o) => {
6
- const n = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${o}` : String(r);
7
- return te(t(r, o), `each-${n}`);
4
+ function mt(e, t) {
5
+ return e.map((r, n) => {
6
+ const o = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${n}` : String(r);
7
+ return te(t(r, n), `each-${o}`);
8
8
  });
9
9
  }
10
- function ze() {
10
+ function Be() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,14 +17,14 @@ function ze() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Be(...e);
20
+ return Re(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Be(...e) {
24
+ function Re(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
- const [r, o] = e[t];
27
- if (r) return [te(o, `whenChain-branch-${t}`)];
26
+ const [r, n] = e[t];
27
+ if (r) return [te(n, `whenChain-branch-${t}`)];
28
28
  }
29
29
  return [te([], "whenChain-empty")];
30
30
  }
@@ -36,7 +36,7 @@ function te(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class F extends EventTarget {
39
+ class K extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class F extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return F.instance || (F.instance = new F()), F.instance;
47
+ return K.instance || (K.instance = new K()), K.instance;
48
48
  }
49
49
  // Enhanced emit method with better typing and event storm protection
50
50
  /**
@@ -53,10 +53,10 @@ class F extends EventTarget {
53
53
  * @param data - Optional event payload
54
54
  */
55
55
  emit(t, r) {
56
- const o = Date.now(), n = this.eventCounters.get(t);
57
- if (!n || o - n.window > 1e3)
58
- 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)) {
56
+ const n = Date.now(), o = this.eventCounters.get(t);
57
+ if (!o || n - o.window > 1e3)
58
+ this.eventCounters.set(t, { count: 1, window: n });
59
+ else if (o.count++, o.count > 50 && (console.error(`Event storm detected for "${t}": ${o.count} events in 1 second. Throttling...`), o.count > 100)) {
60
60
  console.warn(`Blocking further "${t}" events to prevent infinite loop`);
61
61
  return;
62
62
  }
@@ -89,8 +89,8 @@ class F extends EventTarget {
89
89
  * @param handler - Handler function to remove
90
90
  */
91
91
  off(t, r) {
92
- const o = this.handlers[t];
93
- o && o.delete(r);
92
+ const n = this.handlers[t];
93
+ n && n.delete(r);
94
94
  }
95
95
  /**
96
96
  * Remove all handlers for a specific event.
@@ -105,8 +105,8 @@ class F extends EventTarget {
105
105
  * @param handler - CustomEvent handler
106
106
  * @param options - AddEventListener options
107
107
  */
108
- listen(t, r, o) {
109
- return this.addEventListener(t, r, o), () => this.removeEventListener(t, r);
108
+ listen(t, r, n) {
109
+ return this.addEventListener(t, r, n), () => this.removeEventListener(t, r);
110
110
  }
111
111
  /**
112
112
  * Register a one-time event handler. Returns a promise that resolves with the event data.
@@ -114,9 +114,9 @@ class F extends EventTarget {
114
114
  * @param handler - Handler function
115
115
  */
116
116
  once(t, r) {
117
- return new Promise((o) => {
118
- const n = this.on(t, (s) => {
119
- n(), r(s), o(s);
117
+ return new Promise((n) => {
118
+ const o = this.on(t, (s) => {
119
+ o(), r(s), n(s);
120
120
  });
121
121
  });
122
122
  }
@@ -146,9 +146,9 @@ class F extends EventTarget {
146
146
  */
147
147
  getEventStats() {
148
148
  const t = {};
149
- for (const [r, o] of this.eventCounters.entries())
149
+ for (const [r, n] of this.eventCounters.entries())
150
150
  t[r] = {
151
- count: o.count,
151
+ count: n.count,
152
152
  handlersCount: this.getHandlerCount(r)
153
153
  };
154
154
  return t;
@@ -160,24 +160,24 @@ class F extends EventTarget {
160
160
  this.eventCounters.clear();
161
161
  }
162
162
  }
163
- const Z = F.getInstance(), mt = (e, t) => Z.emit(e, t), bt = (e, t) => Z.on(e, t), vt = (e, t) => Z.off(e, t), xt = (e, t) => Z.once(e, t), wt = (e, t, r) => Z.listen(e, t, r);
163
+ const Z = K.getInstance(), bt = (e, t) => Z.emit(e, t), vt = (e, t) => Z.on(e, t), xt = (e, t) => Z.off(e, t), wt = (e, t) => Z.once(e, t), kt = (e, t, r) => Z.listen(e, t, r);
164
164
  function xe(e) {
165
165
  let t = { ...e };
166
166
  const r = [];
167
- function o(a) {
167
+ function n(a) {
168
168
  r.push(a), a(t);
169
169
  }
170
- function n() {
170
+ function o() {
171
171
  return t;
172
172
  }
173
173
  function s(a) {
174
- const l = typeof a == "function" ? a(t) : a;
175
- t = { ...t, ...l }, i();
174
+ const c = typeof a == "function" ? a(t) : a;
175
+ t = { ...t, ...c }, i();
176
176
  }
177
177
  function i() {
178
178
  r.forEach((a) => a(t));
179
179
  }
180
- return { subscribe: o, getState: n, setState: s };
180
+ return { subscribe: n, getState: o, setState: s };
181
181
  }
182
182
  function me(e) {
183
183
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
@@ -194,72 +194,72 @@ function pe(e) {
194
194
  })[t]
195
195
  ) : e;
196
196
  }
197
- function Re(e, t, r) {
197
+ function Pe(e, t, r) {
198
198
  if (r)
199
- for (const [o, n] of Object.entries(r)) {
199
+ for (const [n, o] of Object.entries(r)) {
200
200
  let s, i = {};
201
- if (Array.isArray(n) ? (s = n[0], i = n[1] || {}) : s = n, t.set(o, {
201
+ if (Array.isArray(o) ? (s = o[0], i = o[1] || {}) : s = o, t.set(n, {
202
202
  callback: s,
203
203
  options: i,
204
- oldValue: he(e, o)
204
+ oldValue: he(e, n)
205
205
  }), i.immediate)
206
206
  try {
207
- const a = he(e, o);
207
+ const a = he(e, n);
208
208
  s(a, void 0, e);
209
209
  } catch (a) {
210
- console.error(`Error in immediate watcher for "${o}":`, a);
210
+ console.error(`Error in immediate watcher for "${n}":`, a);
211
211
  }
212
212
  }
213
213
  }
214
214
  function he(e, t) {
215
- return t.split(".").reduce((r, o) => r?.[o], e);
215
+ return t.split(".").reduce((r, n) => r?.[n], e);
216
216
  }
217
- function Pe(e, t, r, o) {
218
- const n = (i, a) => {
217
+ function Oe(e, t, r, n) {
218
+ const o = (i, a) => {
219
219
  if (i === a) return !0;
220
220
  if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
221
221
  if (Array.isArray(i) && Array.isArray(a))
222
- return i.length !== a.length ? !1 : i.every((d, y) => n(d, a[y]));
223
- const l = Object.keys(i), f = Object.keys(a);
224
- return l.length !== f.length ? !1 : l.every((d) => n(i[d], a[d]));
222
+ return i.length !== a.length ? !1 : i.every((p, y) => o(p, a[y]));
223
+ const c = Object.keys(i), f = Object.keys(a);
224
+ return c.length !== f.length ? !1 : c.every((p) => o(i[p], a[p]));
225
225
  }, s = t.get(r);
226
- if (s && !n(o, s.oldValue))
226
+ if (s && !o(n, s.oldValue))
227
227
  try {
228
- s.callback(o, s.oldValue, e), s.oldValue = o;
228
+ s.callback(n, s.oldValue, e), s.oldValue = n;
229
229
  } catch (i) {
230
230
  console.error(`Error in watcher for "${r}":`, i);
231
231
  }
232
232
  for (const [i, a] of t.entries())
233
233
  if (a.options.deep && r.startsWith(i + "."))
234
234
  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);
235
+ const c = he(e, i);
236
+ o(c, a.oldValue) || (a.callback(c, a.oldValue, e), a.oldValue = c);
237
+ } catch (c) {
238
+ console.error(`Error in deep watcher for "${i}":`, c);
239
239
  }
240
240
  }
241
- function Oe(e, t, r) {
241
+ function Me(e, t, r) {
242
242
  if (!t.props) return;
243
- function o(n, s) {
244
- return s === Boolean ? n === "true" : s === Number ? Number(n) : n;
243
+ function n(o, s) {
244
+ return s === Boolean ? o === "true" : s === Number ? Number(o) : o;
245
245
  }
246
- Object.entries(t.props).forEach(([n, s]) => {
247
- if (s.type === Function && typeof e[n] == "function")
248
- r[n] = e[n];
246
+ Object.entries(t.props).forEach(([o, s]) => {
247
+ if (s.type === Function && typeof e[o] == "function")
248
+ r[o] = e[o];
249
249
  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));
250
+ const i = e.getAttribute(me(o));
251
+ i !== null ? r[o] = pe(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = pe(s.default));
252
252
  }
253
253
  });
254
254
  }
255
- function Me(e, t, r, o) {
256
- e.onConnected && !r && (e.onConnected(t), o(!0));
255
+ function Ne(e, t, r, n) {
256
+ e.onConnected && !r && (e.onConnected(t), n(!0));
257
257
  }
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);
258
+ function We(e, t, r, n, o, s, i, a) {
259
+ e.onDisconnected && e.onDisconnected(t), r.forEach((c) => c()), n(), o(), s(!1), i(null), a(!1);
260
260
  }
261
- function Ne(e, t, r, o, n) {
262
- e.onAttributeChanged && e.onAttributeChanged(t, r, o, n);
261
+ function De(e, t, r, n, o) {
262
+ e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
263
263
  }
264
264
  function q(e, t) {
265
265
  if (t && e instanceof HTMLElement) {
@@ -269,35 +269,35 @@ function q(e, t) {
269
269
  q(r, t);
270
270
  }
271
271
  }
272
- function H(e, t) {
273
- return typeof t == "string" ? t.split(".").reduce((r, o) => r?.[o], e) : t;
272
+ function I(e, t) {
273
+ return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
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;
276
+ const n = t.split("."), o = n.pop();
277
+ if (!o) return;
278
+ const s = n.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
279
+ s[o] = r;
280
280
  }
281
- function De(e, t, r, o, n, s, i) {
281
+ function qe(e, t, r, n, o, s, i) {
282
282
  if (!s) return;
283
- const a = t.includes("lazy"), l = t.includes("trim"), f = t.includes("number"), d = () => {
283
+ const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), p = () => {
284
284
  const h = s._state || s;
285
- return H(h, e);
286
- }, y = d();
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")
285
+ return I(h, e);
286
+ }, y = p();
287
+ let l = "text";
288
+ const w = n?.type;
289
+ if (i instanceof HTMLInputElement ? l = w || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
290
290
  if (Array.isArray(y)) {
291
- const h = i?.getAttribute("value") || o?.value || "", u = y.includes(h);
291
+ const h = i?.getAttribute("value") || n?.value || "", u = y.includes(h);
292
292
  i && i.checked !== u && (r.checked = u);
293
293
  } else {
294
294
  const h = i?.getAttribute("true-value") || !0, u = y === h;
295
295
  i && i.checked !== u && (r.checked = u);
296
296
  }
297
- else if (c === "radio") {
298
- const h = o?.value || "", u = y === h;
297
+ else if (l === "radio") {
298
+ const h = n?.value || "", u = y === h;
299
299
  i && i.checked !== u && (r.checked = u);
300
- } else if (c === "select")
300
+ } else if (l === "select")
301
301
  if (i && i.hasAttribute("multiple")) {
302
302
  const h = i, u = Array.isArray(y) ? y : [];
303
303
  setTimeout(() => {
@@ -314,124 +314,127 @@ function De(e, t, r, o, n, s, i) {
314
314
  const h = String(y ?? "");
315
315
  (!i || i.value !== h) && (r.value = y);
316
316
  }
317
- const x = a || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", S = (h) => {
318
- if (h.isComposing || n._isComposing || h.isTrusted === !1) return;
317
+ const x = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", k = (h) => {
318
+ if (h.isComposing || o._isComposing || h.isTrusted === !1) return;
319
319
  const u = h.target;
320
320
  if (u._modelUpdating) return;
321
- const g = d();
321
+ const g = p();
322
322
  let b = u.value;
323
- if (c === "checkbox")
323
+ if (l === "checkbox")
324
324
  if (Array.isArray(g)) {
325
- const k = u.getAttribute("value") || "", _ = [...g];
325
+ const $ = u.getAttribute("value") || "", _ = [...g];
326
326
  if (u.checked)
327
- _.includes(k) || _.push(k);
327
+ _.includes($) || _.push($);
328
328
  else {
329
- const C = _.indexOf(k);
329
+ const C = _.indexOf($);
330
330
  C > -1 && _.splice(C, 1);
331
331
  }
332
332
  b = _;
333
333
  } else {
334
- const k = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
- b = u.checked ? k : _;
334
+ const $ = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
+ b = u.checked ? $ : _;
336
336
  }
337
- else if (c === "radio")
337
+ else if (l === "radio")
338
338
  b = u.getAttribute("value") || u.value;
339
- else if (c === "select" && u.multiple) {
340
- const k = u;
341
- b = Array.from(k.selectedOptions).map(
339
+ else if (l === "select" && u.multiple) {
340
+ const $ = u;
341
+ b = Array.from($.selectedOptions).map(
342
342
  (_) => _.value
343
343
  );
344
- } else if (l && (b = b.trim()), f) {
345
- const k = Number(b);
346
- isNaN(k) || (b = k);
344
+ } else if (c && (b = b.trim()), f) {
345
+ const $ = Number(b);
346
+ isNaN($) || (b = $);
347
347
  }
348
- const p = s._state || s, v = H(p, e);
348
+ const d = s._state || s, v = I(d, e);
349
349
  if (Array.isArray(b) && Array.isArray(v) ? JSON.stringify([...b].sort()) !== JSON.stringify([...v].sort()) : b !== v) {
350
- const k = h.target;
351
- k._modelUpdating = !0, we(p, e, b), setTimeout(() => {
352
- k._modelUpdating = !1;
350
+ const $ = h.target;
351
+ $._modelUpdating = !0, we(d, e, b), setTimeout(() => {
352
+ $._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (n[x] = S, c === "text" || c === "textarea") {
356
+ if (o[x] = k, l === "text" || l === "textarea") {
357
357
  const h = () => {
358
- n._isComposing = !0;
358
+ o._isComposing = !0;
359
359
  }, u = (g) => {
360
- n._isComposing = !1;
360
+ o._isComposing = !1;
361
361
  const b = g.target;
362
362
  setTimeout(() => {
363
363
  if (b) {
364
- let p = b.value;
365
- if (l && (p = p.trim()), f) {
366
- const _ = Number(p);
367
- isNaN(_) || (p = _);
364
+ let d = b.value;
365
+ if (c && (d = d.trim()), f) {
366
+ const _ = Number(d);
367
+ isNaN(_) || (d = _);
368
368
  }
369
- const v = s._state || s, m = H(v, e);
370
- (Array.isArray(p) && Array.isArray(m) ? JSON.stringify([...p].sort()) !== JSON.stringify([...m].sort()) : p !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
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
371
  b._modelUpdating = !1;
372
- }, 0)), we(v, e, p), s._requestRender && s._requestRender());
372
+ }, 0)), we(v, e, d), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
- n.compositionstart = h, n.compositionend = u;
376
+ o.compositionstart = h, o.compositionend = u;
377
377
  }
378
378
  }
379
- function qe(e, t, r, o) {
380
- if (o) {
379
+ function Ae(e) {
380
+ return e.slice(2).charAt(0).toLowerCase() + e.slice(3);
381
+ }
382
+ function Ie(e, t, r, n) {
383
+ if (n) {
381
384
  if (typeof e == "object" && e !== null)
382
- for (const [n, s] of Object.entries(e))
383
- t[n] = s;
385
+ for (const [o, s] of Object.entries(e))
386
+ t[o] = s;
384
387
  else if (typeof e == "string")
385
388
  try {
386
- const n = JSON.parse(e);
387
- if (typeof n == "object" && n !== null) {
388
- for (const [s, i] of Object.entries(n))
389
+ const o = JSON.parse(e);
390
+ if (typeof o == "object" && o !== null) {
391
+ for (const [s, i] of Object.entries(o))
389
392
  t[s] = i;
390
393
  return;
391
394
  }
392
395
  } catch {
393
- const n = H(o, e);
394
- r[e] = n;
396
+ const o = I(n, e);
397
+ r[e] = o;
395
398
  }
396
399
  }
397
400
  }
398
401
  function He(e, t, r) {
399
402
  if (!r) return;
400
- const o = H(r, e), n = t.style || "", s = o ? "" : "none";
401
- if (n) {
402
- const i = n.split(";").filter(Boolean), a = i.findIndex(
403
- (l) => l.trim().startsWith("display:")
403
+ const n = I(r, e), o = t.style || "", s = n ? "" : "none";
404
+ if (o) {
405
+ const i = o.split(";").filter(Boolean), a = i.findIndex(
406
+ (c) => c.trim().startsWith("display:")
404
407
  );
405
408
  a >= 0 ? i[a] = `display: ${s}` : i.push(`display: ${s}`), t.style = i.join("; ");
406
409
  } else
407
410
  t.style = `display: ${s}`;
408
411
  }
409
- function Ie(e, t, r) {
412
+ function Fe(e, t, r) {
410
413
  if (!r) return;
411
- const o = H(r, e);
412
- let n = [];
413
- 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)));
414
- const s = t.class || "", i = s ? `${s} ${n.join(" ")}`.trim() : n.join(" ");
414
+ const n = I(r, e);
415
+ let o = [];
416
+ typeof n == "string" ? o = [n] : Array.isArray(n) ? o = n.filter(Boolean) : typeof n == "object" && (o = Object.entries(n).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
417
+ const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
415
418
  i && (t.class = i);
416
419
  }
417
- function Ue(e, t, r) {
418
- let o;
420
+ function Ke(e, t, r) {
421
+ let n;
419
422
  if (typeof e == "string") {
420
423
  if (!r) return;
421
- o = H(r, e);
424
+ n = I(r, e);
422
425
  } else
423
- o = e;
424
- let n = "";
425
- if (typeof o == "string")
426
- n = o;
427
- else if (o && typeof o == "object") {
426
+ n = e;
427
+ let o = "";
428
+ if (typeof n == "string")
429
+ o = n;
430
+ else if (n && typeof n == "object") {
428
431
  const i = [];
429
- for (const [a, l] of Object.entries(o))
430
- if (l != null && l !== "") {
432
+ for (const [a, c] of Object.entries(n))
433
+ if (c != null && c !== "") {
431
434
  const f = a.replace(
432
435
  /[A-Z]/g,
433
- (c) => `-${c.toLowerCase()}`
434
- ), d = [
436
+ (l) => `-${l.toLowerCase()}`
437
+ ), p = [
435
438
  "width",
436
439
  "height",
437
440
  "top",
@@ -457,24 +460,24 @@ function Ue(e, t, r) {
457
460
  "min-height",
458
461
  "max-height"
459
462
  ];
460
- let y = String(l);
461
- typeof l == "number" && d.includes(f) && (y = `${l}px`), i.push(`${f}: ${y}`);
463
+ let y = String(c);
464
+ typeof c == "number" && p.includes(f) && (y = `${c}px`), i.push(`${f}: ${y}`);
462
465
  }
463
- n = i.join("; ") + (i.length > 0 ? ";" : "");
466
+ o = i.join("; ") + (i.length > 0 ? ";" : "");
464
467
  }
465
468
  const s = t.style || "";
466
- t.style = s + (s && !s.endsWith(";") ? "; " : "") + n;
469
+ t.style = s + (s && !s.endsWith(";") ? "; " : "") + o;
467
470
  }
468
- function Ae(e, t, r, o) {
469
- const n = {}, s = { ...o || {} }, i = {};
470
- for (const [a, l] of Object.entries(e)) {
471
- const { value: f, modifiers: d } = l;
471
+ function Te(e, t, r, n) {
472
+ const o = {}, s = { ...n || {} }, i = {};
473
+ for (const [a, c] of Object.entries(e)) {
474
+ const { value: f, modifiers: p } = c;
472
475
  switch (a) {
473
476
  case "model":
474
- De(
477
+ qe(
475
478
  typeof f == "string" ? f : String(f),
476
- d,
477
- n,
479
+ p,
480
+ o,
478
481
  s,
479
482
  i,
480
483
  t,
@@ -482,20 +485,20 @@ function Ae(e, t, r, o) {
482
485
  );
483
486
  break;
484
487
  case "bind":
485
- qe(f, n, s, t);
488
+ Ie(f, o, s, t);
486
489
  break;
487
490
  case "show":
488
491
  He(f, s, t);
489
492
  break;
490
493
  case "class":
491
- Ie(f, s, t);
494
+ Fe(f, s, t);
492
495
  break;
493
496
  case "style":
494
- Ue(f, s, t);
497
+ Ke(f, s, t);
495
498
  break;
496
499
  }
497
500
  }
498
- return { props: n, attrs: s, listeners: i };
501
+ return { props: o, attrs: s, listeners: i };
499
502
  }
500
503
  function ge(e, t) {
501
504
  if (Array.isArray(e)) {
@@ -504,25 +507,25 @@ function ge(e, t) {
504
507
  if (!i || typeof i != "object") return i;
505
508
  let a = i.props?.key ?? i.key;
506
509
  if (!a) {
507
- const y = i.tag || "node", c = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
508
- a = c ? `${t}:${y}:${c}` : `${t}:${y}`;
510
+ const y = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
511
+ a = l ? `${t}:${y}:${l}` : `${t}:${y}`;
509
512
  }
510
- let l = a, f = 1;
511
- for (; s.has(l); )
512
- l = `${a}#${f++}`;
513
- s.add(l);
514
- let d = i.children;
515
- return Array.isArray(d) && (d = ge(d, l)), { ...i, key: l, children: d };
513
+ let c = a, f = 1;
514
+ for (; s.has(c); )
515
+ c = `${a}#${f++}`;
516
+ s.add(c);
517
+ let p = i.children;
518
+ return Array.isArray(p) && (p = ge(p, c)), { ...i, key: c, children: p };
516
519
  });
517
520
  }
518
521
  const r = e;
519
- let o = r.props?.key ?? r.key ?? t, n = r.children;
520
- return Array.isArray(n) && (n = ge(n, o)), { ...r, key: o, children: n };
522
+ let n = r.props?.key ?? r.key ?? t, o = r.children;
523
+ return Array.isArray(o) && (o = ge(o, n)), { ...r, key: n, children: o };
521
524
  }
522
- function Fe(e, t, r, o) {
523
- const n = r.directives ?? {}, s = Ae(
524
- n,
525
+ function Ue(e, t, r, n) {
526
+ const o = r.directives ?? {}, s = Te(
525
527
  o,
528
+ n,
526
529
  e,
527
530
  r.attrs
528
531
  ), i = {
@@ -533,19 +536,27 @@ function Fe(e, t, r, o) {
533
536
  ...t.attrs,
534
537
  ...r.attrs,
535
538
  ...s.attrs
536
- }, l = t.props ?? {}, f = i;
537
- for (const c in { ...l, ...f }) {
538
- const w = l[c], x = f[c];
539
- w !== x && (c === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== x && (e.value = x ?? "") : c === "checked" && e instanceof HTMLInputElement ? e.checked = !!x : c.startsWith("on") && typeof x == "function" ? (typeof w == "function" && e.removeEventListener(c.slice(2).toLowerCase(), w), e.addEventListener(c.slice(2).toLowerCase(), x)) : x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x)));
540
- }
541
- for (const [c, w] of Object.entries(
539
+ }, c = t.props ?? {}, f = i;
540
+ for (const l in { ...c, ...f }) {
541
+ const w = c[l], x = f[l];
542
+ if (w !== x)
543
+ if (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
544
+ e.value !== x && (e.value = x ?? "");
545
+ else if (l === "checked" && e instanceof HTMLInputElement)
546
+ e.checked = !!x;
547
+ else if (l.startsWith("on") && typeof x == "function") {
548
+ const k = Ae(l);
549
+ typeof w == "function" && e.removeEventListener(k, w), e.addEventListener(k, x);
550
+ } else x == null || x === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(x));
551
+ }
552
+ for (const [l, w] of Object.entries(
542
553
  s.listeners || {}
543
554
  ))
544
- e.addEventListener(c, w);
545
- const d = t.attrs ?? {}, y = a;
546
- for (const c in { ...d, ...y }) {
547
- const w = d[c], x = y[c];
548
- w !== x && (x == null || x === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(x)));
555
+ e.addEventListener(l, w);
556
+ const p = t.attrs ?? {}, y = a;
557
+ for (const l in { ...p, ...y }) {
558
+ const w = p[l], x = y[l];
559
+ w !== x && (x == null || x === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(x)));
549
560
  }
550
561
  }
551
562
  function P(e, t, r) {
@@ -558,63 +569,63 @@ function P(e, t, r) {
558
569
  return e.key != null && (y.key = e.key), y;
559
570
  }
560
571
  if (e.tag === "#anchor") {
561
- const y = e, c = Array.isArray(y.children) ? y.children : [], w = document.createTextNode(""), x = document.createTextNode("");
572
+ const y = e, l = Array.isArray(y.children) ? y.children : [], w = document.createTextNode(""), x = document.createTextNode("");
562
573
  y.key != null && (w.key = `${y.key}:start`, x.key = `${y.key}:end`), y._startNode = w, y._endNode = x;
563
- const S = document.createDocumentFragment();
564
- S.appendChild(w);
565
- for (const h of c) {
574
+ const k = document.createDocumentFragment();
575
+ k.appendChild(w);
576
+ for (const h of l) {
566
577
  const u = P(h, t);
567
- S.appendChild(u);
578
+ k.appendChild(u);
568
579
  }
569
- return S.appendChild(x), S;
580
+ return k.appendChild(x), k;
570
581
  }
571
- const o = document.createElement(e.tag);
572
- e.key != null && (o.key = e.key);
573
- const { props: n = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = Ae(i, t, o, s), l = {
574
- ...n,
582
+ const n = document.createElement(e.tag);
583
+ e.key != null && (n.key = e.key);
584
+ const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = Te(i, t, n, s), c = {
585
+ ...o,
575
586
  ...a.props
576
587
  }, f = {
577
588
  ...s,
578
589
  ...a.attrs
579
590
  };
580
591
  for (const y in f) {
581
- const c = f[y];
592
+ const l = f[y];
582
593
  if (typeof y != "string" || /\[object Object\]/.test(y)) {
583
- typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", y, c);
594
+ typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", y, l);
584
595
  continue;
585
596
  }
586
- typeof c == "boolean" ? c && o.setAttribute(y, "") : c != null && o.setAttribute(y, c);
597
+ typeof l == "boolean" ? l && n.setAttribute(y, "") : l != null && n.setAttribute(y, l);
587
598
  }
588
- for (const y in l) {
589
- const c = l[y];
599
+ for (const y in c) {
600
+ const l = c[y];
590
601
  if (typeof y != "string" || /\[object Object\]/.test(y)) {
591
- typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", y, c);
602
+ typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", y, l);
592
603
  continue;
593
604
  }
594
- if (y === "value" && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement))
595
- o.value = c ?? "";
596
- else if (y === "checked" && o instanceof HTMLInputElement)
597
- o.checked = !!c;
598
- else if (y.startsWith("on") && typeof c == "function")
599
- o.addEventListener(y.slice(2).toLowerCase(), c);
605
+ if (y === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
606
+ n.value = l ?? "";
607
+ else if (y === "checked" && n instanceof HTMLInputElement)
608
+ n.checked = !!l;
609
+ else if (y.startsWith("on") && typeof l == "function")
610
+ n.addEventListener(Ae(y), l);
600
611
  else {
601
- if (y.startsWith("on") && c === void 0)
612
+ if (y.startsWith("on") && l === void 0)
602
613
  continue;
603
- c == null || c === !1 ? o.removeAttribute(y) : o.setAttribute(y, String(c));
614
+ l == null || l === !1 ? n.removeAttribute(y) : n.setAttribute(y, String(l));
604
615
  }
605
616
  }
606
- for (const [y, c] of Object.entries(
617
+ for (const [y, l] of Object.entries(
607
618
  a.listeners || {}
608
619
  ))
609
- o.addEventListener(y, c);
610
- const d = e.props?.ref ?? (e.props?.props && e.props.props.ref);
611
- if (typeof e != "string" && d && r && (r[d] = o), Array.isArray(e.children))
620
+ n.addEventListener(y, l);
621
+ const p = e.props?.ref ?? (e.props?.props && e.props.props.ref);
622
+ if (typeof e != "string" && p && r && (r[p] = n), Array.isArray(e.children))
612
623
  for (const y of e.children)
613
- o.appendChild(P(y, t, r));
614
- else typeof e.children == "string" && (o.textContent = e.children);
615
- return o;
624
+ n.appendChild(P(y, t, r));
625
+ else typeof e.children == "string" && (n.textContent = e.children);
626
+ return n;
616
627
  }
617
- function Ke(e, t, r, o, n) {
628
+ function Ve(e, t, r, n, o) {
618
629
  if (typeof r == "string") {
619
630
  e.textContent !== r && (e.textContent = r);
620
631
  return;
@@ -623,24 +634,24 @@ function Ke(e, t, r, o, n) {
623
634
  const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
624
635
  for (const w of i)
625
636
  w && w.key != null && a.set(w.key, w);
626
- const l = /* @__PURE__ */ new Map();
637
+ const c = /* @__PURE__ */ new Map();
627
638
  for (const w of s) {
628
639
  const x = w.key;
629
- x != null && l.set(x, w);
640
+ x != null && c.set(x, w);
630
641
  }
631
642
  const f = /* @__PURE__ */ new Set();
632
- let d = e.firstChild;
643
+ let p = e.firstChild;
633
644
  function y(w, x) {
634
- let S = w;
635
- for (; S && (f.add(S), S !== x); )
636
- S = S.nextSibling;
645
+ let k = w;
646
+ for (; k && (f.add(k), k !== x); )
647
+ k = k.nextSibling;
637
648
  }
638
- function c(w, x, S, h) {
649
+ function l(w, x, k, h) {
639
650
  const u = [];
640
651
  let g = w.nextSibling;
641
652
  for (; g && g !== x; )
642
653
  u.push(g), g = g.nextSibling;
643
- const b = Array.isArray(S) ? S : [];
654
+ const b = Array.isArray(k) ? k : [];
644
655
  if (h.some((v) => v && v.key != null) || b.some((v) => v && v.key != null)) {
645
656
  const v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
646
657
  for (const C of b)
@@ -649,7 +660,7 @@ function Ke(e, t, r, o, n) {
649
660
  const E = C.key;
650
661
  E != null && m.set(E, C);
651
662
  }
652
- const k = /* @__PURE__ */ new Set();
663
+ const $ = /* @__PURE__ */ new Set();
653
664
  let _ = w.nextSibling;
654
665
  for (const C of h) {
655
666
  let E;
@@ -659,25 +670,25 @@ function Ke(e, t, r, o, n) {
659
670
  m.get(C.key),
660
671
  j,
661
672
  C,
662
- o
663
- ), k.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
673
+ n
674
+ ), $.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
664
675
  } else
665
- E = P(C, o), e.insertBefore(E, _), k.add(E);
676
+ E = P(C, n), e.insertBefore(E, _), $.add(E);
666
677
  _ = E.nextSibling;
667
678
  }
668
679
  for (const C of u)
669
- !k.has(C) && e.contains(C) && e.removeChild(C);
680
+ !$.has(C) && e.contains(C) && e.removeChild(C);
670
681
  } else {
671
682
  const v = Math.min(
672
683
  b.length,
673
684
  h.length
674
685
  );
675
686
  for (let m = 0; m < v; m++) {
676
- const k = b[m], _ = h[m], C = Y(u[m], k, _, o);
687
+ const $ = b[m], _ = h[m], C = Y(u[m], $, _, n);
677
688
  C !== u[m] && (e.insertBefore(C, u[m]), e.removeChild(u[m]));
678
689
  }
679
690
  for (let m = v; m < h.length; m++)
680
- e.insertBefore(P(h[m], o), x);
691
+ e.insertBefore(P(h[m], n), x);
681
692
  for (let m = v; m < u.length; m++)
682
693
  e.removeChild(u[m]);
683
694
  }
@@ -685,42 +696,42 @@ function Ke(e, t, r, o, n) {
685
696
  for (const w of r) {
686
697
  let x;
687
698
  if (w.tag === "#anchor") {
688
- const S = w.key, h = `${S}:start`, u = `${S}:end`;
689
- let g = l.get(h), b = l.get(u);
690
- const p = Array.isArray(w.children) ? w.children : [];
699
+ const k = w.key, h = `${k}:start`, u = `${k}:end`;
700
+ let g = c.get(h), b = c.get(u);
701
+ const d = Array.isArray(w.children) ? w.children : [];
691
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)) {
692
- e.insertBefore(g, d);
693
- for (const v of p)
694
- e.insertBefore(P(v, o), d);
695
- e.insertBefore(b, d);
703
+ e.insertBefore(g, p);
704
+ for (const v of d)
705
+ e.insertBefore(P(v, n), p);
706
+ e.insertBefore(b, p);
696
707
  } else
697
- c(
708
+ l(
698
709
  g,
699
710
  b,
700
- a.get(S)?.children,
701
- p
711
+ a.get(k)?.children,
712
+ d
702
713
  );
703
- y(g, b), d = b.nextSibling;
714
+ y(g, b), p = b.nextSibling;
704
715
  continue;
705
716
  }
706
- if (w.key != null && l.has(w.key)) {
707
- const S = a.get(w.key);
717
+ if (w.key != null && c.has(w.key)) {
718
+ const k = a.get(w.key);
708
719
  x = Y(
709
- l.get(w.key),
710
- S,
720
+ c.get(w.key),
721
+ k,
711
722
  w,
712
- o,
713
- n
714
- ), f.add(x), x !== d && e.contains(x) && (d && !e.contains(d) && (d = null), e.insertBefore(x, d));
723
+ n,
724
+ o
725
+ ), f.add(x), x !== p && e.contains(x) && (p && !e.contains(p) && (p = null), e.insertBefore(x, p));
715
726
  } else
716
- x = P(w, o, n), d && !e.contains(d) && (d = null), e.insertBefore(x, d), f.add(x);
717
- d = x.nextSibling;
727
+ x = P(w, n, o), p && !e.contains(p) && (p = null), e.insertBefore(x, p), f.add(x);
728
+ p = x.nextSibling;
718
729
  }
719
730
  for (const w of s)
720
- !f.has(w) && e.contains(w) && (q(w, n), e.removeChild(w));
731
+ !f.has(w) && e.contains(w) && (q(w, o), e.removeChild(w));
721
732
  }
722
- function Y(e, t, r, o, n) {
723
- if (t && typeof t != "string" && t.props?.ref && n && q(e, n), t === r) return e;
733
+ function Y(e, t, r, n, o) {
734
+ if (t && typeof t != "string" && t.props?.ref && o && q(e, o), t === r) return e;
724
735
  if (typeof r == "string") {
725
736
  if (e.nodeType === Node.TEXT_NODE)
726
737
  return e.textContent !== r && (e.textContent = r), e;
@@ -730,78 +741,78 @@ function Y(e, t, r, o, n) {
730
741
  }
731
742
  }
732
743
  if (r && typeof r != "string" && r.tag === "#anchor") {
733
- const i = r, a = Array.isArray(i.children) ? i.children : [], l = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
734
- i.key != null && (l.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = l, i._endNode = f;
735
- const d = document.createDocumentFragment();
736
- d.appendChild(l);
744
+ const i = r, a = Array.isArray(i.children) ? i.children : [], c = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
745
+ i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
746
+ const p = document.createDocumentFragment();
747
+ p.appendChild(c);
737
748
  for (const y of a) {
738
- const c = P(y, o);
739
- d.appendChild(c);
749
+ const l = P(y, n);
750
+ p.appendChild(l);
740
751
  }
741
- return d.appendChild(f), e.parentNode?.replaceChild(d, e), l;
752
+ return p.appendChild(f), e.parentNode?.replaceChild(p, e), c;
742
753
  }
743
754
  if (!r) {
744
- q(e, n);
755
+ q(e, o);
745
756
  const i = document.createComment("removed");
746
757
  return e.parentNode?.replaceChild(i, e), i;
747
758
  }
748
759
  if (!t || typeof t == "string") {
749
- q(e, n);
750
- const i = P(r, o, n);
751
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
760
+ q(e, o);
761
+ const i = P(r, n, o);
762
+ return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
752
763
  }
753
764
  if (r.tag === "#anchor") {
754
- const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), l = r._endNode ?? document.createTextNode("");
755
- r.key != null && (a.key = `${r.key}:start`, l.key = `${r.key}:end`), r._startNode = a, r._endNode = l;
765
+ const i = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), c = r._endNode ?? document.createTextNode("");
766
+ r.key != null && (a.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = a, r._endNode = c;
756
767
  const f = document.createDocumentFragment();
757
768
  f.appendChild(a);
758
- for (const d of i)
759
- f.appendChild(P(d, o));
760
- return f.appendChild(l), e.parentNode?.replaceChild(f, e), a;
769
+ for (const p of i)
770
+ f.appendChild(P(p, n));
771
+ return f.appendChild(c), e.parentNode?.replaceChild(f, e), a;
761
772
  }
762
773
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
763
774
  const i = e;
764
- return Fe(i, t.props || {}, r.props || {}, o), Ke(i, t.children, r.children, o, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = i), i;
775
+ return Ue(i, t.props || {}, r.props || {}, n), Ve(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
765
776
  }
766
- q(e, n);
767
- const s = P(r, o, n);
768
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
777
+ q(e, o);
778
+ const s = P(r, n, o);
779
+ return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
769
780
  }
770
- function Ve(e, t, r, o) {
771
- let n;
772
- 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 = {
781
+ function Je(e, t, r, n) {
782
+ let o;
783
+ Array.isArray(t) ? t.length === 1 ? (o = t[0], o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })) : o = { tag: "div", key: "__root__", children: t } : (o = t, o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })), o && typeof o == "object" && o.tag === "#anchor" && (o = {
773
784
  tag: "div",
774
785
  key: "__anchor_root__",
775
786
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
776
- children: [n]
777
- }), n = ge(n, String(n.key ?? "root"));
787
+ children: [o]
788
+ }), o = ge(o, String(o.key ?? "root"));
778
789
  const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
779
790
  let a;
780
- s && i ? typeof s != "string" && typeof n != "string" && s.tag === n.tag && s.key === n.key ? a = Y(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));
781
- const l = [];
791
+ s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = Y(i, s, o, r, n) : (a = P(o, r, n), e.replaceChild(a, i)) : (a = P(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
792
+ const c = [];
782
793
  for (let f = 0; f < e.childNodes.length; f++) {
783
- const d = e.childNodes[f];
784
- d !== a && d.nodeName !== "STYLE" && (q(d, o), l.push(d));
794
+ const p = e.childNodes[f];
795
+ p !== a && p.nodeName !== "STYLE" && (q(p, n), c.push(p));
785
796
  }
786
- l.forEach((f) => e.removeChild(f)), e._prevVNode = n, e._prevDom = a;
797
+ c.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
787
798
  }
788
- function Te(e, ...t) {
799
+ function je(e, ...t) {
789
800
  let r = "";
790
- for (let o = 0; o < e.length; o++)
791
- r += e[o], o < t.length && (r += t[o]);
801
+ for (let n = 0; n < e.length; n++)
802
+ r += e[n], n < t.length && (r += t[n]);
792
803
  return r;
793
804
  }
794
- function je(e) {
805
+ function Le(e) {
795
806
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
796
807
  }
797
808
  let Q = null;
798
809
  function ke() {
799
- return Q || (Q = new CSSStyleSheet(), Q.replaceSync(je(Ze))), Q;
810
+ return Q || (Q = new CSSStyleSheet(), Q.replaceSync(Le(Qe))), Q;
800
811
  }
801
- function Je(e) {
812
+ function Ze(e) {
802
813
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
803
814
  }
804
- const Ze = Te`
815
+ const Qe = je`
805
816
  :host, *, ::before, ::after {
806
817
  all: isolate;
807
818
  box-sizing: border-box;
@@ -859,7 +870,7 @@ const Ze = Te`
859
870
  sup { top: -.5em }
860
871
  [disabled], [aria-disabled=true] { cursor: not-allowed }
861
872
  [hidden] { display: none }
862
- `, Qe = {
873
+ `, Xe = {
863
874
  gray: {
864
875
  50: "var(--color-gray-50, #f9fafb)",
865
876
  100: "var(--color-gray-100, #f3f4f6)",
@@ -1175,7 +1186,7 @@ const Ze = Te`
1175
1186
  "z-30": "z-index:30;",
1176
1187
  "z-40": "z-index:40;",
1177
1188
  "z-50": "z-index:50;"
1178
- }, Xe = "0.25rem", $e = {
1189
+ }, Ye = "0.25rem", $e = {
1179
1190
  m: ["margin"],
1180
1191
  mx: ["margin-inline"],
1181
1192
  my: ["margin-block"],
@@ -1208,19 +1219,19 @@ const Ze = Te`
1208
1219
  "gap-y": ["row-gap"]
1209
1220
  };
1210
1221
  function R(e, t) {
1211
- let r = 0, o = 0;
1212
- for (let n = 0; n < e.length; n++) {
1213
- const s = e[n];
1222
+ let r = 0, n = 0;
1223
+ for (let o = 0; o < e.length; o++) {
1224
+ const s = e[o];
1214
1225
  if (s === "[") r++;
1215
1226
  else if (s === "]" && r > 0) r--;
1216
- else if (s === "(") o++;
1217
- else if (s === ")" && o > 0) o--;
1218
- else if (r === 0 && o === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1219
- return e.slice(0, n) + t + e.slice(n);
1227
+ else if (s === "(") n++;
1228
+ else if (s === ")" && n > 0) n--;
1229
+ else if (r === 0 && n === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1230
+ return e.slice(0, o) + t + e.slice(o);
1220
1231
  }
1221
1232
  return e + t;
1222
1233
  }
1223
- const Ye = {
1234
+ const Ge = {
1224
1235
  before: (e, t) => `${e}::before{${t}}`,
1225
1236
  after: (e, t) => `${e}::after{${t}}`,
1226
1237
  hover: (e, t) => `${R(e, ":hover")}{${t}}`,
@@ -1254,21 +1265,21 @@ const Ye = {
1254
1265
  dark: "(prefers-color-scheme: dark)"
1255
1266
  }, le = ["sm", "md", "lg", "xl", "2xl"];
1256
1267
  function ce(e) {
1257
- const t = e.startsWith("-"), o = (t ? e.slice(1) : e).split("-");
1258
- if (o.length < 2) return null;
1259
- const n = o.slice(0, -1).join("-"), s = o[o.length - 1], i = parseFloat(s);
1260
- if (Number.isNaN(i) || !$e[n]) return null;
1268
+ const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1269
+ if (n.length < 2) return null;
1270
+ const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
1271
+ if (Number.isNaN(i) || !$e[o]) return null;
1261
1272
  const a = t ? "-" : "";
1262
- return $e[n].map((l) => `${l}:calc(${a}${Xe} * ${i});`).join("");
1273
+ return $e[o].map((c) => `${c}:calc(${a}${Ye} * ${i});`).join("");
1263
1274
  }
1264
1275
  function Se(e) {
1265
- const t = e.replace("#", ""), r = parseInt(t, 16), o = r >> 16 & 255, n = r >> 8 & 255, s = r & 255;
1266
- return `${o} ${n} ${s}`;
1276
+ const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
1277
+ return `${n} ${o} ${s}`;
1267
1278
  }
1268
- function Ge(e) {
1279
+ function et(e) {
1269
1280
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1270
1281
  if (!t) return null;
1271
- const [, r, o, n = "DEFAULT"] = t, s = Qe[o]?.[n];
1282
+ const [, r, n, o = "DEFAULT"] = t, s = Xe[n]?.[o];
1272
1283
  return s ? `${{
1273
1284
  bg: "background-color",
1274
1285
  decoration: "text-decoration-color",
@@ -1283,33 +1294,33 @@ function Ge(e) {
1283
1294
  stroke: "stroke-color"
1284
1295
  }[r]}:${s};` : null;
1285
1296
  }
1286
- function et(e) {
1297
+ function tt(e) {
1287
1298
  const [t, r] = e.split("/");
1288
1299
  if (!r) return { base: t };
1289
- const o = parseInt(r, 10);
1290
- return isNaN(o) || o < 0 || o > 100 ? { base: t } : { base: t, opacity: o / 100 };
1300
+ const n = parseInt(r, 10);
1301
+ return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1291
1302
  }
1292
1303
  function fe(e) {
1293
- const { base: t, opacity: r } = et(e), o = Ge(t);
1294
- if (o) {
1304
+ const { base: t, opacity: r } = tt(e), n = et(t);
1305
+ if (n) {
1295
1306
  if (r !== void 0) {
1296
- const s = /#([0-9a-f]{6})/i.exec(o);
1307
+ const s = /#([0-9a-f]{6})/i.exec(n);
1297
1308
  if (s) {
1298
1309
  const i = Se(s[0]);
1299
- return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1310
+ return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1300
1311
  }
1301
1312
  }
1302
- return o;
1313
+ return n;
1303
1314
  }
1304
- const n = G(t);
1305
- if (n && r !== void 0) {
1306
- const s = /#([0-9a-f]{6})/i.exec(n);
1315
+ const o = G(t);
1316
+ if (o && r !== void 0) {
1317
+ const s = /#([0-9a-f]{6})/i.exec(o);
1307
1318
  if (s) {
1308
1319
  const i = Se(s[0]);
1309
- return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1320
+ return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1310
1321
  }
1311
1322
  }
1312
- return n;
1323
+ return o;
1313
1324
  }
1314
1325
  function ue(e) {
1315
1326
  const t = /^opacity-(\d{1,3})$/.exec(e);
@@ -1319,19 +1330,19 @@ function ue(e) {
1319
1330
  }
1320
1331
  function G(e) {
1321
1332
  if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1322
- const n = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1323
- if (n) {
1324
- const s = n[1].trim();
1325
- let i = n[2].trim();
1333
+ const o = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1334
+ if (o) {
1335
+ const s = o[1].trim();
1336
+ let i = o[2].trim();
1326
1337
  return i = i.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), i = i.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${i};`;
1327
1338
  }
1328
1339
  return null;
1329
1340
  }
1330
1341
  const t = e.indexOf("-["), r = e.endsWith("]");
1331
1342
  if (t > 0 && r) {
1332
- const o = e.slice(0, t);
1333
- let n = e.slice(t + 2, -1);
1334
- n = n.replace(/_/g, " ");
1343
+ const n = e.slice(0, t);
1344
+ let o = e.slice(t + 2, -1);
1345
+ o = o.replace(/_/g, " ");
1335
1346
  const s = {
1336
1347
  bg: "background-color",
1337
1348
  text: "color",
@@ -1372,14 +1383,14 @@ function G(e) {
1372
1383
  leading: "line-height",
1373
1384
  z: "z-index"
1374
1385
  };
1375
- if (o === "rotate")
1376
- return `transform:rotate(${n});`;
1377
- const i = s[o] ?? o.replace(/_/g, "-");
1378
- if (i && n) return `${i}:${n};`;
1386
+ if (n === "rotate")
1387
+ return `transform:rotate(${o});`;
1388
+ const i = s[n] ?? n.replace(/_/g, "-");
1389
+ if (i && o) return `${i}:${o};`;
1379
1390
  }
1380
1391
  return null;
1381
1392
  }
1382
- function tt(e) {
1393
+ function rt(e) {
1383
1394
  if (e.startsWith("[") && e.endsWith("]")) {
1384
1395
  const r = e.slice(1, -1);
1385
1396
  return r.includes("&") ? r : e;
@@ -1391,24 +1402,24 @@ function tt(e) {
1391
1402
  }
1392
1403
  return null;
1393
1404
  }
1394
- function rt(e) {
1405
+ function nt(e) {
1395
1406
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1396
1407
  }
1397
- function nt(e) {
1408
+ function ot(e) {
1398
1409
  const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1399
- let o;
1400
- for (; o = t.exec(e); ) {
1401
- const n = o[2].split(/\s+/).filter(Boolean);
1402
- n.length && r.push(...n);
1410
+ let n;
1411
+ for (; n = t.exec(e); ) {
1412
+ const o = n[2].split(/\s+/).filter(Boolean);
1413
+ o.length && r.push(...o);
1403
1414
  }
1404
1415
  return r.filter(Boolean);
1405
1416
  }
1406
- const _e = /* @__PURE__ */ new Map(), ot = 16;
1407
- function it(e) {
1417
+ const _e = /* @__PURE__ */ new Map(), it = 16;
1418
+ function st(e) {
1408
1419
  const t = Date.now(), r = _e.get(e);
1409
- if (r && t - r.timestamp < ot) return r.css;
1410
- const o = nt(e), n = new Set(o), s = [], i = [], a = [], l = [], f = {};
1411
- function d(h, u = !1) {
1420
+ if (r && t - r.timestamp < it) return r.css;
1421
+ const n = ot(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1422
+ function p(h, u = !1) {
1412
1423
  const g = (u ? "dark|" : "") + h;
1413
1424
  if (g in f) return f[g];
1414
1425
  const b = x(h, u);
@@ -1418,12 +1429,12 @@ function it(e) {
1418
1429
  const u = h.some((b) => le.includes(b)), g = h.includes("dark");
1419
1430
  return h.length === 0 ? 1 : !u && !g ? 2 : u && !g ? 3 : 4;
1420
1431
  }
1421
- function c(h) {
1432
+ function l(h) {
1422
1433
  const u = [];
1423
- let g = "", b = 0, p = 0;
1434
+ let g = "", b = 0, d = 0;
1424
1435
  for (let v = 0; v < h.length; v++) {
1425
1436
  const m = h[v];
1426
- m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? p++ : m === ")" && p > 0 && p--, m === ":" && b === 0 && p === 0 ? (u.push(g), g = "") : g += m;
1437
+ m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? d++ : m === ")" && d > 0 && d--, m === ":" && b === 0 && d === 0 ? (u.push(g), g = "") : g += m;
1427
1438
  }
1428
1439
  return g && u.push(g), u;
1429
1440
  }
@@ -1458,181 +1469,181 @@ function it(e) {
1458
1469
  }
1459
1470
  }
1460
1471
  function x(h, u = !1) {
1461
- const g = c(h);
1472
+ const g = l(h);
1462
1473
  (h.includes("mask-image") || h.includes("sm: hover") || h.includes("sm:hover") || h.includes("mask.svg")) && console.error("DEBUG generateRule:", h, g);
1463
- let b = !1, p = g.find(($) => ($.startsWith("!") && (b = !0, $ = $.slice(1)), se[$] || ce($) || ue($) || fe($) || G($)));
1464
- if (!p) return null;
1465
- const v = p.replace(/^!/, ""), m = se[v] ?? ce(v) ?? ue(v) ?? fe(v) ?? G(v);
1474
+ let b = !1, d = g.find((S) => (S.startsWith("!") && (b = !0, S = S.slice(1)), se[S] || ce(S) || ue(S) || fe(S) || G(S)));
1475
+ if (!d) return null;
1476
+ const v = d.replace(/^!/, ""), m = se[v] ?? ce(v) ?? ue(v) ?? fe(v) ?? G(v);
1466
1477
  if (!m) return null;
1467
- const k = g.indexOf(p);
1468
- let _ = k >= 0 ? g.slice(0, k) : [];
1469
- u && (_ = _.filter(($) => $ !== "dark"));
1470
- const C = `.${rt(h)}`, E = "__SUBJECT__", j = b ? m.replace(/;$/, " !important;") : m;
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;
1471
1482
  let A = E;
1472
1483
  const re = [];
1473
- for (const $ of _)
1474
- $.startsWith("group-") ? (A = `.group:${$.slice(6)} ${A}`, re.push($)) : $.startsWith("peer-") && (A = A.replace(E, `.peer:${$.slice(5)}~${E}`), re.push($));
1475
- _ = _.filter(($) => !re.includes($));
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));
1476
1487
  const ne = [], be = [];
1477
- let N = null;
1478
- for (const $ of _) {
1479
- if ($ === "dark" || le.includes($)) continue;
1480
- const M = tt($);
1488
+ let W = null;
1489
+ for (const S of _) {
1490
+ if (S === "dark" || le.includes(S)) continue;
1491
+ const M = rt(S);
1481
1492
  if (M) {
1482
- N = M;
1493
+ W = M;
1483
1494
  continue;
1484
1495
  }
1485
- const L = w($);
1496
+ const L = w(S);
1486
1497
  if (L) {
1487
- N ? be.push(L) : ne.push(L);
1498
+ W ? be.push(L) : ne.push(L);
1488
1499
  continue;
1489
1500
  }
1490
- const B = Ye[$];
1501
+ const B = Ge[S];
1491
1502
  typeof B == "function" && (A = B(A, j).split("{")[0]);
1492
1503
  }
1493
- function Le($, M) {
1494
- if (!M) return $;
1504
+ function ze(S, M) {
1505
+ if (!M) return S;
1495
1506
  let L = 0, B = 0;
1496
- if ($.length && ($[0] === ">" || $[0] === "+" || $[0] === "~" || $[0] === " ")) {
1507
+ if (S.length && (S[0] === ">" || S[0] === "+" || S[0] === "~" || S[0] === " ")) {
1497
1508
  let T = 1;
1498
- for (; T < $.length && $[T] === " "; ) T++;
1499
- for (; T < $.length; T++) {
1500
- const z = $[T];
1501
- if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && ($[T] === ">" || $[T] === "+" || $[T] === "~" || $[T] === " "))
1502
- return $.slice(0, T) + M + $.slice(T);
1509
+ for (; T < S.length && S[T] === " "; ) T++;
1510
+ for (; T < S.length; T++) {
1511
+ const z = S[T];
1512
+ if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && (S[T] === ">" || S[T] === "+" || S[T] === "~" || S[T] === " "))
1513
+ return S.slice(0, T) + M + S.slice(T);
1503
1514
  }
1504
- return $ + M;
1515
+ return S + M;
1505
1516
  }
1506
- for (let T = 0; T < $.length; T++) {
1507
- const z = $[T];
1517
+ for (let T = 0; T < S.length; T++) {
1518
+ const z = S[T];
1508
1519
  if (z === "[" ? L++ : z === "]" && L > 0 ? L-- : z === "(" ? B++ : z === ")" && B > 0 && B--, L === 0 && B === 0 && (z === ">" || z === "+" || z === "~" || z === " "))
1509
- return $.slice(0, T) + M + $.slice(T);
1520
+ return S.slice(0, T) + M + S.slice(T);
1510
1521
  }
1511
- return $ + M;
1522
+ return S + M;
1512
1523
  }
1513
- const oe = ne.join(""), K = be.join("");
1514
- if (N)
1515
- if (N.includes("&")) {
1516
- const $ = N.indexOf("&"), M = N.slice(0, $), L = N.slice($ + 1), B = E + oe, T = A;
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), B = E + oe, T = A;
1517
1528
  if (ne.length === 0)
1518
- A = T.replace(E, M + B + K + L);
1529
+ A = T.replace(E, M + B + U + L);
1519
1530
  else {
1520
- const z = Le(L, K);
1531
+ const z = ze(L, U);
1521
1532
  A = T.replace(E, M + B + z);
1522
1533
  }
1523
1534
  } else
1524
- A = A.replace(E, `${N}${E + oe}`), K && (A = A.replace(E, `${E}${K}`));
1535
+ A = A.replace(E, `${W}${E + oe}`), U && (A = A.replace(E, `${E}${U}`));
1525
1536
  else
1526
- A = E + oe + K;
1537
+ A = E + oe + U;
1527
1538
  A = A.replace(new RegExp(E, "g"), C);
1528
1539
  let O = `${A}{${j}}`;
1529
- const ie = _.filter(($) => le.includes($)), I = ie.length ? ie[ie.length - 1] : null, ve = _.includes("dark");
1530
- return u && I ? O = `@media (prefers-color-scheme: dark) and ${ae[I]}{${O}}` : u ? O = `@media (prefers-color-scheme: dark){${O}}` : ve && I ? O = `@media (prefers-color-scheme: dark) and ${ae[I]}{${O}}` : ve ? O = `@media (prefers-color-scheme: dark){${O}}` : I && (O = `@media ${ae[I]}{${O}}`), O;
1540
+ const ie = _.filter((S) => le.includes(S)), H = ie.length ? ie[ie.length - 1] : null, ve = _.includes("dark");
1541
+ return u && H ? O = `@media (prefers-color-scheme: dark) and ${ae[H]}{${O}}` : u ? O = `@media (prefers-color-scheme: dark){${O}}` : ve && H ? O = `@media (prefers-color-scheme: dark) and ${ae[H]}{${O}}` : ve ? O = `@media (prefers-color-scheme: dark){${O}}` : H && (O = `@media ${ae[H]}{${O}}`), O;
1531
1542
  }
1532
- for (const h of n) {
1533
- const u = c(h), g = u.find(
1543
+ for (const h of o) {
1544
+ const u = l(h), g = u.find(
1534
1545
  (m) => se[m] || ce(m) || ue(m) || fe(m) || G(m)
1535
1546
  );
1536
1547
  if (!g) continue;
1537
- const b = u.indexOf(g), p = b >= 0 ? u.slice(0, b) : [], v = y(p);
1548
+ const b = u.indexOf(g), d = b >= 0 ? u.slice(0, b) : [], v = y(d);
1538
1549
  if (v === 4) {
1539
- const m = d(h, !0);
1540
- m && l.push(m);
1550
+ const m = p(h, !0);
1551
+ m && c.push(m);
1541
1552
  } else {
1542
- const m = d(h);
1553
+ const m = p(h);
1543
1554
  m && (v === 1 ? s.push(m) : v === 2 ? i.push(m) : v === 3 && a.push(m));
1544
1555
  }
1545
1556
  }
1546
- const S = [...s, ...i, ...a, ...l].join("");
1547
- return _e.set(e, { css: S, timestamp: t }), S;
1557
+ const k = [...s, ...i, ...a, ...c].join("");
1558
+ return _e.set(e, { css: k, timestamp: t }), k;
1548
1559
  }
1549
1560
  const J = [];
1550
- function st(e, t, r, o, n, s, i, a) {
1561
+ function at(e, t, r, n, o, s, i, a) {
1551
1562
  if (e) {
1552
1563
  J.push(r);
1553
1564
  try {
1554
1565
  if (t.loadingTemplate && r.isLoading) {
1555
- U(e, t.loadingTemplate(r), r, o, n);
1566
+ F(e, t.loadingTemplate(r), r, n, o);
1556
1567
  return;
1557
1568
  }
1558
1569
  if (t.errorTemplate && r.hasError) {
1559
- r.error instanceof Error && U(e, t.errorTemplate(r.error, r), r, o, n);
1570
+ r.error instanceof Error && F(e, t.errorTemplate(r.error, r), r, n, o);
1560
1571
  return;
1561
1572
  }
1562
- const l = t.render(r);
1563
- if (l instanceof Promise) {
1564
- s(!0), l.then((f) => {
1565
- s(!1), i(null), U(e, f, r, o, n), a(e.innerHTML);
1573
+ const c = t.render(r);
1574
+ if (c instanceof Promise) {
1575
+ s(!0), c.then((f) => {
1576
+ s(!1), i(null), F(e, f, r, n, o), a(e.innerHTML);
1566
1577
  }).catch((f) => {
1567
- s(!1), i(f), t.errorTemplate && U(e, t.errorTemplate(f, r), r, o, n);
1568
- }), t.loadingTemplate && U(e, t.loadingTemplate(r), r, o, n);
1578
+ s(!1), i(f), t.errorTemplate && F(e, t.errorTemplate(f, r), r, n, o);
1579
+ }), t.loadingTemplate && F(e, t.loadingTemplate(r), r, n, o);
1569
1580
  return;
1570
1581
  }
1571
- U(e, l, r, o, n), a(e.innerHTML);
1582
+ F(e, c, r, n, o), a(e.innerHTML);
1572
1583
  } finally {
1573
1584
  J.pop();
1574
1585
  }
1575
1586
  }
1576
1587
  }
1577
- function U(e, t, r, o, n) {
1578
- e && (Ve(
1588
+ function F(e, t, r, n, o) {
1589
+ e && (Je(
1579
1590
  e,
1580
1591
  Array.isArray(t) ? t : [t],
1581
1592
  r,
1582
- o
1583
- ), n(e.innerHTML));
1593
+ n
1594
+ ), o(e.innerHTML));
1584
1595
  }
1585
- function at(e, t, r, o, n, s, i) {
1596
+ function lt(e, t, r, n, o, s, i) {
1586
1597
  if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1587
- if (n(r + 1), r > 10) {
1598
+ if (o(r + 1), r > 10) {
1588
1599
  console.warn("Potential infinite render loop detected. Skipping render."), i(null);
1589
1600
  return;
1590
1601
  }
1591
1602
  } else
1592
- n(0);
1593
- const l = setTimeout(() => {
1594
- o(Date.now()), e(), i(null);
1603
+ o(0);
1604
+ const c = setTimeout(() => {
1605
+ n(Date.now()), e(), i(null);
1595
1606
  }, 0);
1596
- i(l);
1607
+ i(c);
1597
1608
  }
1598
- function lt(e, t, r, o, n, s) {
1609
+ function ct(e, t, r, n, o, s) {
1599
1610
  if (!e) return;
1600
- const i = it(o);
1611
+ const i = st(n);
1601
1612
  if (!t.style && (!i || i.trim() === "")) {
1602
1613
  s(null), e.adoptedStyleSheets = [ke()];
1603
1614
  return;
1604
1615
  }
1605
1616
  let a = "";
1606
1617
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1607
- let l = Je(`${a}
1618
+ let c = Ze(`${a}
1608
1619
  ${i}
1609
1620
  `);
1610
- l = je(l);
1611
- let f = n;
1612
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== l) && f.replaceSync(l), e.adoptedStyleSheets = [ke(), f], s(f);
1621
+ c = Le(c);
1622
+ let f = o;
1623
+ f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [ke(), f], s(f);
1613
1624
  }
1614
1625
  const ye = /* @__PURE__ */ new Map();
1615
1626
  function Ce(e, t, r) {
1616
- let o = me(e);
1617
- o.includes("-") || (o = `cer-${o}`);
1618
- let n;
1619
- if (typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (s, i) => {
1620
- console.error(`[${o}] Error:`, s, i);
1621
- }), ye.set(o, n), typeof window < "u")
1622
- if (!customElements.get(o))
1623
- customElements.define(o, ct(o, n));
1627
+ let n = me(e);
1628
+ n.includes("-") || (n = `cer-${n}`);
1629
+ let o;
1630
+ if (typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
1631
+ console.error(`[${n}] Error:`, s, i);
1632
+ }), ye.set(n, o), typeof window < "u")
1633
+ if (!customElements.get(n))
1634
+ customElements.define(n, ft(n, o));
1624
1635
  else
1625
1636
  try {
1626
- document.querySelectorAll(o).forEach((s) => {
1637
+ document.querySelectorAll(n).forEach((s) => {
1627
1638
  try {
1628
- typeof s._cfg < "u" && (s._cfg = n), typeof s._render == "function" && s._render(n);
1639
+ typeof s._cfg < "u" && (s._cfg = o), typeof s._render == "function" && s._render(o);
1629
1640
  } catch {
1630
1641
  }
1631
1642
  });
1632
1643
  } catch {
1633
1644
  }
1634
1645
  }
1635
- function ct(e, t) {
1646
+ function ft(e, t) {
1636
1647
  if (!t.render)
1637
1648
  throw new Error(
1638
1649
  "Component must have a render function"
@@ -1689,39 +1700,28 @@ function ct(e, t) {
1689
1700
  enumerable: !1,
1690
1701
  configurable: !1
1691
1702
  }), this.context = r, this._applyProps(t), Object.defineProperty(this.context, "emit", {
1692
- value: (n, s, i) => {
1693
- this.dispatchEvent(
1694
- new CustomEvent(n, {
1695
- detail: s,
1696
- bubbles: !0,
1697
- composed: !0,
1698
- ...i || {}
1699
- })
1700
- );
1701
- const a = `on${n.charAt(0).toUpperCase()}${n.slice(1)}`, l = typeof this[a] == "function" ? this[a] : void 0, f = typeof this.context[a] == "function" ? this.context[a] : void 0, d = typeof t[a] == "function" ? t[a] : void 0;
1702
- l && l(s, this.context), f && f !== l && f(s, this.context), d && d !== l && d !== f && d(s, this.context);
1703
+ value: (o, s, i) => {
1704
+ const a = new CustomEvent(o, {
1705
+ detail: s,
1706
+ bubbles: !0,
1707
+ composed: !0,
1708
+ ...i || {}
1709
+ });
1710
+ return this.dispatchEvent(a), !a.defaultPrevented;
1703
1711
  },
1704
1712
  writable: !1,
1705
1713
  enumerable: !1,
1706
1714
  configurable: !1
1707
1715
  });
1708
- const o = ye.get(e) || t;
1709
- Object.keys(o).forEach((n) => {
1710
- const s = o[n];
1711
- if (typeof s == "function" && !n.startsWith("on"))
1712
- this.context[n] = (...i) => s(...i, this.context);
1713
- else if (n.startsWith("on") && n.length > 2 && n[2] === n[2].toUpperCase()) {
1714
- const i = n.slice(2, 3).toLowerCase() + n.slice(3);
1715
- this.addEventListener(i, (a) => {
1716
- const l = typeof this[n] == "function" ? this[n] : this.context[n];
1717
- typeof l == "function" && l(a.detail, this.context);
1718
- });
1719
- }
1720
- }), this._applyComputed(o), this._initializing = !1, this._initWatchers(o), this._render(o);
1716
+ const n = ye.get(e) || t;
1717
+ Object.keys(n).forEach((o) => {
1718
+ const s = n[o];
1719
+ typeof s == "function" && (this.context[o] = (...i) => s(...i, this.context));
1720
+ }), this._applyComputed(n), this._initializing = !1, this._initWatchers(n), this._render(n);
1721
1721
  }
1722
1722
  connectedCallback() {
1723
1723
  this._runLogicWithinErrorBoundary(t, () => {
1724
- Me(
1724
+ Ne(
1725
1725
  t,
1726
1726
  this.context,
1727
1727
  this._mounted,
@@ -1755,13 +1755,13 @@ function ct(e, t) {
1755
1755
  );
1756
1756
  });
1757
1757
  }
1758
- attributeChangedCallback(r, o, n) {
1758
+ attributeChangedCallback(r, n, o) {
1759
1759
  this._runLogicWithinErrorBoundary(t, () => {
1760
- this._applyProps(t), Ne(
1760
+ this._applyProps(t), De(
1761
1761
  t,
1762
1762
  r,
1763
- o,
1764
1763
  n,
1764
+ o,
1765
1765
  this.context
1766
1766
  );
1767
1767
  });
@@ -1771,10 +1771,10 @@ function ct(e, t) {
1771
1771
  }
1772
1772
  _applyComputed(r) {
1773
1773
  this._runLogicWithinErrorBoundary(t, () => {
1774
- r.computed && Object.entries(r.computed).forEach(([o, n]) => {
1775
- Object.defineProperty(this.context, o, {
1774
+ r.computed && Object.entries(r.computed).forEach(([n, o]) => {
1775
+ Object.defineProperty(this.context, n, {
1776
1776
  get: () => {
1777
- const s = n(this.context);
1777
+ const s = o(this.context);
1778
1778
  return pe(s);
1779
1779
  },
1780
1780
  enumerable: !0
@@ -1785,21 +1785,21 @@ function ct(e, t) {
1785
1785
  // --- Render ---
1786
1786
  _render(r) {
1787
1787
  this._runLogicWithinErrorBoundary(r, () => {
1788
- st(
1788
+ at(
1789
1789
  this.shadowRoot,
1790
1790
  r,
1791
1791
  this.context,
1792
1792
  this._refs,
1793
- (o) => {
1794
- this._lastHtmlStringForJitCSS = o, typeof this.onHtmlStringUpdate == "function" && this.onHtmlStringUpdate(o);
1793
+ (n) => {
1794
+ this._lastHtmlStringForJitCSS = n, typeof this.onHtmlStringUpdate == "function" && this.onHtmlStringUpdate(n);
1795
1795
  },
1796
- (o) => {
1797
- this._templateLoading = o, typeof this.onLoadingStateChange == "function" && this.onLoadingStateChange(o);
1796
+ (n) => {
1797
+ this._templateLoading = n, typeof this.onLoadingStateChange == "function" && this.onLoadingStateChange(n);
1798
1798
  },
1799
- (o) => {
1800
- this._templateError = o, typeof this.onErrorStateChange == "function" && this.onErrorStateChange(o);
1799
+ (n) => {
1800
+ this._templateError = n, typeof this.onErrorStateChange == "function" && this.onErrorStateChange(n);
1801
1801
  },
1802
- (o) => this._applyStyle(r, o)
1802
+ (n) => this._applyStyle(r, n)
1803
1803
  );
1804
1804
  });
1805
1805
  }
@@ -1808,7 +1808,7 @@ function ct(e, t) {
1808
1808
  }
1809
1809
  _requestRender() {
1810
1810
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1811
- at(
1811
+ lt(
1812
1812
  () => this._render(this._cfg),
1813
1813
  this._lastRenderTime,
1814
1814
  this._renderCount,
@@ -1826,28 +1826,28 @@ function ct(e, t) {
1826
1826
  });
1827
1827
  }
1828
1828
  // --- Style ---
1829
- _applyStyle(r, o) {
1829
+ _applyStyle(r, n) {
1830
1830
  this._runLogicWithinErrorBoundary(r, () => {
1831
- lt(
1831
+ ct(
1832
1832
  this.shadowRoot,
1833
1833
  r,
1834
1834
  this.context,
1835
- o,
1835
+ n,
1836
1836
  this._styleSheet,
1837
- (n) => {
1838
- this._styleSheet = n;
1837
+ (o) => {
1838
+ this._styleSheet = o;
1839
1839
  }
1840
1840
  );
1841
1841
  });
1842
1842
  }
1843
1843
  // --- Error Boundary function ---
1844
- _runLogicWithinErrorBoundary(r, o) {
1844
+ _runLogicWithinErrorBoundary(r, n) {
1845
1845
  this._hasError && (this._hasError = !1);
1846
1846
  try {
1847
- o();
1848
- } catch (n) {
1849
- this._hasError = !0, r.onError && r.onError(n, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(
1850
- n,
1847
+ n();
1848
+ } catch (o) {
1849
+ this._hasError = !0, r.onError && r.onError(o, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(
1850
+ o,
1851
1851
  this.context
1852
1852
  ));
1853
1853
  }
@@ -1855,11 +1855,11 @@ function ct(e, t) {
1855
1855
  // --- State, props, computed ---
1856
1856
  _initContext(r) {
1857
1857
  try {
1858
- let o = function(s, i = "") {
1858
+ let n = function(s, i = "") {
1859
1859
  return Array.isArray(s) ? new Proxy(s, {
1860
- get(a, l, f) {
1861
- const d = Reflect.get(a, l, f);
1862
- return typeof d == "function" && typeof l == "string" && [
1860
+ get(a, c, f) {
1861
+ const p = Reflect.get(a, c, f);
1862
+ return typeof p == "function" && typeof c == "string" && [
1863
1863
  "push",
1864
1864
  "pop",
1865
1865
  "shift",
@@ -1867,77 +1867,77 @@ function ct(e, t) {
1867
1867
  "splice",
1868
1868
  "sort",
1869
1869
  "reverse"
1870
- ].includes(l) ? function(...c) {
1871
- const w = d.apply(a, c);
1872
- if (!n._initializing) {
1870
+ ].includes(c) ? function(...l) {
1871
+ const w = p.apply(a, l);
1872
+ if (!o._initializing) {
1873
1873
  const x = i || "root";
1874
- n._triggerWatchers(x, a), n._render(r);
1874
+ o._triggerWatchers(x, a), o._render(r);
1875
1875
  }
1876
1876
  return w;
1877
- } : d;
1877
+ } : p;
1878
1878
  },
1879
- set(a, l, f) {
1880
- if (a[l] = f, !n._initializing) {
1881
- const d = i ? `${i}.${String(l)}` : String(l);
1882
- n._triggerWatchers(d, f), n._render(r);
1879
+ set(a, c, f) {
1880
+ if (a[c] = f, !o._initializing) {
1881
+ const p = i ? `${i}.${String(c)}` : String(c);
1882
+ o._triggerWatchers(p, f), o._render(r);
1883
1883
  }
1884
1884
  return !0;
1885
1885
  },
1886
- deleteProperty(a, l) {
1887
- if (delete a[l], !n._initializing) {
1888
- const f = i ? `${i}.${String(l)}` : String(l);
1889
- n._triggerWatchers(f, void 0), n._render(r);
1886
+ deleteProperty(a, c) {
1887
+ if (delete a[c], !o._initializing) {
1888
+ const f = i ? `${i}.${String(c)}` : String(c);
1889
+ o._triggerWatchers(f, void 0), o._render(r);
1890
1890
  }
1891
1891
  return !0;
1892
1892
  }
1893
1893
  }) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
1894
- const l = i ? `${i}.${a}` : a;
1895
- s[a] = o(s[a], l);
1894
+ const c = i ? `${i}.${a}` : a;
1895
+ s[a] = n(s[a], c);
1896
1896
  }), new Proxy(s, {
1897
- set(a, l, f) {
1898
- const d = i ? `${i}.${String(l)}` : String(l);
1899
- return a[l] = o(f, d), n._initializing || (n._triggerWatchers(
1900
- d,
1901
- a[l]
1902
- ), n._render(r)), !0;
1897
+ set(a, c, f) {
1898
+ const p = i ? `${i}.${String(c)}` : String(c);
1899
+ return a[c] = n(f, p), o._initializing || (o._triggerWatchers(
1900
+ p,
1901
+ a[c]
1902
+ ), o._render(r)), !0;
1903
1903
  },
1904
- get(a, l, f) {
1905
- return Reflect.get(a, l, f);
1904
+ get(a, c, f) {
1905
+ return Reflect.get(a, c, f);
1906
1906
  }
1907
1907
  })) : s;
1908
1908
  };
1909
- const n = this;
1910
- return o({ ...r.state });
1909
+ const o = this;
1910
+ return n({ ...r.state });
1911
1911
  } catch {
1912
1912
  return {};
1913
1913
  }
1914
1914
  }
1915
1915
  _initWatchers(r) {
1916
1916
  this._runLogicWithinErrorBoundary(r, () => {
1917
- Re(
1917
+ Pe(
1918
1918
  this.context,
1919
1919
  this._watchers,
1920
1920
  r.watch || {}
1921
1921
  );
1922
1922
  });
1923
1923
  }
1924
- _triggerWatchers(r, o) {
1925
- Pe(this.context, this._watchers, r, o);
1924
+ _triggerWatchers(r, n) {
1925
+ Oe(this.context, this._watchers, r, n);
1926
1926
  }
1927
1927
  _applyProps(r) {
1928
1928
  this._runLogicWithinErrorBoundary(r, () => {
1929
1929
  try {
1930
- Oe(this, r, this.context);
1931
- } catch (o) {
1932
- this._hasError = !0, r.onError && r.onError(o, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(o, this.context));
1930
+ Me(this, r, this.context);
1931
+ } catch (n) {
1932
+ this._hasError = !0, r.onError && r.onError(n, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(n, this.context));
1933
1933
  }
1934
1934
  });
1935
1935
  }
1936
1936
  };
1937
1937
  }
1938
- function V(e, t = {}, r, o) {
1939
- const n = o ?? t.key;
1940
- return { tag: e, key: n, props: t, children: r };
1938
+ function V(e, t = {}, r, n) {
1939
+ const o = n ?? t.key;
1940
+ return { tag: e, key: o, props: t, children: r };
1941
1941
  }
1942
1942
  function ee(e) {
1943
1943
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
@@ -1945,90 +1945,90 @@ function ee(e) {
1945
1945
  function X(e) {
1946
1946
  return typeof e == "object" && e !== null && "tag" in e && !ee(e);
1947
1947
  }
1948
- function ft(e, t) {
1948
+ function ut(e, t) {
1949
1949
  return e.key != null ? e : { ...e, key: t };
1950
1950
  }
1951
- function ut(e, t = [], r = {}) {
1952
- const o = {}, n = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1951
+ function dt(e, t = [], r = {}) {
1952
+ const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1953
1953
  let a;
1954
1954
  for (; a = i.exec(e); ) {
1955
- const l = a[1], f = a[2], d = (a[4] || a[6]) ?? "", y = d.match(/^{{(\d+)}}$/);
1956
- let c = y ? t[Number(y[1])] ?? null : d;
1957
- y || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
1955
+ const c = a[1], f = a[2], p = (a[4] || a[6]) ?? "", y = p.match(/^{{(\d+)}}$/);
1956
+ let l = y ? t[Number(y[1])] ?? null : p;
1957
+ y || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1958
1958
  const w = ["model", "bind", "show", "class", "style"];
1959
- if (l === ":") {
1960
- const [x, ...S] = f.split(".");
1959
+ if (c === ":") {
1960
+ const [x, ...k] = f.split(".");
1961
1961
  if (w.includes(x)) {
1962
- const h = [...S];
1962
+ const h = [...k];
1963
1963
  s[x] = {
1964
- value: c,
1964
+ value: l,
1965
1965
  modifiers: h
1966
1966
  };
1967
1967
  } else
1968
- n[f] = c;
1969
- } else if (l === "@") {
1968
+ o[f] = l;
1969
+ } else if (c === "@") {
1970
1970
  const x = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1971
- o[x] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
1972
- } else f === "ref" ? o.ref = c : n[f] = c;
1971
+ n[x] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1972
+ } else f === "ref" ? n.ref = l : o[f] = l;
1973
1973
  }
1974
- return { props: o, attrs: n, directives: s };
1974
+ return { props: n, attrs: o, directives: s };
1975
1975
  }
1976
- function dt(e, t, r) {
1977
- const o = J.length > 0 ? J[J.length - 1] : void 0, n = r ?? o;
1978
- function s(p, v) {
1979
- return V("#text", {}, p, v);
1976
+ function pt(e, t, r) {
1977
+ const n = J.length > 0 ? J[J.length - 1] : void 0, o = r ?? n;
1978
+ function s(d, v) {
1979
+ return V("#text", {}, d, v);
1980
1980
  }
1981
1981
  let i = "";
1982
- for (let p = 0; p < e.length; p++)
1983
- i += e[p], p < t.length && (i += `{{${p}}}`);
1984
- const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, l = [];
1985
- let f, d = [], y = null, c = {}, w, x = 0, S = [];
1986
- function h(p) {
1987
- !p || typeof p != "object" || ee(p) || (p.props || p.attrs ? (p.props && (c.props || (c.props = {}), Object.assign(c.props, p.props)), p.attrs && (c.attrs || (c.attrs = {}), Object.keys(p.attrs).forEach((v) => {
1988
- if (v === "style" && c.attrs.style) {
1989
- const m = c.attrs.style.replace(
1982
+ for (let d = 0; d < e.length; d++)
1983
+ i += e[d], d < t.length && (i += `{{${d}}}`);
1984
+ const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
1985
+ let f, p = [], y = null, l = {}, w, x = 0, k = [];
1986
+ function h(d) {
1987
+ !d || typeof d != "object" || ee(d) || (d.props || d.attrs ? (d.props && (l.props || (l.props = {}), Object.assign(l.props, d.props)), d.attrs && (l.attrs || (l.attrs = {}), Object.keys(d.attrs).forEach((v) => {
1988
+ if (v === "style" && l.attrs.style) {
1989
+ const m = l.attrs.style.replace(
1990
1990
  /;?\s*$/,
1991
1991
  ""
1992
- ), k = p.attrs.style.replace(/^;?\s*/, "");
1993
- c.attrs.style = m + "; " + k;
1994
- } else if (v === "class" && c.attrs.class) {
1995
- const m = c.attrs.class.trim().split(/\s+/).filter(Boolean), k = p.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1996
- .../* @__PURE__ */ new Set([...m, ...k])
1992
+ ), $ = d.attrs.style.replace(/^;?\s*/, "");
1993
+ l.attrs.style = m + "; " + $;
1994
+ } else if (v === "class" && l.attrs.class) {
1995
+ const m = l.attrs.class.trim().split(/\s+/).filter(Boolean), $ = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1996
+ .../* @__PURE__ */ new Set([...m, ...$])
1997
1997
  ];
1998
- c.attrs.class = _.join(" ");
1998
+ l.attrs.class = _.join(" ");
1999
1999
  } else
2000
- c.attrs[v] = p.attrs[v];
2001
- }))) : (c.props || (c.props = {}), Object.assign(c.props, p)));
2002
- }
2003
- function u(p, v) {
2004
- const m = y ? d : S;
2005
- if (ee(p)) {
2006
- const k = p.key ?? v;
2007
- let _ = p.children;
2000
+ l.attrs[v] = d.attrs[v];
2001
+ }))) : (l.props || (l.props = {}), Object.assign(l.props, d)));
2002
+ }
2003
+ function u(d, v) {
2004
+ const m = y ? p : k;
2005
+ if (ee(d)) {
2006
+ const $ = d.key ?? v;
2007
+ let _ = d.children;
2008
2008
  m.push({
2009
- ...p,
2010
- key: k,
2009
+ ...d,
2010
+ key: $,
2011
2011
  children: _
2012
2012
  });
2013
2013
  return;
2014
2014
  }
2015
- if (X(p)) {
2016
- m.push(ft(p, void 0));
2015
+ if (X(d)) {
2016
+ m.push(ut(d, void 0));
2017
2017
  return;
2018
2018
  }
2019
- if (Array.isArray(p)) {
2020
- if (p.length === 0) return;
2021
- for (let k = 0; k < p.length; k++) {
2022
- const _ = p[k];
2023
- ee(_) || X(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ? h(_) : m.push(s(String(_), `${v}-${k}`));
2019
+ if (Array.isArray(d)) {
2020
+ if (d.length === 0) return;
2021
+ for (let $ = 0; $ < d.length; $++) {
2022
+ const _ = d[$];
2023
+ ee(_) || X(_) || Array.isArray(_) ? u(_, `${v}-${$}`) : _ !== null && typeof _ == "object" ? h(_) : m.push(s(String(_), `${v}-${$}`));
2024
2024
  }
2025
2025
  return;
2026
2026
  }
2027
- if (p !== null && typeof p == "object") {
2028
- h(p);
2027
+ if (d !== null && typeof d == "object") {
2028
+ h(d);
2029
2029
  return;
2030
2030
  }
2031
- m.push(s(String(p), v));
2031
+ m.push(s(String(d), v));
2032
2032
  }
2033
2033
  const g = /* @__PURE__ */ new Set([
2034
2034
  "area",
@@ -2048,64 +2048,64 @@ function dt(e, t, r) {
2048
2048
  ]);
2049
2049
  for (; f = a.exec(i); )
2050
2050
  if (f[1]) {
2051
- const p = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || g.has(p), {
2052
- props: k,
2051
+ const d = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || g.has(d), {
2052
+ props: $,
2053
2053
  attrs: _,
2054
2054
  directives: C
2055
- } = ut(f[2] || "", t, n), E = { props: {}, attrs: {} };
2056
- for (const j in k) E.props[j] = k[j];
2055
+ } = dt(f[2] || "", t, o), E = { props: {}, attrs: {} };
2056
+ for (const j in $) E.props[j] = $[j];
2057
2057
  for (const j in _) E.attrs[j] = _[j];
2058
2058
  if (Object.keys(C).length > 0 && (E.directives = { ...C }), v) {
2059
2059
  const j = V(
2060
2060
  y,
2061
- c,
2062
- d.length === 1 && X(d[0]) && d[0].tag === "#text" ? typeof d[0].children == "string" ? d[0].children : "" : d.length ? d : void 0,
2061
+ l,
2062
+ p.length === 1 && X(p[0]) && p[0].tag === "#text" ? typeof p[0].children == "string" ? p[0].children : "" : p.length ? p : void 0,
2063
2063
  w
2064
- ), A = l.pop();
2065
- A ? (y = A.tag, c = A.props, w = A.key, d = A.children, d.push(j)) : (S.push(j), y = null, c = {}, w = void 0, d = []);
2066
- } else m ? y ? d.push(V(p, E, void 0, void 0)) : S.push(V(p, E, void 0, void 0)) : (y && l.push({
2064
+ ), A = c.pop();
2065
+ A ? (y = A.tag, l = A.props, w = A.key, p = A.children, p.push(j)) : (k.push(j), y = null, l = {}, w = void 0, p = []);
2066
+ } else m ? y ? p.push(V(d, E, void 0, void 0)) : k.push(V(d, E, void 0, void 0)) : (y && c.push({
2067
2067
  tag: y,
2068
- props: c,
2069
- children: d,
2068
+ props: l,
2069
+ children: p,
2070
2070
  key: w
2071
- }), y = p, c = E, d = []);
2071
+ }), y = d, l = E, p = []);
2072
2072
  } else if (typeof f[3] < "u") {
2073
- const p = Number(f[3]), v = t[p], m = `interp-${p}`;
2073
+ const d = Number(f[3]), v = t[d], m = `interp-${d}`;
2074
2074
  u(v, m);
2075
2075
  } else if (f[4]) {
2076
- const p = f[4], v = y ? d : S, m = p.split(/({{\d+}})/);
2077
- for (const k of m) {
2078
- if (!k) continue;
2079
- const _ = k.match(/^{{(\d+)}}$/);
2076
+ const d = f[4], v = y ? p : k, m = d.split(/({{\d+}})/);
2077
+ for (const $ of m) {
2078
+ if (!$) continue;
2079
+ const _ = $.match(/^{{(\d+)}}$/);
2080
2080
  if (_) {
2081
2081
  const C = Number(_[1]), E = t[C], j = `interp-${C}`;
2082
2082
  u(E, j);
2083
2083
  } else {
2084
2084
  const C = `text-${x++}`;
2085
- v.push(s(k, C));
2085
+ v.push(s($, C));
2086
2086
  }
2087
2087
  }
2088
2088
  }
2089
- const b = S.filter((p) => X(p) && p.tag === "#text" ? typeof p.children == "string" && p.children.trim() !== "" : !0);
2089
+ const b = k.filter((d) => X(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2090
2090
  return b.length === 1 ? b[0] : b.length > 1 ? b : V("div", {}, "", "fallback-root");
2091
2091
  }
2092
2092
  function D(e, ...t) {
2093
- const r = t[t.length - 1], o = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2094
- return dt(e, t, o);
2093
+ const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2094
+ return pt(e, t, n);
2095
2095
  }
2096
- const Ee = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, W = (e, t) => {
2096
+ const Ee = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, N = (e, t) => {
2097
2097
  for (const r of e) {
2098
- const o = [], n = r.path.replace(/:[^/]+/g, (a) => (o.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${n}$`), i = t.match(s);
2098
+ const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
2099
2099
  if (i) {
2100
2100
  const a = {};
2101
- return o.forEach((l, f) => {
2102
- a[l] = i[f + 1];
2101
+ return n.forEach((c, f) => {
2102
+ a[c] = i[f + 1];
2103
2103
  }), { route: r, params: a };
2104
2104
  }
2105
2105
  }
2106
2106
  return { route: null, params: {} };
2107
2107
  }, de = {};
2108
- async function pt(e) {
2108
+ async function ht(e) {
2109
2109
  if (e.component) return e.component;
2110
2110
  if (e.load) {
2111
2111
  if (de[e.path]) return de[e.path];
@@ -2118,81 +2118,81 @@ async function pt(e) {
2118
2118
  }
2119
2119
  throw new Error(`No component or loader defined for route: ${e.path}`);
2120
2120
  }
2121
- function ht(e) {
2122
- const { routes: t, base: r = "", initialUrl: o } = e;
2123
- let n, s, i, a, l, f, d;
2124
- const y = async (S, h) => {
2125
- const u = t.find((g) => W([g], S.path).route !== null);
2121
+ function gt(e) {
2122
+ const { routes: t, base: r = "", initialUrl: n } = e;
2123
+ let o, s, i, a, c, f, p;
2124
+ const y = async (k, h) => {
2125
+ const u = t.find((g) => N([g], k.path).route !== null);
2126
2126
  if (u?.beforeEnter)
2127
2127
  try {
2128
- const g = await u.beforeEnter(S, h);
2128
+ const g = await u.beforeEnter(k, h);
2129
2129
  return typeof g == "string" ? (await x(g, !0), !1) : g !== !1;
2130
2130
  } catch (g) {
2131
2131
  return console.error("beforeEnter error", g), !1;
2132
2132
  }
2133
2133
  return !0;
2134
- }, c = async (S, h) => {
2135
- const u = t.find((g) => W([g], S.path).route !== null);
2134
+ }, l = async (k, h) => {
2135
+ const u = t.find((g) => N([g], k.path).route !== null);
2136
2136
  if (u?.onEnter)
2137
2137
  try {
2138
- const g = await u.onEnter(S, h);
2138
+ const g = await u.onEnter(k, h);
2139
2139
  return typeof g == "string" ? (await x(g, !0), !1) : g !== !1;
2140
2140
  } catch (g) {
2141
2141
  return console.error("onEnter error", g), !1;
2142
2142
  }
2143
2143
  return !0;
2144
- }, w = (S, h) => {
2145
- const u = t.find((g) => W([g], S.path).route !== null);
2144
+ }, w = (k, h) => {
2145
+ const u = t.find((g) => N([g], k.path).route !== null);
2146
2146
  if (u?.afterEnter)
2147
2147
  try {
2148
- u.afterEnter(S, h);
2148
+ u.afterEnter(k, h);
2149
2149
  } catch (g) {
2150
2150
  console.error("afterEnter error", g);
2151
2151
  }
2152
- }, x = async (S, h = !1) => {
2152
+ }, x = async (k, h = !1) => {
2153
2153
  try {
2154
2154
  const u = {
2155
- path: S.replace(r, "") || "/",
2155
+ path: k.replace(r, "") || "/",
2156
2156
  query: {}
2157
- }, g = W(t, u.path);
2157
+ }, g = N(t, u.path);
2158
2158
  if (!g) throw new Error(`No route found for ${u.path}`);
2159
- const b = i.getState(), p = {
2159
+ const b = i.getState(), d = {
2160
2160
  path: u.path,
2161
2161
  params: g.params,
2162
2162
  query: u.query
2163
2163
  };
2164
- if (!await y(p, b) || !await c(p, b)) return;
2165
- typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + S) : window.history.pushState({}, "", r + S)), i.setState(p), w(p, b);
2164
+ if (!await y(d, b) || !await l(d, b)) return;
2165
+ typeof window < "u" && typeof document < "u" && (h ? window.history.replaceState({}, "", r + k) : window.history.pushState({}, "", r + k)), i.setState(d), w(d, b);
2166
2166
  } catch (u) {
2167
2167
  console.error("Navigation error:", u);
2168
2168
  }
2169
2169
  };
2170
2170
  if (typeof window < "u" && typeof document < "u") {
2171
- n = () => {
2171
+ o = () => {
2172
2172
  const h = new URL(window.location.href), u = h.pathname.replace(r, "") || "/", g = Ee(h.search);
2173
2173
  return { path: u, query: g };
2174
- }, s = n();
2175
- const S = W(t, s.path);
2174
+ }, s = o();
2175
+ const k = N(t, s.path);
2176
2176
  i = xe({
2177
2177
  path: s.path,
2178
- params: S.params,
2178
+ params: k.params,
2179
2179
  query: s.query
2180
2180
  }), a = async (h = !1) => {
2181
- const u = n();
2181
+ const u = o();
2182
2182
  await x(u.path, h);
2183
- }, window.addEventListener("popstate", () => a(!0)), l = (h) => x(h, !1), f = (h) => x(h, !0), d = () => window.history.back();
2183
+ }, window.addEventListener("popstate", () => a(!0)), c = (h) => x(h, !1), f = (h) => x(h, !0), p = () => window.history.back();
2184
2184
  } else {
2185
- n = () => {
2186
- const u = new URL(o || "/", "http://localhost"), g = u.pathname.replace(r, "") || "/", b = Ee(u.search);
2185
+ o = () => {
2186
+ const u = new URL(n || "/", "http://localhost"), g = u.pathname.replace(r, "") || "/", b = Ee(u.search);
2187
2187
  return { path: g, query: b };
2188
- }, s = n();
2189
- const S = W(t, s.path);
2188
+ }, s = o();
2189
+ const k = N(t, s.path);
2190
2190
  i = xe({
2191
2191
  path: s.path,
2192
- params: S.params,
2192
+ params: k.params,
2193
2193
  query: s.query
2194
2194
  }), a = async () => {
2195
- const u = n();
2195
+ const u = o();
2196
2196
  await h(u.path);
2197
2197
  };
2198
2198
  const h = async (u) => {
@@ -2200,69 +2200,69 @@ function ht(e) {
2200
2200
  const g = {
2201
2201
  path: u.replace(r, "") || "/",
2202
2202
  query: {}
2203
- }, b = W(t, g.path);
2203
+ }, b = N(t, g.path);
2204
2204
  if (!b) throw new Error(`No route found for ${g.path}`);
2205
- const p = i.getState(), v = {
2205
+ const d = i.getState(), v = {
2206
2206
  path: g.path,
2207
2207
  params: b.params,
2208
2208
  query: g.query
2209
- }, m = t.find((k) => W([k], v.path).route !== null);
2209
+ }, m = t.find(($) => N([$], v.path).route !== null);
2210
2210
  if (m?.beforeEnter)
2211
2211
  try {
2212
- const k = await m.beforeEnter(v, p);
2213
- if (typeof k == "string") {
2214
- await h(k);
2212
+ const $ = await m.beforeEnter(v, d);
2213
+ if (typeof $ == "string") {
2214
+ await h($);
2215
2215
  return;
2216
2216
  }
2217
- if (k === !1) return;
2217
+ if ($ === !1) return;
2218
2218
  } catch {
2219
2219
  return;
2220
2220
  }
2221
2221
  if (m?.onEnter)
2222
2222
  try {
2223
- const k = await m.onEnter(v, p);
2224
- if (typeof k == "string") {
2225
- await h(k);
2223
+ const $ = await m.onEnter(v, d);
2224
+ if (typeof $ == "string") {
2225
+ await h($);
2226
2226
  return;
2227
2227
  }
2228
- if (k === !1) return;
2228
+ if ($ === !1) return;
2229
2229
  } catch {
2230
2230
  return;
2231
2231
  }
2232
2232
  if (i.setState(v), m?.afterEnter)
2233
2233
  try {
2234
- m.afterEnter(v, p);
2234
+ m.afterEnter(v, d);
2235
2235
  } catch {
2236
2236
  }
2237
2237
  } catch {
2238
2238
  }
2239
2239
  };
2240
- l = async (u) => h(u), f = async (u) => h(u), d = () => {
2240
+ c = async (u) => h(u), f = async (u) => h(u), p = () => {
2241
2241
  };
2242
2242
  }
2243
2243
  return {
2244
2244
  store: i,
2245
- push: l,
2245
+ push: c,
2246
2246
  replace: f,
2247
- back: d,
2247
+ back: p,
2248
2248
  subscribe: i.subscribe,
2249
- matchRoute: (S) => W(t, S),
2249
+ matchRoute: (k) => N(t, k),
2250
2250
  getCurrent: () => i.getState(),
2251
- resolveRouteComponent: pt
2251
+ resolveRouteComponent: ht
2252
2252
  };
2253
2253
  }
2254
- function kt(e, t) {
2255
- return W(e, t);
2254
+ function $t(e, t) {
2255
+ return N(e, t);
2256
2256
  }
2257
- function $t(e) {
2258
- const t = ht(e);
2257
+ function St(e) {
2258
+ const t = gt(e);
2259
2259
  return Ce("router-view", {
2260
2260
  async render() {
2261
2261
  if (!t) return D`<div>Router not initialized.</div>`;
2262
- const r = t.getCurrent(), { path: o } = r, n = t.matchRoute(o);
2263
- if (!n.route) return D`<div>Not found</div>`;
2262
+ const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
2263
+ if (!o.route) return D`<div>Not found</div>`;
2264
2264
  try {
2265
- const s = await t.resolveRouteComponent(n.route);
2265
+ const s = await t.resolveRouteComponent(o.route);
2266
2266
  if (typeof s == "string")
2267
2267
  return { tag: s, props: {}, children: [] };
2268
2268
  if (typeof s == "function") {
@@ -2292,7 +2292,7 @@ function $t(e) {
2292
2292
  disabled: { type: Boolean, default: !1 },
2293
2293
  external: { type: Boolean, default: !1 },
2294
2294
  class: { type: String, default: "" },
2295
- style: { type: String, default: Te`
2295
+ style: { type: String, default: je`
2296
2296
  [aria-disabled="true"] {
2297
2297
  pointer-events: none;
2298
2298
  opacity: 0.5;
@@ -2301,66 +2301,66 @@ function $t(e) {
2301
2301
  },
2302
2302
  style: (r) => r.style,
2303
2303
  render: (r) => {
2304
- const o = t.getCurrent(), n = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, l = r.ariaCurrentValue, f = r.tag, d = 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}"` : "", S = (r.class || "").split(/\s+/).filter(Boolean), h = {};
2305
- for (const v of S) h[v] = !0;
2304
+ const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, p = r.disabled, y = r.external, l = n.path === o, w = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, x = l ? `aria-current="${c}"` : "", k = (r.class || "").split(/\s+/).filter(Boolean), h = {};
2305
+ for (const v of k) h[v] = !0;
2306
2306
  const u = {
2307
2307
  ...h,
2308
2308
  // Also include the configurable names (may duplicate the above)
2309
2309
  [a]: w,
2310
- [i]: c
2311
- }, g = f === "button", b = d ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", p = y && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2310
+ [i]: l
2311
+ }, g = f === "button", b = p ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", d = y && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2312
2312
  return D`
2313
- ${ze().when(g, D`
2313
+ ${Be().when(g, D`
2314
2314
  <button
2315
2315
  part="button"
2316
2316
  :class="${u}"
2317
2317
  ${x}
2318
2318
  ${b}
2319
- ${p}
2319
+ ${d}
2320
2320
  @click="navigate"
2321
2321
  ><slot></slot></button>
2322
2322
  `).otherwise(D`
2323
2323
  <a
2324
2324
  part="link"
2325
- href="${n}"
2325
+ href="${o}"
2326
2326
  :class="${u}"
2327
2327
  ${x}
2328
2328
  ${b}
2329
- ${p}
2329
+ ${d}
2330
2330
  @click="navigate"
2331
2331
  ><slot></slot></a>
2332
2332
  `).done()}
2333
2333
  `;
2334
2334
  },
2335
- navigate: (r, o) => {
2336
- if (o.disabled) {
2335
+ navigate: (r, n) => {
2336
+ if (n.disabled) {
2337
2337
  r.preventDefault();
2338
2338
  return;
2339
2339
  }
2340
- o.external && (o.tag === "a" || !o.tag) || (r.preventDefault(), o.replace ? t.replace(o.to) : t.push(o.to));
2340
+ n.external && (n.tag === "a" || !n.tag) || (r.preventDefault(), n.replace ? t.replace(n.to) : t.push(n.to));
2341
2341
  }
2342
2342
  }), t;
2343
2343
  }
2344
2344
  export {
2345
- F as GlobalEventBus,
2345
+ K as GlobalEventBus,
2346
2346
  Ce as component,
2347
2347
  xe as createStore,
2348
- Te as css,
2349
- yt as each,
2350
- mt as emit,
2348
+ je as css,
2349
+ mt as each,
2350
+ bt as emit,
2351
2351
  Z as eventBus,
2352
2352
  D as html,
2353
- $t as initRouter,
2354
- wt as listen,
2355
- ze as match,
2356
- W as matchRoute,
2357
- kt as matchRouteSSR,
2358
- vt as off,
2359
- bt as on,
2360
- xt as once,
2353
+ St as initRouter,
2354
+ kt as listen,
2355
+ Be as match,
2356
+ N as matchRoute,
2357
+ $t as matchRouteSSR,
2358
+ xt as off,
2359
+ vt as on,
2360
+ wt as once,
2361
2361
  Ee as parseQuery,
2362
- pt as resolveRouteComponent,
2363
- ht as useRouter,
2364
- gt as when
2362
+ ht as resolveRouteComponent,
2363
+ gt as useRouter,
2364
+ yt as when
2365
2365
  };
2366
2366
  //# sourceMappingURL=custom-elements-runtime.es.js.map