solely 0.1.0 → 0.1.1

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.
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ var Nt = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
5
  var te = (n, t, e) => t in n ? Xt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
- var L = (n, t, e) => te(n, typeof t != "symbol" ? t + "" : t, e), wt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
7
- var k = (n, t, e) => (wt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), P = (n, t, e) => t.has(n) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), _ = (n, t, e, s) => (wt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), N = (n, t, e) => (wt(n, t, "access private method"), e);
6
+ var L = (n, t, e) => te(n, typeof t != "symbol" ? t + "" : t, e), vt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
7
+ var k = (n, t, e) => (vt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), O = (n, t, e) => t.has(n) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), N = (n, t, e, s) => (vt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), _ = (n, t, e) => (vt(n, t, "access private method"), e);
8
8
  const ee = {
9
9
  dark: {
10
10
  gutter: "#858585",
@@ -16,7 +16,7 @@ const ee = {
16
16
  exprLabel: "#a0a0a0",
17
17
  exprCode: "#5ddcff"
18
18
  }
19
- }, W = ee.dark;
19
+ }, T = ee.dark;
20
20
  function lt(n) {
21
21
  let t = 0;
22
22
  for (let e = 0; e < n.length; ) {
@@ -29,14 +29,14 @@ function lt(n) {
29
29
  }
30
30
  return t;
31
31
  }
32
- function Tt(n, t) {
32
+ function _t(n, t) {
33
33
  return (t ? "~" : "^").repeat(Math.max(1, n));
34
34
  }
35
35
  function ne(n, t = "", e, s = "component") {
36
36
  var I;
37
37
  const r = (n == null ? void 0 : n.message) ?? String(n), i = `%cTemplate Error%c in <${s}> → ${r}`, o = [
38
- `color:${W.badgeFg};background:${W.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
39
- `color:${W.arrow};font-weight:bold;`
38
+ `color:${T.badgeFg};background:${T.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
39
+ `color:${T.arrow};font-weight:bold;`
40
40
  ];
41
41
  if (!t || !(e != null && e.loc) || e.loc.length < 2) {
42
42
  console.error(i, ...o), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
@@ -52,60 +52,60 @@ function ne(n, t = "", e, s = "component") {
52
52
  return;
53
53
  }
54
54
  const h = a - 1, p = Math.max(0, h - 3), v = Math.min(u.length - 1, h + 3), m = String(v + 1).length, d = ((I = e.expr) == null ? void 0 : I.trim()) ?? "", C = d ? d.split(`
55
- `) : [], b = d ? Math.max(...C.map(lt)) : 0, $ = C.length > 1, S = `color:${W.gutter};`, R = `color:${W.arrow};font-weight:bold;`, f = `color:${W.gutter};`, w = `color:${W.errorLineFg};background:${W.errorLineBg};padding:0 4px;`, E = `color:${W.gutter};`, g = `color:${W.arrow};font-weight:bold;padding:0 4px;`;
55
+ `) : [], b = d ? Math.max(...C.map(lt)) : 0, $ = C.length > 1, S = `color:${T.gutter};`, R = `color:${T.arrow};font-weight:bold;`, f = `color:${T.gutter};`, w = `color:${T.errorLineFg};background:${T.errorLineBg};padding:0 4px;`, E = `color:${T.gutter};`, y = `color:${T.arrow};font-weight:bold;padding:0 4px;`;
56
56
  console.groupCollapsed(
57
57
  `${i} %c(Line:${a}, Col:${l})`,
58
58
  ...o,
59
- `color:${W.gutter};font-weight:normal;`
59
+ `color:${T.gutter};font-weight:normal;`
60
60
  );
61
61
  for (let x = p; x <= v; x++) {
62
- const M = u[x], O = String(x + 1).padStart(m, " ");
62
+ const M = u[x], P = String(x + 1).padStart(m, " ");
63
63
  if (!(x === h)) {
64
- console.log(`%c${O} │%c ${M}`, S, f);
64
+ console.log(`%c${P} │%c ${M}`, S, f);
65
65
  continue;
66
66
  }
67
- const j = M.slice(0, Math.max(0, l - 1)), F = lt(j), at = " ".repeat(m + 3), Zt = O.padEnd(m, " ");
67
+ const F = M.slice(0, Math.max(0, l - 1)), D = lt(F), at = " ".repeat(m + 3), Zt = P.padEnd(m, " ");
68
68
  if (console.log(`%c${Zt} │%c ${M}`, R, w), $)
69
69
  for (let B = 0; B < C.length; B++) {
70
- const gt = C[B], et = h + B;
71
- let bt = 0;
70
+ const bt = C[B], et = h + B;
71
+ let wt = 0;
72
72
  if (B === 0)
73
- bt = F;
73
+ wt = D;
74
74
  else if (et < u.length) {
75
75
  const nt = u[et], ct = nt.search(/\S/), Qt = ct === -1 ? nt : nt.slice(0, ct);
76
- bt = lt(Qt);
76
+ wt = lt(Qt);
77
77
  }
78
- const Jt = Math.max(1, lt(gt)), Pt = Tt(Jt, !0), _t = at + " ".repeat(bt);
78
+ const Jt = Math.max(1, lt(bt)), Pt = _t(Jt, !0), Ot = at + " ".repeat(wt);
79
79
  if (B === 0)
80
- console.log(`%c${_t}%c${Pt}`, E, g);
80
+ console.log(`%c${Ot}%c${Pt}`, E, y);
81
81
  else if (et < u.length) {
82
82
  const nt = String(et + 1).padEnd(m, " "), ct = u[et];
83
- console.log(`%c${nt} │%c ${ct}`, R, w), console.log(`%c${_t}%c${Pt}`, E, g);
83
+ console.log(`%c${nt} │%c ${ct}`, R, w), console.log(`%c${Ot}%c${Pt}`, E, y);
84
84
  }
85
85
  }
86
86
  else {
87
- const B = at + " ".repeat(F), gt = Tt(b || 1, !1);
88
- console.log(`%c${B}%c${gt}`, E, g);
87
+ const B = at + " ".repeat(D), bt = _t(b || 1, !1);
88
+ console.log(`%c${B}%c${bt}`, E, y);
89
89
  }
90
90
  }
91
91
  d && console.log(
92
92
  `%cExpression:%c ${d}`,
93
- `color:${W.exprLabel};font-weight:bold;`,
94
- `color:${W.exprCode};font-family:monospace;`
93
+ `color:${T.exprLabel};font-weight:bold;`,
94
+ `color:${T.exprCode};font-family:monospace;`
95
95
  ), console.groupEnd();
96
96
  }
97
- const vt = {};
97
+ const Et = {};
98
98
  function se(n) {
99
99
  const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
100
- if (!vt[t]) {
100
+ if (!Et[t]) {
101
101
  const e = n[n.length - 1];
102
102
  if (e.trim() === "")
103
103
  throw new Error("Function body cannot be empty");
104
104
  if (ie(e))
105
105
  throw new Error("Input contains potentially dangerous code: " + e);
106
- vt[t] = new Function(...n);
106
+ Et[t] = new Function(...n);
107
107
  }
108
- return vt[t];
108
+ return Et[t];
109
109
  }
110
110
  const re = ["eval", "Function", "process", "require"];
111
111
  function ie(n) {
@@ -215,7 +215,7 @@ const he = /* @__PURE__ */ new Set([
215
215
  "ontoggle",
216
216
  "onvolumechange",
217
217
  "onwaiting"
218
- ]), z = (n) => {
218
+ ]), Y = (n) => {
219
219
  if (n === null || typeof n != "object") return !1;
220
220
  const t = Object.prototype.toString.call(n);
221
221
  return ![
@@ -244,7 +244,7 @@ function Ze(n = window.location) {
244
244
  // 查询参数对象
245
245
  };
246
246
  }
247
- var y = /* @__PURE__ */ ((n) => (n[n.Element = 0] = "Element", n[n.Text = 1] = "Text", n[n.Comment = 2] = "Comment", n[n.If = 3] = "If", n[n.ElseIf = 4] = "ElseIf", n[n.Else = 5] = "Else", n[n.For = 6] = "For", n[n.Conditional = 7] = "Conditional", n[n.Other = 99] = "Other", n))(y || {});
247
+ var g = /* @__PURE__ */ ((n) => (n[n.Element = 0] = "Element", n[n.Text = 1] = "Text", n[n.Comment = 2] = "Comment", n[n.If = 3] = "If", n[n.ElseIf = 4] = "ElseIf", n[n.Else = 5] = "Else", n[n.For = 6] = "For", n[n.Conditional = 7] = "Conditional", n[n.Other = 99] = "Other", n))(g || {});
248
248
  const fe = {
249
249
  // 可选别名
250
250
  onMounted: "mounted",
@@ -257,14 +257,14 @@ function de(n) {
257
257
  function pe(n) {
258
258
  return n === "mounted" || n === "updated" || n === "unmounted";
259
259
  }
260
- const xt = Symbol.for("solely.irMeta"), tt = process.env.NODE_ENV !== "production", me = /\{\{.*?\}\}/;
261
- class ye {
260
+ const $t = Symbol.for("solely.irMeta"), tt = process.env.NODE_ENV !== "production", me = /\{\{.*?\}\}/;
261
+ class ge {
262
262
  constructor() {
263
263
  L(this, "compilers", /* @__PURE__ */ new Map());
264
264
  }
265
265
  get(t = "anonymous") {
266
266
  let e = this.compilers.get(t);
267
- return e || (e = new ge(), this.compilers.set(t, e)), e;
267
+ return e || (e = new ye(), this.compilers.set(t, e)), e;
268
268
  }
269
269
  clear(t) {
270
270
  var e;
@@ -276,8 +276,8 @@ class ye {
276
276
  }
277
277
  }
278
278
  }
279
- const Dt = new ye();
280
- class ge {
279
+ const jt = new ge();
280
+ class ye {
281
281
  constructor() {
282
282
  L(this, "cache", /* @__PURE__ */ new Map());
283
283
  L(this, "functions", []);
@@ -319,8 +319,8 @@ function Vt(n) {
319
319
  function be(n) {
320
320
  return n ? me.test(n) : !1;
321
321
  }
322
- function $t(n, t, e) {
323
- tt && (n[xt] = { expr: t ?? "", loc: e ?? null });
322
+ function St(n, t, e) {
323
+ tt && (n[$t] = { expr: t ?? "", loc: e ?? null });
324
324
  }
325
325
  function we(n) {
326
326
  if (!n.attrs) return;
@@ -378,7 +378,7 @@ function ft(n, t, e, s = null) {
378
378
  const { key: o, value: c, role: a } = i, { isDynamic: l, type: u } = Vt(o);
379
379
  if (l && u) {
380
380
  const h = e.compile(u, c ?? "", t), p = { key: o, fid: h, dynamic: 1, role: a };
381
- $t(p, c, i.loc ?? n.loc), r.push(p);
381
+ St(p, c, i.loc ?? n.loc), r.push(p);
382
382
  } else
383
383
  r.push({ key: o, value: c, dynamic: 0, role: a });
384
384
  }
@@ -388,32 +388,32 @@ function ve(n, t, e) {
388
388
  var i, o, c, a, l, u;
389
389
  const s = { type: n.type, dynamic: 0 };
390
390
  let r = !1;
391
- switch (n.type === y.Text ? be(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((h) => h.key === "s-model" || Vt(h.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
392
- case y.Text: {
391
+ switch (n.type === g.Text ? be(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((h) => h.key === "s-model" || Vt(h.key).isDynamic) && (r = !0), n.type === g.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
392
+ case g.Text: {
393
393
  const h = n.content ?? "";
394
- r ? (s.fid = e.compile("template", h, t), $t(s, h, n.loc)) : s.txt = h;
394
+ r ? (s.fid = e.compile("template", h, t), St(s, h, n.loc)) : s.txt = h;
395
395
  break;
396
396
  }
397
- case y.Element: {
397
+ case g.Element: {
398
398
  s.tag = n.tag, we(n), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
399
399
  break;
400
400
  }
401
- case y.For: {
401
+ case g.For: {
402
402
  const h = (o = n.attrs) == null ? void 0 : o.find((d) => d.key === "each"), p = (h == null ? void 0 : h.value) ?? "";
403
- s.fid = e.compile("expression", p, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((u = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "index")) == null ? void 0 : u.value) ?? "index", $t(s, p, (h == null ? void 0 : h.loc) ?? n.loc);
403
+ s.fid = e.compile("expression", p, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((u = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "index")) == null ? void 0 : u.value) ?? "index", St(s, p, (h == null ? void 0 : h.loc) ?? n.loc);
404
404
  const v = /* @__PURE__ */ new Set(["each", "item", "index"]);
405
405
  s.attrs = ft(n, t, e, v);
406
406
  const m = [...t, { item: s.item, index: s.index }];
407
407
  n.children && (s.children = st(n.children, m, e));
408
408
  break;
409
409
  }
410
- case y.If:
411
- case y.ElseIf:
412
- case y.Else: {
413
- tt && console.warn(`[IR] Orphaned conditional node found: ${y[n.type]}`), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
410
+ case g.If:
411
+ case g.ElseIf:
412
+ case g.Else: {
413
+ tt && console.warn(`[IR] Orphaned conditional node found: ${g[n.type]}`), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
414
414
  break;
415
415
  }
416
- case y.Comment: {
416
+ case g.Comment: {
417
417
  s.txt = n.content ?? "";
418
418
  break;
419
419
  }
@@ -426,15 +426,15 @@ function st(n, t, e) {
426
426
  let r = 0;
427
427
  for (; r < n.length; ) {
428
428
  const o = n[r];
429
- if (o.type === y.If) {
429
+ if (o.type === g.If) {
430
430
  const c = [];
431
431
  let a = r;
432
432
  for (; a < n.length; ) {
433
433
  const l = n[a], u = l.type;
434
- if (u !== y.If && u !== y.ElseIf && u !== y.Else)
434
+ if (u !== g.If && u !== g.ElseIf && u !== g.Else)
435
435
  break;
436
436
  let h = null, p = "";
437
- if (u !== y.Else) {
437
+ if (u !== g.Else) {
438
438
  const C = (i = l.attrs) == null ? void 0 : i.find(
439
439
  (b) => b.key === "test" || b.key === "condition"
440
440
  );
@@ -445,14 +445,14 @@ function st(n, t, e) {
445
445
  condFid: h,
446
446
  children: v,
447
447
  attrs: d.length > 0 ? d : void 0,
448
- [xt]: tt ? { expr: p, loc: l.loc } : void 0
449
- }), a++, u === y.Else) break;
448
+ [$t]: tt ? { expr: p, loc: l.loc } : void 0
449
+ }), a++, u === g.Else) break;
450
450
  }
451
451
  s.push({
452
- type: y.Conditional,
452
+ type: g.Conditional,
453
453
  dynamic: 1,
454
454
  branches: c,
455
- ...tt && { [xt]: { loc: o.loc } }
455
+ ...tt && { [$t]: { loc: o.loc } }
456
456
  }), r = a;
457
457
  } else
458
458
  s.push(ve(o, t, e)), r++;
@@ -460,7 +460,7 @@ function st(n, t, e) {
460
460
  return s;
461
461
  }
462
462
  function Ee(n, t = {}) {
463
- const { filename: e = "anonymous", source: s } = t, r = Dt.get(e);
463
+ const { filename: e = "anonymous", source: s } = t, r = jt.get(e);
464
464
  r.clear();
465
465
  const i = performance.now(), o = st(n, [], r), c = performance.now(), a = r.getStats(), l = o.filter((h) => h.dynamic === 1).length, u = {
466
466
  type: "root",
@@ -487,7 +487,7 @@ function Ee(n, t = {}) {
487
487
  ), u;
488
488
  }
489
489
  function Je(n) {
490
- Dt.clear(n);
490
+ jt.clear(n);
491
491
  }
492
492
  const xe = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, $e = /* @__PURE__ */ new Set([
493
493
  "area",
@@ -545,11 +545,11 @@ function Ce(n, t) {
545
545
  const e = ((o = (n.match(xe) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", s = ke(n, t);
546
546
  return {
547
547
  type: {
548
- for: y.For,
549
- if: y.If,
550
- elseif: y.ElseIf,
551
- else: y.Else
552
- }[e] ?? y.Element,
548
+ for: g.For,
549
+ if: g.If,
550
+ elseif: g.ElseIf,
551
+ else: g.Else
552
+ }[e] ?? g.Element,
553
553
  tag: e,
554
554
  loc: t,
555
555
  children: [],
@@ -609,7 +609,7 @@ function Le(n) {
609
609
  if (R) {
610
610
  const f = S.indexOf(R), w = i + f, E = a(w);
611
611
  r().push({
612
- type: y.Text,
612
+ type: g.Text,
613
613
  tag: "text",
614
614
  content: R,
615
615
  loc: E,
@@ -623,7 +623,7 @@ function Le(n) {
623
623
  if (u === -1) {
624
624
  const S = n.substring(i);
625
625
  S.trim() && r().push({
626
- type: y.Text,
626
+ type: g.Text,
627
627
  tag: "text",
628
628
  content: S.trim(),
629
629
  children: [],
@@ -634,7 +634,7 @@ function Le(n) {
634
634
  const h = n.substring(i, u + 1), p = r(), v = a(i);
635
635
  if (h.startsWith("<!--")) {
636
636
  p.push({
637
- type: y.Comment,
637
+ type: g.Comment,
638
638
  tag: "comment",
639
639
  content: h.slice(4, -3),
640
640
  loc: v,
@@ -644,7 +644,7 @@ function Le(n) {
644
644
  }
645
645
  if (h.startsWith("<![CDATA[")) {
646
646
  p.push({
647
- type: y.Text,
647
+ type: g.Text,
648
648
  tag: "text",
649
649
  content: h.slice(9, -3),
650
650
  loc: v,
@@ -654,7 +654,7 @@ function Le(n) {
654
654
  }
655
655
  if (h.startsWith("<!") && !h.startsWith("<!--")) {
656
656
  p.push({
657
- type: y.Comment,
657
+ type: g.Comment,
658
658
  tag: "comment",
659
659
  content: h.slice(2, -1),
660
660
  loc: v,
@@ -664,7 +664,7 @@ function Le(n) {
664
664
  }
665
665
  if (h.startsWith("<?")) {
666
666
  p.push({
667
- type: y.Comment,
667
+ type: g.Comment,
668
668
  tag: "comment",
669
669
  content: h.slice(2, -2),
670
670
  loc: v,
@@ -692,7 +692,7 @@ function Le(n) {
692
692
  if (R !== -1) {
693
693
  const f = n.substring(u + 1, R);
694
694
  f.length && m.children.push({
695
- type: y.Text,
695
+ type: g.Text,
696
696
  tag: "text",
697
697
  content: f,
698
698
  loc: a(u + 1),
@@ -702,7 +702,7 @@ function Le(n) {
702
702
  } else {
703
703
  const f = n.substring(u + 1);
704
704
  f.length && m.children.push({
705
- type: y.Text,
705
+ type: g.Text,
706
706
  tag: "text",
707
707
  content: f,
708
708
  loc: a(u + 1),
@@ -711,7 +711,7 @@ function Le(n) {
711
711
  continue;
712
712
  }
713
713
  }
714
- !$ && m.type !== y.Text && m.type !== y.Comment && (e.push(m), s.push(d)), i = u + 1;
714
+ !$ && m.type !== g.Text && m.type !== g.Comment && (e.push(m), s.push(d)), i = u + 1;
715
715
  }
716
716
  return t;
717
717
  }
@@ -723,7 +723,7 @@ function Bt(n) {
723
723
  function Ae(n) {
724
724
  return !!(n && n[pt]);
725
725
  }
726
- const St = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
726
+ const kt = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
727
727
  if (n === t) return !0;
728
728
  if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
729
729
  if (Array.isArray(n) && Array.isArray(t)) {
@@ -731,7 +731,7 @@ const St = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
731
731
  if (e.has(n)) return e.get(n) === t;
732
732
  e.set(n, t);
733
733
  for (let r = 0; r < n.length; r++)
734
- if (!St(n[r], t[r], e)) return !1;
734
+ if (!kt(n[r], t[r], e)) return !1;
735
735
  return !0;
736
736
  }
737
737
  if (Array.isArray(n) !== Array.isArray(t)) return !1;
@@ -740,7 +740,7 @@ const St = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
740
740
  const s = Reflect.ownKeys(n);
741
741
  if (s.length !== Reflect.ownKeys(t).length) return !1;
742
742
  for (const r of s)
743
- if (!Reflect.has(t, r) || !St(n[r], t[r], e)) return !1;
743
+ if (!Reflect.has(t, r) || !kt(n[r], t[r], e)) return !1;
744
744
  return !0;
745
745
  };
746
746
  function Ie(n, t, e = {}) {
@@ -751,95 +751,95 @@ function Ie(n, t, e = {}) {
751
751
  const w = f.map(String).join(".");
752
752
  return m.some((E) => {
753
753
  if (E === "") return !0;
754
- const g = E.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
755
- return new RegExp(`^${g}$`).test(w);
754
+ const y = E.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
755
+ return new RegExp(`^${y}$`).test(w);
756
756
  });
757
757
  }, C = (f) => {
758
758
  const w = [];
759
759
  let E = f;
760
760
  for (; E; ) {
761
- const g = p.get(E);
762
- if (!g || g.key == null) break;
763
- w.unshift(g.key), E = g.parent;
761
+ const y = p.get(E);
762
+ if (!y || y.key == null) break;
763
+ w.unshift(y.key), E = y.parent;
764
764
  }
765
765
  return w;
766
766
  }, b = (f, w) => {
767
767
  if (!c) return;
768
768
  const E = C(f);
769
769
  if (!d(E)) return;
770
- const g = { ...w, path: E };
771
- s > 0 ? (l.push(g), a || (a = setTimeout(() => {
770
+ const y = { ...w, path: E };
771
+ s > 0 ? (l.push(y), a || (a = setTimeout(() => {
772
772
  const I = [...l];
773
773
  l = [], a = null, c && (r == null || r(I), I.forEach(t));
774
- }, s))) : (r == null || r([g]), t(g));
774
+ }, s))) : (r == null || r([y]), t(y));
775
775
  }, $ = (f, w) => {
776
776
  const E = {};
777
- return ["push", "pop", "shift", "unshift", "splice"].forEach((g) => {
778
- E[g] = function(...I) {
777
+ return ["push", "pop", "shift", "unshift", "splice"].forEach((y) => {
778
+ E[y] = function(...I) {
779
779
  u++;
780
- const x = f[g].apply(f, I);
781
- if (u--, g === "push")
780
+ const x = f[y].apply(f, I);
781
+ if (u--, y === "push")
782
782
  b(w, { type: "array-push", index: f.length - I.length, values: I });
783
- else if (g === "unshift")
783
+ else if (y === "unshift")
784
784
  b(w, { type: "array-push", index: 0, values: I });
785
- else if (g === "pop")
785
+ else if (y === "pop")
786
786
  b(w, { type: "array-splice", index: f.length, deleteCount: 1, insert: [] });
787
- else if (g === "shift")
787
+ else if (y === "shift")
788
788
  b(w, { type: "array-splice", index: 0, deleteCount: 1, insert: [] });
789
- else if (g === "splice") {
790
- const [M, O, ...T] = I;
791
- b(w, { type: "array-splice", index: M, deleteCount: O, insert: T });
789
+ else if (y === "splice") {
790
+ const [M, P, ...W] = I;
791
+ b(w, { type: "array-splice", index: M, deleteCount: P, insert: W });
792
792
  }
793
793
  return x;
794
794
  };
795
- }), ["sort", "reverse", "fill", "copyWithin"].forEach((g) => {
796
- E[g] = function(...I) {
795
+ }), ["sort", "reverse", "fill", "copyWithin"].forEach((y) => {
796
+ E[y] = function(...I) {
797
797
  u++;
798
- const x = f[g].apply(f, I);
799
- return u--, b(w, { type: "array-reset", method: g }), x;
798
+ const x = f[y].apply(f, I);
799
+ return u--, b(w, { type: "array-reset", method: y }), x;
800
800
  };
801
- }), ["indexOf", "lastIndexOf", "includes"].forEach((g) => {
802
- E[g] = function(I, ...x) {
803
- let M = f[g].apply(f, [I, ...x]);
804
- return (M === -1 || M === !1) && Ae(I) && (M = f[g].apply(f, [Bt(I), ...x])), M;
801
+ }), ["indexOf", "lastIndexOf", "includes"].forEach((y) => {
802
+ E[y] = function(I, ...x) {
803
+ let M = f[y].apply(f, [I, ...x]);
804
+ return (M === -1 || M === !1) && Ae(I) && (M = f[y].apply(f, [Bt(I), ...x])), M;
805
805
  };
806
806
  }), E;
807
807
  }, S = (f, w, E) => {
808
808
  if (!Object.isExtensible(f) || f[pt])
809
809
  return f;
810
- const g = h.get(f);
811
- if (g)
812
- return p.set(g, { parent: w, key: E }), g;
810
+ const y = h.get(f);
811
+ if (y)
812
+ return p.set(y, { parent: w, key: E }), y;
813
813
  const I = {
814
- get(M, O, T) {
815
- if (O === pt) return M;
814
+ get(M, P, W) {
815
+ if (P === pt) return M;
816
816
  if (Array.isArray(M)) {
817
- const F = v.get(x);
818
- if (F && Object.prototype.hasOwnProperty.call(F, O))
819
- return Reflect.get(F, O, T);
817
+ const D = v.get(x);
818
+ if (D && Object.prototype.hasOwnProperty.call(D, P))
819
+ return Reflect.get(D, P, W);
820
820
  }
821
- const j = Reflect.get(M, O, T);
822
- return typeof O == "symbol" ? j : z(j) ? S(j, x, O) : j;
821
+ const F = Reflect.get(M, P, W);
822
+ return typeof P == "symbol" ? F : Y(F) ? S(F, x, P) : F;
823
823
  },
824
- set(M, O, T, j) {
825
- const F = M[O];
826
- if (o ? St(F, T) : F === T) return !0;
827
- const at = Reflect.set(M, O, T, j);
828
- return u === 0 && (Array.isArray(F) && Array.isArray(T) ? b(x, { type: "array-replace", oldValue: F, newValue: T }) : b(x, { type: "set", key: O, newValue: T, oldValue: F })), at;
824
+ set(M, P, W, F) {
825
+ const D = M[P];
826
+ if (o ? kt(D, W) : D === W) return !0;
827
+ const at = Reflect.set(M, P, W, F);
828
+ return u === 0 && (Array.isArray(D) && Array.isArray(W) ? b(x, { type: "array-replace", oldValue: D, newValue: W }) : b(x, { type: "set", key: P, newValue: W, oldValue: D })), at;
829
829
  },
830
- deleteProperty(M, O) {
831
- if (!Reflect.has(M, O)) return !1;
832
- const T = M[O], j = Reflect.deleteProperty(M, O);
833
- return j && u === 0 && b(x, { type: "delete", key: O, oldValue: T }), j;
830
+ deleteProperty(M, P) {
831
+ if (!Reflect.has(M, P)) return !1;
832
+ const W = M[P], F = Reflect.deleteProperty(M, P);
833
+ return F && u === 0 && b(x, { type: "delete", key: P, oldValue: W }), F;
834
834
  }
835
835
  }, x = new Proxy(f, I);
836
836
  return h.set(f, x), p.set(x, { parent: w, key: E }), Array.isArray(f) && v.set(x, $(f, x)), x;
837
837
  }, R = S(n, null, null);
838
838
  if (i) {
839
- const f = (w, E, g = /* @__PURE__ */ new WeakSet()) => {
840
- !z(w) || g.has(w) || (g.add(w), Reflect.ownKeys(w).forEach((I) => {
839
+ const f = (w, E, y = /* @__PURE__ */ new WeakSet()) => {
840
+ !Y(w) || y.has(w) || (y.add(w), Reflect.ownKeys(w).forEach((I) => {
841
841
  const x = w[I];
842
- b(E, { type: "set", key: I, newValue: x, oldValue: void 0 }), z(x) && f(x, S(x, E, I), g);
842
+ b(E, { type: "set", key: I, newValue: x, oldValue: void 0 }), Y(x) && f(x, S(x, E, I), y);
843
843
  }));
844
844
  };
845
845
  f(n, R);
@@ -855,35 +855,35 @@ function Ie(n, t, e = {}) {
855
855
  };
856
856
  }
857
857
  const Wt = Symbol.for("solely.manifest");
858
- var q, H, Z, rt, J, K, Q, X, Y, it, ot, U, A, kt, qt, Ct, Rt, dt, Kt, Yt, Lt, Ot;
859
- const D = class D extends HTMLElement {
858
+ var q, H, Z, rt, J, G, Q, X, K, it, ot, z, A, Ct, qt, Rt, Lt, dt, Gt, Kt, At, Mt;
859
+ const j = class j extends HTMLElement {
860
860
  /* -------------------- 构造 -------------------- */
861
861
  constructor(e = {}) {
862
862
  var r;
863
863
  super();
864
- P(this, A);
865
- P(this, q);
866
- P(this, H);
867
- P(this, Z);
868
- P(this, rt);
869
- P(this, J);
870
- P(this, K);
871
- P(this, Q, !1);
872
- P(this, X, !1);
873
- P(this, Y, !1);
874
- P(this, it, !1);
875
- _(this, q, this.constructor[Wt] || {});
864
+ O(this, A);
865
+ O(this, q);
866
+ O(this, H);
867
+ O(this, Z);
868
+ O(this, rt);
869
+ O(this, J);
870
+ O(this, G);
871
+ O(this, Q, !1);
872
+ O(this, X, !1);
873
+ O(this, K, !1);
874
+ O(this, it, !1);
875
+ N(this, q, this.constructor[Wt] || {});
876
876
  const s = k(this, q);
877
- _(this, J, (r = s.shadowDOM) != null && r.use ? this.attachShadow({ mode: s.shadowDOM.mode || "open" }) : this), N(this, A, kt).call(this, e), N(this, A, qt).call(this, s), queueMicrotask(() => N(this, A, Lt).call(this));
877
+ N(this, J, (r = s.shadowDOM) != null && r.use ? this.attachShadow({ mode: s.shadowDOM.mode || "open" }) : this), _(this, A, Ct).call(this, e), _(this, A, qt).call(this, s), queueMicrotask(() => _(this, A, At).call(this));
878
878
  }
879
879
  static get observedAttributes() {
880
- if (k(D, U).has(this))
881
- return k(D, U).get(this);
880
+ if (k(j, z).has(this))
881
+ return k(j, z).get(this);
882
882
  const e = this[Wt];
883
883
  if (!(e != null && e.props))
884
- return k(D, U).set(this, []), [];
884
+ return k(j, z).set(this, []), [];
885
885
  const s = e.props.map((r) => (typeof r == "string" ? r : r.name).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase());
886
- return k(D, U).set(this, s), s;
886
+ return k(j, z).set(this, s), s;
887
887
  }
888
888
  /* -------------------- $data -------------------- */
889
889
  get $data() {
@@ -891,28 +891,28 @@ const D = class D extends HTMLElement {
891
891
  }
892
892
  set $data(e) {
893
893
  var s;
894
- z(e) || (e = {}), (s = k(this, K)) == null || s.call(this), N(this, A, kt).call(this, e), N(this, A, dt).call(this);
894
+ Y(e) || (e = {}), (s = k(this, G)) == null || s.call(this), _(this, A, Ct).call(this, e), _(this, A, dt).call(this);
895
895
  }
896
896
  refresh() {
897
- N(this, A, dt).call(this);
897
+ _(this, A, dt).call(this);
898
898
  }
899
899
  /* -------------------- 生命周期 -------------------- */
900
900
  connectedCallback() {
901
901
  var r;
902
- N(this, A, Lt).call(this);
902
+ _(this, A, At).call(this);
903
903
  const e = k(this, q);
904
- if ((e.className || e.tagName || "").split(" ").forEach((i) => i && this.classList.add(i)), N(this, A, Yt).call(this), e.props && z(this.$data))
904
+ if ((e.className || e.tagName || "").split(" ").forEach((i) => i && this.classList.add(i)), _(this, A, Kt).call(this), e.props && Y(this.$data))
905
905
  for (const i of e.props) {
906
- const o = typeof i == "string" ? i : i.name, c = N(this, A, Ct).call(this, o), a = o.replace(
906
+ const o = typeof i == "string" ? i : i.name, c = _(this, A, Rt).call(this, o), a = o.replace(
907
907
  /-([a-z])/g,
908
908
  (l, u) => u.toUpperCase()
909
909
  );
910
910
  if (this.hasAttribute(o)) {
911
- const l = this.getAttribute(o), u = N(this, A, Rt).call(this, l, c == null ? void 0 : c.default, c == null ? void 0 : c.type);
911
+ const l = this.getAttribute(o), u = _(this, A, Lt).call(this, l, c == null ? void 0 : c.default, c == null ? void 0 : c.type);
912
912
  this.$data[a] = u;
913
913
  } else c && "default" in c && (this.$data[a] = c.default);
914
914
  }
915
- k(this, Z) && _(this, H, qe(
915
+ k(this, Z) && N(this, H, qe(
916
916
  k(this, Z),
917
917
  k(this, J),
918
918
  this
@@ -920,12 +920,12 @@ const D = class D extends HTMLElement {
920
920
  }
921
921
  disconnectedCallback() {
922
922
  var e;
923
- this.unmounted(), (e = k(this, K)) == null || e.call(this), _(this, K, void 0);
923
+ this.unmounted(), (e = k(this, G)) == null || e.call(this), N(this, G, void 0);
924
924
  }
925
925
  attributeChangedCallback(e, s, r) {
926
- if (s === r || !z(this.$data)) return;
927
- const i = N(this, A, Ct).call(this, e), o = e.replace(/-([a-z])/g, (l, u) => u.toUpperCase()), c = this.$data[o], a = N(this, A, Rt).call(this, r, (i == null ? void 0 : i.default) ?? c, i == null ? void 0 : i.type);
928
- this.$data[o] = a, _(this, Y, !0), this.attributeChanged(e, c, a), this.emit("change", {
926
+ if (s === r || !Y(this.$data)) return;
927
+ const i = _(this, A, Rt).call(this, e), o = e.replace(/-([a-z])/g, (l, u) => u.toUpperCase()), c = this.$data[o], a = _(this, A, Lt).call(this, r, (i == null ? void 0 : i.default) ?? c, i == null ? void 0 : i.type);
928
+ this.$data[o] = a, N(this, K, !0), this.attributeChanged(e, c, a), this.emit("change", {
929
929
  source: "attribute",
930
930
  name: e,
931
931
  oldValue: c,
@@ -963,26 +963,26 @@ const D = class D extends HTMLElement {
963
963
  afterAttributesUpdate() {
964
964
  }
965
965
  };
966
- q = new WeakMap(), H = new WeakMap(), Z = new WeakMap(), rt = new WeakMap(), J = new WeakMap(), K = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), U = new WeakMap(), A = new WeakSet(), /* -------------------- 初始化 -------------------- */
967
- kt = function(e) {
966
+ q = new WeakMap(), H = new WeakMap(), Z = new WeakMap(), rt = new WeakMap(), J = new WeakMap(), G = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), K = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), z = new WeakMap(), A = new WeakSet(), /* -------------------- 初始化 -------------------- */
967
+ Ct = function(e) {
968
968
  const { proxy: s, unobserve: r } = Ie(e, (i) => {
969
969
  this.emit("change", {
970
970
  source: "state",
971
971
  ...i
972
- }), N(this, A, dt).call(this);
972
+ }), _(this, A, dt).call(this);
973
973
  });
974
- _(this, rt, s), _(this, K, r);
974
+ N(this, rt, s), N(this, G, r);
975
975
  }, qt = function(e) {
976
976
  const s = e.template;
977
977
  if (typeof s == "string") {
978
978
  const r = Le(s);
979
- _(this, Z, Ee(r, {
979
+ N(this, Z, Ee(r, {
980
980
  source: s,
981
981
  filename: e.tagName
982
982
  }));
983
983
  }
984
984
  }, /* -------------------- Prop 工具 -------------------- */
985
- Ct = function(e) {
985
+ Rt = function(e) {
986
986
  const s = k(this, q).props;
987
987
  if (!s) return;
988
988
  const r = e.replace(/-([a-z])/g, (o, c) => c.toUpperCase()), i = s.find(
@@ -990,7 +990,7 @@ Ct = function(e) {
990
990
  );
991
991
  if (i)
992
992
  return typeof i == "string" ? { name: i } : i;
993
- }, Rt = function(e, s, r) {
993
+ }, Lt = function(e, s, r) {
994
994
  if (e === null) return s;
995
995
  switch (r) {
996
996
  case "number": {
@@ -1010,19 +1010,19 @@ Ct = function(e) {
1010
1010
  }
1011
1011
  }, /* -------------------- 刷新调度 -------------------- */
1012
1012
  dt = function() {
1013
- k(this, X) || !k(this, H) || (_(this, X, !0), queueMicrotask(() => {
1014
- _(this, X, !1), N(this, A, Kt).call(this);
1013
+ k(this, X) || !k(this, H) || (N(this, X, !0), queueMicrotask(() => {
1014
+ N(this, X, !1), _(this, A, Gt).call(this);
1015
1015
  }));
1016
+ }, Gt = function() {
1017
+ k(this, Q) || !this.isConnected || (N(this, Q, !0), k(this, K) && this.beforeAttributesUpdate(), this.beforeUpdate(), k(this, H).update(), this.updated(), k(this, K) && (this.afterAttributesUpdate(), N(this, K, !1)), N(this, Q, !1));
1016
1018
  }, Kt = function() {
1017
- k(this, Q) || !this.isConnected || (_(this, Q, !0), k(this, Y) && this.beforeAttributesUpdate(), this.beforeUpdate(), k(this, H).update(), this.updated(), k(this, Y) && (this.afterAttributesUpdate(), _(this, Y, !1)), _(this, Q, !1));
1018
- }, Yt = function() {
1019
1019
  const s = k(this, q).styles;
1020
1020
  if (!s) return;
1021
1021
  const r = k(this, J);
1022
1022
  if ("adoptedStyleSheets" in r) {
1023
1023
  if (r._styleInjected) return;
1024
- let o = k(D, ot).get(s);
1025
- o || (o = new CSSStyleSheet(), o.replaceSync(s), k(D, ot).set(s, o)), r.adoptedStyleSheets = [
1024
+ let o = k(j, ot).get(s);
1025
+ o || (o = new CSSStyleSheet(), o.replaceSync(s), k(j, ot).set(s, o)), r.adoptedStyleSheets = [
1026
1026
  ...r.adoptedStyleSheets,
1027
1027
  o
1028
1028
  ], r._styleInjected = !0;
@@ -1032,73 +1032,68 @@ dt = function() {
1032
1032
  const i = document.createElement("style");
1033
1033
  i.dataset.manifestStyle = "true", i.textContent = s, r.appendChild(i);
1034
1034
  }, /* -------------------- created 保障 -------------------- */
1035
- Lt = function() {
1036
- k(this, it) || (_(this, it, !0), this.created());
1037
- }, Ot = new WeakMap(), P(D, ot, /* @__PURE__ */ new Map()), /* -------------------- observedAttributes -------------------- */
1038
- P(D, U, /* @__PURE__ */ new WeakMap()), /* -------------------- DEV define 保护 -------------------- */
1039
- P(D, Ot, !1);
1040
- let mt = D;
1041
- const Me = Symbol.for("solely.manifest"), Ut = (n) => (t) => {
1035
+ At = function() {
1036
+ k(this, it) || (N(this, it, !0), this.created());
1037
+ }, Mt = new WeakMap(), O(j, ot, /* @__PURE__ */ new Map()), /* -------------------- observedAttributes -------------------- */
1038
+ O(j, z, /* @__PURE__ */ new WeakMap()), /* -------------------- DEV define 保护 -------------------- */
1039
+ O(j, Mt, !1);
1040
+ let mt = j;
1041
+ const Me = Symbol.for("solely.manifest"), zt = (n) => (t) => {
1042
1042
  if (customElements.get(n.tagName))
1043
1043
  return console.warn(`标签名称 "${n.tagName}" 已经被注册`), t;
1044
1044
  class e extends t {
1045
1045
  }
1046
1046
  return e[Me] = n, customElements.define(n.tagName, e), e;
1047
- }, ut = Symbol("solely.irCtx"), ht = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), At = Symbol("solely.staticClass"), It = Symbol("solely.staticStyle"), Ft = Symbol("solely.dynamicStyle"), Oe = {
1047
+ }, gt = Symbol("solely.isSVG"), ut = Symbol("solely.irCtx"), ht = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), Tt = Symbol("solely.lastDynamicClass"), Dt = Symbol("solely.dynamicStyleLast"), Pe = {
1048
1048
  xml: "http://www.w3.org/XML/1998/namespace",
1049
1049
  xlink: "http://www.w3.org/1999/xlink",
1050
1050
  xmlns: "http://www.w3.org/2000/xmlns/"
1051
- }, Pe = {
1051
+ }, Oe = {
1052
1052
  readonly: "readOnly",
1053
1053
  for: "htmlFor",
1054
1054
  tabindex: "tabIndex",
1055
1055
  contenteditable: "contentEditable",
1056
1056
  maxlength: "maxLength"
1057
- }, _e = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Ne = /* @__PURE__ */ new Set([
1057
+ }, Ne = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), _e = /* @__PURE__ */ new Set([
1058
1058
  "value",
1059
1059
  "selectedIndex"
1060
1060
  ]);
1061
- function Te(n, t) {
1062
- var s;
1063
- const e = n;
1064
- if (e[At] === void 0) {
1065
- const r = (s = t.attrs) == null ? void 0 : s.find((i) => i.key === "class" && !i.dynamic);
1066
- e[At] = r ? r.value : "";
1067
- }
1068
- }
1069
1061
  function We(n, t) {
1070
- var s;
1071
- const e = n;
1072
- if (e[It] === void 0) {
1073
- const r = (s = t.attrs) == null ? void 0 : s.find((i) => i.key === "style" && !i.dynamic);
1074
- e[It] = r ? Gt(r.value) : {};
1062
+ var i;
1063
+ const e = n, s = (i = t.attrs) == null ? void 0 : i.find((o) => o.key === "class" && !o.dynamic), r = s ? s.value : "";
1064
+ r && (e[gt] ? e.className.baseVal = r : e.className = r);
1065
+ }
1066
+ function Te(n, t) {
1067
+ var r;
1068
+ const e = (r = t.attrs) == null ? void 0 : r.find((i) => i.key === "style" && !i.dynamic), s = e ? Ut(e.value) : {};
1069
+ for (const i in s) {
1070
+ const o = s[i];
1071
+ i.startsWith("--") ? n.style.setProperty(i, o) : n.style[i] = o;
1075
1072
  }
1076
1073
  }
1077
- const Fe = (n, t) => {
1078
- const e = n, s = e[It] || {}, r = Gt(t), i = { ...s };
1079
- for (const c in r) {
1080
- const a = r[c];
1081
- a === "" || a == null ? delete i[c] : i[c] = a;
1082
- }
1083
- const o = e[Ft] || {};
1084
- for (const c in o)
1085
- c in i || (c.startsWith("--") ? n.style.removeProperty(c) : n.style[c] = "");
1086
- for (const c in i) {
1087
- const a = i[c];
1088
- c.startsWith("--") ? n.style.getPropertyValue(c) !== a && n.style.setProperty(c, a) : n.style[c] !== a && (n.style[c] = a);
1089
- }
1090
- e[Ft] = r;
1091
- }, je = (n, t) => {
1092
- const s = n[At] || "", r = De(t), i = /* @__PURE__ */ new Set();
1093
- s && s.split(/\s+/).forEach((c) => {
1094
- (!r.hasOwnProperty(c) || r[c]) && i.add(c);
1095
- });
1096
- for (const [c, a] of Object.entries(r))
1097
- a && i.add(c);
1098
- const o = [...i].join(" ");
1099
- n.className !== o && (n.className = o);
1074
+ const De = (n, t) => {
1075
+ const e = n, s = Ut(t), r = e[Dt] || {};
1076
+ for (const i in r)
1077
+ i in s || (i.startsWith("--") ? n.style.removeProperty(i) : n.style[i] = "");
1078
+ for (const i in s) {
1079
+ const o = s[i];
1080
+ i.startsWith("--") ? n.style.setProperty(i, o) : n.style[i] = o;
1081
+ }
1082
+ e[Dt] = s;
1083
+ }, Fe = (n, t) => {
1084
+ const e = n, s = e[Tt] || {}, r = je(t);
1085
+ for (const i in s)
1086
+ s[i] && !r[i] && (e[gt] ? e.className.baseVal = e.className.baseVal.replace(new RegExp(`\\b${i}\\b`, "g"), "").trim() : e.classList.remove(i));
1087
+ for (const i in r)
1088
+ if (r[i])
1089
+ if (e[gt]) {
1090
+ const o = e.className.baseVal.split(/\s+/);
1091
+ o.includes(i) || (o.push(i), e.className.baseVal = o.join(" "));
1092
+ } else
1093
+ e.classList.add(i);
1094
+ e[Tt] = r;
1100
1095
  };
1101
- function Gt(n) {
1096
+ function Ut(n) {
1102
1097
  const t = {}, e = [[n]];
1103
1098
  for (; e.length; ) {
1104
1099
  const [s, r] = e.pop();
@@ -1121,7 +1116,7 @@ function Gt(n) {
1121
1116
  }
1122
1117
  return t;
1123
1118
  }
1124
- function De(n) {
1119
+ function je(n) {
1125
1120
  const t = {}, e = [n];
1126
1121
  for (; e.length; ) {
1127
1122
  const s = e.pop();
@@ -1140,17 +1135,17 @@ function De(n) {
1140
1135
  function Ve(n, t, e) {
1141
1136
  const s = t.indexOf(":");
1142
1137
  if (s > 0) {
1143
- const r = t.slice(0, s), i = Oe[r];
1138
+ const r = t.slice(0, s), i = Pe[r];
1144
1139
  if (i) return n.setAttributeNS(i, t, e);
1145
1140
  }
1146
1141
  n.setAttribute(t, e);
1147
1142
  }
1148
- function jt(n, t, e) {
1149
- if (t.startsWith("data-") || t.startsWith("aria-") || _e.has(t)) {
1143
+ function Ft(n, t, e) {
1144
+ if (t.startsWith("data-") || t.startsWith("aria-") || Ne.has(t)) {
1150
1145
  n.setAttribute(t, e);
1151
1146
  return;
1152
1147
  }
1153
- const s = Pe[t] || t;
1148
+ const s = Oe[t] || t;
1154
1149
  n[s] = e;
1155
1150
  }
1156
1151
  class Be {
@@ -1169,9 +1164,9 @@ class Be {
1169
1164
  }
1170
1165
  }
1171
1166
  // ================ 创建节点 ================
1172
- createElement(t) {
1173
- const e = t.tag;
1174
- return e === "svg" ? document.createElementNS("http://www.w3.org/2000/svg", e) : document.createElement(e);
1167
+ createElement(t, e) {
1168
+ const s = t.tag, r = e instanceof SVGElement || s === "svg", i = r ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
1169
+ return i[gt] = r, i;
1175
1170
  }
1176
1171
  createText(t, e) {
1177
1172
  const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
@@ -1241,11 +1236,11 @@ class Be {
1241
1236
  const b = m ? this.evalIR(v, [s], h[V]) : d ?? "";
1242
1237
  if (C === ":") {
1243
1238
  const $ = p.slice(1);
1244
- t.tagName === "SELECT" && Ne.has($) ? i.push(() => jt(t, $, b)) : jt(t, $, b);
1239
+ t.tagName === "SELECT" && _e.has($) ? i.push(() => Ft(t, $, b)) : Ft(t, $, b);
1245
1240
  } else
1246
1241
  Ve(t, p, String(b));
1247
1242
  }
1248
- return (a || !r) && je(t, c), (u || !r) && Fe(t, l), i;
1243
+ return (a || !r) && Fe(t, c), (u || !r) && De(t, l), i;
1249
1244
  }
1250
1245
  // ================ 更新已有节点 Text Or Comment ================
1251
1246
  updateNode(t, e, s) {
@@ -1260,7 +1255,7 @@ class Be {
1260
1255
  if (c) {
1261
1256
  a = c.node, c.marker = this.marker;
1262
1257
  let v = [];
1263
- t.dynamic && (t.type === y.Element ? v = this.applyAttrs(
1258
+ t.dynamic && (t.type === g.Element ? v = this.applyAttrs(
1264
1259
  a,
1265
1260
  t.attrs ?? [],
1266
1261
  i,
@@ -1270,24 +1265,24 @@ class Be {
1270
1265
  }), v.forEach((m) => m());
1271
1266
  } else
1272
1267
  switch (t.type) {
1273
- case y.Element:
1274
- a = this.createElement(t), Te(a, t), We(a, t);
1268
+ case g.Element:
1269
+ a = this.createElement(t, r), We(a, t), Te(a, t);
1275
1270
  const v = this.applyAttrs(a, t.attrs ?? [], i);
1276
1271
  r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker }), (u = t.children) == null || u.forEach((m, d) => {
1277
1272
  this.irToNode(m, d, o, a, i);
1278
1273
  }), v.forEach((m) => m());
1279
1274
  break;
1280
- case y.Text:
1275
+ case g.Text:
1281
1276
  a = this.createText(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1282
1277
  break;
1283
- case y.Comment:
1278
+ case g.Comment:
1284
1279
  a = this.createComment(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1285
1280
  break;
1286
- case y.For: {
1281
+ case g.For: {
1287
1282
  const m = `${o}-end`;
1288
1283
  let d = (h = this.nodeMap.get(m)) == null ? void 0 : h.node;
1289
1284
  d ? this.nodeMap.get(m).marker = this.marker : (d = document.createComment(`for:${o}`), r.appendChild(d), this.nodeMap.set(m, {
1290
- irNode: { type: y.Comment },
1285
+ irNode: { type: g.Comment },
1291
1286
  node: d,
1292
1287
  loops: i,
1293
1288
  marker: this.marker
@@ -1302,7 +1297,7 @@ class Be {
1302
1297
  }), d.parentNode.insertBefore(b, d);
1303
1298
  break;
1304
1299
  }
1305
- case y.Conditional: {
1300
+ case g.Conditional: {
1306
1301
  const m = `${o}-end`;
1307
1302
  let d = (p = this.nodeMap.get(m)) == null ? void 0 : p.node;
1308
1303
  d ? this.nodeMap.get(m).marker = this.marker : (d = document.createComment(`if:${o}`), r.appendChild(d), this.nodeMap.set(m, { irNode: {}, node: d, loops: i, marker: this.marker }));
@@ -1362,17 +1357,17 @@ const qe = (n, t, e = {}) => {
1362
1357
  destroy: () => s.destroy()
1363
1358
  };
1364
1359
  };
1365
- let G = null, zt;
1360
+ let U = null, Yt;
1366
1361
  const Ht = new Promise((n) => {
1367
- zt = n;
1362
+ Yt = n;
1368
1363
  });
1369
1364
  function Qe(n) {
1370
- return G || (G = new Ke(n), zt(G), G);
1365
+ return U || (U = new Ge(n), Yt(U), U);
1371
1366
  }
1372
- function Et() {
1373
- return G;
1367
+ function xt() {
1368
+ return U;
1374
1369
  }
1375
- class Ke {
1370
+ class Ge {
1376
1371
  constructor(t) {
1377
1372
  L(this, "routes");
1378
1373
  L(this, "base");
@@ -1382,10 +1377,10 @@ class Ke {
1382
1377
  L(this, "currentRoute", null);
1383
1378
  L(this, "listeners", /* @__PURE__ */ new Set());
1384
1379
  L(this, "isStarted", !1);
1385
- this.routes = t.routes, this.base = t.base || "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1380
+ this.routes = t.routes, this.base = t.base ?? "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1386
1381
  }
1387
1382
  // --- 核心匹配逻辑 ---
1388
- matchRoute(t) {
1383
+ matchRoute(t = "/") {
1389
1384
  const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"), i = s.split("/").filter(Boolean), o = this.parseQuery(r), c = this.recursiveMatch(this.routes, i);
1390
1385
  if (c) {
1391
1386
  const a = c.matched[c.matched.length - 1];
@@ -1447,7 +1442,7 @@ class Ke {
1447
1442
  }
1448
1443
  return null;
1449
1444
  }
1450
- calculateScore(t) {
1445
+ calculateScore(t = "/") {
1451
1446
  const e = t.split("/").filter(Boolean);
1452
1447
  return e.length === 0 ? 1 : e.reduce((s, r) => r.startsWith(":") ? s + 5 : r === "*" ? s + 0 : s + 10, 0);
1453
1448
  }
@@ -1457,46 +1452,57 @@ class Ke {
1457
1452
  e[i] = r;
1458
1453
  }), e;
1459
1454
  }
1460
- // --- 导航逻辑 (已修复循环跳转) ---
1455
+ normalizePath(t = "/") {
1456
+ let e = t && typeof t == "string" ? t : "/";
1457
+ return e.startsWith("/") || (e = "/" + e), e.length > 1 && e.endsWith("/") && (e = e.slice(0, -1)), e;
1458
+ }
1459
+ // --- 导航逻辑 ---
1461
1460
  getPath() {
1462
- let t = this.mode === "hash" ? window.location.hash.slice(1) || "/" : window.location.pathname;
1463
- return this.base && this.base !== "/" && t.startsWith(this.base) && (t = t.slice(this.base.length) || "/"), t.startsWith("/") ? t : "/" + t;
1461
+ let t;
1462
+ try {
1463
+ t = this.mode === "hash" ? window.location.hash.slice(1) || "/" : window.location.pathname || "/";
1464
+ } catch {
1465
+ t = "/";
1466
+ }
1467
+ const e = this.base || "/";
1468
+ return e !== "/" && t.startsWith(e) && (t = t.slice(e.length) || "/"), this.normalizePath(t);
1464
1469
  }
1465
- updateBrowserHistory(t, e) {
1466
- if (this.mode === "hash") {
1467
- const s = t.startsWith("/") ? t : "/" + t;
1470
+ updateBrowserHistory(t = "/", e) {
1471
+ const s = this.normalizePath(t), r = this.base || "/";
1472
+ if (this.mode === "hash")
1468
1473
  e ? window.location.replace(`#${s}`) : window.location.hash = s;
1469
- } else {
1470
- const s = this.base && this.base !== "/" ? (this.base.endsWith("/") ? this.base.slice(0, -1) : this.base) + t : t;
1471
- e ? window.history.replaceState({ path: s }, "", s) : window.history.pushState({ path: s }, "", s);
1474
+ else {
1475
+ const i = r.endsWith("/") ? r.slice(0, -1) : r, o = i === "/" ? s : i + s;
1476
+ e ? window.history.replaceState({ path: o }, "", o) : window.history.pushState({ path: o }, "", o);
1472
1477
  }
1473
1478
  }
1474
1479
  /**
1475
1480
  * @param fromEvent 标志位:是否由浏览器 popstate 事件触发
1476
1481
  */
1477
- async navigate(t, e = !1, s = !1) {
1478
- const r = this.currentRoute, i = this.matchRoute(t);
1479
- if (!i) return { success: !1, error: `No route matched: ${t}` };
1480
- if (r && r.fullPath === i.fullPath)
1481
- return { success: !0 };
1482
+ async navigate(t = "/", e = !1, s = !1) {
1483
+ const r = this.normalizePath(t), i = this.currentRoute, o = this.matchRoute(r);
1484
+ if (!o) return { success: !1, error: `No route matched: ${r}` };
1485
+ if (i && i.fullPath === o.fullPath) return { success: !0 };
1482
1486
  if (this.beforeEachGuard)
1483
1487
  try {
1484
- const o = await this.beforeEachGuard(i, r);
1485
- if (o === !1) return { success: !1, cancelled: !0 };
1486
- if (typeof o == "string") return this.navigate(o, e);
1487
- } catch (o) {
1488
- return { success: !1, error: o instanceof Error ? o.message : "Guard Error" };
1488
+ const c = await this.beforeEachGuard(o, i);
1489
+ if (c === !1) return { success: !1, cancelled: !0 };
1490
+ if (typeof c == "string") return this.navigate(c, e);
1491
+ } catch (c) {
1492
+ return { success: !1, error: c instanceof Error ? c.message : "Guard Error" };
1489
1493
  }
1490
- return this.currentRoute = i, s || this.updateBrowserHistory(t, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(i, r), { success: !0 };
1494
+ return this.currentRoute = o, s || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(o, i), { success: !0 };
1491
1495
  }
1492
1496
  // --- 路径解析逻辑 ---
1493
1497
  /**
1494
1498
  * 将逻辑路径解析为浏览器真实的 URL 路径
1495
1499
  * 供 RouterLink 等组件生成 href 使用
1496
1500
  */
1497
- resolve(t) {
1498
- const e = t.startsWith("/") ? t : "/" + t;
1499
- return this.mode === "hash" ? `#${e}` : (this.base.endsWith("/") ? this.base.slice(0, -1) : this.base) + e;
1501
+ resolve(t = "/") {
1502
+ const e = this.normalizePath(t);
1503
+ if (this.mode === "hash") return `#${e}`;
1504
+ const s = this.base.endsWith("/") ? this.base.slice(0, -1) : this.base;
1505
+ return s === "/" ? e : s + e;
1500
1506
  }
1501
1507
  /**
1502
1508
  * 获取当前模式(供外部组件判断,如 RouterLink)
@@ -1504,14 +1510,14 @@ class Ke {
1504
1510
  get modeType() {
1505
1511
  return this.mode;
1506
1512
  }
1507
- pushWithQuery(t, e) {
1513
+ pushWithQuery(t = "/", e) {
1508
1514
  const s = new URLSearchParams(e).toString(), r = t.includes("?") ? "&" : "?";
1509
1515
  return this.push(t + (s ? r + s : ""));
1510
1516
  }
1511
- push(t) {
1517
+ push(t = "/") {
1512
1518
  return this.navigate(t, !1);
1513
1519
  }
1514
- replace(t) {
1520
+ replace(t = "/") {
1515
1521
  return this.navigate(t, !0);
1516
1522
  }
1517
1523
  back() {
@@ -1534,8 +1540,8 @@ class Ke {
1534
1540
  return this.currentRoute;
1535
1541
  }
1536
1542
  }
1537
- var Ye = Object.getOwnPropertyDescriptor, Ue = (n, t, e, s) => {
1538
- for (var r = s > 1 ? void 0 : s ? Ye(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1543
+ var Ke = Object.getOwnPropertyDescriptor, ze = (n, t, e, s) => {
1544
+ for (var r = s > 1 ? void 0 : s ? Ke(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1539
1545
  (o = n[i]) && (r = o(r) || r);
1540
1546
  return r;
1541
1547
  };
@@ -1582,30 +1588,30 @@ let yt = class extends mt {
1582
1588
  this.handleEmptyRoute();
1583
1589
  return;
1584
1590
  }
1585
- const { config: r, params: i } = s;
1586
- let o = r.tagName;
1587
- if (!o && typeof r.component == "function") {
1591
+ const { config: r } = s;
1592
+ let i = r.tagName;
1593
+ if (!i && typeof r.component == "function") {
1588
1594
  this.renderLoading();
1589
1595
  try {
1590
- const a = await r.component();
1591
- o = typeof a == "string" ? a : a.tagName;
1592
- } catch (a) {
1593
- this.renderError(`Load Error: ${a}`);
1596
+ const c = await r.component();
1597
+ i = typeof c == "string" ? c : c.tagName;
1598
+ } catch (c) {
1599
+ this.renderError(`Load Error: ${c}`);
1594
1600
  return;
1595
1601
  }
1596
1602
  }
1597
1603
  if (e !== this.latestLoadId) return;
1598
- if (!o) {
1604
+ if (!i) {
1599
1605
  this.clear();
1600
1606
  return;
1601
1607
  }
1602
- if (!r.forceReload && this.currentElement && this.currentTagName === o.toLowerCase()) {
1603
- this.syncState(this.currentElement, i, (t == null ? void 0 : t.query) || {}, r.props);
1608
+ if (!r.forceReload && this.currentElement && this.currentTagName === i.toLowerCase()) {
1609
+ this.syncState(this.currentElement, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props);
1604
1610
  return;
1605
1611
  }
1606
1612
  this.clear(r.keepAlive);
1607
- const c = this.getOrCreateComponent(o, r);
1608
- this.syncState(c, i, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(c), this.currentElement = c, this.currentTagName = o.toLowerCase();
1613
+ const o = this.getOrCreateComponent(i, r);
1614
+ this.syncState(o, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(o), this.currentElement = o, this.currentTagName = i.toLowerCase();
1609
1615
  }
1610
1616
  getOrCreateComponent(t, e) {
1611
1617
  const s = t.toLowerCase();
@@ -1641,33 +1647,39 @@ let yt = class extends mt {
1641
1647
  this.currentElement ? this.contains(this.currentElement) && this.removeChild(this.currentElement) : t || (this.innerHTML = ""), this.currentElement = null, this.currentTagName = null, this.routerAttrs.clear(), this.prevPropKeys.clear();
1642
1648
  }
1643
1649
  };
1644
- yt = Ue([
1645
- Ut({
1650
+ yt = ze([
1651
+ zt({
1646
1652
  tagName: "router-view"
1647
1653
  // 注意:删除了 shadowDOM 配置,默认为 false
1648
1654
  })
1649
1655
  ], yt);
1650
1656
  const Xe = yt;
1651
- var Ge = Object.getOwnPropertyDescriptor, ze = (n, t, e, s) => {
1652
- for (var r = s > 1 ? void 0 : s ? Ge(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1657
+ var Ue = Object.getOwnPropertyDescriptor, Ye = (n, t, e, s) => {
1658
+ for (var r = s > 1 ? void 0 : s ? Ue(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1653
1659
  (o = n[i]) && (r = o(r) || r);
1654
1660
  return r;
1655
1661
  };
1656
- let Mt = class extends mt {
1662
+ let It = class extends mt {
1657
1663
  constructor() {
1658
1664
  super(...arguments);
1659
1665
  L(this, "_prefetched", !1);
1660
1666
  }
1667
+ set to(t) {
1668
+ this.$data.to = t, this.updateState();
1669
+ }
1670
+ get to() {
1671
+ return this.$data.to;
1672
+ }
1661
1673
  async mounted() {
1662
1674
  (await Ht).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1663
1675
  var r, i;
1664
- e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (i = Et()) == null || i.push(this.$data.to));
1676
+ e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (i = xt()) == null || i.push(this.$data.to));
1665
1677
  }), this.addEventListener("mouseenter", () => {
1666
1678
  this.prefetchRoute();
1667
1679
  }, { once: !0 });
1668
1680
  }
1669
1681
  updateState() {
1670
- const t = Et();
1682
+ const t = xt();
1671
1683
  if (!t) return;
1672
1684
  this.$data.href = t.resolve(this.$data.to);
1673
1685
  let e = !1;
@@ -1687,12 +1699,12 @@ let Mt = class extends mt {
1687
1699
  // 预加载路由的具体实现
1688
1700
  prefetchRoute() {
1689
1701
  if (this._prefetched || !this.hasAttribute("prefetch")) return;
1690
- const t = Et();
1702
+ const t = xt();
1691
1703
  t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
1692
1704
  }
1693
1705
  };
1694
- Mt = ze([
1695
- Ut({
1706
+ It = Ye([
1707
+ zt({
1696
1708
  tagName: "router-link",
1697
1709
  // template 中 slot 包裹 label 作为 fallback:
1698
1710
  // 如果有子节点,显示子节点;如果没有,显示 label 属性的内容。
@@ -1703,7 +1715,6 @@ Mt = ze([
1703
1715
  `,
1704
1716
  styles: `
1705
1717
  :host {
1706
- display: inline-block;
1707
1718
  }
1708
1719
 
1709
1720
  a {
@@ -1726,15 +1737,15 @@ Mt = ze([
1726
1737
  // 注册所有支持的 props
1727
1738
  props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
1728
1739
  })
1729
- ], Mt);
1730
- const tn = Mt;
1740
+ ], It);
1741
+ const tn = It;
1731
1742
  export {
1732
- y as ASTType,
1743
+ g as ASTType,
1733
1744
  mt as BaseElement,
1734
- Ut as CustomElement,
1745
+ zt as CustomElement,
1735
1746
  Be as IRRenderer,
1736
1747
  fe as LIFECYCLE_ATTRS_MAP,
1737
- Ke as Router,
1748
+ Ge as Router,
1738
1749
  tn as RouterLink,
1739
1750
  Xe as RouterView,
1740
1751
  Ee as buildIR,
@@ -1743,14 +1754,15 @@ export {
1743
1754
  qe as createRender,
1744
1755
  Qe as createRouter,
1745
1756
  ue as genFunction,
1746
- Et as getRouter,
1757
+ xt as getRouter,
1747
1758
  pe as isLifecycleKind,
1748
- z as isObject,
1759
+ Y as isObject,
1749
1760
  he as listeners,
1750
1761
  de as mapAttrKeyToLifecycleKind,
1751
1762
  Ie as observe,
1752
1763
  Ze as parseHashUrl,
1753
1764
  Le as parseHtml,
1765
+ Ht as routerReady,
1754
1766
  ne as showTemplateError,
1755
1767
  we as transformModel
1756
1768
  };