lone-format 0.3.2 → 0.3.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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as be, useCssVars as Ce, ref as G, computed as L, resolveComponent as Me, createElementBlock as N, openBlock as x, createElementVNode as E, createCommentVNode as F, withDirectives as ve, toDisplayString as R, withKeys as le, vModelText as _e, createTextVNode as Se, Fragment as he, renderList as pe, createVNode as Ue, normalizeClass as Oe, nextTick as ce, watch as Fe, normalizeStyle as I, createBlock as Xe } from "vue";
1
+ import { defineComponent as be, useCssVars as Ce, ref as G, computed as L, resolveComponent as Me, createElementBlock as N, openBlock as x, createElementVNode as E, createCommentVNode as X, withDirectives as ve, toDisplayString as j, withKeys as le, vModelText as _e, createTextVNode as Se, Fragment as he, renderList as pe, createVNode as Ue, normalizeClass as Oe, nextTick as ce, watch as Fe, normalizeStyle as I, createBlock as Xe } from "vue";
2
2
  class De {
3
3
  /**
4
4
  * @callback HookCallback
@@ -826,7 +826,7 @@ ee.plugins.register(ot, ue);
826
826
  ee.addUnaryOp("typeof");
827
827
  ee.addLiteral("null", null);
828
828
  ee.addLiteral("undefined", void 0);
829
- const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), V = {
829
+ const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), R = {
830
830
  /**
831
831
  * @param {jsep.Expression} ast
832
832
  * @param {Record<string, any>} subs
@@ -835,25 +835,25 @@ const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
835
835
  switch (r.type) {
836
836
  case "BinaryExpression":
837
837
  case "LogicalExpression":
838
- return V.evalBinaryExpression(r, e);
838
+ return R.evalBinaryExpression(r, e);
839
839
  case "Compound":
840
- return V.evalCompound(r, e);
840
+ return R.evalCompound(r, e);
841
841
  case "ConditionalExpression":
842
- return V.evalConditionalExpression(r, e);
842
+ return R.evalConditionalExpression(r, e);
843
843
  case "Identifier":
844
- return V.evalIdentifier(r, e);
844
+ return R.evalIdentifier(r, e);
845
845
  case "Literal":
846
- return V.evalLiteral(r, e);
846
+ return R.evalLiteral(r, e);
847
847
  case "MemberExpression":
848
- return V.evalMemberExpression(r, e);
848
+ return R.evalMemberExpression(r, e);
849
849
  case "UnaryExpression":
850
- return V.evalUnaryExpression(r, e);
850
+ return R.evalUnaryExpression(r, e);
851
851
  case "ArrayExpression":
852
- return V.evalArrayExpression(r, e);
852
+ return R.evalArrayExpression(r, e);
853
853
  case "CallExpression":
854
- return V.evalCallExpression(r, e);
854
+ return R.evalCallExpression(r, e);
855
855
  case "AssignmentExpression":
856
- return V.evalAssignmentExpression(r, e);
856
+ return R.evalAssignmentExpression(r, e);
857
857
  default:
858
858
  throw SyntaxError("Unexpected expression", r);
859
859
  }
@@ -883,19 +883,19 @@ const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
883
883
  "*": (s, n) => s * n(),
884
884
  "/": (s, n) => s / n(),
885
885
  "%": (s, n) => s % n()
886
- }[r.operator](V.evalAst(r.left, e), () => V.evalAst(r.right, e));
886
+ }[r.operator](R.evalAst(r.left, e), () => R.evalAst(r.right, e));
887
887
  },
888
888
  evalCompound(r, e) {
889
889
  let t;
890
890
  for (let s = 0; s < r.body.length; s++) {
891
891
  r.body[s].type === "Identifier" && ["var", "let", "const"].includes(r.body[s].name) && r.body[s + 1] && r.body[s + 1].type === "AssignmentExpression" && (s += 1);
892
892
  const n = r.body[s];
893
- t = V.evalAst(n, e);
893
+ t = R.evalAst(n, e);
894
894
  }
895
895
  return t;
896
896
  },
897
897
  evalConditionalExpression(r, e) {
898
- return V.evalAst(r.test, e) ? V.evalAst(r.consequent, e) : V.evalAst(r.alternate, e);
898
+ return R.evalAst(r.test, e) ? R.evalAst(r.consequent, e) : R.evalAst(r.alternate, e);
899
899
  },
900
900
  evalIdentifier(r, e) {
901
901
  if (Object.hasOwn(e, r.name))
@@ -910,9 +910,9 @@ const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
910
910
  // NOTE: `String(value)` throws error when
911
911
  // value has overwritten the toString method to return non-string
912
912
  // i.e. `value = {toString: () => []}`
913
- r.computed ? V.evalAst(r.property) : r.property.name
913
+ r.computed ? R.evalAst(r.property) : r.property.name
914
914
  // `object.property` property is Identifier
915
- ), s = V.evalAst(r.object, e);
915
+ ), s = R.evalAst(r.object, e);
916
916
  if (s == null)
917
917
  throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
918
918
  if (!Object.hasOwn(s, t) && at.has(t))
@@ -922,25 +922,25 @@ const at = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
922
922
  },
923
923
  evalUnaryExpression(r, e) {
924
924
  return {
925
- "-": (s) => -V.evalAst(s, e),
926
- "!": (s) => !V.evalAst(s, e),
927
- "~": (s) => ~V.evalAst(s, e),
925
+ "-": (s) => -R.evalAst(s, e),
926
+ "!": (s) => !R.evalAst(s, e),
927
+ "~": (s) => ~R.evalAst(s, e),
928
928
  // eslint-disable-next-line no-implicit-coercion -- API
929
- "+": (s) => +V.evalAst(s, e),
930
- typeof: (s) => typeof V.evalAst(s, e)
929
+ "+": (s) => +R.evalAst(s, e),
930
+ typeof: (s) => typeof R.evalAst(s, e)
931
931
  }[r.operator](r.argument);
932
932
  },
933
933
  evalArrayExpression(r, e) {
934
- return r.elements.map((t) => V.evalAst(t, e));
934
+ return r.elements.map((t) => R.evalAst(t, e));
935
935
  },
936
936
  evalCallExpression(r, e) {
937
- const t = r.arguments.map((n) => V.evalAst(n, e));
938
- return V.evalAst(r.callee, e)(...t);
937
+ const t = r.arguments.map((n) => R.evalAst(n, e));
938
+ return R.evalAst(r.callee, e)(...t);
939
939
  },
940
940
  evalAssignmentExpression(r, e) {
941
941
  if (r.left.type !== "Identifier")
942
942
  throw SyntaxError("Invalid left-hand side in assignment");
943
- const t = r.left.name, s = V.evalAst(r.right, e);
943
+ const t = r.left.name, s = R.evalAst(r.right, e);
944
944
  return e[t] = s, e[t];
945
945
  }
946
946
  };
@@ -958,7 +958,7 @@ class lt {
958
958
  */
959
959
  runInNewContext(e) {
960
960
  const t = Object.assign(/* @__PURE__ */ Object.create(null), e);
961
- return V.evalAst(this.ast, t);
961
+ return R.evalAst(this.ast, t);
962
962
  }
963
963
  }
