solely 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var Xt = Object.defineProperty;
2
- var Nt = (n) => {
2
+ var Pt = (n) => {
3
3
  throw TypeError(n);
4
4
  };
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 C = (n, t, e) => te(n, typeof t != "symbol" ? t + "" : t, e), wt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
7
- var R = (n, t, e) => (wt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), _ = (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) => (wt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), O = (n, t, e) => (wt(n, t, "access private method"), e);
8
- const ee = {
5
+ var Qt = (n, t, e) => t in n ? Xt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
+ var k = (n, t, e) => Qt(n, typeof t != "symbol" ? t + "" : t, e), gt = (n, t, e) => t.has(n) || Pt("Cannot " + e);
7
+ var P = (n, t, e) => (gt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), T = (n, t, e) => t.has(n) ? Pt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), O = (n, t, e, s) => (gt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), N = (n, t, e) => (gt(n, t, "access private method"), e);
8
+ const te = {
9
9
  dark: {
10
10
  gutter: "#858585",
11
11
  errorLineBg: "#3c1e1e",
@@ -16,8 +16,8 @@ const ee = {
16
16
  exprLabel: "#a0a0a0",
17
17
  exprCode: "#5ddcff"
18
18
  }
19
- }, T = ee.dark;
20
- function lt(n) {
19
+ }, W = te.dark;
20
+ function ot(n) {
21
21
  let t = 0;
22
22
  for (let e = 0; e < n.length; ) {
23
23
  const s = n.codePointAt(e);
@@ -29,97 +29,97 @@ function lt(n) {
29
29
  }
30
30
  return t;
31
31
  }
32
- function Wt(n, t = {}) {
32
+ function Ot(n, t = {}) {
33
33
  const { lineIndex: e = 0, totalLines: s = 1 } = t, r = Math.max(1, Math.floor(n));
34
34
  return (s <= 1 || e === 0 ? "^" : "~").repeat(r);
35
35
  }
36
- function ne(n, t = "", e, s = "component") {
37
- var A;
38
- const r = (n == null ? void 0 : n.message) ?? String(n), i = `%cTemplate Error%c in <${s}> → ${r}`, o = [
39
- `color:${T.badgeFg};background:${T.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
40
- `color:${T.arrow};font-weight:bold;`
36
+ function ee(n, t = "", e, s = "component") {
37
+ var L;
38
+ const r = (n == null ? void 0 : n.message) ?? String(n), o = `%cTemplate Error%c in <${s}> → ${r}`, i = [
39
+ `color:${W.badgeFg};background:${W.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
40
+ `color:${W.arrow};font-weight:bold;`
41
41
  ];
42
42
  if (!t || !(e != null && e.loc) || e.loc.length < 2) {
43
- console.error(i, ...o), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
43
+ console.error(o, ...i), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
44
44
  return;
45
45
  }
46
46
  const c = e.loc;
47
47
  let a = c[0] || 0, l = c[1] || 0;
48
48
  a |= 0, l |= 0, a < 1 && (a = 1), l < 1 && (l = 1);
49
- const h = t.split(`
49
+ const u = t.split(`
50
50
  `);
51
- if (a > h.length) {
51
+ if (a > u.length) {
52
52
  console.error(`[Template Error] 行号 ${a} 超出范围`);
53
53
  return;
54
54
  }
55
- const u = a - 1, m = Math.max(0, u - 3), E = Math.min(h.length - 1, u + 3), p = String(E + 1).length, d = ((A = e.expr) == null ? void 0 : A.trim()) ?? "", L = d ? d.split(`
56
- `) : [], g = d ? Math.max(...L.map(lt)) : 0, v = L.length > 1, k = `color:${T.gutter};`, I = `color:${T.arrow};font-weight:bold;`, f = `color:${T.gutter};`, w = `color:${T.errorLineFg};background:${T.errorLineBg};padding:0 4px;`, x = `color:${T.gutter};`, b = `color:${T.arrow};font-weight:bold;padding:0 4px;`;
55
+ const h = a - 1, d = Math.max(0, h - 3), E = Math.min(u.length - 1, h + 3), m = String(E + 1).length, p = ((L = e.expr) == null ? void 0 : L.trim()) ?? "", R = p ? p.split(`
56
+ `) : [], g = p ? Math.max(...R.map(ot)) : 0, v = R.length > 1, S = `color:${W.gutter};`, A = `color:${W.arrow};font-weight:bold;`, f = `color:${W.gutter};`, w = `color:${W.errorLineFg};background:${W.errorLineBg};padding:0 4px;`, x = `color:${W.gutter};`, b = `color:${W.arrow};font-weight:bold;padding:0 4px;`;
57
57
  console.groupCollapsed(
58
- `${i} %c(Line:${a}, Col:${l})`,
59
- ...o,
60
- `color:${T.gutter};font-weight:normal;`
58
+ `${o} %c(Line:${a}, Col:${l})`,
59
+ ...i,
60
+ `color:${W.gutter};font-weight:normal;`
61
61
  );
62
- for (let $ = m; $ <= E; $++) {
63
- const M = h[$], P = String($ + 1).padStart(p, " ");
64
- if (!($ === u)) {
65
- console.log(`%c${P} │%c ${M}`, k, f);
62
+ for (let $ = d; $ <= E; $++) {
63
+ const I = u[$], M = String($ + 1).padStart(m, " ");
64
+ if (!($ === h)) {
65
+ console.log(`%c${M} │%c ${I}`, S, f);
66
66
  continue;
67
67
  }
68
- const V = M.slice(0, Math.max(0, l - 1)), D = lt(V), at = " ".repeat(p + 3), Jt = P.padEnd(p, " ");
69
- if (console.log(`%c${Jt} │%c ${M}`, I, w), v)
70
- for (let B = 0; B < L.length; B++) {
71
- const yt = L[B], et = u + B;
72
- let bt = 0;
73
- if (B === 0)
74
- bt = D;
75
- else if (et < h.length) {
76
- const nt = h[et], ct = nt.search(/\S/), Qt = ct === -1 ? nt : nt.slice(0, ct);
77
- bt = lt(Qt);
68
+ const D = I.slice(0, Math.max(0, l - 1)), F = ot(D), rt = " ".repeat(m + 3), Yt = M.padEnd(m, " ");
69
+ if (console.log(`%c${Yt} │%c ${I}`, A, w), v)
70
+ for (let j = 0; j < R.length; j++) {
71
+ const pt = R[j], Q = h + j;
72
+ let mt = 0;
73
+ if (j === 0)
74
+ mt = F;
75
+ else if (Q < u.length) {
76
+ const tt = u[Q], it = tt.search(/\S/), Jt = it === -1 ? tt : tt.slice(0, it);
77
+ mt = ot(Jt);
78
78
  }
79
- const Zt = Math.max(1, lt(yt.trim())), Ot = Wt(Zt, { lineIndex: B, totalLines: L.length }), _t = at + " ".repeat(bt);
80
- if (B === 0)
81
- console.log(`%c${_t}%c${Ot}`, x, b);
82
- else if (et < h.length) {
83
- const nt = String(et + 1).padEnd(p, " "), ct = h[et];
84
- console.log(`%c${nt} │%c ${ct}`, I, w), console.log(`%c${_t}%c${Ot}`, x, b);
79
+ const Zt = Math.max(1, ot(pt.trim())), It = Ot(Zt, { lineIndex: j, totalLines: R.length }), Mt = rt + " ".repeat(mt);
80
+ if (j === 0)
81
+ console.log(`%c${Mt}%c${It}`, x, b);
82
+ else if (Q < u.length) {
83
+ const tt = String(Q + 1).padEnd(m, " "), it = u[Q];
84
+ console.log(`%c${tt} │%c ${it}`, A, w), console.log(`%c${Mt}%c${It}`, x, b);
85
85
  }
86
86
  }
87
87
  else {
88
- const B = at + " ".repeat(D), yt = Wt(g || 1);
89
- console.log(`%c${B}%c${yt}`, x, b);
88
+ const j = rt + " ".repeat(F), pt = Ot(g || 1);
89
+ console.log(`%c${j}%c${pt}`, x, b);
90
90
  }
91
91
  }
92
- d && console.log(
93
- `%cExpression:%c ${d}`,
94
- `color:${T.exprLabel};font-weight:bold;`,
95
- `color:${T.exprCode};font-family:monospace;`
92
+ p && console.log(
93
+ `%cExpression:%c ${p}`,
94
+ `color:${W.exprLabel};font-weight:bold;`,
95
+ `color:${W.exprCode};font-family:monospace;`
96
96
  ), console.groupEnd();
97
97
  }
98
- const vt = {};
99
- function se(n) {
98
+ const yt = {};
99
+ function ne(n) {
100
100
  const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
101
- if (!vt[t]) {
101
+ if (!yt[t]) {
102
102
  const e = n[n.length - 1];
103
103
  if (e.trim() === "")
104
104
  throw new Error("Function body cannot be empty");
105
- if (ie(e))
105
+ if (re(e))
106
106
  throw new Error("Input contains potentially dangerous code: " + e);
107
- vt[t] = new Function(...n);
107
+ yt[t] = new Function(...n);
108
108
  }
109
- return vt[t];
109
+ return yt[t];
110
110
  }
111
- const re = ["eval", "Function", "process", "require"];
112
- function ie(n) {
113
- return re.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
111
+ const se = ["eval", "Function", "process", "require"];
112
+ function re(n) {
113
+ return se.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
114
114
  }
115
- const oe = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, ae = /\{\{\s*([\s\S]*?)\s*\}\}/g;
116
- function ce(n, t) {
115
+ const ie = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, oe = /\{\{\s*([\s\S]*?)\s*\}\}/g;
116
+ function ae(n, t) {
117
117
  if (!(n != null && n.trim())) return "";
118
- if (oe.test(n))
118
+ if (ie.test(n))
119
119
  throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");
120
- return t === "template" ? n.replace(ae, (e, s) => `\${${s.trim()}}`) : n;
120
+ return t === "template" ? n.replace(oe, (e, s) => `\${${s.trim()}}`) : n;
121
121
  }
122
- function le(n, t) {
122
+ function ce(n, t) {
123
123
  const e = (s) => s.endsWith(";") ? s : s + ";";
124
124
  switch (t) {
125
125
  case "template":
@@ -131,7 +131,7 @@ function le(n, t) {
131
131
  return e(n);
132
132
  }
133
133
  }
134
- function ue(n) {
134
+ function le(n) {
135
135
  if (!n.length) return { loopValues: "", loopIndices: "" };
136
136
  const t = n.map((s) => s.item).join(", "), e = n.map((s) => s.index).join(", ");
137
137
  return {
@@ -139,22 +139,22 @@ function ue(n) {
139
139
  loopIndices: `var [${e}] = loops.map(l => l.idxVal);`
140
140
  };
141
141
  }
142
- function he(n, t, e, s) {
143
- const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], o = `
142
+ function ue(n, t, e, s) {
143
+ const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], i = `
144
144
  const { $data } = this;
145
145
  ${n === "handler" ? "const { value, checked } = event?.target || {};" : ""}
146
146
  ${e}
147
147
  ${s}
148
148
  ${t}
149
149
  `.replace(/^\s+|\s+$/gm, "");
150
- return r.push(o), r;
150
+ return r.push(i), r;
151
151
  }
152
- function fe(n, t, e) {
152
+ function he(n, t, e) {
153
153
  if (!(n != null && n.trim())) return () => "";
154
- const s = ce(n, t), r = le(s, t), { loopValues: i, loopIndices: o } = ue(e), c = he(t, r, i, o);
155
- return se(c);
154
+ const s = ae(n, t), r = ce(s, t), { loopValues: o, loopIndices: i } = le(e), c = ue(t, r, o, i);
155
+ return ne(c);
156
156
  }
157
- const de = /* @__PURE__ */ new Set([
157
+ const fe = /* @__PURE__ */ new Set([
158
158
  "onabort",
159
159
  "onautocomplete",
160
160
  "onautocompleteerror",
@@ -217,7 +217,7 @@ const de = /* @__PURE__ */ new Set([
217
217
  "ontoggle",
218
218
  "onvolumechange",
219
219
  "onwaiting"
220
- ]), H = (n) => {
220
+ ]), K = (n) => {
221
221
  if (n === null || typeof n != "object") return !1;
222
222
  const t = Object.prototype.toString.call(n);
223
223
  return ![
@@ -230,43 +230,43 @@ const de = /* @__PURE__ */ new Set([
230
230
  "[object WeakSet]"
231
231
  ].includes(t);
232
232
  };
233
- function Qe(n = window.location) {
233
+ function Ye(n = window.location) {
234
234
  let t;
235
235
  typeof n == "string" ? t = new URL(n).hash : t = n.hash;
236
236
  const e = t.split("?");
237
237
  let s = e[0];
238
- const r = e[1], i = {};
239
- return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((o) => {
240
- const [c, a] = o.split("=");
241
- c && a && (i[decodeURIComponent(c)] = decodeURIComponent(a));
238
+ const r = e[1], o = {};
239
+ return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((i) => {
240
+ const [c, a] = i.split("=");
241
+ c && a && (o[decodeURIComponent(c)] = decodeURIComponent(a));
242
242
  }), {
243
243
  path: s.split("/").filter(Boolean),
244
244
  // 将路径分割成数组并过滤空字符串
245
- query: i
245
+ query: o
246
246
  // 查询参数对象
247
247
  };
248
248
  }
249
249
  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 || {});
250
- const pe = {
250
+ const de = {
251
251
  // 可选别名
252
252
  onMounted: "mounted",
253
253
  onUpdated: "updated",
254
254
  onUnmounted: "unmounted"
255
255
  };
256
- function me(n) {
257
- return pe[n] ?? null;
256
+ function pe(n) {
257
+ return de[n] ?? null;
258
258
  }
259
- function ge(n) {
259
+ function me(n) {
260
260
  return n === "mounted" || n === "updated" || n === "unmounted";
261
261
  }
262
- const kt = Symbol.for("solely.irMeta"), tt = process.env.NODE_ENV !== "production", ye = /\{\{[\s\S]*?\}\}/;
263
- class be {
262
+ const vt = Symbol.for("solely.irMeta"), X = process.env.NODE_ENV !== "production", ge = /\{\{[\s\S]*?\}\}/;
263
+ class ye {
264
264
  constructor() {
265
- C(this, "compilers", /* @__PURE__ */ new Map());
265
+ k(this, "compilers", /* @__PURE__ */ new Map());
266
266
  }
267
267
  get(t = "anonymous") {
268
268
  let e = this.compilers.get(t);
269
- return e || (e = new we(), this.compilers.set(t, e)), e;
269
+ return e || (e = new be(), this.compilers.set(t, e)), e;
270
270
  }
271
271
  clear(t) {
272
272
  var e;
@@ -278,31 +278,31 @@ class be {
278
278
  }
279
279
  }
280
280
  }
281
- const Ft = new be();
282
- class we {
281
+ const Wt = new ye();
282
+ class be {
283
283
  constructor() {
284
- C(this, "cache", /* @__PURE__ */ new Map());
285
- C(this, "functions", []);
284
+ k(this, "cache", /* @__PURE__ */ new Map());
285
+ k(this, "functions", []);
286
286
  }
287
287
  // 缓存 key 生成优化:避免每次都重新分配数组
288
288
  makeCacheKey(t, e, s) {
289
289
  if (s.length === 0) return `${t}:${e}`;
290
- const r = s.map((i) => Object.keys(i).sort().join(",")).join(";");
290
+ const r = s.map((o) => Object.keys(o).sort().join(",")).join(";");
291
291
  return `${t}:${e}:${r}`;
292
292
  }
293
293
  compile(t, e, s) {
294
294
  const r = e == null ? void 0 : e.trim();
295
295
  if (!r) return 0;
296
- const i = this.makeCacheKey(t, r, s), o = this.cache.get(i);
297
- if (o !== void 0) return o;
296
+ const o = this.makeCacheKey(t, r, s), i = this.cache.get(o);
297
+ if (i !== void 0) return i;
298
298
  let c;
299
299
  try {
300
- c = fe(r, t, s);
300
+ c = he(r, t, s);
301
301
  } catch (l) {
302
- tt && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, l), c = () => "";
302
+ X && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, l), c = () => "";
303
303
  }
304
304
  const a = this.functions.push(c);
305
- return this.cache.set(i, a), a;
305
+ return this.cache.set(o, a), a;
306
306
  }
307
307
  getFunctions() {
308
308
  return this.functions;
@@ -314,31 +314,31 @@ class we {
314
314
  this.cache.clear(), this.functions = [];
315
315
  }
316
316
  }
317
- function jt(n) {
317
+ function Ft(n) {
318
318
  const t = n[0];
319
- return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : ge(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
319
+ return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : me(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
320
320
  }
321
- function ve(n) {
322
- return n ? ye.test(n) : !1;
321
+ function we(n) {
322
+ return n ? ge.test(n) : !1;
323
323
  }
324
- function St(n, t, e) {
325
- tt && (n[kt] = { expr: t ?? "", loc: e ?? null });
324
+ function xt(n, t, e) {
325
+ X && (n[vt] = { expr: t ?? "", loc: e ?? null });
326
326
  }
327
327
  function Ee(n) {
328
328
  if (!n.attrs) return;
329
329
  const t = n.attrs.find((a) => a.key === "s-model");
330
330
  if (!t) return;
331
- const e = "$data." + t.value.replace("this.", "").replace("$data.", ""), s = t.loc, r = (n.tag || "").toLowerCase(), i = n.attrs.find((a) => a.key === "type"), o = (i == null ? void 0 : i.value) ?? "text";
331
+ const e = "$data." + t.value.replace("this.", "").replace("$data.", ""), s = t.loc, r = (n.tag || "").toLowerCase(), o = n.attrs.find((a) => a.key === "type"), i = (o == null ? void 0 : o.value) ?? "text";
332
332
  n.attrs = n.attrs.filter((a) => a !== t);
333
- const c = (a, l, h) => {
334
- var u;
335
- (u = n.attrs) == null || u.push({ key: a, value: l, role: h, loc: s });
333
+ const c = (a, l, u) => {
334
+ var h;
335
+ (h = n.attrs) == null || h.push({ key: a, value: l, role: u, loc: s });
336
336
  };
337
337
  if (r === "input") {
338
- if (o === "checkbox") {
339
- const a = n.attrs.find((m) => m.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', h = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
340
- c(":checked", h);
341
- const u = `
338
+ if (i === "checkbox") {
339
+ const a = n.attrs.find((d) => d.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', u = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
340
+ c(":checked", u);
341
+ const h = `
342
342
  const _v = ${l};
343
343
  if(Array.isArray(${e})) {
344
344
  const _i = ${e}.indexOf(_v);
@@ -347,11 +347,11 @@ function Ee(n) {
347
347
  } else {
348
348
  ${e} = checked;
349
349
  }`;
350
- c("@change", u, "model");
350
+ c("@change", h, "model");
351
351
  return;
352
352
  }
353
- if (o === "radio") {
354
- const a = n.attrs.find((h) => h.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
353
+ if (i === "radio") {
354
+ const a = n.attrs.find((u) => u.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
355
355
  c(":checked", `${e} == ${JSON.stringify(l)}`), c("@change", `if (checked) ${e} = ${JSON.stringify(l)}`, "model");
356
356
  return;
357
357
  }
@@ -372,47 +372,47 @@ function Ee(n) {
372
372
  }
373
373
  c(":value", e), c("@input", `${e} = $event`, "model");
374
374
  }
375
- function ft(n, t, e, s = null) {
375
+ function lt(n, t, e, s = null) {
376
376
  if (!n.attrs || n.attrs.length === 0) return [];
377
377
  const r = [];
378
- for (const i of n.attrs) {
379
- if (s && s.has(i.key)) continue;
380
- const { key: o, value: c, role: a } = i, { isDynamic: l, type: h } = jt(o);
381
- if (l && h) {
382
- const u = e.compile(h, c ?? "", t), m = { key: o, fid: u, dynamic: 1, role: a };
383
- St(m, c, i.loc ?? n.loc), r.push(m);
378
+ for (const o of n.attrs) {
379
+ if (s && s.has(o.key)) continue;
380
+ const { key: i, value: c, role: a } = o, { isDynamic: l, type: u } = Ft(i);
381
+ if (l && u) {
382
+ const h = e.compile(u, c ?? "", t), d = { key: i, fid: h, dynamic: 1, role: a };
383
+ xt(d, c, o.loc ?? n.loc), r.push(d);
384
384
  } else
385
- r.push({ key: o, value: c, dynamic: 0, role: a });
385
+ r.push({ key: i, value: c, dynamic: 0, role: a });
386
386
  }
387
387
  return r;
388
388
  }
389
- function xe(n, t, e) {
390
- var i, o, c, a, l, h;
389
+ function ve(n, t, e) {
390
+ var o, i, c, a, l, u;
391
391
  const s = { type: n.type, dynamic: 0 };
392
392
  let r = !1;
393
- switch (n.type === y.Text ? ve(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((u) => u.key === "s-model" || jt(u.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
393
+ switch (n.type === y.Text ? we(n.content) && (r = !0) : ((o = n.attrs) != null && o.some((h) => h.key === "s-model" || Ft(h.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
394
394
  case y.Text: {
395
- const u = n.content ?? "";
396
- r ? (s.fid = e.compile("template", u, t), St(s, u, n.loc)) : s.txt = u;
395
+ const h = n.content ?? "";
396
+ r ? (s.fid = e.compile("template", h, t), xt(s, h, n.loc)) : s.txt = h;
397
397
  break;
398
398
  }
399
399
  case y.Element: {
400
- s.tag = n.tag, Ee(n), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
400
+ s.tag = n.tag, Ee(n), s.attrs = lt(n, t, e), n.children && (s.children = et(n.children, t, e));
401
401
  break;
402
402
  }
403
403
  case y.For: {
404
- const u = (o = n.attrs) == null ? void 0 : o.find((d) => d.key === "each"), m = (u == null ? void 0 : u.value) ?? "";
405
- s.fid = e.compile("expression", m, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((h = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "index")) == null ? void 0 : h.value) ?? "index", St(s, m, (u == null ? void 0 : u.loc) ?? n.loc);
404
+ const h = (i = n.attrs) == null ? void 0 : i.find((p) => p.key === "each"), d = (h == null ? void 0 : h.value) ?? "";
405
+ s.fid = e.compile("expression", d, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((p) => p.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((u = (l = n.attrs) == null ? void 0 : l.find((p) => p.key === "index")) == null ? void 0 : u.value) ?? "index", xt(s, d, (h == null ? void 0 : h.loc) ?? n.loc);
406
406
  const E = /* @__PURE__ */ new Set(["each", "item", "index"]);
407
- s.attrs = ft(n, t, e, E);
408
- const p = [...t, { item: s.item, index: s.index }];
409
- n.children && (s.children = st(n.children, p, e));
407
+ s.attrs = lt(n, t, e, E);
408
+ const m = [...t, { item: s.item, index: s.index }];
409
+ n.children && (s.children = et(n.children, m, e));
410
410
  break;
411
411
  }
412
412
  case y.If:
413
413
  case y.ElseIf:
414
414
  case y.Else: {
415
- 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));
415
+ X && console.warn(`[IR] Orphaned conditional node found: ${y[n.type]}`), s.attrs = lt(n, t, e), n.children && (s.children = et(n.children, t, e));
416
416
  break;
417
417
  }
418
418
  case y.Comment: {
@@ -422,60 +422,60 @@ function xe(n, t, e) {
422
422
  }
423
423
  return s;
424
424
  }
425
- function st(n, t, e) {
426
- var i;
425
+ function et(n, t, e) {
426
+ var o;
427
427
  const s = [];
428
428
  let r = 0;
429
429
  for (; r < n.length; ) {
430
- const o = n[r];
431
- if (o.type === y.If) {
430
+ const i = n[r];
431
+ if (i.type === y.If) {
432
432
  const c = [];
433
433
  let a = r;
434
434
  for (; a < n.length; ) {
435
- const l = n[a], h = l.type;
436
- if (h !== y.If && h !== y.ElseIf && h !== y.Else)
435
+ const l = n[a], u = l.type;
436
+ if (u !== y.If && u !== y.ElseIf && u !== y.Else || u === y.If && c.length > 0)
437
437
  break;
438
- let u = null, m = "", E = null;
439
- if (h !== y.Else) {
440
- const g = (i = l.attrs) == null ? void 0 : i.find(
438
+ let h = null, d = "", E = null;
439
+ if (u !== y.Else) {
440
+ const g = (o = l.attrs) == null ? void 0 : o.find(
441
441
  (v) => v.key === "test" || v.key === "condition"
442
442
  );
443
- m = (g == null ? void 0 : g.value) ?? "false", u = e.compile("expression", m, t), E = (g == null ? void 0 : g.loc) ?? l.loc;
443
+ d = (g == null ? void 0 : g.value) ?? "false", h = e.compile("expression", d, t), E = (g == null ? void 0 : g.loc) ?? l.loc;
444
444
  }
445
- const p = l.children ? st(l.children, t, e) : [], L = ft(l, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
445
+ const m = l.children ? et(l.children, t, e) : [], R = lt(l, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
446
446
  if (c.push({
447
- condFid: u,
448
- children: p,
449
- attrs: L.length > 0 ? L : void 0,
450
- [kt]: tt ? { expr: m, loc: E } : void 0
451
- }), a++, h === y.Else) break;
447
+ condFid: h,
448
+ children: m,
449
+ attrs: R.length > 0 ? R : void 0,
450
+ [vt]: X ? { expr: d, loc: E } : void 0
451
+ }), a++, u === y.Else) break;
452
452
  }
453
453
  s.push({
454
454
  type: y.Conditional,
455
455
  dynamic: 1,
456
456
  branches: c,
457
- ...tt && { [kt]: { loc: o.loc } }
457
+ ...X && { [vt]: { loc: i.loc } }
458
458
  }), r = a;
459
459
  } else
460
- s.push(xe(o, t, e)), r++;
460
+ s.push(ve(i, t, e)), r++;
461
461
  }
462
462
  return s;
463
463
  }
464
- function $e(n, t = {}) {
465
- const { filename: e = "anonymous", source: s } = t, r = Ft.get(e);
464
+ function xe(n, t = {}) {
465
+ const { filename: e = "anonymous", source: s } = t, r = Wt.get(e);
466
466
  r.clear();
467
- const i = performance.now(), o = st(n, [], r), c = performance.now(), a = r.getStats(), l = o.filter((u) => u.dynamic === 1).length, h = {
467
+ const o = performance.now(), i = et(n, [], r), c = performance.now(), a = r.getStats(), l = i.filter((h) => h.dynamic === 1).length, u = {
468
468
  type: "root",
469
469
  version: "1.1.0",
470
470
  // Bump version
471
471
  functions: r.getFunctions(),
472
472
  // 获取函数列表快照
473
- nodes: o,
473
+ nodes: i,
474
474
  stats: {
475
475
  totalFunctions: a.total,
476
476
  cachedFunctions: a.cached,
477
477
  dynamicNodes: l,
478
- totalNodes: o.length
478
+ totalNodes: i.length
479
479
  },
480
480
  metadata: {
481
481
  compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -484,14 +484,14 @@ function $e(n, t = {}) {
484
484
  ...s && { source: s }
485
485
  }
486
486
  };
487
- return tt && console.log(
488
- `[IRBuilder] ${e} | ${(c - i).toFixed(2)}ms | Nodes: ${o.length} | Fns: ${a.total}`
489
- ), h;
487
+ return X && console.log(
488
+ `[IRBuilder] ${e} | ${(c - o).toFixed(2)}ms | Nodes: ${i.length} | Fns: ${a.total}`
489
+ ), u;
490
490
  }
491
- function Xe(n) {
492
- Ft.clear(n);
491
+ function Ze(n) {
492
+ Wt.clear(n);
493
493
  }
494
- const ke = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set([
494
+ const $e = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set([
495
495
  "area",
496
496
  "base",
497
497
  "br",
@@ -506,45 +506,45 @@ const ke = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set
506
506
  "source",
507
507
  "track",
508
508
  "wbr"
509
- ]), Ce = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
510
- function Re(n, t) {
509
+ ]), ke = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
510
+ function Ce(n, t) {
511
511
  const e = [];
512
512
  let s;
513
- const r = n.replace(/^\s*[^\s"'/>]+/, ""), i = n.length - r.length;
514
- for (; (s = Ce.exec(r)) !== null; ) {
515
- const o = s[1];
516
- if (!o) continue;
513
+ const r = n.replace(/^\s*[^\s"'/>]+/, ""), o = n.length - r.length;
514
+ for (; (s = ke.exec(r)) !== null; ) {
515
+ const i = s[1];
516
+ if (!i) continue;
517
517
  const c = s[2] ?? s[3] ?? s[4] ?? "";
518
- let a = o;
519
- de.has(o) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = me(a) || a;
520
- const l = s[0], h = l.indexOf("=");
521
- let u;
522
- if (h === -1)
523
- u = l.indexOf(o) + o.length;
518
+ let a = i;
519
+ fe.has(i) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = pe(a) || a;
520
+ const l = s[0], u = l.indexOf("=");
521
+ let h;
522
+ if (u === -1)
523
+ h = l.indexOf(i) + i.length;
524
524
  else {
525
- let g = h + 1;
525
+ let g = u + 1;
526
526
  for (; g < l.length && /\s/.test(l[g]); ) g++;
527
527
  if (l[g] === '"' || l[g] === "'") {
528
528
  let v = g + 1;
529
529
  for (; v < l.length && /\s/.test(l[v]); )
530
530
  v++;
531
- u = v;
531
+ h = v;
532
532
  } else {
533
533
  let v = g;
534
534
  for (; v < l.length && /\s/.test(l[v]); ) v++;
535
- u = v;
535
+ h = v;
536
536
  }
537
537
  }
538
- let m = s.index + u + i;
539
- const p = n.slice(0, m).split(`
540
- `), d = t[0] + p.length - 1, L = p.length > 1 ? p[p.length - 1].length + 1 : t[1] + m;
541
- e.push({ key: a, value: c, loc: [d, L] });
538
+ let d = s.index + h + o;
539
+ const m = n.slice(0, d).split(`
540
+ `), p = t[0] + m.length - 1, R = m.length > 1 ? m[m.length - 1].length + 1 : t[1] + d;
541
+ e.push({ key: a, value: c, loc: [p, R] });
542
542
  }
543
543
  return e;
544
544
  }
545
- function Le(n, t) {
546
- var o;
547
- const e = ((o = (n.match(ke) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", s = Re(n, t);
545
+ function Re(n, t) {
546
+ var i;
547
+ const e = ((i = (n.match($e) || [])[1]) == null ? void 0 : i.toLowerCase()) ?? "", s = Ce(n, t);
548
548
  return {
549
549
  type: {
550
550
  for: y.For,
@@ -558,174 +558,174 @@ function Le(n, t) {
558
558
  attrs: s
559
559
  };
560
560
  }
561
- function Ie(n, t) {
561
+ function Ae(n, t) {
562
562
  const e = n.length;
563
563
  if (n.startsWith("!--", t)) {
564
- const o = n.indexOf("-->", t + 3);
565
- return o === -1 ? -1 : o + 2;
564
+ const i = n.indexOf("-->", t + 3);
565
+ return i === -1 ? -1 : i + 2;
566
566
  }
567
567
  if (n.startsWith("![CDATA[", t)) {
568
- const o = n.indexOf("]]>", t + 8);
569
- return o === -1 ? -1 : o + 2;
568
+ const i = n.indexOf("]]>", t + 8);
569
+ return i === -1 ? -1 : i + 2;
570
570
  }
571
571
  if (n[t] === "!")
572
572
  return n.indexOf(">", t + 1);
573
573
  if (n[t] === "?") {
574
- const o = n.indexOf("?>", t + 1);
575
- return o === -1 ? -1 : o + 1;
574
+ const i = n.indexOf("?>", t + 1);
575
+ return i === -1 ? -1 : i + 1;
576
576
  }
577
- let s = !1, r = !1, i = t;
578
- for (; i < e; ) {
579
- const o = n[i];
580
- if (o === "'" && !r)
577
+ let s = !1, r = !1, o = t;
578
+ for (; o < e; ) {
579
+ const i = n[o];
580
+ if (i === "'" && !r)
581
581
  s = !s;
582
- else if (o === '"' && !s)
582
+ else if (i === '"' && !s)
583
583
  r = !r;
584
- else if (o === ">" && !s && !r)
585
- return i;
586
- i++;
584
+ else if (i === ">" && !s && !r)
585
+ return o;
586
+ o++;
587
587
  }
588
588
  return -1;
589
589
  }
590
- function Ae(n) {
590
+ function Le(n) {
591
591
  const t = [];
592
592
  if (!n) return [];
593
593
  const e = [], s = [], r = () => {
594
594
  var l;
595
595
  return e.length === 0 ? t : (l = e[e.length - 1]).children || (l.children = []);
596
596
  };
597
- let i = 0;
598
- const o = n.length, c = [0];
599
- for (let l = 0; l < o; l++) n[l] === `
597
+ let o = 0;
598
+ const i = n.length, c = [0];
599
+ for (let l = 0; l < i; l++) n[l] === `
600
600
  ` && c.push(l + 1);
601
601
  function a(l) {
602
- let h = 0;
603
- for (let u = 1; u < c.length && !(c[u] > l); u++)
604
- h = u;
605
- return [h + 1, l - c[h] + 1];
606
- }
607
- for (; i < o; ) {
608
- const l = n.indexOf("<", i);
609
- if (l === -1 || l > i) {
610
- const k = n.substring(i, l === -1 ? void 0 : l), I = k.trim();
611
- if (I) {
612
- const f = k.indexOf(I), w = i + f, x = a(w);
602
+ let u = 0;
603
+ for (let h = 1; h < c.length && !(c[h] > l); h++)
604
+ u = h;
605
+ return [u + 1, l - c[u] + 1];
606
+ }
607
+ for (; o < i; ) {
608
+ const l = n.indexOf("<", o);
609
+ if (l === -1 || l > o) {
610
+ const S = n.substring(o, l === -1 ? void 0 : l), A = S.trim();
611
+ if (A) {
612
+ const f = S.indexOf(A), w = o + f, x = a(w);
613
613
  r().push({
614
614
  type: y.Text,
615
615
  tag: "text",
616
- content: I,
616
+ content: A,
617
617
  loc: x,
618
618
  children: []
619
619
  });
620
620
  }
621
621
  if (l === -1) break;
622
- i = l;
622
+ o = l;
623
623
  }
624
- const h = Ie(n, i + 1);
625
- if (h === -1) {
626
- const k = n.substring(i);
627
- k.trim() && r().push({
624
+ const u = Ae(n, o + 1);
625
+ if (u === -1) {
626
+ const S = n.substring(o);
627
+ S.trim() && r().push({
628
628
  type: y.Text,
629
629
  tag: "text",
630
- content: k.trim(),
630
+ content: S.trim(),
631
631
  children: [],
632
- loc: a(i)
632
+ loc: a(o)
633
633
  });
634
634
  break;
635
635
  }
636
- const u = n.substring(i, h + 1), m = r(), E = a(i);
637
- if (u.startsWith("<!--")) {
638
- m.push({
636
+ const h = n.substring(o, u + 1), d = r(), E = a(o);
637
+ if (h.startsWith("<!--")) {
638
+ d.push({
639
639
  type: y.Comment,
640
640
  tag: "comment",
641
- content: u.slice(4, -3),
641
+ content: h.slice(4, -3),
642
642
  loc: E,
643
643
  children: []
644
- }), i = h + 1;
644
+ }), o = u + 1;
645
645
  continue;
646
646
  }
647
- if (u.startsWith("<![CDATA[")) {
648
- m.push({
647
+ if (h.startsWith("<![CDATA[")) {
648
+ d.push({
649
649
  type: y.Text,
650
650
  tag: "text",
651
- content: u.slice(9, -3),
651
+ content: h.slice(9, -3),
652
652
  loc: E,
653
653
  children: []
654
- }), i = h + 1;
654
+ }), o = u + 1;
655
655
  continue;
656
656
  }
657
- if (u.startsWith("<!") && !u.startsWith("<!--")) {
658
- m.push({
657
+ if (h.startsWith("<!") && !h.startsWith("<!--")) {
658
+ d.push({
659
659
  type: y.Comment,
660
660
  tag: "comment",
661
- content: u.slice(2, -1),
661
+ content: h.slice(2, -1),
662
662
  loc: E,
663
663
  children: []
664
- }), i = h + 1;
664
+ }), o = u + 1;
665
665
  continue;
666
666
  }
667
- if (u.startsWith("<?")) {
668
- m.push({
667
+ if (h.startsWith("<?")) {
668
+ d.push({
669
669
  type: y.Comment,
670
670
  tag: "comment",
671
- content: u.slice(2, -2),
671
+ content: h.slice(2, -2),
672
672
  loc: E,
673
673
  children: []
674
- }), i = h + 1;
674
+ }), o = u + 1;
675
675
  continue;
676
676
  }
677
- if (u.startsWith("</")) {
678
- const k = s.pop();
677
+ if (h.startsWith("</")) {
678
+ const S = s.pop();
679
679
  for (; e.length > 0; ) {
680
- if ((e[e.length - 1].tag || "").toLowerCase() === (k == null ? void 0 : k.toLowerCase())) {
680
+ if ((e[e.length - 1].tag || "").toLowerCase() === (S == null ? void 0 : S.toLowerCase())) {
681
681
  e.pop();
682
682
  break;
683
683
  }
684
684
  e.pop();
685
685
  }
686
- i = h + 1;
686
+ o = u + 1;
687
687
  continue;
688
688
  }
689
- const p = Le(u, E);
690
- m.push(p);
691
- const d = p.tag || "", L = d.toLowerCase().startsWith("script"), g = d.toLowerCase().startsWith("style"), v = u.endsWith("/>") || Se.has(d.toLowerCase());
692
- if ((L || g) && !v) {
693
- const k = `</${d}>`, I = n.toLowerCase().indexOf(k, h + 1);
694
- if (I !== -1) {
695
- const f = n.substring(h + 1, I);
696
- f.length && p.children.push({
689
+ const m = Re(h, E);
690
+ d.push(m);
691
+ const p = m.tag || "", R = p.toLowerCase().startsWith("script"), g = p.toLowerCase().startsWith("style"), v = h.endsWith("/>") || Se.has(p.toLowerCase());
692
+ if ((R || g) && !v) {
693
+ const S = `</${p}>`, A = n.toLowerCase().indexOf(S, u + 1);
694
+ if (A !== -1) {
695
+ const f = n.substring(u + 1, A);
696
+ f.length && m.children.push({
697
697
  type: y.Text,
698
698
  tag: "text",
699
699
  content: f,
700
- loc: a(h + 1),
700
+ loc: a(u + 1),
701
701
  children: []
702
- }), i = I + k.length;
702
+ }), o = A + S.length;
703
703
  continue;
704
704
  } else {
705
- const f = n.substring(h + 1);
706
- f.length && p.children.push({
705
+ const f = n.substring(u + 1);
706
+ f.length && m.children.push({
707
707
  type: y.Text,
708
708
  tag: "text",
709
709
  content: f,
710
- loc: a(h + 1),
710
+ loc: a(u + 1),
711
711
  children: []
712
- }), i = o;
712
+ }), o = i;
713
713
  continue;
714
714
  }
715
715
  }
716
- !v && p.type !== y.Text && p.type !== y.Comment && (e.push(p), s.push(d)), i = h + 1;
716
+ !v && m.type !== y.Text && m.type !== y.Comment && (e.push(m), s.push(p)), o = u + 1;
717
717
  }
718
718
  return t;
719
719
  }
720
- const pt = Symbol("solely.raw");
720
+ const ht = Symbol("solely.raw");
721
721
  function Vt(n) {
722
- const t = n && n[pt];
722
+ const t = n && n[ht];
723
723
  return t ? Vt(t) : n;
724
724
  }
725
- function Me(n) {
726
- return !!(n && n[pt]);
725
+ function Ie(n) {
726
+ return !!(n && n[ht]);
727
727
  }
728
- const Ct = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
728
+ const $t = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
729
729
  if (n === t) return !0;
730
730
  if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
731
731
  if (Array.isArray(n) && Array.isArray(t)) {
@@ -733,7 +733,7 @@ const Ct = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
733
733
  if (e.has(n)) return e.get(n) === t;
734
734
  e.set(n, t);
735
735
  for (let r = 0; r < n.length; r++)
736
- if (!Ct(n[r], t[r], e)) return !1;
736
+ if (!$t(n[r], t[r], e)) return !1;
737
737
  return !0;
738
738
  }
739
739
  if (Array.isArray(n) !== Array.isArray(t)) return !1;
@@ -742,112 +742,112 @@ const Ct = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
742
742
  const s = Reflect.ownKeys(n);
743
743
  if (s.length !== Reflect.ownKeys(t).length) return !1;
744
744
  for (const r of s)
745
- if (!Reflect.has(t, r) || !Ct(n[r], t[r], e)) return !1;
745
+ if (!Reflect.has(t, r) || !$t(n[r], t[r], e)) return !1;
746
746
  return !0;
747
747
  };
748
- function Pe(n, t, e = {}) {
749
- const { throttle: s = 0, onBatch: r, immediate: i = !1, deepCompare: o = !1 } = e;
750
- let c = !0, a = null, l = [], h = 0;
751
- const u = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), p = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], d = (f) => {
752
- if (p.length === 0) return !0;
748
+ function Me(n, t, e = {}) {
749
+ const { throttle: s = 0, onBatch: r, immediate: o = !1, deepCompare: i = !1 } = e;
750
+ let c = !0, a = null, l = [], u = 0;
751
+ const h = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), m = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], p = (f) => {
752
+ if (m.length === 0) return !0;
753
753
  const w = f.map(String).join(".");
754
- return p.some((x) => {
754
+ return m.some((x) => {
755
755
  if (x === "") return !0;
756
756
  const b = x.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
757
757
  return new RegExp(`^${b}$`).test(w);
758
758
  });
759
- }, L = (f) => {
759
+ }, R = (f) => {
760
760
  const w = [];
761
761
  let x = f;
762
762
  for (; x; ) {
763
- const b = m.get(x);
763
+ const b = d.get(x);
764
764
  if (!b || b.key == null) break;
765
765
  w.unshift(b.key), x = b.parent;
766
766
  }
767
767
  return w;
768
768
  }, g = (f, w) => {
769
769
  if (!c) return;
770
- const x = L(f);
771
- if (!d(x)) return;
770
+ const x = R(f);
771
+ if (!p(x)) return;
772
772
  const b = { ...w, path: x };
773
773
  s > 0 ? (l.push(b), a || (a = setTimeout(() => {
774
- const A = [...l];
775
- l = [], a = null, c && (r == null || r(A), A.forEach(t));
774
+ const L = [...l];
775
+ l = [], a = null, c && (r == null || r(L), L.forEach(t));
776
776
  }, s))) : (r == null || r([b]), t(b));
777
777
  }, v = (f, w) => {
778
778
  const x = {};
779
779
  return ["push", "pop", "shift", "unshift", "splice"].forEach((b) => {
780
- x[b] = function(...A) {
781
- h++;
782
- const $ = f[b].apply(f, A);
783
- if (h--, b === "push")
784
- g(w, { type: "array-push", index: f.length - A.length, values: A });
780
+ x[b] = function(...L) {
781
+ u++;
782
+ const $ = f[b].apply(f, L);
783
+ if (u--, b === "push")
784
+ g(w, { type: "array-push", index: f.length - L.length, values: L });
785
785
  else if (b === "unshift")
786
- g(w, { type: "array-push", index: 0, values: A });
786
+ g(w, { type: "array-push", index: 0, values: L });
787
787
  else if (b === "pop")
788
788
  g(w, { type: "array-splice", index: f.length, deleteCount: 1, insert: [] });
789
789
  else if (b === "shift")
790
790
  g(w, { type: "array-splice", index: 0, deleteCount: 1, insert: [] });
791
791
  else if (b === "splice") {
792
- const [M, P, ...W] = A;
793
- g(w, { type: "array-splice", index: M, deleteCount: P, insert: W });
792
+ const [I, M, ..._] = L;
793
+ g(w, { type: "array-splice", index: I, deleteCount: M, insert: _ });
794
794
  }
795
795
  return $;
796
796
  };
797
797
  }), ["sort", "reverse", "fill", "copyWithin"].forEach((b) => {
798
- x[b] = function(...A) {
799
- h++;
800
- const $ = f[b].apply(f, A);
801
- return h--, g(w, { type: "array-reset", method: b }), $;
798
+ x[b] = function(...L) {
799
+ u++;
800
+ const $ = f[b].apply(f, L);
801
+ return u--, g(w, { type: "array-reset", method: b }), $;
802
802
  };
803
803
  }), ["indexOf", "lastIndexOf", "includes"].forEach((b) => {
804
- x[b] = function(A, ...$) {
805
- let M = f[b].apply(f, [A, ...$]);
806
- return (M === -1 || M === !1) && Me(A) && (M = f[b].apply(f, [Vt(A), ...$])), M;
804
+ x[b] = function(L, ...$) {
805
+ let I = f[b].apply(f, [L, ...$]);
806
+ return (I === -1 || I === !1) && Ie(L) && (I = f[b].apply(f, [Vt(L), ...$])), I;
807
807
  };
808
808
  }), x;
809
- }, k = (f, w, x) => {
810
- if (!Object.isExtensible(f) || f[pt])
809
+ }, S = (f, w, x) => {
810
+ if (!Object.isExtensible(f) || f[ht])
811
811
  return f;
812
- const b = u.get(f);
812
+ const b = h.get(f);
813
813
  if (b)
814
- return m.set(b, { parent: w, key: x }), b;
815
- const A = {
816
- get(M, P, W) {
817
- if (P === pt) return M;
818
- if (Array.isArray(M)) {
819
- const D = E.get($);
820
- if (D && Object.prototype.hasOwnProperty.call(D, P))
821
- return Reflect.get(D, P, W);
814
+ return d.set(b, { parent: w, key: x }), b;
815
+ const L = {
816
+ get(I, M, _) {
817
+ if (M === ht) return I;
818
+ if (Array.isArray(I)) {
819
+ const F = E.get($);
820
+ if (F && Object.prototype.hasOwnProperty.call(F, M))
821
+ return Reflect.get(F, M, _);
822
822
  }
823
- const V = Reflect.get(M, P, W);
824
- return typeof P == "symbol" ? V : H(V) ? k(V, $, P) : V;
823
+ const D = Reflect.get(I, M, _);
824
+ return typeof M == "symbol" ? D : K(D) ? S(D, $, M) : D;
825
825
  },
826
- set(M, P, W, V) {
827
- const D = M[P];
828
- if (o ? Ct(D, W) : D === W) return !0;
829
- const at = Reflect.set(M, P, W, V);
830
- return h === 0 && (Array.isArray(D) && Array.isArray(W) ? g($, { type: "array-replace", oldValue: D, newValue: W }) : g($, { type: "set", key: P, newValue: W, oldValue: D })), at;
826
+ set(I, M, _, D) {
827
+ const F = I[M];
828
+ if (i ? $t(F, _) : F === _) return !0;
829
+ const rt = Reflect.set(I, M, _, D);
830
+ return u === 0 && (Array.isArray(F) && Array.isArray(_) ? g($, { type: "array-replace", oldValue: F, newValue: _ }) : g($, { type: "set", key: M, newValue: _, oldValue: F })), rt;
831
831
  },
832
- deleteProperty(M, P) {
833
- if (!Reflect.has(M, P)) return !1;
834
- const W = M[P], V = Reflect.deleteProperty(M, P);
835
- return V && h === 0 && g($, { type: "delete", key: P, oldValue: W }), V;
832
+ deleteProperty(I, M) {
833
+ if (!Reflect.has(I, M)) return !1;
834
+ const _ = I[M], D = Reflect.deleteProperty(I, M);
835
+ return D && u === 0 && g($, { type: "delete", key: M, oldValue: _ }), D;
836
836
  }
837
- }, $ = new Proxy(f, A);
838
- return u.set(f, $), m.set($, { parent: w, key: x }), Array.isArray(f) && E.set($, v(f, $)), $;
839
- }, I = k(n, null, null);
840
- if (i) {
837
+ }, $ = new Proxy(f, L);
838
+ return h.set(f, $), d.set($, { parent: w, key: x }), Array.isArray(f) && E.set($, v(f, $)), $;
839
+ }, A = S(n, null, null);
840
+ if (o) {
841
841
  const f = (w, x, b = /* @__PURE__ */ new WeakSet()) => {
842
- !H(w) || b.has(w) || (b.add(w), Reflect.ownKeys(w).forEach((A) => {
843
- const $ = w[A];
844
- g(x, { type: "set", key: A, newValue: $, oldValue: void 0 }), H($) && f($, k($, x, A), b);
842
+ !K(w) || b.has(w) || (b.add(w), Reflect.ownKeys(w).forEach((L) => {
843
+ const $ = w[L];
844
+ g(x, { type: "set", key: L, newValue: $, oldValue: void 0 }), K($) && f($, S($, x, L), b);
845
845
  }));
846
846
  };
847
- f(n, I);
847
+ f(n, A);
848
848
  }
849
849
  return {
850
- proxy: I,
850
+ proxy: A,
851
851
  unobserve: () => {
852
852
  c = !1, l = [], a && clearTimeout(a);
853
853
  },
@@ -856,85 +856,77 @@ function Pe(n, t, e = {}) {
856
856
  }
857
857
  };
858
858
  }
859
- const Tt = Symbol.for("solely.manifest");
860
- var q, Y, J, rt, Z, G, Q, X, K, it, ot, z, S, Bt, Rt, qt, Lt, It, dt, Gt, Kt, At, Pt;
861
- const j = class j extends HTMLElement {
859
+ const Nt = Symbol.for("solely.manifest");
860
+ var B, U, H, nt, Y, G, Z, J, q, st, C, Dt, St, jt, Bt, kt, ut, Gt, qt, Ct, Lt;
861
+ class ft extends HTMLElement {
862
862
  /* -------------------- 构造 -------------------- */
863
863
  constructor(e = {}) {
864
- var i;
864
+ var o;
865
865
  super();
866
- _(this, S);
867
- _(this, q);
868
- _(this, Y);
869
- _(this, J);
870
- _(this, rt);
871
- _(this, Z);
872
- _(this, G);
873
- _(this, Q, !1);
874
- _(this, X, !1);
875
- _(this, K, !1);
876
- _(this, it, !1);
866
+ T(this, C);
867
+ T(this, B);
868
+ T(this, U);
869
+ T(this, H);
870
+ T(this, nt);
871
+ T(this, Y);
872
+ T(this, G);
873
+ T(this, Z, !1);
874
+ T(this, J, !1);
875
+ T(this, q, !1);
876
+ T(this, st, !1);
877
877
  const s = this.constructor;
878
- N(this, q, s[Tt] || { tagName: "base-element" });
879
- const r = R(this, q);
880
- N(this, Z, (i = r.shadowDOM) != null && i.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), O(this, S, Rt).call(this, e), O(this, S, qt).call(this, r), queueMicrotask(() => O(this, S, At).call(this));
878
+ O(this, B, s[Nt] || { tagName: "base-element" });
879
+ const r = P(this, B);
880
+ O(this, Y, (o = r.shadowDOM) != null && o.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), N(this, C, St).call(this, e), N(this, C, Bt).call(this, r), queueMicrotask(() => N(this, C, Ct).call(this));
881
881
  }
882
+ // 需要在元素定义前设置的属性列表(Upgrade Property)
883
+ /* -------------------- observedAttributes -------------------- */
882
884
  static get observedAttributes() {
883
- if (R(j, z).has(this))
884
- return R(j, z).get(this);
885
- const e = this[Tt];
886
- if (!(e != null && e.props))
887
- return R(j, z).set(this, []), [];
888
- const s = e.props.map((r) => (typeof r == "string" ? r : r.name).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase());
889
- return R(j, z).set(this, s), s;
885
+ const e = this[Nt];
886
+ return e != null && e.propMap ? Array.from(e.propMap.keys()) : [];
890
887
  }
891
888
  /* -------------------- $data -------------------- */
892
889
  get $data() {
893
- return R(this, rt);
890
+ return P(this, nt);
894
891
  }
895
892
  set $data(e) {
896
893
  var s;
897
- H(e) || (e = {}), (s = R(this, G)) == null || s.call(this), O(this, S, Rt).call(this, e), O(this, S, dt).call(this);
894
+ K(e) || (e = {}), (s = P(this, G)) == null || s.call(this), N(this, C, St).call(this, e), N(this, C, ut).call(this);
898
895
  }
899
896
  refresh() {
900
- O(this, S, dt).call(this);
897
+ N(this, C, ut).call(this);
901
898
  }
902
899
  /* -------------------- 生命周期 -------------------- */
903
900
  connectedCallback() {
904
- var i;
901
+ var o;
905
902
  const e = this.constructor;
906
- Array.isArray(e.upgradeProps) && O(this, S, Bt).call(this, e.upgradeProps), O(this, S, At).call(this);
907
- const s = R(this, q);
908
- if ((s.className || s.tagName || "").split(" ").forEach((o) => o && this.classList.add(o)), O(this, S, Kt).call(this), s.props && H(this.$data))
909
- for (const o of s.props) {
910
- const c = typeof o == "string" ? o : o.name, a = O(this, S, Lt).call(this, c), l = c.replace(
911
- /-([a-z])/g,
912
- (h, u) => u.toUpperCase()
913
- );
914
- if (this.hasAttribute(c)) {
915
- const h = this.getAttribute(c), u = O(this, S, It).call(this, h, a == null ? void 0 : a.default, a == null ? void 0 : a.type);
916
- this.$data[l] = u;
917
- } else a && "default" in a && (this.$data[l] = a.default);
903
+ Array.isArray(e.upgradeProps) && N(this, C, Dt).call(this, e.upgradeProps), N(this, C, Ct).call(this);
904
+ const s = P(this, B);
905
+ if ((s.className || s.tagName || "").split(" ").forEach((i) => i && this.classList.add(i)), N(this, C, qt).call(this), s.propMap && K(this.$data))
906
+ for (const [i, c] of s.propMap) {
907
+ const a = c.name;
908
+ if (this.hasAttribute(i)) {
909
+ const l = this.getAttribute(i), u = N(this, C, kt).call(this, l, c.default, c.type);
910
+ this.$data[a] = u;
911
+ } else "default" in c && (this.$data[a] = c.default);
918
912
  }
919
- R(this, J) && N(this, Y, Ke(
920
- R(this, J),
921
- R(this, Z),
913
+ P(this, H) && O(this, U, Be(
914
+ P(this, H),
915
+ P(this, Y),
922
916
  this
923
- )), this.mounted(), (i = this.onInit) == null || i.call(this);
917
+ )), this.mounted(), (o = this.onInit) == null || o.call(this);
924
918
  }
925
919
  disconnectedCallback() {
926
920
  var e;
927
- this.unmounted(), (e = R(this, G)) == null || e.call(this), N(this, G, void 0);
921
+ this.unmounted(), (e = P(this, G)) == null || e.call(this), O(this, G, void 0);
928
922
  }
929
923
  attributeChangedCallback(e, s, r) {
930
- if (s === r || !H(this.$data)) return;
931
- const i = O(this, S, Lt).call(this, e), o = e.replace(/-([a-z])/g, (l, h) => h.toUpperCase()), c = this.$data[o], a = O(this, S, It).call(this, r, (i == null ? void 0 : i.default) ?? c, i == null ? void 0 : i.type);
932
- this.$data[o] = a, N(this, K, !0), this.attributeChanged(e, c, a), this.emit("change", {
933
- source: "attribute",
934
- name: e,
935
- oldValue: c,
936
- newValue: a
937
- });
924
+ var u;
925
+ if (s === r || !K(this.$data)) return;
926
+ const i = (u = P(this, B).propMap) == null ? void 0 : u.get(e);
927
+ if (!i) return;
928
+ const c = i.name, a = this.$data[c], l = N(this, C, kt).call(this, r, i.default ?? a, i.type);
929
+ this.$data[c] = l, O(this, q, !0), this.attributeChanged(e, a, l);
938
930
  }
939
931
  /* -------------------- 事件派发 -------------------- */
940
932
  emit(e, s, r) {
@@ -966,50 +958,50 @@ const j = class j extends HTMLElement {
966
958
  }
967
959
  afterAttributesUpdate() {
968
960
  }
969
- };
970
- q = new WeakMap(), Y = new WeakMap(), J = new WeakMap(), rt = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), K = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), z = new WeakMap(), S = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
971
- Bt = function(e) {
961
+ }
962
+ B = new WeakMap(), U = new WeakMap(), H = new WeakMap(), nt = new WeakMap(), Y = new WeakMap(), G = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), q = new WeakMap(), st = new WeakMap(), C = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
963
+ Dt = function(e) {
972
964
  for (const s of e)
973
965
  if (this.hasOwnProperty(s)) {
974
966
  const r = this[s];
975
967
  delete this[s], this[s] = r;
976
968
  }
977
969
  }, /* -------------------- 初始化 -------------------- */
978
- Rt = function(e) {
979
- const { proxy: s, unobserve: r } = Pe(e, (i) => {
970
+ St = function(e) {
971
+ const { proxy: s, unobserve: r } = Me(e, (o) => {
972
+ var i, c;
973
+ if (o.type === "set") {
974
+ const { key: a, newValue: l } = o, u = P(this, B), h = String(a), d = ((i = u.propMap) == null ? void 0 : i.get(
975
+ h.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
976
+ )) || Array.from(((c = u.propMap) == null ? void 0 : c.values()) || []).find((E) => E.name === h);
977
+ d != null && d.reflect && N(this, C, jt).call(this, d, l);
978
+ }
980
979
  this.emit("change", {
981
980
  source: "state",
982
- ...i
983
- }), O(this, S, dt).call(this);
981
+ ...o
982
+ }), N(this, C, ut).call(this);
984
983
  });
985
- N(this, rt, s), N(this, G, r);
986
- }, qt = function(e) {
987
- const s = e.template;
988
- if (typeof s == "string") {
989
- const r = Ae(s);
990
- N(this, J, $e(r, {
991
- source: s,
992
- filename: e.tagName
993
- }));
994
- }
995
- }, /* -------------------- Prop 工具 -------------------- */
996
- Lt = function(e) {
997
- const s = R(this, q).props;
998
- if (!s) return;
999
- const r = e.replace(/-([a-z])/g, (o, c) => c.toUpperCase()), i = s.find(
1000
- (o) => typeof o == "string" ? o === r : o.name === r
1001
- );
1002
- if (i)
1003
- return typeof i == "string" ? { name: i } : i;
1004
- }, It = function(e, s, r) {
1005
- if (e === null) return s;
984
+ O(this, nt, s), O(this, G, r);
985
+ }, jt = function(e, s) {
986
+ const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
987
+ if (e.type === "boolean")
988
+ s ? this.setAttribute(r, "") : this.removeAttribute(r);
989
+ else {
990
+ const o = typeof s == "object" ? JSON.stringify(s) : String(s);
991
+ this.setAttribute(r, o);
992
+ }
993
+ }, Bt = function(e) {
994
+ e.ir && O(this, H, e.ir);
995
+ }, kt = function(e, s, r) {
996
+ if (e === null)
997
+ return r === "boolean" ? s ?? !1 : s;
1006
998
  switch (r) {
999
+ case "boolean":
1000
+ return !0;
1007
1001
  case "number": {
1008
- const i = Number(e);
1009
- return isNaN(i) ? s : i;
1002
+ const o = Number(e);
1003
+ return isNaN(o) ? s : o;
1010
1004
  }
1011
- case "boolean":
1012
- return e !== null && e !== "false";
1013
1005
  case "object":
1014
1006
  try {
1015
1007
  return JSON.parse(e);
@@ -1020,142 +1012,165 @@ Lt = function(e) {
1020
1012
  return e;
1021
1013
  }
1022
1014
  }, /* -------------------- 刷新调度 -------------------- */
1023
- dt = function() {
1024
- R(this, X) || !R(this, Y) || (N(this, X, !0), queueMicrotask(() => {
1025
- N(this, X, !1), O(this, S, Gt).call(this);
1015
+ ut = function() {
1016
+ P(this, J) || !P(this, U) || (O(this, J, !0), queueMicrotask(() => {
1017
+ O(this, J, !1), N(this, C, Gt).call(this);
1026
1018
  }));
1027
1019
  }, Gt = function() {
1028
- R(this, Q) || !this.isConnected || (N(this, Q, !0), R(this, K) && this.beforeAttributesUpdate(), this.beforeUpdate(), R(this, Y).update(), this.updated(), R(this, K) && (this.afterAttributesUpdate(), N(this, K, !1)), N(this, Q, !1));
1029
- }, Kt = function() {
1030
- const s = R(this, q).styles;
1031
- if (!s) return;
1032
- const r = R(this, Z);
1033
- if ("adoptedStyleSheets" in r) {
1034
- if (r._styleInjected) return;
1035
- let o = R(j, ot).get(s);
1036
- o || (o = new CSSStyleSheet(), o.replaceSync(s), R(j, ot).set(s, o)), r.adoptedStyleSheets = [
1037
- ...r.adoptedStyleSheets,
1038
- o
1039
- ], r._styleInjected = !0;
1020
+ P(this, Z) || !this.isConnected || (O(this, Z, !0), P(this, q) && this.beforeAttributesUpdate(), this.beforeUpdate(), P(this, U).update(), this.updated(), P(this, q) && (this.afterAttributesUpdate(), O(this, q, !1)), O(this, Z, !1));
1021
+ }, qt = function() {
1022
+ const e = P(this, B);
1023
+ if (!e.styles) return;
1024
+ const s = P(this, Y);
1025
+ if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
1026
+ s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
1040
1027
  return;
1041
1028
  }
1042
- if (r.querySelector("style[data-manifest-style]")) return;
1043
- const i = document.createElement("style");
1044
- i.dataset.manifestStyle = "true", i.textContent = s, r.appendChild(i);
1029
+ const r = s instanceof ShadowRoot ? s : document.head, o = `solely-style-${e.tagName}`;
1030
+ if (!r.querySelector(`#${o}`)) {
1031
+ const i = document.createElement("style");
1032
+ i.id = o, i.textContent = e.styles, r.appendChild(i);
1033
+ }
1045
1034
  }, /* -------------------- created 保障 -------------------- */
1046
- At = function() {
1047
- R(this, it) || (N(this, it, !0), this.created());
1048
- }, Pt = new WeakMap(), C(j, "upgradeProps"), // 需要在元素定义前设置的属性列表(Upgrade Property)
1049
- _(j, ot, /* @__PURE__ */ new Map()), /* -------------------- observedAttributes -------------------- */
1050
- _(j, z, /* @__PURE__ */ new WeakMap()), /* -------------------- DEV define 保护 -------------------- */
1051
- _(j, Pt, !1);
1052
- let mt = j;
1053
- const Oe = Symbol.for("solely.manifest"), zt = (n) => (t) => {
1054
- if (customElements.get(n.tagName))
1055
- return console.warn(`标签名称 "${n.tagName}" 已经被注册`), t;
1056
- class e extends t {
1057
- }
1058
- return e[Oe] = n, customElements.define(n.tagName, e), e;
1059
- }, ut = Symbol("solely.irCtx"), ht = Symbol("solely.irEvents"), F = Symbol.for("solely.irMeta"), Et = Symbol("solely.prevClassObj"), xt = Symbol("solely.prevStyleObj"), _e = {
1035
+ Ct = function() {
1036
+ P(this, st) || (O(this, st, !0), this.created());
1037
+ }, Lt = new WeakMap(), k(ft, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
1038
+ T(ft, Lt, !1);
1039
+ const Pe = Symbol.for("solely.manifest"), zt = (n) => {
1040
+ const t = n;
1041
+ return (e) => {
1042
+ const { tagName: s } = t;
1043
+ if (customElements.get(s))
1044
+ return e;
1045
+ if (typeof t.template == "string" && !t.ir)
1046
+ try {
1047
+ const o = Le(t.template);
1048
+ t.ir = xe(o, {
1049
+ source: t.template,
1050
+ filename: s
1051
+ });
1052
+ } catch (o) {
1053
+ console.error(`[Compiler Error] <${s}>:`, o);
1054
+ }
1055
+ if (t.styles && !t.sheet && "CSSStyleSheet" in window)
1056
+ try {
1057
+ const o = new CSSStyleSheet();
1058
+ o.replaceSync(t.styles), t.sheet = o;
1059
+ } catch (o) {
1060
+ console.error(`[Style Error] <${s}>:`, o);
1061
+ }
1062
+ if (t.props && !t.propMap) {
1063
+ const o = /* @__PURE__ */ new Map();
1064
+ t.props.forEach((i) => {
1065
+ const c = typeof i == "string" ? { name: i } : i, a = c.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1066
+ o.set(a, c);
1067
+ }), t.propMap = o;
1068
+ }
1069
+ class r extends e {
1070
+ }
1071
+ return r[Pe] = t, customElements.define(s, r), r;
1072
+ };
1073
+ }, at = Symbol("solely.irCtx"), ct = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), bt = Symbol("solely.prevClassObj"), wt = Symbol("solely.prevStyleObj"), Oe = {
1060
1074
  xml: "http://www.w3.org/XML/1998/namespace",
1061
1075
  xlink: "http://www.w3.org/1999/xlink",
1062
1076
  xmlns: "http://www.w3.org/2000/xmlns/"
1063
- }, Ne = {
1077
+ }, _t = {
1064
1078
  readonly: "readOnly",
1065
1079
  for: "htmlFor",
1066
1080
  tabindex: "tabIndex",
1067
1081
  contenteditable: "contentEditable",
1068
1082
  maxlength: "maxLength"
1069
- }, We = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Te = /* @__PURE__ */ new Set([
1083
+ }, Ne = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), _e = /* @__PURE__ */ new Set([
1070
1084
  "value",
1071
1085
  "selectedIndex"
1072
1086
  ]);
1073
- function De(n, t) {
1087
+ function Te(n, t) {
1074
1088
  var s;
1075
1089
  const e = (s = t.attrs) == null ? void 0 : s.find((r) => r.key === "class" && !r.dynamic);
1076
1090
  e != null && e.value && n.setAttribute("class", e.value);
1077
1091
  }
1078
- function Fe(n, t) {
1079
- var r;
1080
- const e = (r = t.attrs) == null ? void 0 : r.find((i) => i.key === "style" && !i.dynamic), s = e ? Ut(e.value) : {};
1081
- for (const i in s) {
1082
- const o = s[i];
1083
- i.startsWith("--") ? n.style.setProperty(i, o) : n.style[i] = o;
1092
+ function We(n, t) {
1093
+ var o;
1094
+ if (!n.style) return;
1095
+ const s = (o = t.attrs) == null ? void 0 : o.find((i) => i.key === "style" && !i.dynamic), r = s ? Kt(s.value) : {};
1096
+ for (const i in r) {
1097
+ const c = r[i];
1098
+ i.startsWith("--") ? n.style.setProperty(i, c) : n.style[i] = c;
1084
1099
  }
1085
1100
  }
1086
- const je = (n, t) => {
1087
- const e = n, s = Ut(t), r = e[xt];
1101
+ const Fe = (n, t) => {
1102
+ const e = n, s = Kt(t), r = e[wt];
1088
1103
  if (!r) {
1089
- for (const o in s) {
1090
- const c = s[o];
1091
- o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c;
1104
+ for (const i in s) {
1105
+ const c = s[i];
1106
+ i.startsWith("--") ? n.style.setProperty(i, c) : n.style[i] = c;
1092
1107
  }
1093
- e[xt] = s;
1108
+ e[wt] = s;
1094
1109
  return;
1095
1110
  }
1096
- let i = !1;
1097
- for (const o in r)
1098
- o in s || (o.startsWith("--") ? n.style.removeProperty(o) : n.style[o] = "", i = !0);
1099
- for (const o in s) {
1100
- const c = s[o], a = r[o];
1101
- c !== a && (o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c, i = !0);
1111
+ let o = !1;
1112
+ for (const i in r)
1113
+ i in s || (i.startsWith("--") ? n.style.removeProperty(i) : n.style[i] = "", o = !0);
1114
+ for (const i in s) {
1115
+ const c = s[i], a = r[i];
1116
+ c !== a && (i.startsWith("--") ? n.style.setProperty(i, c) : n.style[i] = c, o = !0);
1102
1117
  }
1103
- i && (e[xt] = s);
1118
+ o && (e[wt] = s);
1104
1119
  }, Ve = (n, t) => {
1105
- const e = n, s = e[Et], r = Be(t);
1120
+ const e = n, s = e[bt], r = De(t);
1106
1121
  if (!s) {
1107
- for (const o in r)
1108
- n.classList.add(o);
1109
- e[Et] = r;
1122
+ for (const i in r)
1123
+ n.classList.add(i);
1124
+ e[bt] = r;
1110
1125
  return;
1111
1126
  }
1112
- let i = !1;
1113
- for (const o in s)
1114
- r[o] || (n.classList.remove(o), i = !0);
1115
- for (const o in r)
1116
- s[o] || (n.classList.add(o), i = !0);
1117
- i && (e[Et] = r);
1127
+ let o = !1;
1128
+ for (const i in s)
1129
+ r[i] || (n.classList.remove(i), o = !0);
1130
+ for (const i in r)
1131
+ s[i] || (n.classList.add(i), o = !0);
1132
+ o && (e[bt] = r);
1118
1133
  };
1119
- function Ut(n) {
1134
+ function Kt(n) {
1120
1135
  const t = {}, e = [[n]];
1121
1136
  for (; e.length; ) {
1122
1137
  const [s, r] = e.pop();
1123
1138
  if (s) {
1124
1139
  if (typeof s == "string") {
1125
- const i = /([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;
1126
- let o;
1127
- for (; (o = i.exec(s)) !== null; ) {
1128
- const c = o[1].trim(), a = o[2].trim();
1140
+ const o = /([^:;]+)\s*:\s*([^;]*\(.*?\)[^;]*|[^;]+)/g;
1141
+ let i;
1142
+ for (; (i = o.exec(s)) !== null; ) {
1143
+ const c = i[1].trim(), a = i[2].trim();
1129
1144
  c && a && (t[c] = a);
1130
1145
  }
1131
1146
  continue;
1132
1147
  }
1133
1148
  if (Array.isArray(s)) {
1134
- for (let i = s.length - 1; i >= 0; i--)
1135
- e.push([s[i]]);
1149
+ for (let o = s.length - 1; o >= 0; o--)
1150
+ e.push([s[o]]);
1136
1151
  continue;
1137
1152
  }
1138
1153
  if (typeof s == "object")
1139
- for (const i in s) {
1140
- const o = s[i];
1141
- if (o == null) continue;
1142
- const c = r ? `${r}-${i}` : i;
1143
- typeof o == "object" && !Array.isArray(o) ? e.push([o, c]) : t[c] = String(o);
1154
+ for (const o in s) {
1155
+ const i = s[o];
1156
+ if (i == null) continue;
1157
+ const c = r ? `${r}-${o}` : o;
1158
+ typeof i == "object" && !Array.isArray(i) ? e.push([i, c]) : t[c] = String(i);
1144
1159
  }
1145
1160
  }
1146
1161
  }
1147
1162
  return t;
1148
1163
  }
1149
- function Be(n) {
1164
+ function De(n) {
1150
1165
  const t = {}, e = [n];
1151
1166
  for (; e.length; ) {
1152
1167
  const s = e.pop();
1153
1168
  if (s) {
1154
1169
  if (typeof s == "string") {
1155
1170
  const r = s.split(" ");
1156
- for (let i = 0; i < r.length; i++) {
1157
- const o = r[i].trim();
1158
- o && (t[o] = !0);
1171
+ for (let o = 0; o < r.length; o++) {
1172
+ const i = r[o].trim();
1173
+ i && (t[i] = !0);
1159
1174
  }
1160
1175
  } else if (Array.isArray(s))
1161
1176
  for (let r = s.length - 1; r >= 0; r--)
@@ -1167,35 +1182,61 @@ function Be(n) {
1167
1182
  }
1168
1183
  return t;
1169
1184
  }
1170
- function qe(n, t, e) {
1171
- const s = t.indexOf(":");
1172
- if (s > 0) {
1173
- const r = t.slice(0, s), i = _e[r];
1174
- if (i) return n.setAttributeNS(i, t, e);
1185
+ function Rt(n, t, e) {
1186
+ const s = e == null ? "" : String(e), r = t.indexOf(":");
1187
+ if (r > 0) {
1188
+ const o = t.slice(0, r), i = Oe[o];
1189
+ if (i) {
1190
+ n.getAttributeNS(i, t) !== s && n.setAttributeNS(i, t, s);
1191
+ return;
1192
+ }
1175
1193
  }
1176
- n.setAttribute(t, e);
1194
+ n.getAttribute(t) !== s && n.setAttribute(t, s);
1177
1195
  }
1178
- function Dt(n, t, e) {
1179
- if (t.startsWith("data-") || t.startsWith("aria-") || We.has(t)) {
1180
- n.setAttribute(t, e);
1196
+ function Tt(n, t, e) {
1197
+ const s = _t[t] || t;
1198
+ if (t.startsWith("data-") || t.startsWith("aria-") || Ne.has(t)) {
1199
+ Rt(n, t, e);
1181
1200
  return;
1182
1201
  }
1183
- const s = Ne[t] || t;
1184
- n[s] = e;
1202
+ const r = n, o = r.tagName;
1203
+ if (e == null) {
1204
+ if (typeof r[s] == "boolean")
1205
+ r[s] !== !1 && (r[s] = !1);
1206
+ else {
1207
+ const c = r[s];
1208
+ c !== "" && c !== void 0 && (r[s] = ""), n.hasAttribute(t) && n.removeAttribute(t);
1209
+ }
1210
+ return;
1211
+ }
1212
+ if (s === "src" || s === "href") {
1213
+ const c = String(e);
1214
+ if (r[s] === c || n.getAttribute(s) === c)
1215
+ return;
1216
+ }
1217
+ if (s === "value" && (o === "INPUT" || o === "TEXTAREA") && r.value === e)
1218
+ return;
1219
+ if (typeof e == "boolean") {
1220
+ if (r[s] === e)
1221
+ return;
1222
+ r[s] = e;
1223
+ return;
1224
+ }
1225
+ (n instanceof SVGElement || r.ownerSVGElement !== void 0) && !_t[t] ? Rt(n, t, e) : r[s] !== e && (r[s] = e);
1185
1226
  }
1186
- class Ge {
1227
+ class je {
1187
1228
  constructor(t, e, s = {}) {
1188
- C(this, "nodeMap", /* @__PURE__ */ new Map());
1189
- C(this, "marker", !1);
1229
+ k(this, "nodeMap", /* @__PURE__ */ new Map());
1230
+ k(this, "marker", !1);
1190
1231
  this.ir = t, this.container = e, this.scope = s;
1191
1232
  }
1192
1233
  evalIR(t, e, s) {
1193
- var i;
1234
+ var o;
1194
1235
  const r = this.ir.functions[t - 1];
1195
1236
  try {
1196
1237
  return r ? r.apply(this.scope, e) : "";
1197
- } catch (o) {
1198
- return ne(o.message || o.toString(), ((i = this.ir.metadata) == null ? void 0 : i.source) || "", s, this.scope.tagName), "";
1238
+ } catch (i) {
1239
+ return ee(i.message || i.toString(), ((o = this.ir.metadata) == null ? void 0 : o.source) || "", s, this.scope.tagName), "";
1199
1240
  }
1200
1241
  }
1201
1242
  // ================ 创建节点 ================
@@ -1204,87 +1245,87 @@ class Ge {
1204
1245
  return e instanceof SVGElement || s === "svg" ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
1205
1246
  }
1206
1247
  createText(t, e) {
1207
- const s = t.dynamic ? this.evalIR(t.fid, [e], t[F]) : t.txt || "";
1248
+ const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1208
1249
  return document.createTextNode(s);
1209
1250
  }
1210
1251
  createComment(t, e) {
1211
- const s = t.dynamic ? this.evalIR(t.fid, [e], t[F]) : t.txt || "";
1252
+ const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1212
1253
  return document.createComment(s);
1213
1254
  }
1214
1255
  // ================ 属性全量应用(创建或更新时用) ================
1215
1256
  applyAttrs(t, e, s, r = !1) {
1216
- const i = [], o = t;
1217
- o[ut] || (o[ut] = {
1257
+ const o = [], i = t;
1258
+ i[at] || (i[at] = {
1218
1259
  loops: null
1219
- }), o[ut].loops = s, o[ht] || (o[ht] = /* @__PURE__ */ Object.create(null));
1220
- let c, a = !1, l, h = !1;
1221
- for (const u of e) {
1222
- const { key: m, fid: E, dynamic: p, value: d } = u;
1223
- if (m === ":class") {
1224
- c = this.evalIR(E, [s], u[F]), a = !0;
1260
+ }), i[at].loops = s, i[ct] || (i[ct] = /* @__PURE__ */ Object.create(null));
1261
+ let c, a = !1, l, u = !1;
1262
+ for (const h of e) {
1263
+ const { key: d, fid: E, dynamic: m, value: p } = h;
1264
+ if (d === ":class") {
1265
+ c = this.evalIR(E, [s], h[V]), a = !0;
1225
1266
  continue;
1226
1267
  }
1227
- if (m === ":style") {
1228
- l = this.evalIR(E, [s], u[F]), h = !0;
1268
+ if (d === ":style") {
1269
+ l = this.evalIR(E, [s], h[V]), u = !0;
1229
1270
  continue;
1230
1271
  }
1231
- if (m === "class" || m === "style")
1272
+ if (d === "class" || d === "style")
1232
1273
  continue;
1233
- const L = m[0];
1234
- if (L === "@") {
1235
- const v = m.slice(1), k = u.role ?? "user";
1236
- let I = o[ht][v];
1237
- if (I || (I = o[ht][v] = {
1274
+ const R = d[0];
1275
+ if (R === "@") {
1276
+ const v = d.slice(1), S = h.role ?? "user";
1277
+ let A = i[ct][v];
1278
+ if (A || (A = i[ct][v] = {
1238
1279
  model: [],
1239
1280
  user: []
1240
1281
  }, t.addEventListener(v, (f) => {
1241
- for (const w of I.model)
1282
+ for (const w of A.model)
1242
1283
  w(f);
1243
- for (const w of I.user)
1284
+ for (const w of A.user)
1244
1285
  w(f);
1245
1286
  })), !r) {
1246
1287
  const f = (w) => this.evalIR(
1247
1288
  E,
1248
- [w, o[ut].loops],
1249
- u[F]
1289
+ [w, i[at].loops],
1290
+ h[V]
1250
1291
  );
1251
- I[k].push(f);
1292
+ A[S].push(f);
1252
1293
  }
1253
1294
  continue;
1254
1295
  }
1255
- if (m === "mounted") {
1296
+ if (d === "mounted") {
1256
1297
  r || requestAnimationFrame(
1257
- () => this.evalIR(E, [t, s], u[F])
1298
+ () => this.evalIR(E, [t, s], h[V])
1258
1299
  );
1259
1300
  continue;
1260
1301
  }
1261
- if (m === "updated") {
1302
+ if (d === "updated") {
1262
1303
  r && requestAnimationFrame(
1263
- () => this.evalIR(E, [t, s], u[F])
1304
+ () => this.evalIR(E, [t, s], h[V])
1264
1305
  );
1265
1306
  continue;
1266
1307
  }
1267
- if (m === "ref" && d) {
1268
- this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[d] = t;
1308
+ if (d === "ref" && p) {
1309
+ this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[p] = t;
1269
1310
  continue;
1270
1311
  }
1271
- const g = p ? this.evalIR(E, [s], u[F]) : d ?? "";
1272
- if (L === ":") {
1273
- const v = m.slice(1);
1274
- t.tagName === "SELECT" && Te.has(v) ? i.push(() => Dt(t, v, g)) : Dt(t, v, g);
1275
- } else r || qe(t, m, String(g));
1312
+ const g = m ? this.evalIR(E, [s], h[V]) : p ?? "";
1313
+ if (R === ":") {
1314
+ const v = d.slice(1);
1315
+ t.tagName === "SELECT" && _e.has(v) ? o.push(() => Tt(t, v, g)) : Tt(t, v, g);
1316
+ } else r || Rt(t, d, String(g));
1276
1317
  }
1277
- return a && Ve(t, c), h && je(t, l), i;
1318
+ return a && Ve(t, c), u && Fe(t, l), o;
1278
1319
  }
1279
1320
  // ================ 更新已有节点 Text Or Comment ================
1280
1321
  updateNode(t, e, s) {
1281
- const r = e.dynamic ? this.evalIR(e.fid, [s], e[F]) : e.txt || "";
1322
+ const r = e.dynamic ? this.evalIR(e.fid, [s], e[V]) : e.txt || "";
1282
1323
  e.dynamic && t.textContent !== r && (t.textContent = r);
1283
1324
  }
1284
1325
  // ================ 核心遍历 ================
1285
- irToNode(t, e, s, r, i) {
1286
- var l, h, u, m;
1287
- const o = s + "-" + e, c = this.nodeMap.get(o);
1326
+ irToNode(t, e, s, r, o) {
1327
+ var l, u, h, d;
1328
+ const i = s + "-" + e, c = this.nodeMap.get(i);
1288
1329
  let a;
1289
1330
  if (c) {
1290
1331
  a = c.node, c.marker = this.marker;
@@ -1292,56 +1333,56 @@ class Ge {
1292
1333
  t.dynamic && (t.type === y.Element ? E = this.applyAttrs(
1293
1334
  a,
1294
1335
  t.attrs ?? [],
1295
- i,
1336
+ o,
1296
1337
  !0
1297
- ) : this.updateNode(a, t, i)), (l = t.children) == null || l.forEach((p, d) => {
1298
- this.irToNode(p, d, o, a, i);
1299
- }), E.forEach((p) => p());
1338
+ ) : this.updateNode(a, t, o)), (l = t.children) == null || l.forEach((m, p) => {
1339
+ this.irToNode(m, p, i, a, o);
1340
+ }), E.forEach((m) => m());
1300
1341
  } else
1301
1342
  switch (t.type) {
1302
1343
  case y.Element:
1303
- a = this.createElement(t, r), De(a, t), Fe(a, t);
1304
- const E = this.applyAttrs(a, t.attrs ?? [], i);
1305
- r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker }), (h = t.children) == null || h.forEach((p, d) => {
1306
- this.irToNode(p, d, o, a, i);
1307
- }), E.forEach((p) => p());
1344
+ a = this.createElement(t, r), Te(a, t), We(a, t);
1345
+ const E = this.applyAttrs(a, t.attrs ?? [], o);
1346
+ r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker }), (u = t.children) == null || u.forEach((m, p) => {
1347
+ this.irToNode(m, p, i, a, o);
1348
+ }), E.forEach((m) => m());
1308
1349
  break;
1309
1350
  case y.Text:
1310
- a = this.createText(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1351
+ a = this.createText(t, o), r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker });
1311
1352
  break;
1312
1353
  case y.Comment:
1313
- a = this.createComment(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1354
+ a = this.createComment(t, o), r.appendChild(a), this.nodeMap.set(i, { irNode: t, node: a, loops: o, marker: this.marker });
1314
1355
  break;
1315
1356
  case y.For: {
1316
- const p = `${o}-end`;
1317
- let d = (u = this.nodeMap.get(p)) == null ? void 0 : u.node;
1318
- d ? this.nodeMap.get(p).marker = this.marker : (d = document.createComment(`for:${o}`), r.appendChild(d), this.nodeMap.set(p, {
1357
+ const m = `${i}-end`;
1358
+ let p = (h = this.nodeMap.get(m)) == null ? void 0 : h.node;
1359
+ p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`for:${i}`), r.appendChild(p), this.nodeMap.set(m, {
1319
1360
  irNode: { type: y.Comment },
1320
- node: d,
1321
- loops: i,
1361
+ node: p,
1362
+ loops: o,
1322
1363
  marker: this.marker
1323
1364
  }));
1324
- const L = this.evalIR(t.fid, [i], t[F]) || [], g = document.createDocumentFragment();
1325
- L.forEach((v, k) => {
1365
+ const R = this.evalIR(t.fid, [o], t[V]) || [], g = document.createDocumentFragment();
1366
+ R.forEach((v, S) => {
1326
1367
  var f;
1327
- const I = [...i, { itmVal: v, idxVal: k }];
1368
+ const A = [...o, { itmVal: v, idxVal: S }];
1328
1369
  (f = t.children) == null || f.forEach((w, x) => {
1329
- this.irToNode(w, x, `${o}-for-${k}`, g, I);
1370
+ this.irToNode(w, x, `${i}-for-${S}`, g, A);
1330
1371
  });
1331
- }), d.parentNode.insertBefore(g, d);
1372
+ }), p.parentNode.insertBefore(g, p);
1332
1373
  break;
1333
1374
  }
1334
1375
  case y.Conditional: {
1335
- const p = `${o}-end`;
1336
- let d = (m = this.nodeMap.get(p)) == null ? void 0 : m.node;
1337
- d ? this.nodeMap.get(p).marker = this.marker : (d = document.createComment(`if:${o}`), r.appendChild(d), this.nodeMap.set(p, { irNode: {}, node: d, loops: i, marker: this.marker }));
1338
- for (let L = 0; L < (t.branches || []).length; L++) {
1339
- const g = t.branches[L];
1340
- if (g.condFid === null || this.evalIR(g.condFid, [i], g[F])) {
1341
- const k = document.createDocumentFragment();
1342
- g.children.forEach((I, f) => {
1343
- this.irToNode(I, f, `${o}-if-${L}`, k, i);
1344
- }), d.parentNode.insertBefore(k, d);
1376
+ const m = `${i}-end`;
1377
+ let p = (d = this.nodeMap.get(m)) == null ? void 0 : d.node;
1378
+ p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`if:${i}`), r.appendChild(p), this.nodeMap.set(m, { irNode: {}, node: p, loops: o, marker: this.marker }));
1379
+ for (let R = 0; R < (t.branches || []).length; R++) {
1380
+ const g = t.branches[R];
1381
+ if (g.condFid === null || this.evalIR(g.condFid, [o], g[V])) {
1382
+ const S = document.createDocumentFragment();
1383
+ g.children.forEach((A, f) => {
1384
+ this.irToNode(A, f, `${i}-if-${R}`, S, o);
1385
+ }), p.parentNode.insertBefore(S, p);
1345
1386
  break;
1346
1387
  }
1347
1388
  }
@@ -1353,14 +1394,14 @@ class Ge {
1353
1394
  cleanupOldNodes() {
1354
1395
  for (const [t, e] of this.nodeMap.entries())
1355
1396
  if (e.marker !== this.marker) {
1356
- const { irNode: s, node: r, loops: i } = e;
1397
+ const { irNode: s, node: r, loops: o } = e;
1357
1398
  if (s.attrs) {
1358
- const o = s.attrs.find((a) => a.key === "unmounted");
1359
- o && requestAnimationFrame(() => {
1399
+ const i = s.attrs.find((a) => a.key === "unmounted");
1400
+ i && requestAnimationFrame(() => {
1360
1401
  this.evalIR(
1361
- o.fid,
1362
- [r, i],
1363
- o[F]
1402
+ i.fid,
1403
+ [r, o],
1404
+ i[V]
1364
1405
  );
1365
1406
  });
1366
1407
  const c = s.attrs.find((a) => a.key === "ref");
@@ -1384,38 +1425,38 @@ class Ge {
1384
1425
  this.container.innerHTML = "", this.nodeMap.clear();
1385
1426
  }
1386
1427
  }
1387
- const Ke = (n, t, e = {}) => {
1388
- const s = new Ge(n, t, e);
1428
+ const Be = (n, t, e = {}) => {
1429
+ const s = new je(n, t, e);
1389
1430
  return s.mount(), {
1390
1431
  update: () => s.update(),
1391
1432
  destroy: () => s.destroy()
1392
1433
  };
1393
1434
  };
1394
- let U = null, Ht;
1395
- const Yt = new Promise((n) => {
1396
- Ht = n;
1435
+ let z = null, Ut;
1436
+ const Ht = new Promise((n) => {
1437
+ Ut = n;
1397
1438
  });
1398
- function tn(n) {
1399
- return U || (U = new ze(n), Ht(U), U);
1439
+ function Je(n) {
1440
+ return z || (z = new Ge(n), Ut(z), z);
1400
1441
  }
1401
- function $t() {
1402
- return U;
1442
+ function Et() {
1443
+ return z;
1403
1444
  }
1404
- class ze {
1445
+ class Ge {
1405
1446
  constructor(t) {
1406
- C(this, "routes");
1407
- C(this, "base");
1408
- C(this, "mode");
1409
- C(this, "beforeEachGuard");
1410
- C(this, "afterEachGuard");
1411
- C(this, "currentRoute", null);
1412
- C(this, "listeners", /* @__PURE__ */ new Set());
1413
- C(this, "isStarted", !1);
1447
+ k(this, "routes");
1448
+ k(this, "base");
1449
+ k(this, "mode");
1450
+ k(this, "beforeEachGuard");
1451
+ k(this, "afterEachGuard");
1452
+ k(this, "currentRoute", null);
1453
+ k(this, "listeners", /* @__PURE__ */ new Set());
1454
+ k(this, "isStarted", !1);
1414
1455
  this.routes = t.routes, this.base = t.base ?? "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1415
1456
  }
1416
1457
  // --- 核心匹配逻辑 ---
1417
1458
  matchRoute(t = "/") {
1418
- 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);
1459
+ const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"), o = s.split("/").filter(Boolean), i = this.parseQuery(r), c = this.recursiveMatch(this.routes, o);
1419
1460
  if (c) {
1420
1461
  const a = c.matched[c.matched.length - 1];
1421
1462
  return a.config.redirect ? this.matchRoute(a.config.redirect) : {
@@ -1423,54 +1464,54 @@ class ze {
1423
1464
  // 这里的结构已经是 [{config, params}, ...]
1424
1465
  params: c.params,
1425
1466
  // 全局合并后的 params
1426
- query: o,
1467
+ query: i,
1427
1468
  fullPath: e,
1428
1469
  // 合并所有层级的 meta
1429
- meta: c.matched.reduce((l, h) => ({ ...l, ...h.config.meta || {} }), {})
1470
+ meta: c.matched.reduce((l, u) => ({ ...l, ...u.config.meta || {} }), {})
1430
1471
  };
1431
1472
  }
1432
1473
  return null;
1433
1474
  }
1434
1475
  recursiveMatch(t, e) {
1435
- const s = [...t].sort((r, i) => this.calculateScore(i.path) - this.calculateScore(r.path));
1476
+ const s = [...t].sort((r, o) => this.calculateScore(o.path) - this.calculateScore(r.path));
1436
1477
  for (const r of s) {
1437
- const i = r.path.split("/").filter(Boolean), o = {};
1478
+ const o = r.path.split("/").filter(Boolean), i = {};
1438
1479
  let c = !0;
1439
- if (i.length === 0 && e.length === 0)
1480
+ if (o.length === 0 && e.length === 0)
1440
1481
  return {
1441
1482
  matched: [{ config: r, params: {} }],
1442
1483
  params: {}
1443
1484
  };
1444
- for (let a = 0; a < i.length; a++) {
1445
- const l = i[a], h = e[a];
1485
+ for (let a = 0; a < o.length; a++) {
1486
+ const l = o[a], u = e[a];
1446
1487
  if (l.startsWith(":")) {
1447
- if (!h) {
1488
+ if (!u) {
1448
1489
  c = !1;
1449
1490
  break;
1450
1491
  }
1451
- o[l.slice(1)] = h;
1492
+ i[l.slice(1)] = u;
1452
1493
  } else if (l === "*") {
1453
1494
  c = !0;
1454
1495
  break;
1455
- } else if (l !== h) {
1496
+ } else if (l !== u) {
1456
1497
  c = !1;
1457
1498
  break;
1458
1499
  }
1459
1500
  }
1460
1501
  if (c) {
1461
- const a = i.length, l = e.slice(a), h = { config: r, params: o };
1502
+ const a = o.length, l = e.slice(a), u = { config: r, params: i };
1462
1503
  if (l.length > 0 && r.children) {
1463
- const u = this.recursiveMatch(r.children, l);
1464
- if (u)
1504
+ const h = this.recursiveMatch(r.children, l);
1505
+ if (h)
1465
1506
  return {
1466
- matched: [h, ...u.matched],
1467
- params: { ...o, ...u.params }
1507
+ matched: [u, ...h.matched],
1508
+ params: { ...i, ...h.params }
1468
1509
  // 全局合并 params
1469
1510
  };
1470
- } else if (l.length === 0 || i.includes("*"))
1511
+ } else if (l.length === 0 || o.includes("*"))
1471
1512
  return {
1472
- matched: [h],
1473
- params: o
1513
+ matched: [u],
1514
+ params: i
1474
1515
  };
1475
1516
  }
1476
1517
  }
@@ -1482,8 +1523,8 @@ class ze {
1482
1523
  }
1483
1524
  parseQuery(t) {
1484
1525
  const e = {};
1485
- return t && new URLSearchParams(t).forEach((r, i) => {
1486
- e[i] = r;
1526
+ return t && new URLSearchParams(t).forEach((r, o) => {
1527
+ e[o] = r;
1487
1528
  }), e;
1488
1529
  }
1489
1530
  normalizePath(t = "/") {
@@ -1506,26 +1547,26 @@ class ze {
1506
1547
  if (this.mode === "hash")
1507
1548
  e ? window.location.replace(`#${s}`) : window.location.hash = s;
1508
1549
  else {
1509
- const i = r.endsWith("/") ? r.slice(0, -1) : r, o = i === "/" ? s : i + s;
1510
- e ? window.history.replaceState({ path: o }, "", o) : window.history.pushState({ path: o }, "", o);
1550
+ const o = r.endsWith("/") ? r.slice(0, -1) : r, i = o === "/" ? s : o + s;
1551
+ e ? window.history.replaceState({ path: i }, "", i) : window.history.pushState({ path: i }, "", i);
1511
1552
  }
1512
1553
  }
1513
1554
  /**
1514
1555
  * @param fromEvent 标志位:是否由浏览器 popstate 事件触发
1515
1556
  */
1516
1557
  async navigate(t = "/", e = !1, s = !1) {
1517
- const r = this.normalizePath(t), i = this.currentRoute, o = this.matchRoute(r);
1518
- if (!o) return { success: !1, error: `No route matched: ${r}` };
1519
- if (i && i.fullPath === o.fullPath) return { success: !0 };
1558
+ const r = this.normalizePath(t), o = this.currentRoute, i = this.matchRoute(r);
1559
+ if (!i) return { success: !1, error: `No route matched: ${r}` };
1560
+ if (o && o.fullPath === i.fullPath) return { success: !0 };
1520
1561
  if (this.beforeEachGuard)
1521
1562
  try {
1522
- const c = await this.beforeEachGuard(o, i);
1563
+ const c = await this.beforeEachGuard(i, o);
1523
1564
  if (c === !1) return { success: !1, cancelled: !0 };
1524
1565
  if (typeof c == "string") return this.navigate(c, e);
1525
1566
  } catch (c) {
1526
1567
  return { success: !1, error: c instanceof Error ? c.message : "Guard Error" };
1527
1568
  }
1528
- return this.currentRoute = o, s || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(o, i), { success: !0 };
1569
+ return this.currentRoute = i, s || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(i, o), { success: !0 };
1529
1570
  }
1530
1571
  // --- 路径解析逻辑 ---
1531
1572
  /**
@@ -1574,28 +1615,28 @@ class ze {
1574
1615
  return this.currentRoute;
1575
1616
  }
1576
1617
  }
1577
- var Ue = Object.getOwnPropertyDescriptor, He = (n, t, e, s) => {
1578
- for (var r = s > 1 ? void 0 : s ? Ue(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1579
- (o = n[i]) && (r = o(r) || r);
1618
+ var qe = Object.getOwnPropertyDescriptor, ze = (n, t, e, s) => {
1619
+ for (var r = s > 1 ? void 0 : s ? qe(t, e) : t, o = n.length - 1, i; o >= 0; o--)
1620
+ (i = n[o]) && (r = i(r) || r);
1580
1621
  return r;
1581
1622
  };
1582
- let gt = class extends mt {
1623
+ let dt = class extends ft {
1583
1624
  constructor() {
1584
1625
  super(...arguments);
1585
- C(this, "unsubscribe");
1586
- C(this, "level", 0);
1587
- C(this, "currentElement", null);
1588
- C(this, "currentTagName", null);
1589
- C(this, "routerAttrs", /* @__PURE__ */ new Set());
1590
- C(this, "prevPropKeys", /* @__PURE__ */ new Set());
1591
- C(this, "scheduled", !1);
1592
- C(this, "cache", /* @__PURE__ */ new Map());
1593
- C(this, "latestLoadId", 0);
1626
+ k(this, "unsubscribe");
1627
+ k(this, "level", 0);
1628
+ k(this, "currentElement", null);
1629
+ k(this, "currentTagName", null);
1630
+ k(this, "routerAttrs", /* @__PURE__ */ new Set());
1631
+ k(this, "prevPropKeys", /* @__PURE__ */ new Set());
1632
+ k(this, "scheduled", !1);
1633
+ k(this, "cache", /* @__PURE__ */ new Map());
1634
+ k(this, "latestLoadId", 0);
1594
1635
  }
1595
1636
  /* -------------------- 生命周期 -------------------- */
1596
1637
  async mounted() {
1597
1638
  this.detectLevel();
1598
- const t = await Yt;
1639
+ const t = await Ht;
1599
1640
  this.unsubscribe = t.listen(() => {
1600
1641
  this.scheduleLoad(t.getCurrentRoute());
1601
1642
  }), this.loadRoute(t.getCurrentRoute());
@@ -1613,7 +1654,7 @@ let gt = class extends mt {
1613
1654
  detectLevel() {
1614
1655
  let t = 0, e = this.parentElement;
1615
1656
  for (; e; )
1616
- e instanceof gt && t++, e = e.parentElement;
1657
+ e instanceof dt && t++, e = e.parentElement;
1617
1658
  this.level = t;
1618
1659
  }
1619
1660
  async loadRoute(t) {
@@ -1623,29 +1664,29 @@ let gt = class extends mt {
1623
1664
  return;
1624
1665
  }
1625
1666
  const { config: r } = s;
1626
- let i = r.tagName;
1627
- if (!i && typeof r.component == "function") {
1667
+ let o = r.tagName;
1668
+ if (!o && typeof r.component == "function") {
1628
1669
  this.renderLoading();
1629
1670
  try {
1630
1671
  const c = await r.component();
1631
- i = typeof c == "string" ? c : c.tagName;
1672
+ o = typeof c == "string" ? c : c.tagName;
1632
1673
  } catch (c) {
1633
1674
  this.renderError(`Load Error: ${c}`);
1634
1675
  return;
1635
1676
  }
1636
1677
  }
1637
1678
  if (e !== this.latestLoadId) return;
1638
- if (!i) {
1679
+ if (!o) {
1639
1680
  this.clear();
1640
1681
  return;
1641
1682
  }
1642
- if (!r.forceReload && this.currentElement && this.currentTagName === i.toLowerCase()) {
1683
+ if (!r.forceReload && this.currentElement && this.currentTagName === o.toLowerCase()) {
1643
1684
  this.syncState(this.currentElement, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props);
1644
1685
  return;
1645
1686
  }
1646
1687
  this.clear(r.keepAlive);
1647
- const o = this.getOrCreateComponent(i, r);
1648
- 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();
1688
+ const i = this.getOrCreateComponent(o, r);
1689
+ this.syncState(i, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(i), this.currentElement = i, this.currentTagName = o.toLowerCase();
1649
1690
  }
1650
1691
  getOrCreateComponent(t, e) {
1651
1692
  const s = t.toLowerCase();
@@ -1655,10 +1696,10 @@ let gt = class extends mt {
1655
1696
  return e.keepAlive && this.cache.set(s, r), r;
1656
1697
  }
1657
1698
  syncState(t, e, s, r = {}) {
1658
- const i = (a) => a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o = /* @__PURE__ */ new Map();
1659
- Object.entries(e).forEach(([a, l]) => o.set(i(a), String(l))), Object.entries(s).forEach(([a, l]) => o.set(`query-${i(a)}`, String(l))), this.routerAttrs.forEach((a) => {
1660
- o.has(a) || (t.removeAttribute(a), this.routerAttrs.delete(a));
1661
- }), o.forEach((a, l) => {
1699
+ const o = (a) => a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), i = /* @__PURE__ */ new Map();
1700
+ Object.entries(e).forEach(([a, l]) => i.set(o(a), String(l))), Object.entries(s).forEach(([a, l]) => i.set(`query-${o(a)}`, String(l))), this.routerAttrs.forEach((a) => {
1701
+ i.has(a) || (t.removeAttribute(a), this.routerAttrs.delete(a));
1702
+ }), i.forEach((a, l) => {
1662
1703
  t.getAttribute(l) !== a && t.setAttribute(l, a), this.routerAttrs.add(l);
1663
1704
  });
1664
1705
  const c = new Set(Object.keys(r));
@@ -1681,22 +1722,22 @@ let gt = class extends mt {
1681
1722
  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();
1682
1723
  }
1683
1724
  };
1684
- gt = He([
1725
+ dt = ze([
1685
1726
  zt({
1686
1727
  tagName: "router-view"
1687
1728
  // 注意:删除了 shadowDOM 配置,默认为 false
1688
1729
  })
1689
- ], gt);
1690
- const en = gt;
1691
- var Ye = Object.getOwnPropertyDescriptor, Je = (n, t, e, s) => {
1692
- for (var r = s > 1 ? void 0 : s ? Ye(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1693
- (o = n[i]) && (r = o(r) || r);
1730
+ ], dt);
1731
+ const Xe = dt;
1732
+ var Ke = Object.getOwnPropertyDescriptor, Ue = (n, t, e, s) => {
1733
+ for (var r = s > 1 ? void 0 : s ? Ke(t, e) : t, o = n.length - 1, i; o >= 0; o--)
1734
+ (i = n[o]) && (r = i(r) || r);
1694
1735
  return r;
1695
1736
  };
1696
- let Mt = class extends mt {
1737
+ let At = class extends ft {
1697
1738
  constructor() {
1698
1739
  super(...arguments);
1699
- C(this, "_prefetched", !1);
1740
+ k(this, "_prefetched", !1);
1700
1741
  }
1701
1742
  set to(t) {
1702
1743
  this.$data.to = t, this.updateState();
@@ -1705,15 +1746,15 @@ let Mt = class extends mt {
1705
1746
  return this.$data.to;
1706
1747
  }
1707
1748
  async mounted() {
1708
- (await Yt).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1709
- var r, i;
1710
- 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 = $t()) == null || i.push(this.$data.to));
1749
+ (await Ht).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1750
+ var r, o;
1751
+ e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (o = Et()) == null || o.push(this.$data.to));
1711
1752
  }), this.addEventListener("mouseenter", () => {
1712
1753
  this.prefetchRoute();
1713
1754
  }, { once: !0 });
1714
1755
  }
1715
1756
  updateState() {
1716
- const t = $t();
1757
+ const t = Et();
1717
1758
  if (!t) return;
1718
1759
  this.$data.href = t.resolve(this.$data.to);
1719
1760
  let e = !1;
@@ -1722,8 +1763,8 @@ let Mt = class extends mt {
1722
1763
  else {
1723
1764
  const r = t.getCurrentRoute();
1724
1765
  if (r) {
1725
- const i = r.fullPath;
1726
- this.hasAttribute("exact") ? e = i === this.$data.to : e = i === this.$data.to || i.startsWith(this.$data.to + "/");
1766
+ const o = r.fullPath;
1767
+ this.hasAttribute("exact") ? e = o === this.$data.to : e = o === this.$data.to || o.startsWith(this.$data.to + "/");
1727
1768
  }
1728
1769
  }
1729
1770
  this.$data.isActive = e;
@@ -1733,11 +1774,11 @@ let Mt = class extends mt {
1733
1774
  // 预加载路由的具体实现
1734
1775
  prefetchRoute() {
1735
1776
  if (this._prefetched || !this.hasAttribute("prefetch")) return;
1736
- const t = $t();
1777
+ const t = Et();
1737
1778
  t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
1738
1779
  }
1739
1780
  };
1740
- Mt = Je([
1781
+ At = Ue([
1741
1782
  zt({
1742
1783
  tagName: "router-link",
1743
1784
  // template 中 slot 包裹 label 作为 fallback:
@@ -1771,32 +1812,32 @@ Mt = Je([
1771
1812
  // 注册所有支持的 props
1772
1813
  props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
1773
1814
  })
1774
- ], Mt);
1775
- const nn = Mt;
1815
+ ], At);
1816
+ const Qe = At;
1776
1817
  export {
1777
1818
  y as ASTType,
1778
- mt as BaseElement,
1819
+ ft as BaseElement,
1779
1820
  zt as CustomElement,
1780
- Ge as IRRenderer,
1781
- pe as LIFECYCLE_ATTRS_MAP,
1782
- ze as Router,
1783
- nn as RouterLink,
1784
- en as RouterView,
1785
- $e as buildIR,
1786
- Xe as clearIRCache,
1787
- se as createFunction,
1788
- Ke as createRender,
1789
- tn as createRouter,
1790
- fe as genFunction,
1791
- $t as getRouter,
1792
- ge as isLifecycleKind,
1793
- H as isObject,
1794
- de as listeners,
1795
- me as mapAttrKeyToLifecycleKind,
1796
- Pe as observe,
1797
- Qe as parseHashUrl,
1798
- Ae as parseHtml,
1799
- Yt as routerReady,
1800
- ne as showTemplateError,
1821
+ je as IRRenderer,
1822
+ de as LIFECYCLE_ATTRS_MAP,
1823
+ Ge as Router,
1824
+ Qe as RouterLink,
1825
+ Xe as RouterView,
1826
+ xe as buildIR,
1827
+ Ze as clearIRCache,
1828
+ ne as createFunction,
1829
+ Be as createRender,
1830
+ Je as createRouter,
1831
+ he as genFunction,
1832
+ Et as getRouter,
1833
+ me as isLifecycleKind,
1834
+ K as isObject,
1835
+ fe as listeners,
1836
+ pe as mapAttrKeyToLifecycleKind,
1837
+ Me as observe,
1838
+ Ye as parseHashUrl,
1839
+ Le as parseHtml,
1840
+ Ht as routerReady,
1841
+ ee as showTemplateError,
1801
1842
  Ee as transformModel
1802
1843
  };