@jasonshimmy/custom-elements-runtime 0.1.22 → 0.1.24

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