964
964
  function te(r, e) {
@@ -1361,10 +1361,10 @@ const ft = { class: "json-node" }, ht = {
1361
1361
  }), k = L(() => {
1362
1362
  const b = typeof t.value;
1363
1363
  return t.value === null ? "json-node__value--null" : b === "boolean" ? "json-node__value--boolean" : b === "number" || a(t.value) ? "json-node__value--number" : b === "string" ? "json-node__value--string" : "";
1364
- }), S = L(() => o.value ? u.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : a(t.value) ? l(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), g = L(() => "Click to edit, double-click to copy"), T = (b) => t.level === 0 ? b : y.value ? `${y.value}.${b}` : b, X = (b) => {
1364
+ }), S = L(() => o.value ? u.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : a(t.value) ? l(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), g = L(() => "Click to edit, double-click to copy"), T = (b) => t.level === 0 ? b : y.value ? `${y.value}.${b}` : b, U = (b) => {
1365
1365
  const d = Object.keys(t.value);
1366
1366
  return d.indexOf(b) === d.length - 1;
1367
- }, j = () => {
1367
+ }, V = () => {
1368
1368
  s("toggle-expand", y.value);
1369
1369
  }, Y = () => {
1370
1370
  t.level !== 0 && (n.value = !0, i.value = t.keyName, ce(() => {
@@ -1420,7 +1420,7 @@ const ft = { class: "json-node" }, ht = {
1420
1420
  class: "json-node__key",
1421
1421
  onClick: Y,
1422
1422
  title: "Click to edit key"
1423
- }, ' "' + R(C.value) + '" ', 1)) : F("", !0),
1423
+ }, ' "' + j(C.value) + '" ', 1)) : X("", !0),
1424
1424
  b.keyName && n.value ? ve((x(), N("input", {
1425
1425
  key: 1,
1426
1426
  "onUpdate:modelValue": d[0] || (d[0] = (_) => i.value = _),
@@ -1432,21 +1432,21 @@ const ft = { class: "json-node" }, ht = {
1432
1432
  class: "json-node__key-input"
1433
1433
  }, null, 544)), [
1434
1434
  [_e, i.value]
1435
- ]) : F("", !0),
1436
- b.keyName ? (x(), N("span", gt, ": ")) : F("", !0),
1435
+ ]) : X("", !0),
1436
+ b.keyName ? (x(), N("span", gt, ": ")) : X("", !0),
1437
1437
  E("span", {
1438
1438
  class: "json-node__bracket json-node__bracket--clickable",
1439
- onClick: j,
1439
+ onClick: V,
1440
1440
  title: m.value ? "Click to collapse" : "Click to expand"
1441
- }, R(O.value), 9, bt),
1442
- m.value ? F("", !0) : (x(), N("span", mt, [
1443
- Se(R(M.value) + " ", 1),
1441
+ }, j(O.value), 9, bt),
1442
+ m.value ? X("", !0) : (x(), N("span", mt, [
1443
+ Se(j(M.value) + " ", 1),
1444
1444
  E("span", {
1445
1445
  class: "json-node__bracket json-node__bracket--clickable",
1446
- onClick: j
1447
- }, R(P.value), 1)
1446
+ onClick: V
1447
+ }, j(P.value), 1)
1448
1448
  ])),
1449
- !m.value && !b.isLast ? (x(), N("span", yt, ",")) : F("", !0)
1449
+ !m.value && !b.isLast ? (x(), N("span", yt, ",")) : X("", !0)
1450
1450
  ]),
