solely 0.1.2 → 0.1.3

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