@jasonshimmy/custom-elements-runtime 0.1.19 → 0.1.21

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