1451
1451
  m.value ? (x(), N("div", Et, [
1452
1452
  E("div", vt, [
@@ -1465,22 +1465,22 @@ const ft = { class: "json-node" }, ht = {
1465
1465
  onToggleExpand: d[2] || (d[2] = (w) => b.$emit("toggle-expand", w)),
1466
1466
  onCopy: d[3] || (d[3] = (w) => b.$emit("copy", w)),
1467
1467
  "onUpdate:key": d[4] || (d[4] = (w, A) => b.$emit("update:key", w, A)),
1468
- "is-last": X(String(v))
1468
+ "is-last": U(String(v))
1469
1469
  }, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
1470
1470
  ]))), 128))
1471
1471
  ]),
1472
1472
  E("div", _t, [
1473
- E("span", xt, R(P.value), 1),
1474
- b.isLast ? F("", !0) : (x(), N("span", Nt, ","))
1473
+ E("span", xt, j(P.value), 1),
1474
+ b.isLast ? X("", !0) : (x(), N("span", Nt, ","))
1475
1475
  ])
1476
- ])) : F("", !0)
1476
+ ])) : X("", !0)
1477
1477
  ])) : (x(), N("div", kt, [
1478
1478
  b.keyName && !n.value ? (x(), N("span", {
1479
1479
  key: 0,
1480
1480
  class: "json-node__key",
1481
1481
  onClick: Y,
1482
1482
  title: "Click to edit key"
1483
- }, ' "' + R(C.value) + '" ', 1)) : F("", !0),
1483
+ }, ' "' + j(C.value) + '" ', 1)) : X("", !0),
1484
1484
  b.keyName && n.value ? ve((x(), N("input", {
1485
1485
  key: 1,
1486
1486
  "onUpdate:modelValue": d[5] || (d[5] = (_) => i.value = _),
@@ -1492,17 +1492,17 @@ const ft = { class: "json-node" }, ht = {
1492
1492
  class: "json-node__key-input"
1493
1493
  }, null, 544)), [
1494
1494
  [_e, i.value]
1495
- ]) : F("", !0),
1496
- b.keyName ? (x(), N("span", wt, ": ")) : F("", !0),
1497
- o.value ? F("", !0) : (x(), N("span", {
1495
+ ]) : X("", !0),
1496
+ b.keyName ? (x(), N("span", wt, ": ")) : X("", !0),
1497
+ o.value ? X("", !0) : (x(), N("span", {
1498
1498
  key: 3,
1499
1499
  class: Oe(["json-node__value", k.value]),
1500
1500
  onClick: Z,
1501
1501
  onDblclick: d[6] || (d[6] = (_) => b.$emit("copy", b.value)),
1502
1502
  title: g.value
1503
1503
  }, [
1504
- Se(R(S.value), 1),
1505
- b.isLast ? F("", !0) : (x(), N("span", Ct, ","))
1504
+ Se(j(S.value), 1),
1505
+ b.isLast ? X("", !0) : (x(), N("span", Ct, ","))
1506
1506
  ], 42, At)),
1507
1507
  o.value ? ve((x(), N("input", {
1508
1508
  key: 4,
@@ -1515,7 +1515,7 @@ const ft = { class: "json-node" }, ht = {
1515
1515
  class: "json-node__value-input"
1516
1516
  }, null, 544)), [
1517
1517
  [_e, u.value]
1518
- ]) : F("", !0)
1518
+ ]) : X("", !0)
1519
1519
  ]))
1520
1520
  ]);
1521
1521
  };
@@ -1866,7 +1866,7 @@ const Lt = {
1866
1866
  p(y.value), u.value = d, n("expand-all");
1867
1867
  }, T = () => {
1868
1868
  u.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1869
- }, X = async () => {
1869
+ }, U = async () => {
1870
1870
  if (h.value)
1871
1871
  try {
1872
1872
  const d = y.value, p = P(d, null, 2);
@@ -1874,7 +1874,7 @@ const Lt = {
1874
1874
  } catch (d) {
1875
1875
  console.error("Failed to copy JSON:", d), n("copy-error", d instanceof Error ? d : new Error("Failed to copy JSON"));
1876
1876
  }
1877
- }, j = () => {
1877
+ }, V = () => {
1878
1878
  if (h.value)
1879
1879
  try {
1880
1880
  const d = y.value, p = P(d);
@@ -1957,8 +1957,8 @@ const Lt = {
1957
1957
  };
1958
1958
  return e({
1959
1959
  // 核心操作方法
1960
- copyJson: X,
1961
- compressSource: j,
1960
+ copyJson: U,
1961
+ compressSource: V,
1962
1962
  expandAll: g,
1963
1963
  collapseAll: T,
1964
1964
  toggleExpand: S,
@@ -1984,7 +1984,7 @@ const Lt = {
1984
1984
  E("div", Vt, [
1985
1985
  E("button", {
1986
1986
  class: "json-format__btn json-format__btn--primary",
1987
- onClick: X,
1987
+ onClick: U,
1988
1988
  disabled: !h.value,
1989
1989
  title: "Copy JSON"
1990
1990
  }, " 📋 Copy ", 8, Rt),
@@ -2002,7 +2002,7 @@ const Lt = {
2002
2002
  }, " ➡️ Collapse All ", 8, Mt),
2003
2003
  E("button", {
2004
2004
  class: "json-format__btn json-format__btn--secondary",
2005
- onClick: j,
2005
+ onClick: V,
2006
2006
  disabled: !h.value,
2007
2007
  title: "Compress JSON"
2008
2008
  }, " 📦 Compress ", 8, Ut)
@@ -2010,11 +2010,11 @@ const Lt = {
2010
2010
  E("div", Ft, [
2011
2011
  h.value ? (x(), N("span", Xt, " ✅ Valid JSON ")) : (x(), N("span", Ht, " ❌ Invalid JSON "))
2012
2012
  ])
2013
- ])) : F("", !0),
2013
+ ])) : X("", !0),
2014
2014
  E("div", Kt, [
2015
2015
  h.value ? l.value ? (x(), N("div", qt, [
2016
2016
  p[1] || (p[1] = E("h4", null, "Filter Error:", -1)),
2017
- E("pre", null, R(l.value), 1)
2017
+ E("pre", null, j(l.value), 1)
2018
2018
  ])) : (x(), N("div", Qt, [
2019
2019
  Ue(Tt, {
2020
2020
  value: y.value,
@@ -2030,7 +2030,7 @@ const Lt = {
2030
2030
  }, null, 8, ["value", "expanded", "theme"])
2031
2031
  ])) : (x(), N("div", Yt, [
2032
2032
  p[0] || (p[0] = E("h4", null, "JSON Parse Error:", -1)),
2033
- E("pre", null, R(i.value), 1)
2033
+ E("pre", null, j(i.value), 1)
2034
2034
  ]))
2035
2035
  ])
2036
2036
  ], 2));
