lone-format 0.12.1 → 0.13.0
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/_chunks/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/_chunks/index-13rwh2MK.js +788 -0
- package/dist/_chunks/index-DfjCsqDT.js +1005 -0
- package/dist/_chunks/index-DvNM7Tl4.js +1784 -0
- package/dist/components/JsonFormat/JsonNode.vue.d.ts +29 -0
- package/dist/components/JsonFormat/index.d.ts +2 -0
- package/dist/components/JsonFormat/index.js +4 -0
- package/dist/components/JsonFormat/index.vue.d.ts +50 -0
- package/dist/components/JsonFormat/themes.d.ts +29 -0
- package/dist/components/JsonFormat/types.d.ts +96 -0
- package/dist/components/SqlFormat/SqlClauseNode.vue.d.ts +13 -0
- package/dist/components/SqlFormat/index.d.ts +5 -0
- package/dist/components/SqlFormat/index.js +5 -0
- package/dist/components/SqlFormat/index.vue.d.ts +43 -0
- package/dist/components/SqlFormat/parser.d.ts +34 -0
- package/dist/components/SqlFormat/themes.d.ts +33 -0
- package/dist/components/SqlFormat/types.d.ts +99 -0
- package/dist/components/XmlFormat/XmlNode.vue.d.ts +37 -0
- package/dist/components/XmlFormat/index.d.ts +7 -0
- package/dist/components/XmlFormat/index.js +27 -0
- package/dist/components/XmlFormat/index.vue.d.ts +57 -0
- package/dist/components/XmlFormat/parser.d.ts +93 -0
- package/dist/components/XmlFormat/themes.d.ts +29 -0
- package/dist/components/XmlFormat/types.d.ts +113 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/index.d.ts +6 -1
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +13 -31862
- package/dist/lone-format.umd.cjs +53 -49
- package/dist/types/components.d.ts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/package.json +8 -3
|
@@ -0,0 +1,1784 @@
|
|
|
1
|
+
import { defineComponent as Ce, useCssVars as $e, ref as q, computed as L, resolveComponent as De, createElementBlock as w, openBlock as $, normalizeStyle as r, createCommentVNode as pe, createElementVNode as n, toDisplayString as E, withKeys as A, withModifiers as j, Fragment as re, renderList as ie, createBlock as Be, nextTick as ne, watch as Ee, normalizeClass as Ve } from "vue";
|
|
2
|
+
import We from "xpath";
|
|
3
|
+
import { DOMParser as Ke, XMLSerializer as Xe } from "@xmldom/xmldom";
|
|
4
|
+
import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
5
|
+
import { XMLValidator as Oe, XMLParser as Pe, XMLBuilder as Ne } from "fast-xml-parser";
|
|
6
|
+
const Re = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "xml-node__comment"
|
|
9
|
+
}, je = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "xml-node__cdata"
|
|
12
|
+
}, qe = {
|
|
13
|
+
key: 2,
|
|
14
|
+
class: "xml-node__element"
|
|
15
|
+
}, Ie = {
|
|
16
|
+
key: 0,
|
|
17
|
+
class: "xml-node__line"
|
|
18
|
+
}, Le = ["contenteditable", "onKeydown"], Ue = ["contenteditable", "onDblclick", "onKeydown"], Fe = ["contenteditable", "onDblclick", "onKeydown"], Me = ["contenteditable", "onKeydown"], Se = {
|
|
19
|
+
key: 1,
|
|
20
|
+
class: "xml-node__line"
|
|
21
|
+
}, Qe = ["contenteditable", "onKeydown"], He = ["contenteditable", "onDblclick", "onKeydown"], ze = ["contenteditable", "onDblclick", "onKeydown"], Ze = ["contenteditable", "onKeydown"], Je = {
|
|
22
|
+
key: 2,
|
|
23
|
+
class: "xml-node__line"
|
|
24
|
+
}, Ge = ["contenteditable", "onKeydown"], Ye = ["contenteditable", "onDblclick", "onKeydown"], et = ["contenteditable", "onDblclick", "onKeydown"], tt = {
|
|
25
|
+
key: 3,
|
|
26
|
+
class: "xml-node__line"
|
|
27
|
+
}, lt = ["contenteditable", "onKeydown"], at = ["contenteditable", "onDblclick", "onKeydown"], nt = ["contenteditable", "onDblclick", "onKeydown"], ot = { key: 4 }, st = {
|
|
28
|
+
key: 0,
|
|
29
|
+
class: "xml-node__line"
|
|
30
|
+
}, rt = ["contenteditable", "onKeydown"], ct = ["contenteditable", "onDblclick", "onKeydown"], it = ["contenteditable", "onDblclick", "onKeydown"], ut = ["title"], dt = { class: "xml-node__line" }, mt = ["title"], ft = ["contenteditable", "onKeydown"], vt = { key: 1 }, pt = ["contenteditable", "onKeydown"], yt = ["contenteditable", "onDblclick", "onKeydown"], ht = ["contenteditable", "onDblclick", "onKeydown"], bt = ["title"], _t = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "xml-node__children"
|
|
33
|
+
}, xt = {
|
|
34
|
+
key: 0,
|
|
35
|
+
class: "xml-node__text"
|
|
36
|
+
}, gt = ["contenteditable", "onKeydown"], kt = {
|
|
37
|
+
key: 1,
|
|
38
|
+
class: "xml-node__line"
|
|
39
|
+
}, At = /* @__PURE__ */ Ce({
|
|
40
|
+
__name: "XmlNode",
|
|
41
|
+
props: {
|
|
42
|
+
node: {},
|
|
43
|
+
index: {},
|
|
44
|
+
level: { default: 0 },
|
|
45
|
+
parentPath: { default: "" },
|
|
46
|
+
expanded: {},
|
|
47
|
+
theme: {},
|
|
48
|
+
selfClosingTags: { default: () => /* @__PURE__ */ new Set() }
|
|
49
|
+
},
|
|
50
|
+
emits: ["toggle-expand", "copy", "update:tagName", "update:attributeName", "update:attributeValue", "update:textContent", "update:cdataContent"],
|
|
51
|
+
setup(s, { emit: m }) {
|
|
52
|
+
$e((e) => ({
|
|
53
|
+
"451d9899": e.theme.colors.collapsedText,
|
|
54
|
+
"6296679a": e.theme.colors.collapsedBackground,
|
|
55
|
+
cd71bc7c: e.theme.colors.collapsedBackgroundHover,
|
|
56
|
+
"30a02a6b": e.theme.colors.indentLine
|
|
57
|
+
}));
|
|
58
|
+
const c = s, f = m, v = q(!1), o = q(null), y = q(null), V = q(!1), B = q(!1), x = q(""), b = q(""), X = q(""), P = q(""), S = q(""), N = q(null), z = q(null), Q = q(null), U = q(null), Y = q(null), K = L(() => Object.keys(c.node).find((i) => !i.startsWith(":") && !i.startsWith("#")) || ""), J = L(() => K.value ? c.parentPath ? `${c.parentPath}.${K.value}[${c.index}]` : `${K.value}[${c.index}]` : ""), te = L(() => c.expanded.has(J.value)), T = L(() => c.node["#comment"] ? "comment" : c.node.__cdata ? "cdata" : K.value ? "element" : "unknown"), R = L(() => {
|
|
59
|
+
const e = c.node[":@"] || {}, i = {};
|
|
60
|
+
return Object.keys(e).forEach((M) => {
|
|
61
|
+
M.startsWith("@_") && (i[M.substring(2)] = e[M]);
|
|
62
|
+
}), i;
|
|
63
|
+
}), G = L(() => {
|
|
64
|
+
if (T.value !== "element" || !K.value) return [];
|
|
65
|
+
const e = c.node[K.value];
|
|
66
|
+
return Array.isArray(e) ? e : [];
|
|
67
|
+
}), ue = L(() => G.value.some((e) => e.__cdata)), de = L(() => {
|
|
68
|
+
if (!ue.value) return "";
|
|
69
|
+
const e = G.value.find((i) => i.__cdata);
|
|
70
|
+
if (e && Array.isArray(e.__cdata)) {
|
|
71
|
+
const i = e.__cdata;
|
|
72
|
+
if (i.length > 0 && i[0]["#text"])
|
|
73
|
+
return i[0]["#text"];
|
|
74
|
+
}
|
|
75
|
+
return "";
|
|
76
|
+
}), le = L(() => {
|
|
77
|
+
if (T.value !== "element" || !K.value || ue.value) return "";
|
|
78
|
+
const e = c.node[K.value];
|
|
79
|
+
if (!Array.isArray(e)) return "";
|
|
80
|
+
const i = e.find((M) => M["#text"]);
|
|
81
|
+
return i ? i["#text"] : "";
|
|
82
|
+
}), ye = L(() => {
|
|
83
|
+
if (T.value !== "comment") return "";
|
|
84
|
+
const e = c.node["#comment"];
|
|
85
|
+
return Array.isArray(e) && e.length > 0 && e[0]["#text"] || "";
|
|
86
|
+
}), Z = L(() => G.value.some((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":")))), me = L(() => Z.value ? G.value.filter((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":"))).length : 0), he = L(() => T.value === "element" && !Z.value && le.value !== ""), fe = L(() => T.value === "element" && !Z.value && le.value === ""), be = L(() => fe.value ? c.node[":selfClosing"] === !0 : !1), oe = () => {
|
|
87
|
+
Z.value && f("toggle-expand", J.value);
|
|
88
|
+
}, _e = (e, i) => `${J.value}-child-${i}`, xe = () => `${J.value}.${K.value}`, ae = () => {
|
|
89
|
+
v.value = !0, x.value = K.value, ne(() => {
|
|
90
|
+
if (N.value) {
|
|
91
|
+
N.value.focus();
|
|
92
|
+
const e = document.createRange();
|
|
93
|
+
e.selectNodeContents(N.value);
|
|
94
|
+
const i = window.getSelection();
|
|
95
|
+
i?.removeAllRanges(), i?.addRange(e);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}, l = (e) => {
|
|
99
|
+
o.value = e, b.value = e, ne(() => {
|
|
100
|
+
if (z.value) {
|
|
101
|
+
z.value.focus();
|
|
102
|
+
const i = document.createRange();
|
|
103
|
+
i.selectNodeContents(z.value);
|
|
104
|
+
const M = window.getSelection();
|
|
105
|
+
M?.removeAllRanges(), M?.addRange(i);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}, d = (e) => {
|
|
109
|
+
y.value = e, X.value = R.value[e] || "", ne(() => {
|
|
110
|
+
if (Q.value) {
|
|
111
|
+
Q.value.focus();
|
|
112
|
+
const i = document.createRange();
|
|
113
|
+
i.selectNodeContents(Q.value);
|
|
114
|
+
const M = window.getSelection();
|
|
115
|
+
M?.removeAllRanges(), M?.addRange(i);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}, g = () => {
|
|
119
|
+
V.value = !0, P.value = le.value, ne(() => {
|
|
120
|
+
if (U.value) {
|
|
121
|
+
U.value.focus();
|
|
122
|
+
const e = document.createRange();
|
|
123
|
+
e.selectNodeContents(U.value);
|
|
124
|
+
const i = window.getSelection();
|
|
125
|
+
i?.removeAllRanges(), i?.addRange(e);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}, t = () => {
|
|
129
|
+
if (!v.value) return;
|
|
130
|
+
const e = N.value?.innerText.trim() || "";
|
|
131
|
+
if (!e || e === K.value) {
|
|
132
|
+
v.value = !1;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
v.value = !1, f("update:tagName", J.value, K.value, e);
|
|
136
|
+
}, a = () => {
|
|
137
|
+
if (!o.value) return;
|
|
138
|
+
const e = o.value, i = z.value?.innerText.trim() || "";
|
|
139
|
+
if (!i || i === e) {
|
|
140
|
+
o.value = null;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
o.value = null, f("update:attributeName", J.value, e, i);
|
|
144
|
+
}, h = () => {
|
|
145
|
+
if (!y.value) return;
|
|
146
|
+
const e = y.value, i = Q.value?.innerText.trim() || "";
|
|
147
|
+
y.value = null, f("update:attributeValue", J.value, e, i);
|
|
148
|
+
}, p = () => {
|
|
149
|
+
if (!V.value) return;
|
|
150
|
+
const e = U.value?.innerText || "";
|
|
151
|
+
if (e === le.value) {
|
|
152
|
+
V.value = !1;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
V.value = !1, f("update:textContent", J.value, e);
|
|
156
|
+
}, C = () => {
|
|
157
|
+
v.value = !1, x.value = K.value;
|
|
158
|
+
}, k = () => {
|
|
159
|
+
o.value && (b.value = o.value, o.value = null);
|
|
160
|
+
}, O = () => {
|
|
161
|
+
y.value && (X.value = R.value[y.value] || "", y.value = null);
|
|
162
|
+
}, W = () => {
|
|
163
|
+
V.value = !1, P.value = le.value;
|
|
164
|
+
}, I = () => {
|
|
165
|
+
B.value = !0, S.value = de.value, ne(() => {
|
|
166
|
+
if (Y.value) {
|
|
167
|
+
Y.value.focus();
|
|
168
|
+
const e = document.createRange();
|
|
169
|
+
e.selectNodeContents(Y.value);
|
|
170
|
+
const i = window.getSelection();
|
|
171
|
+
i?.removeAllRanges(), i?.addRange(e);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}, D = () => {
|
|
175
|
+
if (!B.value) return;
|
|
176
|
+
const e = Y.value?.innerText || "";
|
|
177
|
+
if (e === de.value) {
|
|
178
|
+
B.value = !1;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
B.value = !1, f("update:cdataContent", J.value, e);
|
|
182
|
+
}, ee = () => {
|
|
183
|
+
B.value = !1, S.value = de.value;
|
|
184
|
+
}, H = (e) => {
|
|
185
|
+
Z.value && (e.preventDefault(), ae());
|
|
186
|
+
};
|
|
187
|
+
return (e, i) => {
|
|
188
|
+
const M = De("XmlNode", !0);
|
|
189
|
+
return $(), w("div", {
|
|
190
|
+
class: "xml-node",
|
|
191
|
+
style: r({ paddingLeft: e.level > 0 ? "16px" : "0" })
|
|
192
|
+
}, [
|
|
193
|
+
T.value === "comment" ? ($(), w("div", Re, [
|
|
194
|
+
n("span", {
|
|
195
|
+
style: r({ color: e.theme.colors.xmlComment })
|
|
196
|
+
}, " <!-- " + E(ye.value) + " --> ", 5)
|
|
197
|
+
])) : T.value === "cdata" ? ($(), w("div", je, [
|
|
198
|
+
n("span", {
|
|
199
|
+
style: r({ color: e.theme.colors.xmlCdata })
|
|
200
|
+
}, " <![CDATA[" + E(e.node.__cdata) + "]]> ", 5)
|
|
201
|
+
])) : T.value === "element" ? ($(), w("div", qe, [
|
|
202
|
+
ue.value ? ($(), w("div", Ie, [
|
|
203
|
+
n("span", {
|
|
204
|
+
class: "xml-node__bracket",
|
|
205
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
206
|
+
}, "<", 4),
|
|
207
|
+
n("span", {
|
|
208
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
209
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
210
|
+
contenteditable: v.value,
|
|
211
|
+
onDblclick: ae,
|
|
212
|
+
onContextmenu: H,
|
|
213
|
+
onKeydown: [
|
|
214
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
215
|
+
A(C, ["escape"])
|
|
216
|
+
],
|
|
217
|
+
onBlur: t,
|
|
218
|
+
ref_key: "tagNameRef",
|
|
219
|
+
ref: N,
|
|
220
|
+
title: "Double-click to edit tag name"
|
|
221
|
+
}, E(v.value ? x.value : K.value), 45, Le),
|
|
222
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
223
|
+
key: u,
|
|
224
|
+
class: "xml-node__attribute"
|
|
225
|
+
}, [
|
|
226
|
+
n("span", {
|
|
227
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
228
|
+
style: r({ color: e.theme.colors.xmlAttribute }),
|
|
229
|
+
contenteditable: o.value === u,
|
|
230
|
+
onDblclick: (_) => l(u),
|
|
231
|
+
onKeydown: [
|
|
232
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
233
|
+
A(k, ["escape"])
|
|
234
|
+
],
|
|
235
|
+
onBlur: a,
|
|
236
|
+
ref_for: !0,
|
|
237
|
+
ref: (_) => {
|
|
238
|
+
o.value === u && (z.value = _);
|
|
239
|
+
},
|
|
240
|
+
title: "Double-click to edit attribute name"
|
|
241
|
+
}, E(o.value === u ? b.value : u), 45, Ue),
|
|
242
|
+
n("span", {
|
|
243
|
+
class: "xml-node__equals",
|
|
244
|
+
style: r({ color: e.theme.colors.xmlEquals })
|
|
245
|
+
}, "=", 4),
|
|
246
|
+
n("span", {
|
|
247
|
+
class: "xml-node__quote",
|
|
248
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
249
|
+
}, '"', 4),
|
|
250
|
+
n("span", {
|
|
251
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
252
|
+
style: r({ color: e.theme.colors.xmlAttributeValue }),
|
|
253
|
+
contenteditable: y.value === u,
|
|
254
|
+
onDblclick: (_) => d(u),
|
|
255
|
+
onKeydown: [
|
|
256
|
+
A(j(h, ["prevent"]), ["enter"]),
|
|
257
|
+
A(O, ["escape"])
|
|
258
|
+
],
|
|
259
|
+
onBlur: h,
|
|
260
|
+
ref_for: !0,
|
|
261
|
+
ref: (_) => {
|
|
262
|
+
y.value === u && (Q.value = _);
|
|
263
|
+
},
|
|
264
|
+
title: "Double-click to edit attribute value"
|
|
265
|
+
}, E(y.value === u ? X.value : F), 45, Fe),
|
|
266
|
+
n("span", {
|
|
267
|
+
class: "xml-node__quote",
|
|
268
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
269
|
+
}, '"', 4)
|
|
270
|
+
]))), 128)),
|
|
271
|
+
n("span", {
|
|
272
|
+
class: "xml-node__bracket",
|
|
273
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
274
|
+
}, ">", 4),
|
|
275
|
+
n("span", {
|
|
276
|
+
class: "xml-node__cdata",
|
|
277
|
+
style: r({ color: e.theme.colors.xmlCdata })
|
|
278
|
+
}, "<![CDATA[", 4),
|
|
279
|
+
n("span", {
|
|
280
|
+
class: "xml-node__cdata-content xml-node__cdata-content--editable",
|
|
281
|
+
style: r({ color: e.theme.colors.xmlCdata }),
|
|
282
|
+
contenteditable: B.value,
|
|
283
|
+
onDblclick: I,
|
|
284
|
+
onKeydown: [
|
|
285
|
+
A(j(D, ["prevent"]), ["enter"]),
|
|
286
|
+
A(ee, ["escape"])
|
|
287
|
+
],
|
|
288
|
+
onBlur: D,
|
|
289
|
+
ref_key: "cdataContentRef",
|
|
290
|
+
ref: Y,
|
|
291
|
+
title: "Double-click to edit CDATA content"
|
|
292
|
+
}, E(B.value ? S.value : de.value), 45, Me),
|
|
293
|
+
n("span", {
|
|
294
|
+
class: "xml-node__cdata",
|
|
295
|
+
style: r({ color: e.theme.colors.xmlCdata })
|
|
296
|
+
}, "]]>", 4),
|
|
297
|
+
n("span", {
|
|
298
|
+
class: "xml-node__bracket",
|
|
299
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
300
|
+
}, "</", 4),
|
|
301
|
+
n("span", {
|
|
302
|
+
class: "xml-node__tag",
|
|
303
|
+
style: r({ color: e.theme.colors.xmlTag })
|
|
304
|
+
}, E(v.value ? x.value : K.value), 5),
|
|
305
|
+
n("span", {
|
|
306
|
+
class: "xml-node__bracket",
|
|
307
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
308
|
+
}, ">", 4)
|
|
309
|
+
])) : he.value ? ($(), w("div", Se, [
|
|
310
|
+
n("span", {
|
|
311
|
+
class: "xml-node__bracket",
|
|
312
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
313
|
+
}, "<", 4),
|
|
314
|
+
n("span", {
|
|
315
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
316
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
317
|
+
contenteditable: v.value,
|
|
318
|
+
onDblclick: ae,
|
|
319
|
+
onContextmenu: H,
|
|
320
|
+
onKeydown: [
|
|
321
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
322
|
+
A(C, ["escape"])
|
|
323
|
+
],
|
|
324
|
+
onBlur: t,
|
|
325
|
+
ref_key: "tagNameRef",
|
|
326
|
+
ref: N,
|
|
327
|
+
title: "Double-click to edit tag name"
|
|
328
|
+
}, E(v.value ? x.value : K.value), 45, Qe),
|
|
329
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
330
|
+
key: u,
|
|
331
|
+
class: "xml-node__attribute"
|
|
332
|
+
}, [
|
|
333
|
+
n("span", {
|
|
334
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
335
|
+
style: r({ color: e.theme.colors.xmlAttribute }),
|
|
336
|
+
contenteditable: o.value === u,
|
|
337
|
+
onDblclick: (_) => l(u),
|
|
338
|
+
onKeydown: [
|
|
339
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
340
|
+
A(k, ["escape"])
|
|
341
|
+
],
|
|
342
|
+
onBlur: a,
|
|
343
|
+
ref_for: !0,
|
|
344
|
+
ref: (_) => {
|
|
345
|
+
o.value === u && (z.value = _);
|
|
346
|
+
},
|
|
347
|
+
title: "Double-click to edit attribute name"
|
|
348
|
+
}, E(o.value === u ? b.value : u), 45, He),
|
|
349
|
+
n("span", {
|
|
350
|
+
class: "xml-node__equals",
|
|
351
|
+
style: r({ color: e.theme.colors.xmlEquals })
|
|
352
|
+
}, "=", 4),
|
|
353
|
+
n("span", {
|
|
354
|
+
class: "xml-node__quote",
|
|
355
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
356
|
+
}, '"', 4),
|
|
357
|
+
n("span", {
|
|
358
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
359
|
+
style: r({ color: e.theme.colors.xmlAttributeValue }),
|
|
360
|
+
contenteditable: y.value === u,
|
|
361
|
+
onDblclick: (_) => d(u),
|
|
362
|
+
onKeydown: [
|
|
363
|
+
A(j(h, ["prevent"]), ["enter"]),
|
|
364
|
+
A(O, ["escape"])
|
|
365
|
+
],
|
|
366
|
+
onBlur: h,
|
|
367
|
+
ref_for: !0,
|
|
368
|
+
ref: (_) => {
|
|
369
|
+
y.value === u && (Q.value = _);
|
|
370
|
+
},
|
|
371
|
+
title: "Double-click to edit attribute value"
|
|
372
|
+
}, E(y.value === u ? X.value : F), 45, ze),
|
|
373
|
+
n("span", {
|
|
374
|
+
class: "xml-node__quote",
|
|
375
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
376
|
+
}, '"', 4)
|
|
377
|
+
]))), 128)),
|
|
378
|
+
n("span", {
|
|
379
|
+
class: "xml-node__bracket",
|
|
380
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
381
|
+
}, ">", 4),
|
|
382
|
+
n("span", {
|
|
383
|
+
class: "xml-node__text-content xml-node__text-content--editable",
|
|
384
|
+
style: r({ color: e.theme.colors.xmlText }),
|
|
385
|
+
contenteditable: V.value,
|
|
386
|
+
onDblclick: g,
|
|
387
|
+
onKeydown: [
|
|
388
|
+
A(j(p, ["prevent"]), ["enter"]),
|
|
389
|
+
A(W, ["escape"])
|
|
390
|
+
],
|
|
391
|
+
onBlur: p,
|
|
392
|
+
ref_key: "textContentRef",
|
|
393
|
+
ref: U,
|
|
394
|
+
title: "Double-click to edit text content"
|
|
395
|
+
}, E(V.value ? P.value : le.value), 45, Ze),
|
|
396
|
+
n("span", {
|
|
397
|
+
class: "xml-node__bracket",
|
|
398
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
399
|
+
}, "</", 4),
|
|
400
|
+
n("span", {
|
|
401
|
+
class: "xml-node__tag",
|
|
402
|
+
style: r({ color: e.theme.colors.xmlTag })
|
|
403
|
+
}, E(v.value ? x.value : K.value), 5),
|
|
404
|
+
n("span", {
|
|
405
|
+
class: "xml-node__bracket",
|
|
406
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
407
|
+
}, ">", 4)
|
|
408
|
+
])) : fe.value && be.value ? ($(), w("div", Je, [
|
|
409
|
+
n("span", {
|
|
410
|
+
class: "xml-node__bracket",
|
|
411
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
412
|
+
}, "<", 4),
|
|
413
|
+
n("span", {
|
|
414
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
415
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
416
|
+
contenteditable: v.value,
|
|
417
|
+
onDblclick: ae,
|
|
418
|
+
onContextmenu: H,
|
|
419
|
+
onKeydown: [
|
|
420
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
421
|
+
A(C, ["escape"])
|
|
422
|
+
],
|
|
423
|
+
onBlur: t,
|
|
424
|
+
ref_key: "tagNameRef",
|
|
425
|
+
ref: N,
|
|
426
|
+
title: "Double-click to edit tag name"
|
|
427
|
+
}, E(v.value ? x.value : K.value), 45, Ge),
|
|
428
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
429
|
+
key: u,
|
|
430
|
+
class: "xml-node__attribute"
|
|
431
|
+
}, [
|
|
432
|
+
n("span", {
|
|
433
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
434
|
+
style: r({ color: e.theme.colors.xmlAttribute }),
|
|
435
|
+
contenteditable: o.value === u,
|
|
436
|
+
onDblclick: (_) => l(u),
|
|
437
|
+
onKeydown: [
|
|
438
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
439
|
+
A(k, ["escape"])
|
|
440
|
+
],
|
|
441
|
+
onBlur: a,
|
|
442
|
+
ref_for: !0,
|
|
443
|
+
ref: (_) => {
|
|
444
|
+
o.value === u && (z.value = _);
|
|
445
|
+
},
|
|
446
|
+
title: "Double-click to edit attribute name"
|
|
447
|
+
}, E(o.value === u ? b.value : u), 45, Ye),
|
|
448
|
+
n("span", {
|
|
449
|
+
class: "xml-node__equals",
|
|
450
|
+
style: r({ color: e.theme.colors.xmlEquals })
|
|
451
|
+
}, "=", 4),
|
|
452
|
+
n("span", {
|
|
453
|
+
class: "xml-node__quote",
|
|
454
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
455
|
+
}, '"', 4),
|
|
456
|
+
n("span", {
|
|
457
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
458
|
+
style: r({ color: e.theme.colors.xmlAttributeValue }),
|
|
459
|
+
contenteditable: y.value === u,
|
|
460
|
+
onDblclick: (_) => d(u),
|
|
461
|
+
onKeydown: [
|
|
462
|
+
A(j(h, ["prevent"]), ["enter"]),
|
|
463
|
+
A(O, ["escape"])
|
|
464
|
+
],
|
|
465
|
+
onBlur: h,
|
|
466
|
+
ref_for: !0,
|
|
467
|
+
ref: (_) => {
|
|
468
|
+
y.value === u && (Q.value = _);
|
|
469
|
+
},
|
|
470
|
+
title: "Double-click to edit attribute value"
|
|
471
|
+
}, E(y.value === u ? X.value : F), 45, et),
|
|
472
|
+
n("span", {
|
|
473
|
+
class: "xml-node__quote",
|
|
474
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
475
|
+
}, '"', 4)
|
|
476
|
+
]))), 128)),
|
|
477
|
+
n("span", {
|
|
478
|
+
class: "xml-node__bracket",
|
|
479
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
480
|
+
}, " />", 4)
|
|
481
|
+
])) : fe.value ? ($(), w("div", tt, [
|
|
482
|
+
n("span", {
|
|
483
|
+
class: "xml-node__bracket",
|
|
484
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
485
|
+
}, "<", 4),
|
|
486
|
+
n("span", {
|
|
487
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
488
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
489
|
+
contenteditable: v.value,
|
|
490
|
+
onDblclick: ae,
|
|
491
|
+
onContextmenu: H,
|
|
492
|
+
onKeydown: [
|
|
493
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
494
|
+
A(C, ["escape"])
|
|
495
|
+
],
|
|
496
|
+
onBlur: t,
|
|
497
|
+
ref_key: "tagNameRef",
|
|
498
|
+
ref: N,
|
|
499
|
+
title: "Double-click to edit tag name"
|
|
500
|
+
}, E(v.value ? x.value : K.value), 45, lt),
|
|
501
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
502
|
+
key: u,
|
|
503
|
+
class: "xml-node__attribute"
|
|
504
|
+
}, [
|
|
505
|
+
n("span", {
|
|
506
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
507
|
+
style: r({ color: e.theme.colors.xmlAttribute }),
|
|
508
|
+
contenteditable: o.value === u,
|
|
509
|
+
onDblclick: (_) => l(u),
|
|
510
|
+
onKeydown: [
|
|
511
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
512
|
+
A(k, ["escape"])
|
|
513
|
+
],
|
|
514
|
+
onBlur: a,
|
|
515
|
+
ref_for: !0,
|
|
516
|
+
ref: (_) => {
|
|
517
|
+
o.value === u && (z.value = _);
|
|
518
|
+
},
|
|
519
|
+
title: "Double-click to edit attribute name"
|
|
520
|
+
}, E(o.value === u ? b.value : u), 45, at),
|
|
521
|
+
n("span", {
|
|
522
|
+
class: "xml-node__equals",
|
|
523
|
+
style: r({ color: e.theme.colors.xmlEquals })
|
|
524
|
+
}, "=", 4),
|
|
525
|
+
n("span", {
|
|
526
|
+
class: "xml-node__quote",
|
|
527
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
528
|
+
}, '"', 4),
|
|
529
|
+
n("span", {
|
|
530
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
531
|
+
style: r({ color: e.theme.colors.xmlAttributeValue }),
|
|
532
|
+
contenteditable: y.value === u,
|
|
533
|
+
onDblclick: (_) => d(u),
|
|
534
|
+
onKeydown: [
|
|
535
|
+
A(j(h, ["prevent"]), ["enter"]),
|
|
536
|
+
A(O, ["escape"])
|
|
537
|
+
],
|
|
538
|
+
onBlur: h,
|
|
539
|
+
ref_for: !0,
|
|
540
|
+
ref: (_) => {
|
|
541
|
+
y.value === u && (Q.value = _);
|
|
542
|
+
},
|
|
543
|
+
title: "Double-click to edit attribute value"
|
|
544
|
+
}, E(y.value === u ? X.value : F), 45, nt),
|
|
545
|
+
n("span", {
|
|
546
|
+
class: "xml-node__quote",
|
|
547
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
548
|
+
}, '"', 4)
|
|
549
|
+
]))), 128)),
|
|
550
|
+
n("span", {
|
|
551
|
+
class: "xml-node__bracket",
|
|
552
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
553
|
+
}, "></", 4),
|
|
554
|
+
n("span", {
|
|
555
|
+
class: "xml-node__tag",
|
|
556
|
+
style: r({ color: e.theme.colors.xmlTag })
|
|
557
|
+
}, E(v.value ? x.value : K.value), 5),
|
|
558
|
+
n("span", {
|
|
559
|
+
class: "xml-node__bracket",
|
|
560
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
561
|
+
}, ">", 4)
|
|
562
|
+
])) : ($(), w("div", ot, [
|
|
563
|
+
!te.value && Z.value ? ($(), w("div", st, [
|
|
564
|
+
n("span", {
|
|
565
|
+
class: "xml-node__clickable-part",
|
|
566
|
+
onClick: i[0] || (i[0] = (F) => oe()),
|
|
567
|
+
title: "Click to expand"
|
|
568
|
+
}, [
|
|
569
|
+
n("span", {
|
|
570
|
+
class: "xml-node__bracket",
|
|
571
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
572
|
+
}, "<", 4),
|
|
573
|
+
n("span", {
|
|
574
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
575
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
576
|
+
contenteditable: v.value,
|
|
577
|
+
onDblclick: j(ae, ["stop"]),
|
|
578
|
+
onContextmenu: H,
|
|
579
|
+
onKeydown: [
|
|
580
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
581
|
+
A(C, ["escape"])
|
|
582
|
+
],
|
|
583
|
+
onBlur: t,
|
|
584
|
+
ref_key: "tagNameRef",
|
|
585
|
+
ref: N,
|
|
586
|
+
title: "Double-click or right-click to edit tag name"
|
|
587
|
+
}, E(v.value ? x.value : K.value), 45, rt)
|
|
588
|
+
]),
|
|
589
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
590
|
+
key: u,
|
|
591
|
+
class: "xml-node__attribute"
|
|
592
|
+
}, [
|
|
593
|
+
n("span", {
|
|
594
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
595
|
+
style: r({ color: e.theme.colors.xmlAttribute }),
|
|
596
|
+
contenteditable: o.value === u,
|
|
597
|
+
onDblclick: (_) => l(u),
|
|
598
|
+
onKeydown: [
|
|
599
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
600
|
+
A(k, ["escape"])
|
|
601
|
+
],
|
|
602
|
+
onBlur: a,
|
|
603
|
+
ref_for: !0,
|
|
604
|
+
ref: (_) => {
|
|
605
|
+
o.value === u && (z.value = _);
|
|
606
|
+
},
|
|
607
|
+
title: "Double-click to edit attribute name"
|
|
608
|
+
}, E(o.value === u ? b.value : u), 45, ct),
|
|
609
|
+
n("span", {
|
|
610
|
+
class: "xml-node__equals",
|
|
611
|
+
style: r({ color: e.theme.colors.xmlEquals })
|
|
612
|
+
}, "=", 4),
|
|
613
|
+
n("span", {
|
|
614
|
+
class: "xml-node__quote",
|
|
615
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
616
|
+
}, '"', 4),
|
|
617
|
+
n("span", {
|
|
618
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
619
|
+
style: r({ color: e.theme.colors.xmlAttributeValue }),
|
|
620
|
+
contenteditable: y.value === u,
|
|
621
|
+
onDblclick: (_) => d(u),
|
|
622
|
+
onKeydown: [
|
|
623
|
+
A(j(h, ["prevent"]), ["enter"]),
|
|
624
|
+
A(O, ["escape"])
|
|
625
|
+
],
|
|
626
|
+
onBlur: h,
|
|
627
|
+
ref_for: !0,
|
|
628
|
+
ref: (_) => {
|
|
629
|
+
y.value === u && (Q.value = _);
|
|
630
|
+
},
|
|
631
|
+
title: "Double-click to edit attribute value"
|
|
632
|
+
}, E(y.value === u ? X.value : F), 45, it),
|
|
633
|
+
n("span", {
|
|
634
|
+
class: "xml-node__quote",
|
|
635
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
636
|
+
}, '"', 4)
|
|
637
|
+
]))), 128)),
|
|
638
|
+
n("span", {
|
|
639
|
+
class: "xml-node__clickable-part",
|
|
640
|
+
onClick: i[1] || (i[1] = (F) => oe()),
|
|
641
|
+
title: "Click to expand"
|
|
642
|
+
}, [
|
|
643
|
+
n("span", {
|
|
644
|
+
class: "xml-node__bracket",
|
|
645
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
646
|
+
}, ">", 4)
|
|
647
|
+
]),
|
|
648
|
+
n("span", {
|
|
649
|
+
class: "xml-node__collapsed-badge",
|
|
650
|
+
onClick: i[2] || (i[2] = (F) => oe()),
|
|
651
|
+
title: `Click to expand ${me.value} tag${me.value > 1 ? "s" : ""}`
|
|
652
|
+
}, E(me.value) + " tag" + E(me.value > 1 ? "s" : ""), 9, ut),
|
|
653
|
+
n("span", {
|
|
654
|
+
class: "xml-node__clickable-part",
|
|
655
|
+
onClick: i[3] || (i[3] = (F) => oe()),
|
|
656
|
+
title: "Click to expand"
|
|
657
|
+
}, [
|
|
658
|
+
n("span", {
|
|
659
|
+
class: "xml-node__bracket",
|
|
660
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
661
|
+
}, "</", 4),
|
|
662
|
+
n("span", {
|
|
663
|
+
class: "xml-node__tag",
|
|
664
|
+
style: r({ color: e.theme.colors.xmlTag })
|
|
665
|
+
}, E(v.value ? x.value : K.value), 5),
|
|
666
|
+
n("span", {
|
|
667
|
+
class: "xml-node__bracket",
|
|
668
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
669
|
+
}, ">", 4)
|
|
670
|
+
])
|
|
671
|
+
])) : ($(), w(re, { key: 1 }, [
|
|
672
|
+
n("div", dt, [
|
|
673
|
+
Z.value ? ($(), w("span", {
|
|
674
|
+
key: 0,
|
|
675
|
+
class: "xml-node__clickable-part",
|
|
676
|
+
onClick: i[4] || (i[4] = (F) => oe()),
|
|
677
|
+
title: te.value ? "Click to collapse" : "Click to expand"
|
|
678
|
+
}, [
|
|
679
|
+
n("span", {
|
|
680
|
+
class: "xml-node__bracket",
|
|
681
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
682
|
+
}, "<", 4),
|
|
683
|
+
n("span", {
|
|
684
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
685
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
686
|
+
contenteditable: v.value,
|
|
687
|
+
onDblclick: j(ae, ["stop"]),
|
|
688
|
+
onContextmenu: H,
|
|
689
|
+
onKeydown: [
|
|
690
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
691
|
+
A(C, ["escape"])
|
|
692
|
+
],
|
|
693
|
+
onBlur: t,
|
|
694
|
+
ref_key: "tagNameRef",
|
|
695
|
+
ref: N,
|
|
696
|
+
title: "Double-click or right-click to edit tag name"
|
|
697
|
+
}, E(v.value ? x.value : K.value), 45, ft)
|
|
698
|
+
], 8, mt)) : ($(), w("span", vt, [
|
|
699
|
+
n("span", {
|
|
700
|
+
class: "xml-node__bracket",
|
|
701
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
702
|
+
}, "<", 4),
|
|
703
|
+
n("span", {
|
|
704
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
705
|
+
style: r({ color: e.theme.colors.xmlTag }),
|
|
706
|
+
contenteditable: v.value,
|
|
707
|
+
onDblclick: ae,
|
|
708
|
+
onKeydown: [
|
|
709
|
+
A(j(t, ["prevent"]), ["enter"]),
|
|
710
|
+
A(C, ["escape"])
|
|
711
|
+
],
|
|
712
|
+
onBlur: t,
|
|
713
|
+
ref_key: "tagNameRef",
|
|
714
|
+
ref: N,
|
|
715
|
+
title: "Double-click to edit tag name"
|
|
716
|
+
}, E(v.value ? x.value : K.value), 45, pt)
|
|
717
|
+
])),
|
|
718
|
+
($(!0), w(re, null, ie(R.value, (F, u) => ($(), w("span", {
|
|
719
|
+
key: u,
|
|
720
|
+
class: "xml-node__attribute"
|
|
721
|
+
}, [
|
|
722
|
+
n("span", {
|
|
723
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
724
|
+
style: r({ color: e.theme.colors.xmlAttribute }),
|
|
725
|
+
contenteditable: o.value === u,
|
|
726
|
+
onDblclick: (_) => l(u),
|
|
727
|
+
onKeydown: [
|
|
728
|
+
A(j(a, ["prevent"]), ["enter"]),
|
|
729
|
+
A(k, ["escape"])
|
|
730
|
+
],
|
|
731
|
+
onBlur: a,
|
|
732
|
+
ref_for: !0,
|
|
733
|
+
ref: (_) => {
|
|
734
|
+
o.value === u && (z.value = _);
|
|
735
|
+
},
|
|
736
|
+
title: "Double-click to edit attribute name"
|
|
737
|
+
}, E(o.value === u ? b.value : u), 45, yt),
|
|
738
|
+
n("span", {
|
|
739
|
+
class: "xml-node__equals",
|
|
740
|
+
style: r({ color: e.theme.colors.xmlEquals })
|
|
741
|
+
}, "=", 4),
|
|
742
|
+
n("span", {
|
|
743
|
+
class: "xml-node__quote",
|
|
744
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
745
|
+
}, '"', 4),
|
|
746
|
+
n("span", {
|
|
747
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
748
|
+
style: r({ color: e.theme.colors.xmlAttributeValue }),
|
|
749
|
+
contenteditable: y.value === u,
|
|
750
|
+
onDblclick: (_) => d(u),
|
|
751
|
+
onKeydown: [
|
|
752
|
+
A(j(h, ["prevent"]), ["enter"]),
|
|
753
|
+
A(O, ["escape"])
|
|
754
|
+
],
|
|
755
|
+
onBlur: h,
|
|
756
|
+
ref_for: !0,
|
|
757
|
+
ref: (_) => {
|
|
758
|
+
y.value === u && (Q.value = _);
|
|
759
|
+
},
|
|
760
|
+
title: "Double-click to edit attribute value"
|
|
761
|
+
}, E(y.value === u ? X.value : F), 45, ht),
|
|
762
|
+
n("span", {
|
|
763
|
+
class: "xml-node__quote",
|
|
764
|
+
style: r({ color: e.theme.colors.xmlQuote })
|
|
765
|
+
}, '"', 4)
|
|
766
|
+
]))), 128)),
|
|
767
|
+
Z.value ? ($(), w("span", {
|
|
768
|
+
key: 2,
|
|
769
|
+
class: "xml-node__clickable-part",
|
|
770
|
+
onClick: i[5] || (i[5] = (F) => oe()),
|
|
771
|
+
title: te.value ? "Click to collapse" : "Click to expand"
|
|
772
|
+
}, [
|
|
773
|
+
n("span", {
|
|
774
|
+
class: "xml-node__bracket",
|
|
775
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
776
|
+
}, ">", 4)
|
|
777
|
+
], 8, bt)) : ($(), w("span", {
|
|
778
|
+
key: 3,
|
|
779
|
+
class: "xml-node__bracket",
|
|
780
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
781
|
+
}, E(Z.value ? ">" : "/>"), 5))
|
|
782
|
+
]),
|
|
783
|
+
te.value && Z.value ? ($(), w("div", _t, [
|
|
784
|
+
G.value.length === 0 && le.value.trim() ? ($(), w("div", xt, [
|
|
785
|
+
n("span", {
|
|
786
|
+
class: "xml-node__text-content xml-node__text-content--editable",
|
|
787
|
+
style: r({ color: e.theme.colors.xmlText }),
|
|
788
|
+
contenteditable: V.value,
|
|
789
|
+
onDblclick: g,
|
|
790
|
+
onKeydown: [
|
|
791
|
+
A(j(p, ["prevent"]), ["enter"]),
|
|
792
|
+
A(W, ["escape"])
|
|
793
|
+
],
|
|
794
|
+
onBlur: p,
|
|
795
|
+
ref_key: "textContentRef",
|
|
796
|
+
ref: U,
|
|
797
|
+
title: "Double-click to edit text content"
|
|
798
|
+
}, E(V.value ? P.value : le.value), 45, gt)
|
|
799
|
+
])) : pe("", !0),
|
|
800
|
+
($(!0), w(re, null, ie(G.value, (F, u) => ($(), Be(M, {
|
|
801
|
+
key: _e(F, u),
|
|
802
|
+
node: F,
|
|
803
|
+
index: u,
|
|
804
|
+
level: e.level + 1,
|
|
805
|
+
"parent-path": xe(),
|
|
806
|
+
expanded: e.expanded,
|
|
807
|
+
theme: e.theme,
|
|
808
|
+
selfClosingTags: e.selfClosingTags,
|
|
809
|
+
onToggleExpand: i[6] || (i[6] = (_) => e.$emit("toggle-expand", _)),
|
|
810
|
+
onCopy: i[7] || (i[7] = (_) => e.$emit("copy", _)),
|
|
811
|
+
"onUpdate:tagName": i[8] || (i[8] = (_, se, ve) => e.$emit("update:tagName", _, se, ve)),
|
|
812
|
+
"onUpdate:attributeName": i[9] || (i[9] = (_, se, ve) => e.$emit("update:attributeName", _, se, ve)),
|
|
813
|
+
"onUpdate:attributeValue": i[10] || (i[10] = (_, se, ve) => e.$emit("update:attributeValue", _, se, ve)),
|
|
814
|
+
"onUpdate:textContent": i[11] || (i[11] = (_, se) => e.$emit("update:textContent", _, se)),
|
|
815
|
+
"onUpdate:cdataContent": i[12] || (i[12] = (_, se) => e.$emit("update:cdataContent", _, se))
|
|
816
|
+
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme", "selfClosingTags"]))), 128))
|
|
817
|
+
])) : pe("", !0),
|
|
818
|
+
te.value && Z.value ? ($(), w("div", kt, [
|
|
819
|
+
n("span", {
|
|
820
|
+
class: "xml-node__clickable-part",
|
|
821
|
+
onClick: i[13] || (i[13] = (F) => oe()),
|
|
822
|
+
title: "Click to collapse"
|
|
823
|
+
}, [
|
|
824
|
+
n("span", {
|
|
825
|
+
class: "xml-node__bracket",
|
|
826
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
827
|
+
}, "</", 4),
|
|
828
|
+
n("span", {
|
|
829
|
+
class: "xml-node__tag",
|
|
830
|
+
style: r({ color: e.theme.colors.xmlTag })
|
|
831
|
+
}, E(v.value ? x.value : K.value), 5),
|
|
832
|
+
n("span", {
|
|
833
|
+
class: "xml-node__bracket",
|
|
834
|
+
style: r({ color: e.theme.colors.xmlBracket })
|
|
835
|
+
}, ">", 4)
|
|
836
|
+
])
|
|
837
|
+
])) : pe("", !0)
|
|
838
|
+
], 64))
|
|
839
|
+
]))
|
|
840
|
+
])) : pe("", !0)
|
|
841
|
+
], 4);
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
}), Ct = /* @__PURE__ */ we(At, [["__scopeId", "data-v-2ea5f623"]]), $t = {
|
|
845
|
+
name: "github-light",
|
|
846
|
+
colors: {
|
|
847
|
+
// 背景色
|
|
848
|
+
background: "#ffffff",
|
|
849
|
+
surfaceBackground: "#f6f8fa",
|
|
850
|
+
// 边框色
|
|
851
|
+
border: "#d0d7de",
|
|
852
|
+
// 文本色
|
|
853
|
+
text: "#24292f",
|
|
854
|
+
textSecondary: "#57606a",
|
|
855
|
+
// 按钮样式
|
|
856
|
+
buttonBackground: "#f6f8fa",
|
|
857
|
+
buttonBackgroundHover: "#f3f4f6",
|
|
858
|
+
buttonBorder: "#d0d7de",
|
|
859
|
+
buttonText: "#24292f",
|
|
860
|
+
buttonPrimary: "#1f883d",
|
|
861
|
+
buttonPrimaryHover: "#1a7f37",
|
|
862
|
+
// 状态指示
|
|
863
|
+
success: "#1f883d",
|
|
864
|
+
successBackground: "#dafbe1",
|
|
865
|
+
error: "#cf222e",
|
|
866
|
+
errorBackground: "#ffebe9",
|
|
867
|
+
// XML 语法高亮
|
|
868
|
+
xmlTag: "#116329",
|
|
869
|
+
// 标签名 - 绿色
|
|
870
|
+
xmlAttribute: "#0550ae",
|
|
871
|
+
// 属性名 - 蓝色
|
|
872
|
+
xmlAttributeValue: "#0a3069",
|
|
873
|
+
// 属性值 - 深蓝
|
|
874
|
+
xmlText: "#24292f",
|
|
875
|
+
// 文本内容 - 黑色
|
|
876
|
+
xmlComment: "#6e7781",
|
|
877
|
+
// 注释 - 灰色
|
|
878
|
+
xmlCdata: "#8250df",
|
|
879
|
+
// CDATA - 紫色
|
|
880
|
+
xmlDeclaration: "#953800",
|
|
881
|
+
// 声明 - 橙色
|
|
882
|
+
xmlBracket: "#6e7781",
|
|
883
|
+
// 括号 - 灰色
|
|
884
|
+
xmlEquals: "#6e7781",
|
|
885
|
+
// 等号 - 灰色
|
|
886
|
+
xmlQuote: "#0550ae",
|
|
887
|
+
// 引号 - 蓝色
|
|
888
|
+
// 折叠效果
|
|
889
|
+
collapsedBackground: "#ddf4ff",
|
|
890
|
+
// 折叠信息背景色 - 浅蓝
|
|
891
|
+
collapsedBackgroundHover: "#b6e3ff",
|
|
892
|
+
// 折叠信息悬停背景色 - 稍深蓝
|
|
893
|
+
collapsedText: "#0969da",
|
|
894
|
+
// 折叠信息文本色 - 蓝色
|
|
895
|
+
// 缩进指示线
|
|
896
|
+
indentLine: "#d0d7de"
|
|
897
|
+
// 对齐线 - 灰色
|
|
898
|
+
}
|
|
899
|
+
}, Bt = {
|
|
900
|
+
name: "github-dark",
|
|
901
|
+
colors: {
|
|
902
|
+
// 背景色
|
|
903
|
+
background: "#0d1117",
|
|
904
|
+
surfaceBackground: "#161b22",
|
|
905
|
+
// 边框色
|
|
906
|
+
border: "#30363d",
|
|
907
|
+
// 文本色
|
|
908
|
+
text: "#c9d1d9",
|
|
909
|
+
textSecondary: "#8b949e",
|
|
910
|
+
// 按钮样式
|
|
911
|
+
buttonBackground: "#21262d",
|
|
912
|
+
buttonBackgroundHover: "#30363d",
|
|
913
|
+
buttonBorder: "#30363d",
|
|
914
|
+
buttonText: "#c9d1d9",
|
|
915
|
+
buttonPrimary: "#238636",
|
|
916
|
+
buttonPrimaryHover: "#2ea043",
|
|
917
|
+
// 状态指示
|
|
918
|
+
success: "#3fb950",
|
|
919
|
+
successBackground: "#0f2e1c",
|
|
920
|
+
error: "#f85149",
|
|
921
|
+
errorBackground: "#3d1319",
|
|
922
|
+
// XML 语法高亮
|
|
923
|
+
xmlTag: "#7ee787",
|
|
924
|
+
// 标签名 - 亮绿色
|
|
925
|
+
xmlAttribute: "#79c0ff",
|
|
926
|
+
// 属性名 - 亮蓝色
|
|
927
|
+
xmlAttributeValue: "#a5d6ff",
|
|
928
|
+
// 属性值 - 淡蓝色
|
|
929
|
+
xmlText: "#c9d1d9",
|
|
930
|
+
// 文本内容 - 白色
|
|
931
|
+
xmlComment: "#8b949e",
|
|
932
|
+
// 注释 - 灰色
|
|
933
|
+
xmlCdata: "#d2a8ff",
|
|
934
|
+
// CDATA - 紫色
|
|
935
|
+
xmlDeclaration: "#ffa657",
|
|
936
|
+
// 声明 - 橙色
|
|
937
|
+
xmlBracket: "#8b949e",
|
|
938
|
+
// 括号 - 灰色
|
|
939
|
+
xmlEquals: "#8b949e",
|
|
940
|
+
// 等号 - 灰色
|
|
941
|
+
xmlQuote: "#79c0ff",
|
|
942
|
+
// 引号 - 亮蓝色
|
|
943
|
+
// 折叠效果
|
|
944
|
+
collapsedBackground: "#1c2128",
|
|
945
|
+
// 折叠信息背景色 - 深蓝
|
|
946
|
+
collapsedBackgroundHover: "#2d333b",
|
|
947
|
+
// 折叠信息悬停背景色 - 稍深
|
|
948
|
+
collapsedText: "#79c0ff",
|
|
949
|
+
// 折叠信息文本色 - 亮蓝色
|
|
950
|
+
// 缩进指示线
|
|
951
|
+
indentLine: "#30363d"
|
|
952
|
+
// 对齐线 - 灰色
|
|
953
|
+
}
|
|
954
|
+
}, wt = {
|
|
955
|
+
name: "min-light",
|
|
956
|
+
colors: {
|
|
957
|
+
// 背景色
|
|
958
|
+
background: "#ffffff",
|
|
959
|
+
surfaceBackground: "#fafafa",
|
|
960
|
+
// 边框色
|
|
961
|
+
border: "#e5e5e5",
|
|
962
|
+
// 文本色
|
|
963
|
+
text: "#171717",
|
|
964
|
+
textSecondary: "#737373",
|
|
965
|
+
// 按钮样式
|
|
966
|
+
buttonBackground: "#fafafa",
|
|
967
|
+
buttonBackgroundHover: "#f5f5f5",
|
|
968
|
+
buttonBorder: "#e5e5e5",
|
|
969
|
+
buttonText: "#171717",
|
|
970
|
+
buttonPrimary: "#22c55e",
|
|
971
|
+
buttonPrimaryHover: "#16a34a",
|
|
972
|
+
// 状态指示
|
|
973
|
+
success: "#22c55e",
|
|
974
|
+
successBackground: "#dcfce7",
|
|
975
|
+
error: "#ef4444",
|
|
976
|
+
errorBackground: "#fee2e2",
|
|
977
|
+
// XML 语法高亮
|
|
978
|
+
xmlTag: "#16a34a",
|
|
979
|
+
// 标签名 - 绿色
|
|
980
|
+
xmlAttribute: "#2563eb",
|
|
981
|
+
// 属性名 - 蓝色
|
|
982
|
+
xmlAttributeValue: "#1e40af",
|
|
983
|
+
// 属性值 - 深蓝
|
|
984
|
+
xmlText: "#171717",
|
|
985
|
+
// 文本内容 - 黑色
|
|
986
|
+
xmlComment: "#737373",
|
|
987
|
+
// 注释 - 灰色
|
|
988
|
+
xmlCdata: "#9333ea",
|
|
989
|
+
// CDATA - 紫色
|
|
990
|
+
xmlDeclaration: "#ea580c",
|
|
991
|
+
// 声明 - 橙色
|
|
992
|
+
xmlBracket: "#737373",
|
|
993
|
+
// 括号 - 灰色
|
|
994
|
+
xmlEquals: "#737373",
|
|
995
|
+
// 等号 - 灰色
|
|
996
|
+
xmlQuote: "#2563eb",
|
|
997
|
+
// 引号 - 蓝色
|
|
998
|
+
// 折叠效果
|
|
999
|
+
collapsedBackground: "#e0f2fe",
|
|
1000
|
+
// 折叠信息背景色 - 浅蓝
|
|
1001
|
+
collapsedBackgroundHover: "#bae6fd",
|
|
1002
|
+
// 折叠信息悬停背景色 - 稍深蓝
|
|
1003
|
+
collapsedText: "#0284c7",
|
|
1004
|
+
// 折叠信息文本色 - 蓝色
|
|
1005
|
+
// 缩进指示线
|
|
1006
|
+
indentLine: "#e5e7eb"
|
|
1007
|
+
// 对齐线 - 灰色
|
|
1008
|
+
}
|
|
1009
|
+
}, Tt = {
|
|
1010
|
+
name: "slack-ochin",
|
|
1011
|
+
colors: {
|
|
1012
|
+
// 背景色
|
|
1013
|
+
background: "#fef5ed",
|
|
1014
|
+
surfaceBackground: "#fef9f3",
|
|
1015
|
+
// 边框色
|
|
1016
|
+
border: "#e9dcc9",
|
|
1017
|
+
// 文本色
|
|
1018
|
+
text: "#3d3c40",
|
|
1019
|
+
textSecondary: "#616061",
|
|
1020
|
+
// 按钮样式
|
|
1021
|
+
buttonBackground: "#fef9f3",
|
|
1022
|
+
buttonBackgroundHover: "#f9f0e5",
|
|
1023
|
+
buttonBorder: "#e9dcc9",
|
|
1024
|
+
buttonText: "#3d3c40",
|
|
1025
|
+
buttonPrimary: "#007a5a",
|
|
1026
|
+
buttonPrimaryHover: "#006644",
|
|
1027
|
+
// 状态指示
|
|
1028
|
+
success: "#007a5a",
|
|
1029
|
+
successBackground: "#d1f4e0",
|
|
1030
|
+
error: "#e01e5a",
|
|
1031
|
+
errorBackground: "#ffdbea",
|
|
1032
|
+
// XML 语法高亮
|
|
1033
|
+
xmlTag: "#007a5a",
|
|
1034
|
+
// 标签名 - 绿色
|
|
1035
|
+
xmlAttribute: "#1264a3",
|
|
1036
|
+
// 属性名 - 蓝色
|
|
1037
|
+
xmlAttributeValue: "#0b4c8c",
|
|
1038
|
+
// 属性值 - 深蓝
|
|
1039
|
+
xmlText: "#3d3c40",
|
|
1040
|
+
// 文本内容 - 黑色
|
|
1041
|
+
xmlComment: "#616061",
|
|
1042
|
+
// 注释 - 灰色
|
|
1043
|
+
xmlCdata: "#8b2eff",
|
|
1044
|
+
// CDATA - 紫色
|
|
1045
|
+
xmlDeclaration: "#e8912d",
|
|
1046
|
+
// 声明 - 橙色
|
|
1047
|
+
xmlBracket: "#616061",
|
|
1048
|
+
// 括号 - 灰色
|
|
1049
|
+
xmlEquals: "#616061",
|
|
1050
|
+
// 等号 - 灰色
|
|
1051
|
+
xmlQuote: "#1264a3",
|
|
1052
|
+
// 引号 - 蓝色
|
|
1053
|
+
// 折叠效果
|
|
1054
|
+
collapsedBackground: "#ffe8d6",
|
|
1055
|
+
// 折叠信息背景色 - 浅橙
|
|
1056
|
+
collapsedBackgroundHover: "#ffd4b0",
|
|
1057
|
+
// 折叠信息悬停背景色 - 稍深橙
|
|
1058
|
+
collapsedText: "#d73502",
|
|
1059
|
+
// 折叠信息文本色 - 橙红色
|
|
1060
|
+
// 缩进指示线
|
|
1061
|
+
indentLine: "#e8d5b7"
|
|
1062
|
+
// 对齐线 - 米色
|
|
1063
|
+
}
|
|
1064
|
+
}, Ae = {
|
|
1065
|
+
"github-light": $t,
|
|
1066
|
+
"github-dark": Bt,
|
|
1067
|
+
"min-light": wt,
|
|
1068
|
+
"slack-ochin": Tt
|
|
1069
|
+
}, Dt = (s) => Ae[s] || Ae["github-light"], Et = {
|
|
1070
|
+
ignoreAttributes: !1,
|
|
1071
|
+
// 保留属性
|
|
1072
|
+
attributeNamePrefix: "@_",
|
|
1073
|
+
// 属性前缀
|
|
1074
|
+
textNodeName: "#text",
|
|
1075
|
+
// 文本节点名
|
|
1076
|
+
ignoreDeclaration: !1,
|
|
1077
|
+
// 保留 XML 声明
|
|
1078
|
+
commentPropName: "#comment",
|
|
1079
|
+
// 注释属性名
|
|
1080
|
+
cdataPropName: "__cdata",
|
|
1081
|
+
// CDATA 属性名
|
|
1082
|
+
preserveOrder: !0,
|
|
1083
|
+
// 保留顺序(使用数组结构以保留注释位置)
|
|
1084
|
+
parseAttributeValue: !1,
|
|
1085
|
+
// 不解析属性值(保持字符串)
|
|
1086
|
+
trimValues: !1,
|
|
1087
|
+
// 不去除首尾空白(保留原始空白字符)
|
|
1088
|
+
parseTagValue: !1,
|
|
1089
|
+
// 不解析标签值(保持字符串)
|
|
1090
|
+
processEntities: !1,
|
|
1091
|
+
// 不处理实体(保留原始实体引用)
|
|
1092
|
+
htmlEntities: !1,
|
|
1093
|
+
// 不是 HTML 实体
|
|
1094
|
+
ignoreNameSpace: !1,
|
|
1095
|
+
// 保留命名空间
|
|
1096
|
+
allowBooleanAttributes: !0,
|
|
1097
|
+
// 允许布尔属性
|
|
1098
|
+
unpairedTags: [],
|
|
1099
|
+
// 未配对的标签
|
|
1100
|
+
stopNodes: [],
|
|
1101
|
+
// 停止解析的节点
|
|
1102
|
+
alwaysCreateTextNode: !1
|
|
1103
|
+
// 仅在有文本时创建文本节点
|
|
1104
|
+
}, Vt = {
|
|
1105
|
+
ignoreAttributes: !1,
|
|
1106
|
+
attributeNamePrefix: "@_",
|
|
1107
|
+
textNodeName: "#text",
|
|
1108
|
+
format: !0,
|
|
1109
|
+
// 格式化输出
|
|
1110
|
+
indentBy: " ",
|
|
1111
|
+
// 缩进 2 空格
|
|
1112
|
+
suppressEmptyNode: !1,
|
|
1113
|
+
// 不抑制空节点
|
|
1114
|
+
suppressBooleanAttributes: !1,
|
|
1115
|
+
suppressUnpairedNode: !1
|
|
1116
|
+
}, Wt = (s) => {
|
|
1117
|
+
const m = /<!\[CDATA\[([\s\S]*?)\]\]>/g, c = [];
|
|
1118
|
+
let f;
|
|
1119
|
+
for (; (f = m.exec(s)) !== null; )
|
|
1120
|
+
c.push({
|
|
1121
|
+
start: f.index,
|
|
1122
|
+
end: f.index + f[0].length
|
|
1123
|
+
});
|
|
1124
|
+
const v = (b) => c.some((X) => b >= X.start && b < X.end), o = /&([a-zA-Z0-9#]+);/g, y = ["lt", "gt", "amp", "quot", "apos"];
|
|
1125
|
+
let V, B = 1, x = 0;
|
|
1126
|
+
for (; (V = o.exec(s)) !== null; ) {
|
|
1127
|
+
const b = V[1], X = V.index;
|
|
1128
|
+
if (v(X))
|
|
1129
|
+
continue;
|
|
1130
|
+
const P = s.substring(x, X);
|
|
1131
|
+
if (B += (P.match(/\n/g) || []).length, x = X, b.startsWith("#")) {
|
|
1132
|
+
const S = b.substring(1);
|
|
1133
|
+
if (S.startsWith("x") || S.startsWith("X")) {
|
|
1134
|
+
const N = S.substring(1);
|
|
1135
|
+
if (!/^[0-9a-fA-F]+$/.test(N))
|
|
1136
|
+
return {
|
|
1137
|
+
valid: !1,
|
|
1138
|
+
error: `Line ${B}: Invalid hexadecimal character reference '&${b};'`
|
|
1139
|
+
};
|
|
1140
|
+
} else if (!/^[0-9]+$/.test(S))
|
|
1141
|
+
return {
|
|
1142
|
+
valid: !1,
|
|
1143
|
+
error: `Line ${B}: Invalid numeric character reference '&${b};'`
|
|
1144
|
+
};
|
|
1145
|
+
continue;
|
|
1146
|
+
}
|
|
1147
|
+
if (!y.includes(b))
|
|
1148
|
+
return {
|
|
1149
|
+
valid: !1,
|
|
1150
|
+
error: `Line ${B}: Invalid entity reference '&${b};'. Valid predefined entities are: < > & " '`
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
return { valid: !0 };
|
|
1154
|
+
}, Kt = (s) => {
|
|
1155
|
+
try {
|
|
1156
|
+
const m = Oe.validate(s, {
|
|
1157
|
+
allowBooleanAttributes: !0
|
|
1158
|
+
});
|
|
1159
|
+
if (m !== !0)
|
|
1160
|
+
return {
|
|
1161
|
+
valid: !1,
|
|
1162
|
+
error: `Line ${m.err.line}: ${m.err.msg}`
|
|
1163
|
+
};
|
|
1164
|
+
const c = Wt(s);
|
|
1165
|
+
return c.valid ? { valid: !0 } : c;
|
|
1166
|
+
} catch (m) {
|
|
1167
|
+
return {
|
|
1168
|
+
valid: !1,
|
|
1169
|
+
error: m instanceof Error ? m.message : "Unknown validation error"
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
}, ge = (s, m) => {
|
|
1173
|
+
try {
|
|
1174
|
+
return new Pe({
|
|
1175
|
+
...Et,
|
|
1176
|
+
...m
|
|
1177
|
+
}).parse(s);
|
|
1178
|
+
} catch (c) {
|
|
1179
|
+
throw new Error(
|
|
1180
|
+
`XML 解析失败: ${c instanceof Error ? c.message : "Unknown error"}`
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
}, ke = (s, m) => {
|
|
1184
|
+
try {
|
|
1185
|
+
let f = new Ne({
|
|
1186
|
+
...Vt,
|
|
1187
|
+
format: m?.format ?? !0,
|
|
1188
|
+
indentBy: m?.indentBy ?? " "
|
|
1189
|
+
}).build(s);
|
|
1190
|
+
return m?.showDeclaration !== !1 && !f.startsWith("<?xml") && (f = `<?xml version="1.0" encoding="UTF-8"?>
|
|
1191
|
+
` + f), f;
|
|
1192
|
+
} catch (c) {
|
|
1193
|
+
throw new Error(
|
|
1194
|
+
`XML 构建失败: ${c instanceof Error ? c.message : "Unknown error"}`
|
|
1195
|
+
);
|
|
1196
|
+
}
|
|
1197
|
+
}, Xt = (s, m) => Array.isArray(s) ? ce(s, { format: !1, originalXml: m }) : ke(s, { format: !1, showDeclaration: !1 }), Ot = (s, m) => {
|
|
1198
|
+
const c = ge(s);
|
|
1199
|
+
return Array.isArray(c) ? ce(c, {
|
|
1200
|
+
indent: m?.indentBy || " ",
|
|
1201
|
+
originalXml: s
|
|
1202
|
+
}) : ke(c, m);
|
|
1203
|
+
}, Ht = (s) => {
|
|
1204
|
+
const m = s.match(/<([a-zA-Z0-9_-]+)[\s>]/);
|
|
1205
|
+
return m ? m[1] : null;
|
|
1206
|
+
}, zt = (s) => {
|
|
1207
|
+
let m = 0;
|
|
1208
|
+
const c = (f) => {
|
|
1209
|
+
f === null || typeof f != "object" || (m++, Array.isArray(f) ? f.forEach(c) : Object.values(f).forEach(c));
|
|
1210
|
+
};
|
|
1211
|
+
return c(s), m;
|
|
1212
|
+
}, Zt = (s) => !s || typeof s != "object" ? !1 : Object.keys(s).some((m) => m.startsWith("@_")), Jt = (s) => {
|
|
1213
|
+
if (!s || typeof s != "object") return {};
|
|
1214
|
+
const m = {};
|
|
1215
|
+
return Object.keys(s).forEach((c) => {
|
|
1216
|
+
if (c.startsWith("@_")) {
|
|
1217
|
+
const f = c.substring(2);
|
|
1218
|
+
m[f] = s[c];
|
|
1219
|
+
}
|
|
1220
|
+
}), m;
|
|
1221
|
+
}, Gt = (s) => !s || typeof s != "object" ? typeof s == "string" ? s : null : s["#text"] || null, Yt = (s) => {
|
|
1222
|
+
if (s == null) return !0;
|
|
1223
|
+
if (typeof s != "object") return !1;
|
|
1224
|
+
const m = Object.keys(s);
|
|
1225
|
+
return m.length === 0 || m.length === 1 && m[0].startsWith("@_");
|
|
1226
|
+
}, Pt = (s, m) => {
|
|
1227
|
+
const c = Te(m), f = /* @__PURE__ */ new Map(), v = (o) => {
|
|
1228
|
+
for (const y of o) {
|
|
1229
|
+
const V = Object.keys(y).find(
|
|
1230
|
+
(b) => !b.startsWith(":") && !b.startsWith("#") && !b.startsWith("__") && !b.startsWith("?")
|
|
1231
|
+
);
|
|
1232
|
+
if (!V) continue;
|
|
1233
|
+
const B = f.get(V) ?? 0;
|
|
1234
|
+
f.set(V, B + 1), y[":selfClosing"] = c.get(V)?.[B] ?? !1;
|
|
1235
|
+
const x = y[V];
|
|
1236
|
+
Array.isArray(x) && x.length > 0 && v(x);
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
v(s);
|
|
1240
|
+
}, Nt = (s) => {
|
|
1241
|
+
const m = /* @__PURE__ */ new Set(), c = /<([a-zA-Z0-9_-]+)(?:\s[^>]*)?\s*\/>/g;
|
|
1242
|
+
let f;
|
|
1243
|
+
for (; (f = c.exec(s)) !== null; )
|
|
1244
|
+
m.add(f[1]);
|
|
1245
|
+
return m;
|
|
1246
|
+
}, Te = (s) => {
|
|
1247
|
+
const m = /* @__PURE__ */ new Map();
|
|
1248
|
+
let c = 0;
|
|
1249
|
+
for (; c < s.length; ) {
|
|
1250
|
+
if (s.startsWith("<!--", c)) {
|
|
1251
|
+
const f = s.indexOf("-->", c);
|
|
1252
|
+
c = f !== -1 ? f + 3 : s.length;
|
|
1253
|
+
continue;
|
|
1254
|
+
}
|
|
1255
|
+
if (s.startsWith("<![CDATA[", c)) {
|
|
1256
|
+
const f = s.indexOf("]]>", c);
|
|
1257
|
+
c = f !== -1 ? f + 3 : s.length;
|
|
1258
|
+
continue;
|
|
1259
|
+
}
|
|
1260
|
+
if (s.startsWith("<?", c)) {
|
|
1261
|
+
const f = s.indexOf("?>", c);
|
|
1262
|
+
c = f !== -1 ? f + 2 : s.length;
|
|
1263
|
+
continue;
|
|
1264
|
+
}
|
|
1265
|
+
if (s.startsWith("</", c)) {
|
|
1266
|
+
const f = s.indexOf(">", c);
|
|
1267
|
+
c = f !== -1 ? f + 1 : s.length;
|
|
1268
|
+
continue;
|
|
1269
|
+
}
|
|
1270
|
+
if (s[c] === "<") {
|
|
1271
|
+
const f = s.slice(c + 1).match(/^([a-zA-Z_][a-zA-Z0-9_:.-]*)/);
|
|
1272
|
+
if (f) {
|
|
1273
|
+
const v = f[1];
|
|
1274
|
+
let o = c + 1 + v.length, y = !1, V = "";
|
|
1275
|
+
for (; o < s.length; ) {
|
|
1276
|
+
const B = s[o];
|
|
1277
|
+
if (y)
|
|
1278
|
+
B === V && (y = !1);
|
|
1279
|
+
else if (B === '"' || B === "'")
|
|
1280
|
+
y = !0, V = B;
|
|
1281
|
+
else if (B === ">") {
|
|
1282
|
+
let x = o - 1;
|
|
1283
|
+
for (; x > c && (s[x] === " " || s[x] === " " || s[x] === `
|
|
1284
|
+
` || s[x] === "\r"); )
|
|
1285
|
+
x--;
|
|
1286
|
+
const b = s[x] === "/";
|
|
1287
|
+
m.has(v) || m.set(v, []), m.get(v).push(b), c = o + 1;
|
|
1288
|
+
break;
|
|
1289
|
+
}
|
|
1290
|
+
o++;
|
|
1291
|
+
}
|
|
1292
|
+
if (o >= s.length) break;
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
c++;
|
|
1297
|
+
}
|
|
1298
|
+
return m;
|
|
1299
|
+
}, ce = (s, m = {}) => {
|
|
1300
|
+
const c = m.indent !== void 0 ? m.indent : " ", f = m.level || 0, v = m.format !== !1, o = v ? c.repeat(f) : "", y = v ? `
|
|
1301
|
+
` : "";
|
|
1302
|
+
let V = m.selfClosingTags, B = m.selfClosingOccurrences, x = m.selfClosingCounters;
|
|
1303
|
+
f === 0 && m.originalXml && (B = Te(m.originalXml), x = /* @__PURE__ */ new Map());
|
|
1304
|
+
let b = "";
|
|
1305
|
+
for (const X of s) {
|
|
1306
|
+
if (X["?xml"]) {
|
|
1307
|
+
const T = X[":@"] || {}, R = Object.entries(T).map(([G, ue]) => `${G.startsWith("@_") ? G.substring(2) : G}="${ue}"`).join(" ");
|
|
1308
|
+
b += `<?xml ${R}?>${y}`;
|
|
1309
|
+
continue;
|
|
1310
|
+
}
|
|
1311
|
+
if (X["#comment"]) {
|
|
1312
|
+
const T = X["#comment"];
|
|
1313
|
+
if (Array.isArray(T) && T.length > 0) {
|
|
1314
|
+
const R = T[0]["#text"] || T[0];
|
|
1315
|
+
b += `${o}<!--${R}-->${y}`;
|
|
1316
|
+
}
|
|
1317
|
+
continue;
|
|
1318
|
+
}
|
|
1319
|
+
const P = Object.keys(X).find((T) => !T.startsWith(":") && !T.startsWith("#") && !T.startsWith("__"));
|
|
1320
|
+
if (!P) continue;
|
|
1321
|
+
let S = 0;
|
|
1322
|
+
B && x && (S = x.get(P) ?? 0, x.set(P, S + 1));
|
|
1323
|
+
const N = X[P], z = X[":@"] || {}, Q = Object.entries(z).map(([T, R]) => `${T.startsWith("@_") ? T.substring(2) : T}="${R}"`).join(" "), U = Q ? " " + Q : "";
|
|
1324
|
+
if (!Array.isArray(N) || N.length === 0) {
|
|
1325
|
+
let T;
|
|
1326
|
+
B ? T = B.get(P)?.[S] ?? !1 : T = !!(V && V.has(P)), T ? b += `${o}<${P}${U}/>${y}` : b += `${o}<${P}${U}></${P}>${y}`;
|
|
1327
|
+
continue;
|
|
1328
|
+
}
|
|
1329
|
+
const Y = N.length === 1 && N[0]["#text"] !== void 0, K = Y ? N[0]["#text"] : "", J = N.some((T) => T.__cdata), te = Y && K === "";
|
|
1330
|
+
if (J) {
|
|
1331
|
+
const T = N.find((R) => R.__cdata);
|
|
1332
|
+
if (T) {
|
|
1333
|
+
const R = T.__cdata[0]["#text"] || "";
|
|
1334
|
+
b += `${o}<${P}${U}><![CDATA[${R}]]></${P}>${y}`;
|
|
1335
|
+
}
|
|
1336
|
+
} else te ? b += `${o}<${P}${U}></${P}>${y}` : Y ? b += `${o}<${P}${U}>${K}</${P}>${y}` : (b += `${o}<${P}${U}>${y}`, b += ce(N, { indent: c, level: f + 1, format: v, selfClosingTags: V, selfClosingOccurrences: B, selfClosingCounters: x }), b += `${o}</${P}>${y}`);
|
|
1337
|
+
}
|
|
1338
|
+
return b;
|
|
1339
|
+
}, Rt = { class: "xml-format__content" }, jt = {
|
|
1340
|
+
key: 0,
|
|
1341
|
+
class: "xml-format__error"
|
|
1342
|
+
}, qt = {
|
|
1343
|
+
key: 1,
|
|
1344
|
+
class: "xml-format__error"
|
|
1345
|
+
}, It = {
|
|
1346
|
+
key: 2,
|
|
1347
|
+
class: "xml-format__viewer"
|
|
1348
|
+
}, Lt = /* @__PURE__ */ Ce({
|
|
1349
|
+
__name: "index",
|
|
1350
|
+
props: {
|
|
1351
|
+
modelValue: { default: "" },
|
|
1352
|
+
readonly: { type: Boolean, default: !1 },
|
|
1353
|
+
maxDepth: { default: 10 },
|
|
1354
|
+
theme: { default: "github-light" },
|
|
1355
|
+
showComments: { type: Boolean, default: !0 },
|
|
1356
|
+
showCdata: { type: Boolean, default: !0 },
|
|
1357
|
+
preserveWhitespace: { type: Boolean, default: !1 }
|
|
1358
|
+
},
|
|
1359
|
+
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
1360
|
+
setup(s, { expose: m, emit: c }) {
|
|
1361
|
+
$e((l) => ({
|
|
1362
|
+
"592bc0b6": U.value.colors.background,
|
|
1363
|
+
"6efa1296": U.value.colors.text,
|
|
1364
|
+
"470e5180": U.value.colors.error,
|
|
1365
|
+
"43e0a2ce": U.value.colors.errorBackground
|
|
1366
|
+
}));
|
|
1367
|
+
const f = s, v = c, o = q(null), y = q(""), V = q(/* @__PURE__ */ new Set()), B = q(null), x = q(""), b = q(""), X = q(/* @__PURE__ */ new Set()), P = q(!1), S = L(() => y.value === ""), N = (l) => {
|
|
1368
|
+
if (!l || typeof l != "object")
|
|
1369
|
+
return l;
|
|
1370
|
+
if (Array.isArray(l)) {
|
|
1371
|
+
const t = l.map((k) => N(k)), a = [], h = [];
|
|
1372
|
+
t.forEach((k, O) => {
|
|
1373
|
+
if (!k || typeof k != "object") {
|
|
1374
|
+
h.push({ item: k, originalIndex: O });
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const W = Object.keys(k), I = W.find((D) => !D.startsWith("?") && !D.startsWith(":") && !D.startsWith("#") && !D.startsWith("__")) || W[0] || "";
|
|
1378
|
+
I.startsWith("#") || I.startsWith("__") ? h.push({ item: k, originalIndex: O }) : I.startsWith("?") ? h.push({ item: k, originalIndex: O }) : a.push({ item: k, originalIndex: O });
|
|
1379
|
+
}), a.sort((k, O) => {
|
|
1380
|
+
const W = (ee) => {
|
|
1381
|
+
const H = Object.keys(ee);
|
|
1382
|
+
for (const e of H)
|
|
1383
|
+
if (!e.startsWith("?") && !e.startsWith(":") && !e.startsWith("#") && !e.startsWith("__"))
|
|
1384
|
+
return e;
|
|
1385
|
+
return H[0] || "";
|
|
1386
|
+
}, I = W(k.item), D = W(O.item);
|
|
1387
|
+
return I.localeCompare(D);
|
|
1388
|
+
});
|
|
1389
|
+
const p = [];
|
|
1390
|
+
let C = 0;
|
|
1391
|
+
for (let k = 0; k < t.length; k++) {
|
|
1392
|
+
const O = h.find((W) => W.originalIndex === k);
|
|
1393
|
+
O ? p.push(O.item) : C < a.length && (p.push(a[C].item), C++);
|
|
1394
|
+
}
|
|
1395
|
+
return p;
|
|
1396
|
+
}
|
|
1397
|
+
const d = {}, g = Object.keys(l).sort((t, a) => {
|
|
1398
|
+
const h = t.startsWith("?") || t.startsWith(":") || t.startsWith("#") || t.startsWith("__"), p = a.startsWith("?") || a.startsWith(":") || a.startsWith("#") || a.startsWith("__"), C = {
|
|
1399
|
+
"?xml": 0,
|
|
1400
|
+
":@": 1,
|
|
1401
|
+
"#text": 2,
|
|
1402
|
+
__cdata: 3,
|
|
1403
|
+
"#cdata": 3,
|
|
1404
|
+
"#comment": 4
|
|
1405
|
+
};
|
|
1406
|
+
if (h && p) {
|
|
1407
|
+
const k = C[t] ?? 99, O = C[a] ?? 99;
|
|
1408
|
+
return k - O;
|
|
1409
|
+
} else return h ? -1 : p ? 1 : t.localeCompare(a);
|
|
1410
|
+
});
|
|
1411
|
+
for (const t of g) {
|
|
1412
|
+
const a = l[t];
|
|
1413
|
+
if (t === ":@" && a && typeof a == "object" && !Array.isArray(a)) {
|
|
1414
|
+
const h = {}, p = Object.keys(a).sort();
|
|
1415
|
+
for (const C of p)
|
|
1416
|
+
h[C] = a[C];
|
|
1417
|
+
d[t] = h;
|
|
1418
|
+
} else
|
|
1419
|
+
d[t] = N(a);
|
|
1420
|
+
}
|
|
1421
|
+
return d;
|
|
1422
|
+
}, z = L(() => {
|
|
1423
|
+
const l = B.value !== null ? B.value : o.value;
|
|
1424
|
+
return !l || !P.value ? l : N(l);
|
|
1425
|
+
}), Q = L(() => x.value ? null : z.value), U = L(() => Dt(f.theme)), Y = L(() => {
|
|
1426
|
+
const l = Q.value;
|
|
1427
|
+
return !l || !Array.isArray(l) ? [] : l.map((d, g) => ({ node: d, originalIndex: g })).filter((d) => !d.node["?xml"]);
|
|
1428
|
+
}), K = L(() => {
|
|
1429
|
+
const l = Q.value;
|
|
1430
|
+
if (!l || !Array.isArray(l)) return null;
|
|
1431
|
+
const d = l.find((a) => a["?xml"]);
|
|
1432
|
+
if (!d || !d[":@"]) return null;
|
|
1433
|
+
const g = d[":@"], t = [];
|
|
1434
|
+
return g["@_version"] && t.push(`version="${g["@_version"]}"`), g["@_encoding"] && t.push(`encoding="${g["@_encoding"]}"`), g["@_standalone"] && t.push(`standalone="${g["@_standalone"]}"`), t.length > 0 ? `<?xml ${t.join(" ")}?>` : null;
|
|
1435
|
+
}), J = L(() => Y.value), te = (l) => {
|
|
1436
|
+
if (!l || !l.trim()) {
|
|
1437
|
+
y.value = "", o.value = null, b.value = "", B.value = null, x.value = "";
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
try {
|
|
1441
|
+
const d = Kt(l);
|
|
1442
|
+
if (!d.valid) {
|
|
1443
|
+
y.value = d.error || "Invalid XML", o.value = null, b.value = "", X.value = /* @__PURE__ */ new Set();
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
b.value = l, X.value = Nt(l), o.value = ge(l), Array.isArray(o.value) && Pt(o.value, l), y.value = "", B.value = null, x.value = "", ne(() => {
|
|
1447
|
+
R();
|
|
1448
|
+
});
|
|
1449
|
+
} catch (d) {
|
|
1450
|
+
y.value = d instanceof Error ? d.message : "Unknown parse error", o.value = null, b.value = "", B.value = null, x.value = "";
|
|
1451
|
+
}
|
|
1452
|
+
}, T = (l) => {
|
|
1453
|
+
V.value.has(l) ? V.value.delete(l) : V.value.add(l);
|
|
1454
|
+
}, R = () => {
|
|
1455
|
+
const l = /* @__PURE__ */ new Set(), d = (g, t = "") => {
|
|
1456
|
+
Array.isArray(g) && g.forEach((a, h) => {
|
|
1457
|
+
const p = Object.keys(a).find((O) => !O.startsWith(":") && !O.startsWith("#"));
|
|
1458
|
+
if (!p) return;
|
|
1459
|
+
const C = t ? `${t}.${p}[${h}]` : `${p}[${h}]`;
|
|
1460
|
+
l.add(C);
|
|
1461
|
+
const k = a[p];
|
|
1462
|
+
Array.isArray(k) && d(k, C + "." + p);
|
|
1463
|
+
});
|
|
1464
|
+
};
|
|
1465
|
+
Y.value.forEach(({ node: g, originalIndex: t }) => {
|
|
1466
|
+
const a = Object.keys(g).find((h) => !h.startsWith(":") && !h.startsWith("#"));
|
|
1467
|
+
if (a) {
|
|
1468
|
+
const h = `${a}[${t}]`;
|
|
1469
|
+
l.add(h);
|
|
1470
|
+
const p = g[a];
|
|
1471
|
+
Array.isArray(p) && d(p, h + "." + a);
|
|
1472
|
+
}
|
|
1473
|
+
}), V.value = l, v("expand-all");
|
|
1474
|
+
}, G = () => {
|
|
1475
|
+
V.value.clear(), v("collapse-all");
|
|
1476
|
+
}, ue = async () => {
|
|
1477
|
+
if (S.value)
|
|
1478
|
+
try {
|
|
1479
|
+
const l = Q.value || o.value;
|
|
1480
|
+
if (!l) return;
|
|
1481
|
+
const d = Array.isArray(l) ? ce(l, { indent: " ", originalXml: b.value || void 0 }) : ke(l, { format: !0, indentBy: " " });
|
|
1482
|
+
await navigator.clipboard.writeText(d), v("copy-success", d);
|
|
1483
|
+
} catch (l) {
|
|
1484
|
+
const d = l instanceof Error ? l : new Error("Copy failed");
|
|
1485
|
+
v("copy-error", d), console.error("Failed to copy XML:", l);
|
|
1486
|
+
}
|
|
1487
|
+
}, de = () => {
|
|
1488
|
+
if (!(!S.value || !o.value))
|
|
1489
|
+
try {
|
|
1490
|
+
const l = Xt(o.value, f.modelValue);
|
|
1491
|
+
v("update:modelValue", l), v("compress", l);
|
|
1492
|
+
} catch (l) {
|
|
1493
|
+
console.error("Failed to compress XML:", l);
|
|
1494
|
+
}
|
|
1495
|
+
}, le = () => {
|
|
1496
|
+
if (S.value)
|
|
1497
|
+
try {
|
|
1498
|
+
const l = Ot(f.modelValue, {
|
|
1499
|
+
format: !0,
|
|
1500
|
+
indentBy: " "
|
|
1501
|
+
});
|
|
1502
|
+
v("update:modelValue", l), v("format", l);
|
|
1503
|
+
} catch (l) {
|
|
1504
|
+
console.error("Failed to format XML:", l);
|
|
1505
|
+
}
|
|
1506
|
+
}, ye = (l) => {
|
|
1507
|
+
if (!l || !l.expression.trim()) {
|
|
1508
|
+
Z();
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
if (!o.value || !b.value) {
|
|
1512
|
+
x.value = "No valid XML data to filter";
|
|
1513
|
+
return;
|
|
1514
|
+
}
|
|
1515
|
+
try {
|
|
1516
|
+
const g = new Ke().parseFromString(b.value, "text/xml"), t = We.select(l.expression, g);
|
|
1517
|
+
if (!t || Array.isArray(t) && t.length === 0) {
|
|
1518
|
+
B.value = [], x.value = "";
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
const a = new Xe();
|
|
1522
|
+
let h = "";
|
|
1523
|
+
Array.isArray(t) ? (h = `<result>
|
|
1524
|
+
`, t.forEach((p) => {
|
|
1525
|
+
p.nodeType === 1 ? h += " " + a.serializeToString(p) + `
|
|
1526
|
+
` : p.nodeType === 2 ? h += ` <attribute name="${p.name}" value="${p.value}"/>
|
|
1527
|
+
` : p.nodeType === 3 && (h += ` <text>${p.nodeValue}</text>
|
|
1528
|
+
`);
|
|
1529
|
+
}), h += "</result>") : h = a.serializeToString(t), B.value = ge(h), x.value = "", ne(() => {
|
|
1530
|
+
R();
|
|
1531
|
+
});
|
|
1532
|
+
} catch (d) {
|
|
1533
|
+
x.value = d instanceof Error ? d.message : "Filter execution error", B.value = null;
|
|
1534
|
+
}
|
|
1535
|
+
}, Z = () => {
|
|
1536
|
+
B.value = null, x.value = "", ne(() => {
|
|
1537
|
+
R();
|
|
1538
|
+
});
|
|
1539
|
+
}, me = () => {
|
|
1540
|
+
P.value = !0, ne(() => {
|
|
1541
|
+
R();
|
|
1542
|
+
});
|
|
1543
|
+
}, he = () => {
|
|
1544
|
+
P.value = !1, ne(() => {
|
|
1545
|
+
R();
|
|
1546
|
+
});
|
|
1547
|
+
}, fe = async (l) => {
|
|
1548
|
+
try {
|
|
1549
|
+
const d = typeof l == "string" ? l : JSON.stringify(l, null, 2);
|
|
1550
|
+
await navigator.clipboard.writeText(d), v("copy-success", d);
|
|
1551
|
+
} catch (d) {
|
|
1552
|
+
const g = d instanceof Error ? d : new Error("Copy failed");
|
|
1553
|
+
v("copy-error", g), console.error("Failed to copy value:", d);
|
|
1554
|
+
}
|
|
1555
|
+
}, be = (l, d, g) => {
|
|
1556
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
1557
|
+
try {
|
|
1558
|
+
const t = l.split(/\./).filter(Boolean);
|
|
1559
|
+
let a = o.value;
|
|
1560
|
+
for (let p = 0; p < t.length; p++) {
|
|
1561
|
+
const C = t[p], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1562
|
+
if (k) {
|
|
1563
|
+
const O = k[1], W = parseInt(k[2]);
|
|
1564
|
+
if (p === t.length - 1) {
|
|
1565
|
+
if (Array.isArray(a) && a[W]) {
|
|
1566
|
+
const I = a[W];
|
|
1567
|
+
if (I[d]) {
|
|
1568
|
+
const D = I[d];
|
|
1569
|
+
delete I[d], I[g] = D, X.value.has(d) && (X.value.delete(d), X.value.add(g));
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
} else
|
|
1573
|
+
Array.isArray(a) && a[W] && (a = a[W]);
|
|
1574
|
+
} else
|
|
1575
|
+
a[C] && (a = a[C]);
|
|
1576
|
+
}
|
|
1577
|
+
const h = ce(o.value, {
|
|
1578
|
+
indent: " ",
|
|
1579
|
+
originalXml: b.value || void 0
|
|
1580
|
+
});
|
|
1581
|
+
v("update:modelValue", h);
|
|
1582
|
+
} catch (t) {
|
|
1583
|
+
console.error("Failed to update tag name:", t);
|
|
1584
|
+
}
|
|
1585
|
+
}, oe = (l, d, g) => {
|
|
1586
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
1587
|
+
try {
|
|
1588
|
+
const t = l.split(/\./).filter(Boolean);
|
|
1589
|
+
let a = o.value;
|
|
1590
|
+
for (let p = 0; p < t.length; p++) {
|
|
1591
|
+
const C = t[p], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1592
|
+
if (k) {
|
|
1593
|
+
const O = k[1], W = parseInt(k[2]);
|
|
1594
|
+
if (p === t.length - 1) {
|
|
1595
|
+
if (Array.isArray(a) && a[W]) {
|
|
1596
|
+
const D = a[W][":@"];
|
|
1597
|
+
if (D && D[`@_${d}`] !== void 0) {
|
|
1598
|
+
const ee = D[`@_${d}`];
|
|
1599
|
+
delete D[`@_${d}`], D[`@_${g}`] = ee;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
} else
|
|
1603
|
+
Array.isArray(a) && a[W] && (a = a[W]);
|
|
1604
|
+
} else
|
|
1605
|
+
a[C] && (a = a[C]);
|
|
1606
|
+
}
|
|
1607
|
+
const h = ce(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1608
|
+
v("update:modelValue", h);
|
|
1609
|
+
} catch (t) {
|
|
1610
|
+
console.error("Failed to update attribute name:", t);
|
|
1611
|
+
}
|
|
1612
|
+
}, _e = (l, d, g) => {
|
|
1613
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
1614
|
+
try {
|
|
1615
|
+
const t = l.split(/\./).filter(Boolean);
|
|
1616
|
+
let a = o.value;
|
|
1617
|
+
for (let p = 0; p < t.length; p++) {
|
|
1618
|
+
const C = t[p], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1619
|
+
if (k) {
|
|
1620
|
+
const O = k[1], W = parseInt(k[2]);
|
|
1621
|
+
if (p === t.length - 1) {
|
|
1622
|
+
if (Array.isArray(a) && a[W]) {
|
|
1623
|
+
const D = a[W][":@"];
|
|
1624
|
+
D && D[`@_${d}`] !== void 0 && (D[`@_${d}`] = g);
|
|
1625
|
+
}
|
|
1626
|
+
} else
|
|
1627
|
+
Array.isArray(a) && a[W] && (a = a[W]);
|
|
1628
|
+
} else
|
|
1629
|
+
a[C] && (a = a[C]);
|
|
1630
|
+
}
|
|
1631
|
+
const h = ce(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1632
|
+
v("update:modelValue", h);
|
|
1633
|
+
} catch (t) {
|
|
1634
|
+
console.error("Failed to update attribute value:", t);
|
|
1635
|
+
}
|
|
1636
|
+
}, xe = (l, d) => {
|
|
1637
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
1638
|
+
try {
|
|
1639
|
+
const g = l.split(/\./).filter(Boolean);
|
|
1640
|
+
let t = o.value, a = "";
|
|
1641
|
+
for (let p = 0; p < g.length; p++) {
|
|
1642
|
+
const C = g[p], k = C.match(/^(.+?)\[(\d+)\]$/);
|
|
1643
|
+
if (k) {
|
|
1644
|
+
const O = k[1], W = parseInt(k[2]);
|
|
1645
|
+
if (p === g.length - 1) {
|
|
1646
|
+
if (Array.isArray(t) && t[W]) {
|
|
1647
|
+
const I = t[W];
|
|
1648
|
+
if (a = Object.keys(I).find((D) => !D.startsWith(":") && !D.startsWith("#")) || "", a && Array.isArray(I[a])) {
|
|
1649
|
+
const D = I[a], ee = D.findIndex((H) => H["#text"] !== void 0);
|
|
1650
|
+
ee !== -1 ? D[ee]["#text"] = d : D.push({ "#text": d });
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
} else
|
|
1654
|
+
Array.isArray(t) && t[W] && (t = t[W]);
|
|
1655
|
+
} else
|
|
1656
|
+
t[C] && (t = t[C]);
|
|
1657
|
+
}
|
|
1658
|
+
const h = ce(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1659
|
+
v("update:modelValue", h);
|
|
1660
|
+
} catch (g) {
|
|
1661
|
+
console.error("Failed to update text content:", g);
|
|
1662
|
+
}
|
|
1663
|
+
}, ae = (l, d) => {
|
|
1664
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
1665
|
+
try {
|
|
1666
|
+
const g = l.split(/\./).filter(Boolean);
|
|
1667
|
+
let t = o.value;
|
|
1668
|
+
for (let h = 0; h < g.length; h++) {
|
|
1669
|
+
const p = g[h], C = p.match(/^(.+?)\[(\d+)\]$/);
|
|
1670
|
+
if (C) {
|
|
1671
|
+
const k = C[1], O = parseInt(C[2]);
|
|
1672
|
+
if (h === g.length - 1) {
|
|
1673
|
+
if (Array.isArray(t) && t[O]) {
|
|
1674
|
+
const W = t[O], I = Object.keys(W).find((D) => !D.startsWith(":") && !D.startsWith("#"));
|
|
1675
|
+
if (I && Array.isArray(W[I])) {
|
|
1676
|
+
const D = W[I], ee = D.findIndex((H) => H.__cdata !== void 0);
|
|
1677
|
+
if (ee !== -1) {
|
|
1678
|
+
const H = D[ee];
|
|
1679
|
+
Array.isArray(H.__cdata) && H.__cdata[0] && (H.__cdata[0]["#text"] = d);
|
|
1680
|
+
} else
|
|
1681
|
+
D.push({
|
|
1682
|
+
__cdata: [{ "#text": d }]
|
|
1683
|
+
});
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
} else
|
|
1687
|
+
Array.isArray(t) && t[O] && (t = t[O]);
|
|
1688
|
+
} else
|
|
1689
|
+
t[p] && (t = t[p]);
|
|
1690
|
+
}
|
|
1691
|
+
const a = ce(o.value, { indent: " ", originalXml: b.value || void 0 });
|
|
1692
|
+
v("update:modelValue", a);
|
|
1693
|
+
} catch (g) {
|
|
1694
|
+
console.error("Failed to update CDATA content:", g);
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
return Ee(() => f.modelValue, (l) => {
|
|
1698
|
+
te(l);
|
|
1699
|
+
}, { immediate: !0 }), m({
|
|
1700
|
+
// 核心操作方法
|
|
1701
|
+
copyXml: ue,
|
|
1702
|
+
compressSource: de,
|
|
1703
|
+
formatSource: le,
|
|
1704
|
+
expandAll: R,
|
|
1705
|
+
collapseAll: G,
|
|
1706
|
+
toggleExpand: T,
|
|
1707
|
+
// 过滤相关方法
|
|
1708
|
+
filter: ye,
|
|
1709
|
+
clearFilter: Z,
|
|
1710
|
+
// 排序相关方法
|
|
1711
|
+
sort: me,
|
|
1712
|
+
clearSort: he,
|
|
1713
|
+
isSorted: () => P.value,
|
|
1714
|
+
// 状态访问方法
|
|
1715
|
+
isValidXml: () => S.value,
|
|
1716
|
+
getParsedXml: () => o.value,
|
|
1717
|
+
getFilteredXml: () => B.value,
|
|
1718
|
+
getExpandedNodes: () => V.value,
|
|
1719
|
+
getParseError: () => y.value,
|
|
1720
|
+
getFilterError: () => x.value,
|
|
1721
|
+
// 工具方法
|
|
1722
|
+
parseXmlString: (l) => te(l),
|
|
1723
|
+
copyValue: (l) => fe(l)
|
|
1724
|
+
}), (l, d) => ($(), w("div", {
|
|
1725
|
+
class: Ve(["xml-format", `xml-format--${U.value.name}`])
|
|
1726
|
+
}, [
|
|
1727
|
+
n("div", Rt, [
|
|
1728
|
+
S.value ? x.value ? ($(), w("div", qt, [
|
|
1729
|
+
d[1] || (d[1] = n("h4", null, "Filter Error:", -1)),
|
|
1730
|
+
n("pre", null, E(x.value), 1)
|
|
1731
|
+
])) : ($(), w("div", It, [
|
|
1732
|
+
K.value ? ($(), w("div", {
|
|
1733
|
+
key: 0,
|
|
1734
|
+
class: "xml-declaration",
|
|
1735
|
+
style: r({ color: U.value.colors.xmlDeclaration })
|
|
1736
|
+
}, E(K.value), 5)) : pe("", !0),
|
|
1737
|
+
($(!0), w(re, null, ie(J.value, (g, t) => ($(), Be(Ct, {
|
|
1738
|
+
key: t,
|
|
1739
|
+
node: g.node,
|
|
1740
|
+
index: g.originalIndex,
|
|
1741
|
+
level: 0,
|
|
1742
|
+
expanded: V.value,
|
|
1743
|
+
theme: U.value,
|
|
1744
|
+
selfClosingTags: X.value,
|
|
1745
|
+
onToggleExpand: T,
|
|
1746
|
+
onCopy: fe,
|
|
1747
|
+
"onUpdate:tagName": be,
|
|
1748
|
+
"onUpdate:attributeName": oe,
|
|
1749
|
+
"onUpdate:attributeValue": _e,
|
|
1750
|
+
"onUpdate:textContent": xe,
|
|
1751
|
+
"onUpdate:cdataContent": ae
|
|
1752
|
+
}, null, 8, ["node", "index", "expanded", "theme", "selfClosingTags"]))), 128))
|
|
1753
|
+
])) : ($(), w("div", jt, [
|
|
1754
|
+
d[0] || (d[0] = n("h4", null, "XML Parse Error:", -1)),
|
|
1755
|
+
n("pre", null, E(y.value), 1)
|
|
1756
|
+
]))
|
|
1757
|
+
])
|
|
1758
|
+
], 2));
|
|
1759
|
+
}
|
|
1760
|
+
}), el = /* @__PURE__ */ we(Lt, [["__scopeId", "data-v-d4c202e6"]]);
|
|
1761
|
+
export {
|
|
1762
|
+
el as X,
|
|
1763
|
+
Ct as a,
|
|
1764
|
+
$t as b,
|
|
1765
|
+
Bt as c,
|
|
1766
|
+
ke as d,
|
|
1767
|
+
Xt as e,
|
|
1768
|
+
Ot as f,
|
|
1769
|
+
Dt as g,
|
|
1770
|
+
Ht as h,
|
|
1771
|
+
zt as i,
|
|
1772
|
+
Zt as j,
|
|
1773
|
+
Jt as k,
|
|
1774
|
+
Gt as l,
|
|
1775
|
+
wt as m,
|
|
1776
|
+
Yt as n,
|
|
1777
|
+
Pt as o,
|
|
1778
|
+
ge as p,
|
|
1779
|
+
Nt as q,
|
|
1780
|
+
ce as r,
|
|
1781
|
+
Tt as s,
|
|
1782
|
+
Ae as t,
|
|
1783
|
+
Kt as v
|
|
1784
|
+
};
|