@@ -2083,11 +2083,11 @@ function qe(r, e) {
2083
2083
  a += r[o];
2084
2084
  if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !lr(a)) {
2085
2085
  let f;
2086
- return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.", U("InvalidTag", f, q(r, o));
2086
+ return a.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + a + "' is an invalid name.", F("InvalidTag", f, q(r, o));
2087
2087
  }
2088
2088
  const l = nr(r, o);
2089
2089
  if (l === !1)
2090
- return U("InvalidAttr", "Attributes for '" + a + "' have open quote.", q(r, o));
2090
+ return F("InvalidAttr", "Attributes for '" + a + "' have open quote.", q(r, o));
2091
2091
  let h = l.value;
2092
2092
  if (o = l.index, h[h.length - 1] === "/") {
2093
2093
  const f = o - h.length;
@@ -2096,18 +2096,18 @@ function qe(r, e) {
2096
2096
  if (y === !0)
2097
2097
  s = !0;
2098
2098
  else
2099
- return U(y.err.code, y.err.msg, q(r, f + y.err.line));
2099
+ return F(y.err.code, y.err.msg, q(r, f + y.err.line));
2100
2100
  } else if (u)
2101
2101
  if (l.tagClosed) {
2102
2102
  if (h.trim().length > 0)
2103
- return U("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", q(r, i));
2103
+ return F("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", q(r, i));
2104
2104
  if (t.length === 0)
2105
- return U("InvalidTag", "Closing tag '" + a + "' has not been opened.", q(r, i));
2105
+ return F("InvalidTag", "Closing tag '" + a + "' has not been opened.", q(r, i));
2106
2106
  {
2107
2107
  const f = t.pop();
2108
2108
  if (a !== f.tagName) {
2109
2109
  let y = q(r, f.tagStartPos);
2110
- return U(
2110
+ return F(
2111
2111
  "InvalidTag",
2112
2112
  "Expected closing tag '" + f.tagName + "' (opened in line " + y.line + ", col " + y.col + ") instead of closing tag '" + a + "'.",
2113
2113
  q(r, i)
@@ -2115,13 +2115,13 @@ function qe(r, e) {
2115
2115
  }
2116
2116
  t.length == 0 && (n = !0);
2117
2117
  }
2118
- } else return U("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", q(r, o));
2118
+ } else return F("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", q(r, o));
2119
2119
  else {
2120
2120
  const f = Ve(h, e);
2121
2121
  if (f !== !0)
2122
- return U(f.err.code, f.err.msg, q(r, o - h.length + f.err.line));
2122
+ return F(f.err.code, f.err.msg, q(r, o - h.length + f.err.line));
2123
2123
  if (n === !0)
2124
- return U("InvalidXml", "Multiple possible root nodes found.", q(r, o));
2124
+ return F("InvalidXml", "Multiple possible root nodes found.", q(r, o));
2125
2125
  e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: i }), s = !0;
2126
2126
  }
2127
2127
  for (o++; o < r.length; o++)
@@ -2136,23 +2136,23 @@ function qe(r, e) {
2136
2136
  else if (r[o] === "&") {
2137
2137
  const f = ir(r, o);
2138
2138
  if (f == -1)
2139
- return U("InvalidChar", "char '&' is not expected.", q(r, o));
2139
+ return F("InvalidChar", "char '&' is not expected.", q(r, o));
2140
2140
  o = f;
2141
2141
  } else if (n === !0 && !$e(r[o]))
2142
- return U("InvalidXml", "Extra text at the end", q(r, o));
2142
+ return F("InvalidXml", "Extra text at the end", q(r, o));
2143
2143
  r[o] === "<" && o--;
2144
2144
  }
2145
2145
  } else {
2146
2146
  if ($e(r[o]))
2147
2147
  continue;
2148
- return U("InvalidChar", "char '" + r[o] + "' is not expected.", q(r, o));
2148
+ return F("InvalidChar", "char '" + r[o] + "' is not expected.", q(r, o));
2149
2149
  }
2150
2150
  if (s) {
2151
2151
  if (t.length == 1)
2152
- return U("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", q(r, t[0].tagStartPos));
2152
+ return F("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", q(r, t[0].tagStartPos));
2153
2153
  if (t.length > 0)
2154
- return U("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
2155
- } else return U("InvalidXml", "Start tag expected.", 1);
2154
+ return F("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
2155
+ } else return F("InvalidXml", "Start tag expected.", 1);
2156
2156
  return !0;
2157
2157
  }
2158
2158
  function $e(r) {
@@ -2165,7 +2165,7 @@ function Be(r, e) {
2165
2165
  if (r[e] == "?" || r[e] == " ") {
2166
2166
  const s = r.substr(t, e - t);
2167
2167
  if (e > 5 && s === "xml")
2168
- return U("InvalidXml", "XML declaration allowed only at the start of the document.", q(r, e));
2168
+ return F("InvalidXml", "XML declaration allowed only at the start of the document.", q(r, e));
2169
2169
  if (r[e] == "?" && r[e + 1] == ">") {
2170
2170
  e++;
2171
2171
  break;
@@ -2220,18 +2220,18 @@ function Ve(r, e) {
2220
2220
  const t = Ye(r, sr), s = {};
2221
2221
  for (let n = 0; n < t.length; n++) {
2222
2222
  if (t[n][1].length === 0)
2223
- return U("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", de(t[n]));
2223
+ return F("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", de(t[n]));
2224
2224
  if (t[n][3] !== void 0 && t[n][4] === void 0)
2225
- return U("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", de(t[n]));
2225
+ return F("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", de(t[n]));
2226
2226
  if (t[n][3] === void 0 && !e.allowBooleanAttributes)
2227
- return U("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", de(t[n]));
2227
+ return F("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", de(t[n]));
2228
2228
  const o = t[n][2];
2229
2229
  if (!ar(o))
2230
- return U("InvalidAttr", "Attribute '" + o + "' is an invalid name.", de(t[n]));
2230
+ return F("InvalidAttr", "Attribute '" + o + "' is an invalid name.", de(t[n]));
2231
2231
  if (!s.hasOwnProperty(o))
2232
2232
  s[o] = 1;
2233
2233
  else
2234
- return U("InvalidAttr", "Attribute '" + o + "' is repeated.", de(t[n]));
2234
+ return F("InvalidAttr", "Attribute '" + o + "' is repeated.", de(t[n]));
2235
2235
  }
2236
2236
  return !0;
2237
2237
  }
@@ -2259,7 +2259,7 @@ function ir(r, e) {
2259
2259
  }
2260
2260
  return e;
2261
2261
  }
2262
- function U(r, e, t) {
2262
+ function F(r, e, t) {
2263
2263
  return {
2264
2264
  err: {
2265
2265
  code: r,
@@ -3326,16 +3326,21 @@ const qr = {
3326
3326
  const g = [];
3327
3327
  return Object.keys(t.value).forEach((T) => {
3328
3328
  if (T.startsWith("@_") || T === "#text") return;
3329
- const X = t.value[T];
3330
- Array.isArray(X) ? X.forEach((j) => {
3331
- g.push({ tagName: T, value: j });
3332
- }) : g.push({ tagName: T, value: X });
3329
+ const U = t.value[T];
3330
+ Array.isArray(U) ? U.forEach((V) => {
3331
+ g.push({ tagName: T, value: V });
3332
+ }) : g.push({ tagName: T, value: U });
3333
3333
  }), g;
3334
3334
  }), O = L(() => C.value.length > 0 ? !0 : f.value.trim() !== ""), P = L(() => i.value && C.value.length === 0 && f.value.trim() !== ""), M = () => {
3335
3335
  O.value && s("toggle-expand", n.value);
3336
- }, k = (g, T) => `${n.value}.${g}[${T}]`, S = (g, T) => `${g.tagName}-${T}`;
3336
+ }, k = (g, T) => {
3337
+ let U = 0;
3338
+ for (let V = 0; V < T; V++)
3339
+ C.value[V].tagName === g && U++;
3340
+ return `${n.value}.${g}[${U}]`;
3341
+ }, S = (g, T) => `${g.tagName}-${T}`;
3337
3342
  return (g, T) => {
3338
- const X = Me("XmlNode", !0);
3343
+ const U = Me("XmlNode", !0);
3339
3344
  return x(), N("div", {
3340
3345
  class: "xml-node",
3341
3346
  style: I({ paddingLeft: g.level > 0 ? "16px" : "0" })
@@ -3349,15 +3354,15 @@ const qr = {
3349
3354
  E("span", {
3350
3355
  class: "xml-node__tag",
3351
3356
  style: I({ color: g.theme.colors.xmlTag })
3352
- }, R(g.tagName), 5),
3353
- (x(!0), N(he, null, pe(h.value, (j, Y) => (x(), N("span", {
3357
+ }, j(g.tagName), 5),
3358
+ (x(!0), N(he, null, pe(h.value, (V, Y) => (x(), N("span", {
3354
3359
  key: Y,
3355
3360
  class: "xml-node__attribute"
3356
3361
  }, [
3357
3362
  E("span", {
3358
3363
  class: "xml-node__attr-name",
3359
3364
  style: I({ color: g.theme.colors.xmlAttribute })
3360
- }, R(Y), 5),
3365
+ }, j(Y), 5),
3361
3366
  E("span", {
3362
3367
  class: "xml-node__equals",
3363
3368
  style: I({ color: g.theme.colors.xmlEquals })
@@ -3369,7 +3374,7 @@ const qr = {
3369
3374
  E("span", {
3370
3375
  class: "xml-node__attr-value",
3371
3376
  style: I({ color: g.theme.colors.xmlAttributeValue })
3372
- }, R(j), 5),
3377
+ }, j(V), 5),
3373
3378
  E("span", {
3374
3379
  class: "xml-node__quote",
3375
3380
  style: I({ color: g.theme.colors.xmlQuote })
@@ -3382,7 +3387,7 @@ const qr = {
3382
3387
  E("span", {
3383
3388
  class: "xml-node__text-content",
3384
3389
  style: I({ color: g.theme.colors.xmlText })
3385
- }, R(f.value), 5),
3390
+ }, j(f.value), 5),
3386
3391
  E("span", {
3387
3392
  class: "xml-node__bracket",
3388
3393
  style: I({ color: g.theme.colors.xmlBracket })
@@ -3390,7 +3395,7 @@ const qr = {
3390
3395
  E("span", {
3391
3396
  class: "xml-node__tag",
3392
3397
  style: I({ color: g.theme.colors.xmlTag })
3393
- }, R(g.tagName), 5),
3398
+ }, j(g.tagName), 5),
3394
3399
  E("span", {
3395
3400
  class: "xml-node__bracket",
3396
3401
  style: I({ color: g.theme.colors.xmlBracket })
@@ -3400,7 +3405,7 @@ const qr = {
3400
3405
  O.value ? (x(), N("span", {
3401
3406
  key: 0,
3402
3407
  class: "xml-node__clickable-part",
3403
- onClick: T[0] || (T[0] = (j) => M()),
3408
+ onClick: T[0] || (T[0] = (V) => M()),
3404
3409
  title: o.value ? "Click to collapse" : "Click to expand"
3405
3410
  }, [
3406
3411
  E("span", {
@@ -3410,7 +3415,7 @@ const qr = {
3410
3415
  E("span", {
3411
3416
  class: "xml-node__tag",
3412
3417
  style: I({ color: g.theme.colors.xmlTag })
3413
- }, R(g.tagName), 5)
3418
+ }, j(g.tagName), 5)
3414
3419
  ], 8, sn)) : (x(), N("span", on, [
3415
3420
  E("span", {
3416
3421
  class: "xml-node__bracket",
@@ -3419,16 +3424,16 @@ const qr = {
3419
3424
  E("span", {
3420
3425
  class: "xml-node__tag",
3421
3426
  style: I({ color: g.theme.colors.xmlTag })
3422
- }, R(g.tagName), 5)
3427
+ }, j(g.tagName), 5)
3423
3428
  ])),
3424
- (x(!0), N(he, null, pe(h.value, (j, Y) => (x(), N("span", {
3429
+ (x(!0), N(he, null, pe(h.value, (V, Y) => (x(), N("span", {
3425
3430
  key: Y,
3426
3431
  class: "xml-node__attribute"
3427
3432
  }, [
3428
3433
  E("span", {
3429
3434
  class: "xml-node__attr-name",
3430
3435
  style: I({ color: g.theme.colors.xmlAttribute })
3431
- }, R(Y), 5),
3436
+ }, j(Y), 5),
3432
3437
  E("span", {
3433
3438
  class: "xml-node__equals",
3434
3439
  style: I({ color: g.theme.colors.xmlEquals })
@@ -3440,7 +3445,7 @@ const qr = {
3440
3445
  E("span", {
3441
3446
  class: "xml-node__attr-value",
3442
3447
  style: I({ color: g.theme.colors.xmlAttributeValue })
3443
- }, R(j), 5),
3448
+ }, j(V), 5),
3444
3449
  E("span", {
3445
3450
  class: "xml-node__quote",
3446
3451
  style: I({ color: g.theme.colors.xmlQuote })
@@ -3449,7 +3454,7 @@ const qr = {
3449
3454
  O.value ? (x(), N("span", {
3450
3455
  key: 2,
3451
3456
  class: "xml-node__clickable-part",
3452
- onClick: T[1] || (T[1] = (j) => M()),
3457
+ onClick: T[1] || (T[1] = (V) => M()),
3453
3458
  title: o.value ? "Click to collapse" : "Click to expand"
3454
3459
  }, [
3455
3460
  E("span", {
@@ -3460,38 +3465,38 @@ const qr = {
3460
3465
  key: 3,
3461
3466
  class: "xml-node__bracket",
3462
3467
  style: I({ color: g.theme.colors.xmlBracket })
3463
- }, R(O.value ? ">" : "/>"), 5)),
3468
+ }, j(O.value ? ">" : "/>"), 5)),
3464
3469
  !o.value && O.value ? (x(), N("span", {
3465
3470
  key: 4,
3466
3471
  class: "xml-node__collapsed xml-node__collapsed--clickable",
3467
3472
  style: I({ color: g.theme.colors.textSecondary }),
3468
- onClick: T[2] || (T[2] = (j) => M()),
3473
+ onClick: T[2] || (T[2] = (V) => M()),
3469
3474
  title: "Click to expand"
3470
- }, "...", 4)) : F("", !0)
3475
+ }, "...", 4)) : X("", !0)
3471
3476
  ]),
3472
3477
  o.value && O.value ? (x(), N("div", ln, [
3473
3478
  C.value.length === 0 && f.value.trim() ? (x(), N("div", un, [
3474
3479
  E("span", {
3475
3480
  class: "xml-node__text-content",
3476
3481
  style: I({ color: g.theme.colors.xmlText })
3477
- }, R(f.value), 5)
3478
- ])) : F("", !0),
3479
- (x(!0), N(he, null, pe(C.value, (j, Y) => (x(), Xe(X, {
3480
- key: S(j, Y),
3481
- value: j.value,
3482
- "tag-name": j.tagName,
3482
+ }, j(f.value), 5)
3483
+ ])) : X("", !0),
3484
+ (x(!0), N(he, null, pe(C.value, (V, Y) => (x(), Xe(U, {
3485
+ key: S(V, Y),
3486
+ value: V.value,
3487
+ "tag-name": V.tagName,
3483
3488
  level: g.level + 1,
3484
- path: k(j.tagName, Y),
3489
+ path: k(V.tagName, Y),
3485
3490
  expanded: g.expanded,
3486
3491
  theme: g.theme,
3487
3492
  onToggleExpand: T[3] || (T[3] = (Z) => g.$emit("toggle-expand", Z)),
3488
3493
  onCopy: T[4] || (T[4] = (Z) => g.$emit("copy", Z))
3489
3494
  }, null, 8, ["value", "tag-name", "level", "path", "expanded", "theme"]))), 128))
3490
- ])) : F("", !0),
3495
+ ])) : X("", !0),
3491
3496
  o.value && O.value ? (x(), N("div", cn, [
3492
3497
  E("span", {
3493
3498
  class: "xml-node__clickable-part",
3494
- onClick: T[5] || (T[5] = (j) => M()),
3499
+ onClick: T[5] || (T[5] = (V) => M()),
3495
3500
  title: "Click to collapse"
3496
3501
  }, [
3497
3502
  E("span", {
@@ -3501,32 +3506,32 @@ const qr = {
3501
3506
  E("span", {
3502
3507
  class: "xml-node__tag",
3503
3508
  style: I({ color: g.theme.colors.xmlTag })
3504
- }, R(g.tagName), 5),
3509
+ }, j(g.tagName), 5),
3505
3510
  E("span", {
3506
3511
  class: "xml-node__bracket",
3507
3512
  style: I({ color: g.theme.colors.xmlBracket })
3508
3513
  }, ">", 4)
3509
3514
  ])
3510
- ])) : F("", !0)
3515
+ ])) : X("", !0)
3511
3516
  ]))
3512
3517
  ])) : u.value ? (x(), N("div", dn, [
3513
3518
  E("span", {
3514
3519
  class: "xml-node__text-content",
3515
3520
  style: I({ color: g.theme.colors.xmlText })
3516
- }, R(f.value), 5)
3521
+ }, j(f.value), 5)
3517
3522
  ])) : a.value ? (x(), N("div", fn, [
3518
3523
  E("span", {
3519
3524
  style: I({ color: g.theme.colors.xmlComment })
3520
- }, " <!-- " + R(y.value) + " --> ", 5)
3525
+ }, " <!-- " + j(y.value) + " --> ", 5)
3521
3526
  ])) : l.value ? (x(), N("div", hn, [
3522
3527
  E("span", {
3523
3528
  style: I({ color: g.theme.colors.xmlCdata })
3524
- }, " <![CDATA[" + R(m.value) + "]]> ", 5)
3525
- ])) : F("", !0)
3529
+ }, " <![CDATA[" + j(m.value) + "]]> ", 5)
3530
+ ])) : X("", !0)
3526
3531
  ], 4);
3527
3532
  };
3528
3533
  }
3529
- }), gn = /* @__PURE__ */ me(pn, [["__scopeId", "data-v-c3ce3f83"]]), bn = {
3534
+ }), gn = /* @__PURE__ */ me(pn, [["__scopeId", "data-v-c8f9132d"]]), bn = {
3530
3535
  name: "github-light",
3531
3536
  colors: {
3532
3537
  // 背景色
@@ -3741,20 +3746,20 @@ const qr = {
3741
3746
  emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
3742
3747
  setup(r, { emit: e }) {
3743
3748
  Ce((k) => ({
3744
- "5da93aa4": a.value.colors.border,
3745
- "138f9aa0": a.value.colors.background,
3746
- "9abf940e": a.value.colors.surfaceBackground,
3747
- "78705f00": a.value.colors.buttonBorder,
3748
- "3f22b602": a.value.colors.buttonBackground,
3749
- "5afed501": a.value.colors.buttonText,
3750
- "7fb3945a": a.value.colors.buttonBackgroundHover,
3751
- "7ed67dae": a.value.colors.buttonPrimary,
3752
- "5c748fa4": a.value.colors.buttonPrimaryHover,
3753
- "3e17bc7e": a.value.colors.success,
3754
- "22d3d5cf": a.value.colors.successBackground,
3755
- "0f2d0b46": a.value.colors.error,
3756
- "6c8e5d14": a.value.colors.errorBackground,
3757
- "7c62ec2f": a.value.colors.text
3749
+ 19083852: a.value.colors.border,
3750
+ "9aacd358": a.value.colors.background,
3751
+ "34ab9c56": a.value.colors.surfaceBackground,
3752
+ "43d12cb8": a.value.colors.buttonBorder,
3753
+ "0f3bcea6": a.value.colors.buttonBackground,
3754
+ "177038a5": a.value.colors.buttonText,
3755
+ "39377b94": a.value.colors.buttonBackgroundHover,
3756
+ "63de70ec": a.value.colors.buttonPrimary,
3757
+ "0009905c": a.value.colors.buttonPrimaryHover,
3758
+ d69bfec6: a.value.colors.success,
3759
+ "55ddd1ab": a.value.colors.successBackground,
3760
+ "4b4cf122": a.value.colors.error,
3761
+ "5344c020": a.value.colors.errorBackground,
3762
+ "3400dad3": a.value.colors.text
3758
3763
  }));
3759
3764
  const t = r, s = e, n = G(null), o = G(""), i = G(/* @__PURE__ */ new Set()), u = L(() => o.value === ""), a = L(() => vn(t.theme)), l = L(() => {
3760
3765
  if (!n.value) return {};
@@ -3764,7 +3769,7 @@ const qr = {
3764
3769
  }), k;
3765
3770
  }), h = (k) => {
3766
3771
  if (!k || !k.trim()) {
3767
- o.value = "XML string is empty", n.value = null;
3772
+ o.value = "", n.value = null;
3768
3773
  return;
3769
3774
  }
3770
3775
  try {
@@ -3774,9 +3779,7 @@ const qr = {
3774
3779
  return;
3775
3780
  }
3776
3781
  n.value = ze(k), o.value = "", ce(() => {
3777
- Object.keys(l.value).forEach((g) => {
3778
- i.value.add(g);
3779
- });
3782
+ y();
3780
3783
  });
3781
3784
  } catch (S) {
3782
3785
  o.value = S instanceof Error ? S.message : "Unknown parse error", n.value = null;
@@ -3785,13 +3788,13 @@ const qr = {
3785
3788
  i.value.has(k) ? i.value.delete(k) : i.value.add(k);
3786
3789
  }, y = () => {
3787
3790
  const k = /* @__PURE__ */ new Set(), S = (g, T = "") => {
3788
- g !== null && typeof g == "object" && (T && k.add(T), Object.keys(g).forEach((X) => {
3789
- if (X.startsWith("@_") || X === "#text") return;
3790
- const j = g[X], Y = T ? `${T}.${X}[0]` : X;
3791
- Array.isArray(j) ? j.forEach((Z, D) => {
3792
- const J = T ? `${T}.${X}[${D}]` : `${X}[${D}]`;
3791
+ g !== null && typeof g == "object" && (T && k.add(T), Object.keys(g).forEach((U) => {
3792
+ if (U.startsWith("@_") || U === "#text") return;
3793
+ const V = g[U], Y = T ? `${T}.${U}[0]` : U;
3794
+ Array.isArray(V) ? V.forEach((Z, D) => {
3795
+ const J = T ? `${T}.${U}[${D}]` : `${U}[${D}]`;
3793
3796
  S(Z, J);
3794
- }) : S(j, Y);
3797
+ }) : S(V, Y);
3795
3798
  }));
3796
3799
  };
3797
3800
  Object.keys(l.value).forEach((g) => {
@@ -3880,7 +3883,7 @@ const qr = {
3880
3883
  E("div", On, [
3881
3884
  u.value ? (x(), N("span", Tn, " ✅ Valid XML ")) : (x(), N("span", Pn, " ❌ Invalid XML "))
3882
3885
  ])
3883
- ])) : F("", !0),
3886
+ ])) : X("", !0),
3884
3887
  E("div", Sn, [
3885
3888
  u.value ? (x(), N("div", $n, [
3886
3889
  (x(!0), N(he, null, pe(l.value, (g, T) => (x(), Xe(gn, {
@@ -3895,12 +3898,12 @@ const qr = {
3895
3898
  }, null, 8, ["value", "tag-name", "expanded", "theme"]))), 128))
3896
3899
  ])) : (x(), N("div", In, [
3897
3900
  S[0] || (S[0] = E("h4", null, "XML Parse Error:", -1)),
3898
- E("pre", null, R(o.value), 1)
3901
+ E("pre", null, j(o.value), 1)
3899
3902
  ]))
3900
3903
  ])
3901
3904
  ], 2));
3902
3905
  }
3903
- }), Un = /* @__PURE__ */ me(Bn, [["__scopeId", "data-v-2b795c5a"]]), Ln = [Wt], Vn = (r) => {
3906
+ }), Un = /* @__PURE__ */ me(Bn, [["__scopeId", "data-v-ec8763a7"]]), Ln = [Wt], Vn = (r) => {
3904
3907
  Ln.forEach((e) => {
3905
3908
  const t = e.name || e.__name || "UnknownComponent";
3906
3909
  r.component(t, e);