@jr2804/livesync-cli 1.0.32-cli.1 → 1.0.51-cli.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +4 -1
- package/dist/{AwsRestJsonProtocol-BPmCQzXa.cjs → AwsRestJsonProtocol-8bfuD33v.cjs} +26 -24
- package/dist/{common-B3KclSP_.cjs → HttpInterceptingShapeSerializer-CdZ0h50h.cjs} +294 -23
- package/dist/XmlShapeDeserializer-B7URh4O0.cjs +435 -0
- package/dist/{dist-es-DhxfSNMj.cjs → dist-es-BM2h2Gys.cjs} +3 -4
- package/dist/dist-es-Cc6BAzq1.cjs +68 -0
- package/dist/{dist-es-BU2b9jKG.cjs → dist-es-CyUUay9V.cjs} +3 -3
- package/dist/{dist-es-FcX9AtZC.cjs → dist-es-DvWHLSEe.cjs} +6 -6
- package/dist/{dist-es-CaaxKLO9.cjs → dist-es-bSvKL25L.cjs} +1 -1
- package/dist/{event-streams-DmrxQXpO.cjs → event-streams-_ny8BA_d.cjs} +4 -4
- package/dist/{extensions-DkDzTVCO.cjs → extensions-BY32lT5G.cjs} +302 -35
- package/dist/index.cjs +49547 -34723
- package/dist/{loadSso-Dn78jIWR.cjs → loadSso-BTCpyZdX.cjs} +36 -14
- package/dist/{sdk-stream-mixin-YBLWtp6l.cjs → sdk-stream-mixin-DkgFkSQp.cjs} +4 -4
- package/dist/{signin-DHnd2WFx.cjs → signin-C5HI1JED.cjs} +39 -17
- package/dist/{sso-oidc-B4fkm2gn.cjs → sso-oidc-CgmbzBa9.cjs} +36 -14
- package/dist/{stream-collector-jwXXBEUn.cjs → stream-collector-DMWbWhbd.cjs} +291 -7
- package/dist/{sts-C9aqjeec.cjs → sts-BN3zvW2j.cjs} +56 -23
- package/dist/toUtf8-Dj4WWtpp.cjs +56 -0
- package/package.json +7 -7
- package/dist/XmlShapeDeserializer-B1_gcW92.cjs +0 -2097
- package/dist/date-utils-Dr5LXq4_.cjs +0 -338
- package/dist/serde-DtADB-gG.cjs +0 -597
|
@@ -1,2097 +0,0 @@
|
|
|
1
|
-
const require_stream_collector = require("./stream-collector-jwXXBEUn.cjs");
|
|
2
|
-
const require_extensions = require("./extensions-DkDzTVCO.cjs");
|
|
3
|
-
const require_date_utils = require("./date-utils-Dr5LXq4_.cjs");
|
|
4
|
-
//#region ../../../node_modules/@smithy/smithy-client/dist-es/get-value-from-text-node.js
|
|
5
|
-
var getValueFromTextNode = (obj) => {
|
|
6
|
-
const textNodeName = "#text";
|
|
7
|
-
for (const key in obj) if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== void 0) obj[key] = obj[key][textNodeName];
|
|
8
|
-
else if (typeof obj[key] === "object" && obj[key] !== null) obj[key] = getValueFromTextNode(obj[key]);
|
|
9
|
-
return obj;
|
|
10
|
-
};
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region ../../../node_modules/fast-xml-parser/lib/fxp.cjs
|
|
13
|
-
var require_fxp = /* @__PURE__ */ require_stream_collector.__commonJSMin(((exports, module) => {
|
|
14
|
-
(() => {
|
|
15
|
-
"use strict";
|
|
16
|
-
var t = {
|
|
17
|
-
d: (e, n) => {
|
|
18
|
-
for (var i in n) t.o(n, i) && !t.o(e, i) && Object.defineProperty(e, i, {
|
|
19
|
-
enumerable: !0,
|
|
20
|
-
get: n[i]
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
o: (t, e) => Object.prototype.hasOwnProperty.call(t, e),
|
|
24
|
-
r: (t) => {
|
|
25
|
-
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t, "__esModule", { value: !0 });
|
|
26
|
-
}
|
|
27
|
-
}, e = {};
|
|
28
|
-
t.r(e), t.d(e, {
|
|
29
|
-
XMLBuilder: () => Bt,
|
|
30
|
-
XMLParser: () => Tt,
|
|
31
|
-
XMLValidator: () => Ut
|
|
32
|
-
});
|
|
33
|
-
const i = /* @__PURE__ */ new RegExp("^[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
|
|
34
|
-
function s(t, e) {
|
|
35
|
-
const n = [];
|
|
36
|
-
let i = e.exec(t);
|
|
37
|
-
for (; i;) {
|
|
38
|
-
const s = [];
|
|
39
|
-
s.startIndex = e.lastIndex - i[0].length;
|
|
40
|
-
const r = i.length;
|
|
41
|
-
for (let t = 0; t < r; t++) s.push(i[t]);
|
|
42
|
-
n.push(s), i = e.exec(t);
|
|
43
|
-
}
|
|
44
|
-
return n;
|
|
45
|
-
}
|
|
46
|
-
const r = function(t) {
|
|
47
|
-
return !(null == i.exec(t));
|
|
48
|
-
}, o = [
|
|
49
|
-
"hasOwnProperty",
|
|
50
|
-
"toString",
|
|
51
|
-
"valueOf",
|
|
52
|
-
"__defineGetter__",
|
|
53
|
-
"__defineSetter__",
|
|
54
|
-
"__lookupGetter__",
|
|
55
|
-
"__lookupSetter__"
|
|
56
|
-
], a = [
|
|
57
|
-
"__proto__",
|
|
58
|
-
"constructor",
|
|
59
|
-
"prototype"
|
|
60
|
-
], h = {
|
|
61
|
-
allowBooleanAttributes: !1,
|
|
62
|
-
unpairedTags: []
|
|
63
|
-
};
|
|
64
|
-
function l(t, e) {
|
|
65
|
-
e = Object.assign({}, h, e);
|
|
66
|
-
const n = [];
|
|
67
|
-
let i = !1, s = !1;
|
|
68
|
-
"" === t[0] && (t = t.substr(1));
|
|
69
|
-
for (let r = 0; r < t.length; r++) if ("<" === t[r] && "?" === t[r + 1]) {
|
|
70
|
-
if (r += 2, r = p(t, r), r.err) return r;
|
|
71
|
-
} else {
|
|
72
|
-
if ("<" !== t[r]) {
|
|
73
|
-
if (u(t[r])) continue;
|
|
74
|
-
return b("InvalidChar", "char '" + t[r] + "' is not expected.", w(t, r));
|
|
75
|
-
}
|
|
76
|
-
{
|
|
77
|
-
let o = r;
|
|
78
|
-
if (r++, "!" === t[r]) {
|
|
79
|
-
r = c(t, r);
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
{
|
|
83
|
-
let a = !1;
|
|
84
|
-
"/" === t[r] && (a = !0, r++);
|
|
85
|
-
let h = "";
|
|
86
|
-
for (; r < t.length && ">" !== t[r] && " " !== t[r] && " " !== t[r] && "\n" !== t[r] && "\r" !== t[r]; r++) h += t[r];
|
|
87
|
-
if (h = h.trim(), "/" === h[h.length - 1] && (h = h.substring(0, h.length - 1), r--), !E(h)) {
|
|
88
|
-
let e;
|
|
89
|
-
return e = 0 === h.trim().length ? "Invalid space after '<'." : "Tag '" + h + "' is an invalid name.", b("InvalidTag", e, w(t, r));
|
|
90
|
-
}
|
|
91
|
-
const l = g(t, r);
|
|
92
|
-
if (!1 === l) return b("InvalidAttr", "Attributes for '" + h + "' have open quote.", w(t, r));
|
|
93
|
-
let d = l.value;
|
|
94
|
-
if (r = l.index, "/" === d[d.length - 1]) {
|
|
95
|
-
const n = r - d.length;
|
|
96
|
-
d = d.substring(0, d.length - 1);
|
|
97
|
-
const s = x(d, e);
|
|
98
|
-
if (!0 !== s) return b(s.err.code, s.err.msg, w(t, n + s.err.line));
|
|
99
|
-
i = !0;
|
|
100
|
-
} else if (a) {
|
|
101
|
-
if (!l.tagClosed) return b("InvalidTag", "Closing tag '" + h + "' doesn't have proper closing.", w(t, r));
|
|
102
|
-
if (d.trim().length > 0) return b("InvalidTag", "Closing tag '" + h + "' can't have attributes or invalid starting.", w(t, o));
|
|
103
|
-
if (0 === n.length) return b("InvalidTag", "Closing tag '" + h + "' has not been opened.", w(t, o));
|
|
104
|
-
{
|
|
105
|
-
const e = n.pop();
|
|
106
|
-
if (h !== e.tagName) {
|
|
107
|
-
let n = w(t, e.tagStartPos);
|
|
108
|
-
return b("InvalidTag", "Expected closing tag '" + e.tagName + "' (opened in line " + n.line + ", col " + n.col + ") instead of closing tag '" + h + "'.", w(t, o));
|
|
109
|
-
}
|
|
110
|
-
0 == n.length && (s = !0);
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
const a = x(d, e);
|
|
114
|
-
if (!0 !== a) return b(a.err.code, a.err.msg, w(t, r - d.length + a.err.line));
|
|
115
|
-
if (!0 === s) return b("InvalidXml", "Multiple possible root nodes found.", w(t, r));
|
|
116
|
-
-1 !== e.unpairedTags.indexOf(h) || n.push({
|
|
117
|
-
tagName: h,
|
|
118
|
-
tagStartPos: o
|
|
119
|
-
}), i = !0;
|
|
120
|
-
}
|
|
121
|
-
for (r++; r < t.length; r++) if ("<" === t[r]) {
|
|
122
|
-
if ("!" === t[r + 1]) {
|
|
123
|
-
r++, r = c(t, r);
|
|
124
|
-
continue;
|
|
125
|
-
}
|
|
126
|
-
if ("?" !== t[r + 1]) break;
|
|
127
|
-
if (r = p(t, ++r), r.err) return r;
|
|
128
|
-
} else if ("&" === t[r]) {
|
|
129
|
-
const e = N(t, r);
|
|
130
|
-
if (-1 == e) return b("InvalidChar", "char '&' is not expected.", w(t, r));
|
|
131
|
-
r = e;
|
|
132
|
-
} else if (!0 === s && !u(t[r])) return b("InvalidXml", "Extra text at the end", w(t, r));
|
|
133
|
-
"<" === t[r] && r--;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return i ? 1 == n.length ? b("InvalidTag", "Unclosed tag '" + n[0].tagName + "'.", w(t, n[0].tagStartPos)) : !(n.length > 0) || b("InvalidXml", "Invalid '" + JSON.stringify(n.map((t) => t.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", {
|
|
138
|
-
line: 1,
|
|
139
|
-
col: 1
|
|
140
|
-
}) : b("InvalidXml", "Start tag expected.", 1);
|
|
141
|
-
}
|
|
142
|
-
function u(t) {
|
|
143
|
-
return " " === t || " " === t || "\n" === t || "\r" === t;
|
|
144
|
-
}
|
|
145
|
-
function p(t, e) {
|
|
146
|
-
const n = e;
|
|
147
|
-
for (; e < t.length; e++) if ("?" == t[e] || " " == t[e]) {
|
|
148
|
-
const i = t.substr(n, e - n);
|
|
149
|
-
if (e > 5 && "xml" === i) return b("InvalidXml", "XML declaration allowed only at the start of the document.", w(t, e));
|
|
150
|
-
if ("?" == t[e] && ">" == t[e + 1]) {
|
|
151
|
-
e++;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
return e;
|
|
157
|
-
}
|
|
158
|
-
function c(t, e) {
|
|
159
|
-
if (t.length > e + 5 && "-" === t[e + 1] && "-" === t[e + 2]) {
|
|
160
|
-
for (e += 3; e < t.length; e++) if ("-" === t[e] && "-" === t[e + 1] && ">" === t[e + 2]) {
|
|
161
|
-
e += 2;
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
} else if (t.length > e + 8 && "D" === t[e + 1] && "O" === t[e + 2] && "C" === t[e + 3] && "T" === t[e + 4] && "Y" === t[e + 5] && "P" === t[e + 6] && "E" === t[e + 7]) {
|
|
165
|
-
let n = 1;
|
|
166
|
-
for (e += 8; e < t.length; e++) if ("<" === t[e]) n++;
|
|
167
|
-
else if (">" === t[e] && (n--, 0 === n)) break;
|
|
168
|
-
} else if (t.length > e + 9 && "[" === t[e + 1] && "C" === t[e + 2] && "D" === t[e + 3] && "A" === t[e + 4] && "T" === t[e + 5] && "A" === t[e + 6] && "[" === t[e + 7]) {
|
|
169
|
-
for (e += 8; e < t.length; e++) if ("]" === t[e] && "]" === t[e + 1] && ">" === t[e + 2]) {
|
|
170
|
-
e += 2;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return e;
|
|
175
|
-
}
|
|
176
|
-
const d = "\"", f = "'";
|
|
177
|
-
function g(t, e) {
|
|
178
|
-
let n = "", i = "", s = !1;
|
|
179
|
-
for (; e < t.length; e++) {
|
|
180
|
-
if (t[e] === d || t[e] === f) "" === i ? i = t[e] : i !== t[e] || (i = "");
|
|
181
|
-
else if (">" === t[e] && "" === i) {
|
|
182
|
-
s = !0;
|
|
183
|
-
break;
|
|
184
|
-
}
|
|
185
|
-
n += t[e];
|
|
186
|
-
}
|
|
187
|
-
return "" === i && {
|
|
188
|
-
value: n,
|
|
189
|
-
index: e,
|
|
190
|
-
tagClosed: s
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
const m = /* @__PURE__ */ new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
|
|
194
|
-
function x(t, e) {
|
|
195
|
-
const n = s(t, m), i = {};
|
|
196
|
-
for (let t = 0; t < n.length; t++) {
|
|
197
|
-
if (0 === n[t][1].length) return b("InvalidAttr", "Attribute '" + n[t][2] + "' has no space in starting.", v(n[t]));
|
|
198
|
-
if (void 0 !== n[t][3] && void 0 === n[t][4]) return b("InvalidAttr", "Attribute '" + n[t][2] + "' is without value.", v(n[t]));
|
|
199
|
-
if (void 0 === n[t][3] && !e.allowBooleanAttributes) return b("InvalidAttr", "boolean attribute '" + n[t][2] + "' is not allowed.", v(n[t]));
|
|
200
|
-
const s = n[t][2];
|
|
201
|
-
if (!y(s)) return b("InvalidAttr", "Attribute '" + s + "' is an invalid name.", v(n[t]));
|
|
202
|
-
if (Object.prototype.hasOwnProperty.call(i, s)) return b("InvalidAttr", "Attribute '" + s + "' is repeated.", v(n[t]));
|
|
203
|
-
i[s] = 1;
|
|
204
|
-
}
|
|
205
|
-
return !0;
|
|
206
|
-
}
|
|
207
|
-
function N(t, e) {
|
|
208
|
-
if (";" === t[++e]) return -1;
|
|
209
|
-
if ("#" === t[e]) return function(t, e) {
|
|
210
|
-
let n = /\d/;
|
|
211
|
-
for ("x" === t[e] && (e++, n = /[\da-fA-F]/); e < t.length; e++) {
|
|
212
|
-
if (";" === t[e]) return e;
|
|
213
|
-
if (!t[e].match(n)) break;
|
|
214
|
-
}
|
|
215
|
-
return -1;
|
|
216
|
-
}(t, ++e);
|
|
217
|
-
let n = 0;
|
|
218
|
-
for (; e < t.length; e++, n++) if (!(t[e].match(/\w/) && n < 20)) {
|
|
219
|
-
if (";" === t[e]) break;
|
|
220
|
-
return -1;
|
|
221
|
-
}
|
|
222
|
-
return e;
|
|
223
|
-
}
|
|
224
|
-
function b(t, e, n) {
|
|
225
|
-
return { err: {
|
|
226
|
-
code: t,
|
|
227
|
-
msg: e,
|
|
228
|
-
line: n.line || n,
|
|
229
|
-
col: n.col
|
|
230
|
-
} };
|
|
231
|
-
}
|
|
232
|
-
function y(t) {
|
|
233
|
-
return r(t);
|
|
234
|
-
}
|
|
235
|
-
function E(t) {
|
|
236
|
-
return r(t);
|
|
237
|
-
}
|
|
238
|
-
function w(t, e) {
|
|
239
|
-
const n = t.substring(0, e).split(/\r?\n/);
|
|
240
|
-
return {
|
|
241
|
-
line: n.length,
|
|
242
|
-
col: n[n.length - 1].length + 1
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
function v(t) {
|
|
246
|
-
return t.startIndex + t[1].length;
|
|
247
|
-
}
|
|
248
|
-
const S = (t) => o.includes(t) ? "__" + t : t, _ = {
|
|
249
|
-
preserveOrder: !1,
|
|
250
|
-
attributeNamePrefix: "@_",
|
|
251
|
-
attributesGroupName: !1,
|
|
252
|
-
textNodeName: "#text",
|
|
253
|
-
ignoreAttributes: !0,
|
|
254
|
-
removeNSPrefix: !1,
|
|
255
|
-
allowBooleanAttributes: !1,
|
|
256
|
-
parseTagValue: !0,
|
|
257
|
-
parseAttributeValue: !1,
|
|
258
|
-
trimValues: !0,
|
|
259
|
-
cdataPropName: !1,
|
|
260
|
-
numberParseOptions: {
|
|
261
|
-
hex: !0,
|
|
262
|
-
leadingZeros: !0,
|
|
263
|
-
eNotation: !0
|
|
264
|
-
},
|
|
265
|
-
tagValueProcessor: function(t, e) {
|
|
266
|
-
return e;
|
|
267
|
-
},
|
|
268
|
-
attributeValueProcessor: function(t, e) {
|
|
269
|
-
return e;
|
|
270
|
-
},
|
|
271
|
-
stopNodes: [],
|
|
272
|
-
alwaysCreateTextNode: !1,
|
|
273
|
-
isArray: () => !1,
|
|
274
|
-
commentPropName: !1,
|
|
275
|
-
unpairedTags: [],
|
|
276
|
-
processEntities: !0,
|
|
277
|
-
htmlEntities: !1,
|
|
278
|
-
entityDecoder: null,
|
|
279
|
-
ignoreDeclaration: !1,
|
|
280
|
-
ignorePiTags: !1,
|
|
281
|
-
transformTagName: !1,
|
|
282
|
-
transformAttributeName: !1,
|
|
283
|
-
updateTag: function(t, e, n) {
|
|
284
|
-
return t;
|
|
285
|
-
},
|
|
286
|
-
captureMetaData: !1,
|
|
287
|
-
maxNestedTags: 100,
|
|
288
|
-
strictReservedNames: !0,
|
|
289
|
-
jPath: !0,
|
|
290
|
-
onDangerousProperty: S
|
|
291
|
-
};
|
|
292
|
-
function A(t, e) {
|
|
293
|
-
if ("string" != typeof t) return;
|
|
294
|
-
const n = t.toLowerCase();
|
|
295
|
-
if (o.some((t) => n === t.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
296
|
-
if (a.some((t) => n === t.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
297
|
-
}
|
|
298
|
-
function T(t, e) {
|
|
299
|
-
return "boolean" == typeof t ? {
|
|
300
|
-
enabled: t,
|
|
301
|
-
maxEntitySize: 1e4,
|
|
302
|
-
maxExpansionDepth: 1e4,
|
|
303
|
-
maxTotalExpansions: Infinity,
|
|
304
|
-
maxExpandedLength: 1e5,
|
|
305
|
-
maxEntityCount: 1e3,
|
|
306
|
-
allowedTags: null,
|
|
307
|
-
tagFilter: null,
|
|
308
|
-
appliesTo: "all"
|
|
309
|
-
} : "object" == typeof t && null !== t ? {
|
|
310
|
-
enabled: !1 !== t.enabled,
|
|
311
|
-
maxEntitySize: Math.max(1, t.maxEntitySize ?? 1e4),
|
|
312
|
-
maxExpansionDepth: Math.max(1, t.maxExpansionDepth ?? 1e4),
|
|
313
|
-
maxTotalExpansions: Math.max(1, t.maxTotalExpansions ?? Infinity),
|
|
314
|
-
maxExpandedLength: Math.max(1, t.maxExpandedLength ?? 1e5),
|
|
315
|
-
maxEntityCount: Math.max(1, t.maxEntityCount ?? 1e3),
|
|
316
|
-
allowedTags: t.allowedTags ?? null,
|
|
317
|
-
tagFilter: t.tagFilter ?? null,
|
|
318
|
-
appliesTo: t.appliesTo ?? "all"
|
|
319
|
-
} : T(!0);
|
|
320
|
-
}
|
|
321
|
-
const C = function(t) {
|
|
322
|
-
const e = Object.assign({}, _, t), n = [
|
|
323
|
-
{
|
|
324
|
-
value: e.attributeNamePrefix,
|
|
325
|
-
name: "attributeNamePrefix"
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
value: e.attributesGroupName,
|
|
329
|
-
name: "attributesGroupName"
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
value: e.textNodeName,
|
|
333
|
-
name: "textNodeName"
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
value: e.cdataPropName,
|
|
337
|
-
name: "cdataPropName"
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
value: e.commentPropName,
|
|
341
|
-
name: "commentPropName"
|
|
342
|
-
}
|
|
343
|
-
];
|
|
344
|
-
for (const { value: t, name: e } of n) t && A(t, e);
|
|
345
|
-
return null === e.onDangerousProperty && (e.onDangerousProperty = S), e.processEntities = T(e.processEntities, e.htmlEntities), e.unpairedTagsSet = new Set(e.unpairedTags), e.stopNodes && Array.isArray(e.stopNodes) && (e.stopNodes = e.stopNodes.map((t) => "string" == typeof t && t.startsWith("*.") ? ".." + t.substring(2) : t)), e;
|
|
346
|
-
};
|
|
347
|
-
let P;
|
|
348
|
-
P = "function" != typeof Symbol ? "@@xmlMetadata" : Symbol("XML Node Metadata");
|
|
349
|
-
class O {
|
|
350
|
-
constructor(t) {
|
|
351
|
-
this.tagname = t, this.child = [], this[":@"] = Object.create(null);
|
|
352
|
-
}
|
|
353
|
-
add(t, e) {
|
|
354
|
-
"__proto__" === t && (t = "#__proto__"), this.child.push({ [t]: e });
|
|
355
|
-
}
|
|
356
|
-
addChild(t, e) {
|
|
357
|
-
"__proto__" === t.tagname && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({
|
|
358
|
-
[t.tagname]: t.child,
|
|
359
|
-
":@": t[":@"]
|
|
360
|
-
}) : this.child.push({ [t.tagname]: t.child }), void 0 !== e && (this.child[this.child.length - 1][P] = { startIndex: e });
|
|
361
|
-
}
|
|
362
|
-
static getMetaDataSymbol() {
|
|
363
|
-
return P;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
class $ {
|
|
367
|
-
constructor(t) {
|
|
368
|
-
this.suppressValidationErr = !t, this.options = t;
|
|
369
|
-
}
|
|
370
|
-
readDocType(t, e) {
|
|
371
|
-
const n = Object.create(null);
|
|
372
|
-
let i = 0;
|
|
373
|
-
if ("O" !== t[e + 3] || "C" !== t[e + 4] || "T" !== t[e + 5] || "Y" !== t[e + 6] || "P" !== t[e + 7] || "E" !== t[e + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
|
|
374
|
-
{
|
|
375
|
-
e += 9;
|
|
376
|
-
let s = 1, r = !1, o = !1, a = "";
|
|
377
|
-
for (; e < t.length; e++) if ("<" !== t[e] || o) if (">" === t[e]) {
|
|
378
|
-
if (o ? "-" === t[e - 1] && "-" === t[e - 2] && (o = !1, s--) : s--, 0 === s) break;
|
|
379
|
-
} else "[" === t[e] ? r = !0 : a += t[e];
|
|
380
|
-
else {
|
|
381
|
-
if (r && D(t, "!ENTITY", e)) {
|
|
382
|
-
let s, r;
|
|
383
|
-
if (e += 7, [s, r, e] = this.readEntityExp(t, e + 1, this.suppressValidationErr), -1 === r.indexOf("&")) {
|
|
384
|
-
if (!1 !== this.options.enabled && null != this.options.maxEntityCount && i >= this.options.maxEntityCount) throw new Error(`Entity count (${i + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
|
|
385
|
-
n[s] = r, i++;
|
|
386
|
-
}
|
|
387
|
-
} else if (r && D(t, "!ELEMENT", e)) {
|
|
388
|
-
e += 8;
|
|
389
|
-
const { index: n } = this.readElementExp(t, e + 1);
|
|
390
|
-
e = n;
|
|
391
|
-
} else if (r && D(t, "!ATTLIST", e)) e += 8;
|
|
392
|
-
else if (r && D(t, "!NOTATION", e)) {
|
|
393
|
-
e += 9;
|
|
394
|
-
const { index: n } = this.readNotationExp(t, e + 1, this.suppressValidationErr);
|
|
395
|
-
e = n;
|
|
396
|
-
} else {
|
|
397
|
-
if (!D(t, "!--", e)) throw new Error("Invalid DOCTYPE");
|
|
398
|
-
o = !0;
|
|
399
|
-
}
|
|
400
|
-
s++, a = "";
|
|
401
|
-
}
|
|
402
|
-
if (0 !== s) throw new Error("Unclosed DOCTYPE");
|
|
403
|
-
}
|
|
404
|
-
return {
|
|
405
|
-
entities: n,
|
|
406
|
-
i: e
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
readEntityExp(t, e) {
|
|
410
|
-
const n = e = I(t, e);
|
|
411
|
-
for (; e < t.length && !/\s/.test(t[e]) && "\"" !== t[e] && "'" !== t[e];) e++;
|
|
412
|
-
let i = t.substring(n, e);
|
|
413
|
-
if (M(i), e = I(t, e), !this.suppressValidationErr) {
|
|
414
|
-
if ("SYSTEM" === t.substring(e, e + 6).toUpperCase()) throw new Error("External entities are not supported");
|
|
415
|
-
if ("%" === t[e]) throw new Error("Parameter entities are not supported");
|
|
416
|
-
}
|
|
417
|
-
let s = "";
|
|
418
|
-
if ([e, s] = this.readIdentifierVal(t, e, "entity"), !1 !== this.options.enabled && null != this.options.maxEntitySize && s.length > this.options.maxEntitySize) throw new Error(`Entity "${i}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
|
|
419
|
-
return [
|
|
420
|
-
i,
|
|
421
|
-
s,
|
|
422
|
-
--e
|
|
423
|
-
];
|
|
424
|
-
}
|
|
425
|
-
readNotationExp(t, e) {
|
|
426
|
-
const n = e = I(t, e);
|
|
427
|
-
for (; e < t.length && !/\s/.test(t[e]);) e++;
|
|
428
|
-
let i = t.substring(n, e);
|
|
429
|
-
!this.suppressValidationErr && M(i), e = I(t, e);
|
|
430
|
-
const s = t.substring(e, e + 6).toUpperCase();
|
|
431
|
-
if (!this.suppressValidationErr && "SYSTEM" !== s && "PUBLIC" !== s) throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);
|
|
432
|
-
e += s.length, e = I(t, e);
|
|
433
|
-
let r = null, o = null;
|
|
434
|
-
if ("PUBLIC" === s) [e, r] = this.readIdentifierVal(t, e, "publicIdentifier"), "\"" !== t[e = I(t, e)] && "'" !== t[e] || ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"));
|
|
435
|
-
else if ("SYSTEM" === s && ([e, o] = this.readIdentifierVal(t, e, "systemIdentifier"), !this.suppressValidationErr && !o)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
436
|
-
return {
|
|
437
|
-
notationName: i,
|
|
438
|
-
publicIdentifier: r,
|
|
439
|
-
systemIdentifier: o,
|
|
440
|
-
index: --e
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
readIdentifierVal(t, e, n) {
|
|
444
|
-
let i = "";
|
|
445
|
-
const s = t[e];
|
|
446
|
-
if ("\"" !== s && "'" !== s) throw new Error(`Expected quoted string, found "${s}"`);
|
|
447
|
-
const r = ++e;
|
|
448
|
-
for (; e < t.length && t[e] !== s;) e++;
|
|
449
|
-
if (i = t.substring(r, e), t[e] !== s) throw new Error(`Unterminated ${n} value`);
|
|
450
|
-
return [++e, i];
|
|
451
|
-
}
|
|
452
|
-
readElementExp(t, e) {
|
|
453
|
-
const n = e = I(t, e);
|
|
454
|
-
for (; e < t.length && !/\s/.test(t[e]);) e++;
|
|
455
|
-
let i = t.substring(n, e);
|
|
456
|
-
if (!this.suppressValidationErr && !r(i)) throw new Error(`Invalid element name: "${i}"`);
|
|
457
|
-
let s = "";
|
|
458
|
-
if ("E" === t[e = I(t, e)] && D(t, "MPTY", e)) e += 4;
|
|
459
|
-
else if ("A" === t[e] && D(t, "NY", e)) e += 2;
|
|
460
|
-
else if ("(" === t[e]) {
|
|
461
|
-
const n = ++e;
|
|
462
|
-
for (; e < t.length && ")" !== t[e];) e++;
|
|
463
|
-
if (s = t.substring(n, e), ")" !== t[e]) throw new Error("Unterminated content model");
|
|
464
|
-
} else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t[e]}"`);
|
|
465
|
-
return {
|
|
466
|
-
elementName: i,
|
|
467
|
-
contentModel: s.trim(),
|
|
468
|
-
index: e
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
readAttlistExp(t, e) {
|
|
472
|
-
let n = e = I(t, e);
|
|
473
|
-
for (; e < t.length && !/\s/.test(t[e]);) e++;
|
|
474
|
-
let i = t.substring(n, e);
|
|
475
|
-
for (M(i), n = e = I(t, e); e < t.length && !/\s/.test(t[e]);) e++;
|
|
476
|
-
let s = t.substring(n, e);
|
|
477
|
-
if (!M(s)) throw new Error(`Invalid attribute name: "${s}"`);
|
|
478
|
-
e = I(t, e);
|
|
479
|
-
let r = "";
|
|
480
|
-
if ("NOTATION" === t.substring(e, e + 8).toUpperCase()) {
|
|
481
|
-
if (r = "NOTATION", "(" !== t[e = I(t, e += 8)]) throw new Error(`Expected '(', found "${t[e]}"`);
|
|
482
|
-
e++;
|
|
483
|
-
let n = [];
|
|
484
|
-
for (; e < t.length && ")" !== t[e];) {
|
|
485
|
-
const i = e;
|
|
486
|
-
for (; e < t.length && "|" !== t[e] && ")" !== t[e];) e++;
|
|
487
|
-
let s = t.substring(i, e);
|
|
488
|
-
if (s = s.trim(), !M(s)) throw new Error(`Invalid notation name: "${s}"`);
|
|
489
|
-
n.push(s), "|" === t[e] && (e++, e = I(t, e));
|
|
490
|
-
}
|
|
491
|
-
if (")" !== t[e]) throw new Error("Unterminated list of notations");
|
|
492
|
-
e++, r += " (" + n.join("|") + ")";
|
|
493
|
-
} else {
|
|
494
|
-
const n = e;
|
|
495
|
-
for (; e < t.length && !/\s/.test(t[e]);) e++;
|
|
496
|
-
r += t.substring(n, e);
|
|
497
|
-
if (!this.suppressValidationErr && ![
|
|
498
|
-
"CDATA",
|
|
499
|
-
"ID",
|
|
500
|
-
"IDREF",
|
|
501
|
-
"IDREFS",
|
|
502
|
-
"ENTITY",
|
|
503
|
-
"ENTITIES",
|
|
504
|
-
"NMTOKEN",
|
|
505
|
-
"NMTOKENS"
|
|
506
|
-
].includes(r.toUpperCase())) throw new Error(`Invalid attribute type: "${r}"`);
|
|
507
|
-
}
|
|
508
|
-
e = I(t, e);
|
|
509
|
-
let o = "";
|
|
510
|
-
return "#REQUIRED" === t.substring(e, e + 8).toUpperCase() ? (o = "#REQUIRED", e += 8) : "#IMPLIED" === t.substring(e, e + 7).toUpperCase() ? (o = "#IMPLIED", e += 7) : [e, o] = this.readIdentifierVal(t, e, "ATTLIST"), {
|
|
511
|
-
elementName: i,
|
|
512
|
-
attributeName: s,
|
|
513
|
-
attributeType: r,
|
|
514
|
-
defaultValue: o,
|
|
515
|
-
index: e
|
|
516
|
-
};
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
const I = (t, e) => {
|
|
520
|
-
for (; e < t.length && /\s/.test(t[e]);) e++;
|
|
521
|
-
return e;
|
|
522
|
-
};
|
|
523
|
-
function D(t, e, n) {
|
|
524
|
-
for (let i = 0; i < e.length; i++) if (e[i] !== t[n + i + 1]) return !1;
|
|
525
|
-
return !0;
|
|
526
|
-
}
|
|
527
|
-
function M(t) {
|
|
528
|
-
if (r(t)) return t;
|
|
529
|
-
throw new Error(`Invalid entity name ${t}`);
|
|
530
|
-
}
|
|
531
|
-
const j = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, L = {
|
|
532
|
-
hex: !0,
|
|
533
|
-
leadingZeros: !0,
|
|
534
|
-
decimalPoint: ".",
|
|
535
|
-
eNotation: !0,
|
|
536
|
-
infinity: "original"
|
|
537
|
-
};
|
|
538
|
-
const k = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
539
|
-
class F {
|
|
540
|
-
constructor(t) {
|
|
541
|
-
this._matcher = t;
|
|
542
|
-
}
|
|
543
|
-
get separator() {
|
|
544
|
-
return this._matcher.separator;
|
|
545
|
-
}
|
|
546
|
-
getCurrentTag() {
|
|
547
|
-
const t = this._matcher.path;
|
|
548
|
-
return t.length > 0 ? t[t.length - 1].tag : void 0;
|
|
549
|
-
}
|
|
550
|
-
getCurrentNamespace() {
|
|
551
|
-
const t = this._matcher.path;
|
|
552
|
-
return t.length > 0 ? t[t.length - 1].namespace : void 0;
|
|
553
|
-
}
|
|
554
|
-
getAttrValue(t) {
|
|
555
|
-
const e = this._matcher.path;
|
|
556
|
-
if (0 !== e.length) return e[e.length - 1].values?.[t];
|
|
557
|
-
}
|
|
558
|
-
hasAttr(t) {
|
|
559
|
-
const e = this._matcher.path;
|
|
560
|
-
if (0 === e.length) return !1;
|
|
561
|
-
const n = e[e.length - 1];
|
|
562
|
-
return void 0 !== n.values && t in n.values;
|
|
563
|
-
}
|
|
564
|
-
getPosition() {
|
|
565
|
-
const t = this._matcher.path;
|
|
566
|
-
return 0 === t.length ? -1 : t[t.length - 1].position ?? 0;
|
|
567
|
-
}
|
|
568
|
-
getCounter() {
|
|
569
|
-
const t = this._matcher.path;
|
|
570
|
-
return 0 === t.length ? -1 : t[t.length - 1].counter ?? 0;
|
|
571
|
-
}
|
|
572
|
-
getIndex() {
|
|
573
|
-
return this.getPosition();
|
|
574
|
-
}
|
|
575
|
-
getDepth() {
|
|
576
|
-
return this._matcher.path.length;
|
|
577
|
-
}
|
|
578
|
-
toString(t, e = !0) {
|
|
579
|
-
return this._matcher.toString(t, e);
|
|
580
|
-
}
|
|
581
|
-
toArray() {
|
|
582
|
-
return this._matcher.path.map((t) => t.tag);
|
|
583
|
-
}
|
|
584
|
-
matches(t) {
|
|
585
|
-
return this._matcher.matches(t);
|
|
586
|
-
}
|
|
587
|
-
matchesAny(t) {
|
|
588
|
-
return t.matchesAny(this._matcher);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
class R {
|
|
592
|
-
constructor(t = {}) {
|
|
593
|
-
this.separator = t.separator || ".", this.path = [], this.siblingStacks = [], this._pathStringCache = null, this._view = new F(this);
|
|
594
|
-
}
|
|
595
|
-
push(t, e = null, n = null) {
|
|
596
|
-
this._pathStringCache = null, this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
|
|
597
|
-
const i = this.path.length;
|
|
598
|
-
this.siblingStacks[i] || (this.siblingStacks[i] = /* @__PURE__ */ new Map());
|
|
599
|
-
const s = this.siblingStacks[i], r = n ? `${n}:${t}` : t, o = s.get(r) || 0;
|
|
600
|
-
let a = 0;
|
|
601
|
-
for (const t of s.values()) a += t;
|
|
602
|
-
s.set(r, o + 1);
|
|
603
|
-
const h = {
|
|
604
|
-
tag: t,
|
|
605
|
-
position: a,
|
|
606
|
-
counter: o
|
|
607
|
-
};
|
|
608
|
-
null != n && (h.namespace = n), null != e && (h.values = e), this.path.push(h);
|
|
609
|
-
}
|
|
610
|
-
pop() {
|
|
611
|
-
if (0 === this.path.length) return;
|
|
612
|
-
this._pathStringCache = null;
|
|
613
|
-
const t = this.path.pop();
|
|
614
|
-
return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t;
|
|
615
|
-
}
|
|
616
|
-
updateCurrent(t) {
|
|
617
|
-
if (this.path.length > 0) {
|
|
618
|
-
const e = this.path[this.path.length - 1];
|
|
619
|
-
null != t && (e.values = t);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
getCurrentTag() {
|
|
623
|
-
return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
|
|
624
|
-
}
|
|
625
|
-
getCurrentNamespace() {
|
|
626
|
-
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
|
|
627
|
-
}
|
|
628
|
-
getAttrValue(t) {
|
|
629
|
-
if (0 !== this.path.length) return this.path[this.path.length - 1].values?.[t];
|
|
630
|
-
}
|
|
631
|
-
hasAttr(t) {
|
|
632
|
-
if (0 === this.path.length) return !1;
|
|
633
|
-
const e = this.path[this.path.length - 1];
|
|
634
|
-
return void 0 !== e.values && t in e.values;
|
|
635
|
-
}
|
|
636
|
-
getPosition() {
|
|
637
|
-
return 0 === this.path.length ? -1 : this.path[this.path.length - 1].position ?? 0;
|
|
638
|
-
}
|
|
639
|
-
getCounter() {
|
|
640
|
-
return 0 === this.path.length ? -1 : this.path[this.path.length - 1].counter ?? 0;
|
|
641
|
-
}
|
|
642
|
-
getIndex() {
|
|
643
|
-
return this.getPosition();
|
|
644
|
-
}
|
|
645
|
-
getDepth() {
|
|
646
|
-
return this.path.length;
|
|
647
|
-
}
|
|
648
|
-
toString(t, e = !0) {
|
|
649
|
-
const n = t || this.separator;
|
|
650
|
-
if (n === this.separator && !0 === e) {
|
|
651
|
-
if (null !== this._pathStringCache) return this._pathStringCache;
|
|
652
|
-
const t = this.path.map((t) => t.namespace ? `${t.namespace}:${t.tag}` : t.tag).join(n);
|
|
653
|
-
return this._pathStringCache = t, t;
|
|
654
|
-
}
|
|
655
|
-
return this.path.map((t) => e && t.namespace ? `${t.namespace}:${t.tag}` : t.tag).join(n);
|
|
656
|
-
}
|
|
657
|
-
toArray() {
|
|
658
|
-
return this.path.map((t) => t.tag);
|
|
659
|
-
}
|
|
660
|
-
reset() {
|
|
661
|
-
this._pathStringCache = null, this.path = [], this.siblingStacks = [];
|
|
662
|
-
}
|
|
663
|
-
matches(t) {
|
|
664
|
-
const e = t.segments;
|
|
665
|
-
return 0 !== e.length && (t.hasDeepWildcard() ? this._matchWithDeepWildcard(e) : this._matchSimple(e));
|
|
666
|
-
}
|
|
667
|
-
_matchSimple(t) {
|
|
668
|
-
if (this.path.length !== t.length) return !1;
|
|
669
|
-
for (let e = 0; e < t.length; e++) if (!this._matchSegment(t[e], this.path[e], e === this.path.length - 1)) return !1;
|
|
670
|
-
return !0;
|
|
671
|
-
}
|
|
672
|
-
_matchWithDeepWildcard(t) {
|
|
673
|
-
let e = this.path.length - 1, n = t.length - 1;
|
|
674
|
-
for (; n >= 0 && e >= 0;) {
|
|
675
|
-
const i = t[n];
|
|
676
|
-
if ("deep-wildcard" === i.type) {
|
|
677
|
-
if (n--, n < 0) return !0;
|
|
678
|
-
const i = t[n];
|
|
679
|
-
let s = !1;
|
|
680
|
-
for (let t = e; t >= 0; t--) if (this._matchSegment(i, this.path[t], t === this.path.length - 1)) {
|
|
681
|
-
e = t - 1, n--, s = !0;
|
|
682
|
-
break;
|
|
683
|
-
}
|
|
684
|
-
if (!s) return !1;
|
|
685
|
-
} else {
|
|
686
|
-
if (!this._matchSegment(i, this.path[e], e === this.path.length - 1)) return !1;
|
|
687
|
-
e--, n--;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
return n < 0;
|
|
691
|
-
}
|
|
692
|
-
_matchSegment(t, e, n) {
|
|
693
|
-
if ("*" !== t.tag && t.tag !== e.tag) return !1;
|
|
694
|
-
if (void 0 !== t.namespace && "*" !== t.namespace && t.namespace !== e.namespace) return !1;
|
|
695
|
-
if (void 0 !== t.attrName) {
|
|
696
|
-
if (!n) return !1;
|
|
697
|
-
if (!e.values || !(t.attrName in e.values)) return !1;
|
|
698
|
-
if (void 0 !== t.attrValue && String(e.values[t.attrName]) !== String(t.attrValue)) return !1;
|
|
699
|
-
}
|
|
700
|
-
if (void 0 !== t.position) {
|
|
701
|
-
if (!n) return !1;
|
|
702
|
-
const i = e.counter ?? 0;
|
|
703
|
-
if ("first" === t.position && 0 !== i) return !1;
|
|
704
|
-
if ("odd" === t.position && i % 2 != 1) return !1;
|
|
705
|
-
if ("even" === t.position && i % 2 != 0) return !1;
|
|
706
|
-
if ("nth" === t.position && i !== t.positionValue) return !1;
|
|
707
|
-
}
|
|
708
|
-
return !0;
|
|
709
|
-
}
|
|
710
|
-
matchesAny(t) {
|
|
711
|
-
return t.matchesAny(this);
|
|
712
|
-
}
|
|
713
|
-
snapshot() {
|
|
714
|
-
return {
|
|
715
|
-
path: this.path.map((t) => ({ ...t })),
|
|
716
|
-
siblingStacks: this.siblingStacks.map((t) => new Map(t))
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
restore(t) {
|
|
720
|
-
this._pathStringCache = null, this.path = t.path.map((t) => ({ ...t })), this.siblingStacks = t.siblingStacks.map((t) => new Map(t));
|
|
721
|
-
}
|
|
722
|
-
readOnly() {
|
|
723
|
-
return this._view;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
class G {
|
|
727
|
-
constructor(t, e = {}, n) {
|
|
728
|
-
this.pattern = t, this.separator = e.separator || ".", this.segments = this._parse(t), this.data = n, this._hasDeepWildcard = this.segments.some((t) => "deep-wildcard" === t.type), this._hasAttributeCondition = this.segments.some((t) => void 0 !== t.attrName), this._hasPositionSelector = this.segments.some((t) => void 0 !== t.position);
|
|
729
|
-
}
|
|
730
|
-
_parse(t) {
|
|
731
|
-
const e = [];
|
|
732
|
-
let n = 0, i = "";
|
|
733
|
-
for (; n < t.length;) t[n] === this.separator ? n + 1 < t.length && t[n + 1] === this.separator ? (i.trim() && (e.push(this._parseSegment(i.trim())), i = ""), e.push({ type: "deep-wildcard" }), n += 2) : (i.trim() && e.push(this._parseSegment(i.trim())), i = "", n++) : (i += t[n], n++);
|
|
734
|
-
return i.trim() && e.push(this._parseSegment(i.trim())), e;
|
|
735
|
-
}
|
|
736
|
-
_parseSegment(t) {
|
|
737
|
-
const e = { type: "tag" };
|
|
738
|
-
let n = null, i = t;
|
|
739
|
-
const s = t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
|
|
740
|
-
if (s && (i = s[1] + s[3], s[2])) {
|
|
741
|
-
const t = s[2].slice(1, -1);
|
|
742
|
-
t && (n = t);
|
|
743
|
-
}
|
|
744
|
-
let r, o, a = i;
|
|
745
|
-
if (i.includes("::")) {
|
|
746
|
-
const e = i.indexOf("::");
|
|
747
|
-
if (r = i.substring(0, e).trim(), a = i.substring(e + 2).trim(), !r) throw new Error(`Invalid namespace in pattern: ${t}`);
|
|
748
|
-
}
|
|
749
|
-
let h = null;
|
|
750
|
-
if (a.includes(":")) {
|
|
751
|
-
const t = a.lastIndexOf(":"), e = a.substring(0, t).trim(), n = a.substring(t + 1).trim();
|
|
752
|
-
[
|
|
753
|
-
"first",
|
|
754
|
-
"last",
|
|
755
|
-
"odd",
|
|
756
|
-
"even"
|
|
757
|
-
].includes(n) || /^nth\(\d+\)$/.test(n) ? (o = e, h = n) : o = a;
|
|
758
|
-
} else o = a;
|
|
759
|
-
if (!o) throw new Error(`Invalid segment pattern: ${t}`);
|
|
760
|
-
if (e.tag = o, r && (e.namespace = r), n) if (n.includes("=")) {
|
|
761
|
-
const t = n.indexOf("=");
|
|
762
|
-
e.attrName = n.substring(0, t).trim(), e.attrValue = n.substring(t + 1).trim();
|
|
763
|
-
} else e.attrName = n.trim();
|
|
764
|
-
if (h) {
|
|
765
|
-
const t = h.match(/^nth\((\d+)\)$/);
|
|
766
|
-
t ? (e.position = "nth", e.positionValue = parseInt(t[1], 10)) : e.position = h;
|
|
767
|
-
}
|
|
768
|
-
return e;
|
|
769
|
-
}
|
|
770
|
-
get length() {
|
|
771
|
-
return this.segments.length;
|
|
772
|
-
}
|
|
773
|
-
hasDeepWildcard() {
|
|
774
|
-
return this._hasDeepWildcard;
|
|
775
|
-
}
|
|
776
|
-
hasAttributeCondition() {
|
|
777
|
-
return this._hasAttributeCondition;
|
|
778
|
-
}
|
|
779
|
-
hasPositionSelector() {
|
|
780
|
-
return this._hasPositionSelector;
|
|
781
|
-
}
|
|
782
|
-
toString() {
|
|
783
|
-
return this.pattern;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
class B {
|
|
787
|
-
constructor() {
|
|
788
|
-
this._byDepthAndTag = /* @__PURE__ */ new Map(), this._wildcardByDepth = /* @__PURE__ */ new Map(), this._deepWildcards = [], this._patterns = /* @__PURE__ */ new Set(), this._sealed = !1;
|
|
789
|
-
}
|
|
790
|
-
add(t) {
|
|
791
|
-
if (this._sealed) throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");
|
|
792
|
-
if (this._patterns.has(t.pattern)) return this;
|
|
793
|
-
if (this._patterns.add(t.pattern), t.hasDeepWildcard()) return this._deepWildcards.push(t), this;
|
|
794
|
-
const e = t.length, i = t.segments[t.segments.length - 1]?.tag;
|
|
795
|
-
if (i && "*" !== i) {
|
|
796
|
-
const n = `${e}:${i}`;
|
|
797
|
-
this._byDepthAndTag.has(n) || this._byDepthAndTag.set(n, []), this._byDepthAndTag.get(n).push(t);
|
|
798
|
-
} else this._wildcardByDepth.has(e) || this._wildcardByDepth.set(e, []), this._wildcardByDepth.get(e).push(t);
|
|
799
|
-
return this;
|
|
800
|
-
}
|
|
801
|
-
addAll(t) {
|
|
802
|
-
for (const e of t) this.add(e);
|
|
803
|
-
return this;
|
|
804
|
-
}
|
|
805
|
-
has(t) {
|
|
806
|
-
return this._patterns.has(t.pattern);
|
|
807
|
-
}
|
|
808
|
-
get size() {
|
|
809
|
-
return this._patterns.size;
|
|
810
|
-
}
|
|
811
|
-
seal() {
|
|
812
|
-
return this._sealed = !0, this;
|
|
813
|
-
}
|
|
814
|
-
get isSealed() {
|
|
815
|
-
return this._sealed;
|
|
816
|
-
}
|
|
817
|
-
matchesAny(t) {
|
|
818
|
-
return null !== this.findMatch(t);
|
|
819
|
-
}
|
|
820
|
-
findMatch(t) {
|
|
821
|
-
const e = t.getDepth(), n = `${e}:${t.getCurrentTag()}`, i = this._byDepthAndTag.get(n);
|
|
822
|
-
if (i) {
|
|
823
|
-
for (let e = 0; e < i.length; e++) if (t.matches(i[e])) return i[e];
|
|
824
|
-
}
|
|
825
|
-
const s = this._wildcardByDepth.get(e);
|
|
826
|
-
if (s) {
|
|
827
|
-
for (let e = 0; e < s.length; e++) if (t.matches(s[e])) return s[e];
|
|
828
|
-
}
|
|
829
|
-
for (let e = 0; e < this._deepWildcards.length; e++) if (t.matches(this._deepWildcards[e])) return this._deepWildcards[e];
|
|
830
|
-
return null;
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
const U = {
|
|
834
|
-
cent: "¢",
|
|
835
|
-
pound: "£",
|
|
836
|
-
curren: "¤",
|
|
837
|
-
yen: "¥",
|
|
838
|
-
euro: "€",
|
|
839
|
-
dollar: "$",
|
|
840
|
-
euro: "€",
|
|
841
|
-
fnof: "ƒ",
|
|
842
|
-
inr: "₹",
|
|
843
|
-
af: "؋",
|
|
844
|
-
birr: "ብር",
|
|
845
|
-
peso: "₱",
|
|
846
|
-
rub: "₽",
|
|
847
|
-
won: "₩",
|
|
848
|
-
yuan: "¥",
|
|
849
|
-
cedil: "¸"
|
|
850
|
-
}, W = {
|
|
851
|
-
amp: "&",
|
|
852
|
-
apos: "'",
|
|
853
|
-
gt: ">",
|
|
854
|
-
lt: "<",
|
|
855
|
-
quot: "\""
|
|
856
|
-
}, X = {
|
|
857
|
-
nbsp: "\xA0",
|
|
858
|
-
copy: "©",
|
|
859
|
-
reg: "®",
|
|
860
|
-
trade: "™",
|
|
861
|
-
mdash: "—",
|
|
862
|
-
ndash: "–",
|
|
863
|
-
hellip: "…",
|
|
864
|
-
laquo: "«",
|
|
865
|
-
raquo: "»",
|
|
866
|
-
lsquo: "‘",
|
|
867
|
-
rsquo: "’",
|
|
868
|
-
ldquo: "“",
|
|
869
|
-
rdquo: "”",
|
|
870
|
-
bull: "•",
|
|
871
|
-
para: "¶",
|
|
872
|
-
sect: "§",
|
|
873
|
-
deg: "°",
|
|
874
|
-
frac12: "½",
|
|
875
|
-
frac14: "¼",
|
|
876
|
-
frac34: "¾"
|
|
877
|
-
}, Y = /* @__PURE__ */ new Set("!?\\\\/[]$%{}^&*()<>|+");
|
|
878
|
-
function z(t) {
|
|
879
|
-
if ("#" === t[0]) throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${t}"`);
|
|
880
|
-
for (const e of t) if (Y.has(e)) throw new Error(`[EntityReplacer] Invalid character '${e}' in entity name: "${t}"`);
|
|
881
|
-
return t;
|
|
882
|
-
}
|
|
883
|
-
function q(...t) {
|
|
884
|
-
const e = Object.create(null);
|
|
885
|
-
for (const n of t) if (n) for (const t of Object.keys(n)) {
|
|
886
|
-
const i = n[t];
|
|
887
|
-
if ("string" == typeof i) e[t] = i;
|
|
888
|
-
else if (i && "object" == typeof i && void 0 !== i.val) {
|
|
889
|
-
const n = i.val;
|
|
890
|
-
"string" == typeof n && (e[t] = n);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
return e;
|
|
894
|
-
}
|
|
895
|
-
const Z = "external", J = "base", K = "all", Q = Object.freeze({
|
|
896
|
-
allow: 0,
|
|
897
|
-
leave: 1,
|
|
898
|
-
remove: 2,
|
|
899
|
-
throw: 3
|
|
900
|
-
}), H = new Set([
|
|
901
|
-
9,
|
|
902
|
-
10,
|
|
903
|
-
13
|
|
904
|
-
]);
|
|
905
|
-
class tt {
|
|
906
|
-
constructor(t = {}) {
|
|
907
|
-
var e;
|
|
908
|
-
this._limit = t.limit || {}, this._maxTotalExpansions = this._limit.maxTotalExpansions || 0, this._maxExpandedLength = this._limit.maxExpandedLength || 0, this._postCheck = "function" == typeof t.postCheck ? t.postCheck : (t) => t, this._limitTiers = (e = this._limit.applyLimitsTo ?? Z) && e !== Z ? e === K ? new Set([K]) : e === J ? new Set([J]) : Array.isArray(e) ? new Set(e) : new Set([Z]) : new Set([Z]), this._numericAllowed = t.numericAllowed ?? !0, this._baseMap = q(W, t.namedEntities || null), this._externalMap = Object.create(null), this._inputMap = Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this._removeSet = new Set(t.remove && Array.isArray(t.remove) ? t.remove : []), this._leaveSet = new Set(t.leave && Array.isArray(t.leave) ? t.leave : []);
|
|
909
|
-
const n = function(t) {
|
|
910
|
-
if (!t) return {
|
|
911
|
-
xmlVersion: 1,
|
|
912
|
-
onLevel: Q.allow,
|
|
913
|
-
nullLevel: Q.remove
|
|
914
|
-
};
|
|
915
|
-
const e = 1.1 === t.xmlVersion ? 1.1 : 1, n = Q[t.onNCR] ?? Q.allow, i = Q[t.nullNCR] ?? Q.remove;
|
|
916
|
-
return {
|
|
917
|
-
xmlVersion: e,
|
|
918
|
-
onLevel: n,
|
|
919
|
-
nullLevel: Math.max(i, Q.remove)
|
|
920
|
-
};
|
|
921
|
-
}(t.ncr);
|
|
922
|
-
this._ncrXmlVersion = n.xmlVersion, this._ncrOnLevel = n.onLevel, this._ncrNullLevel = n.nullLevel;
|
|
923
|
-
}
|
|
924
|
-
setExternalEntities(t) {
|
|
925
|
-
if (t) for (const e of Object.keys(t)) z(e);
|
|
926
|
-
this._externalMap = q(t);
|
|
927
|
-
}
|
|
928
|
-
addExternalEntity(t, e) {
|
|
929
|
-
z(t), "string" == typeof e && -1 === e.indexOf("&") && (this._externalMap[t] = e);
|
|
930
|
-
}
|
|
931
|
-
addInputEntities(t) {
|
|
932
|
-
this._totalExpansions = 0, this._expandedLength = 0, this._inputMap = q(t);
|
|
933
|
-
}
|
|
934
|
-
reset() {
|
|
935
|
-
return this._inputMap = Object.create(null), this._totalExpansions = 0, this._expandedLength = 0, this;
|
|
936
|
-
}
|
|
937
|
-
setXmlVersion(t) {
|
|
938
|
-
this._ncrXmlVersion = 1.1 === t ? 1.1 : 1;
|
|
939
|
-
}
|
|
940
|
-
decode(t) {
|
|
941
|
-
if ("string" != typeof t || 0 === t.length) return t;
|
|
942
|
-
const e = t, n = [], i = t.length;
|
|
943
|
-
let s = 0, r = 0;
|
|
944
|
-
const o = this._maxTotalExpansions > 0, a = this._maxExpandedLength > 0, h = o || a;
|
|
945
|
-
for (; r < i;) {
|
|
946
|
-
if (38 !== t.charCodeAt(r)) {
|
|
947
|
-
r++;
|
|
948
|
-
continue;
|
|
949
|
-
}
|
|
950
|
-
let e = r + 1;
|
|
951
|
-
for (; e < i && 59 !== t.charCodeAt(e) && e - r <= 32;) e++;
|
|
952
|
-
if (e >= i || 59 !== t.charCodeAt(e)) {
|
|
953
|
-
r++;
|
|
954
|
-
continue;
|
|
955
|
-
}
|
|
956
|
-
const l = t.slice(r + 1, e);
|
|
957
|
-
if (0 === l.length) {
|
|
958
|
-
r++;
|
|
959
|
-
continue;
|
|
960
|
-
}
|
|
961
|
-
let u, p;
|
|
962
|
-
if (this._removeSet.has(l)) u = "", void 0 === p && (p = Z);
|
|
963
|
-
else {
|
|
964
|
-
if (this._leaveSet.has(l)) {
|
|
965
|
-
r++;
|
|
966
|
-
continue;
|
|
967
|
-
}
|
|
968
|
-
if (35 === l.charCodeAt(0)) {
|
|
969
|
-
const t = this._resolveNCR(l);
|
|
970
|
-
if (void 0 === t) {
|
|
971
|
-
r++;
|
|
972
|
-
continue;
|
|
973
|
-
}
|
|
974
|
-
u = t, p = J;
|
|
975
|
-
} else {
|
|
976
|
-
const t = this._resolveName(l);
|
|
977
|
-
u = t?.value, p = t?.tier;
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
if (void 0 !== u) {
|
|
981
|
-
if (r > s && n.push(t.slice(s, r)), n.push(u), s = e + 1, r = s, h && this._tierCounts(p)) {
|
|
982
|
-
if (o && (this._totalExpansions++, this._totalExpansions > this._maxTotalExpansions)) throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);
|
|
983
|
-
if (a) {
|
|
984
|
-
const t = u.length - (l.length + 2);
|
|
985
|
-
if (t > 0 && (this._expandedLength += t, this._expandedLength > this._maxExpandedLength)) throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
} else r++;
|
|
989
|
-
}
|
|
990
|
-
s < i && n.push(t.slice(s));
|
|
991
|
-
const l = 0 === n.length ? t : n.join("");
|
|
992
|
-
return this._postCheck(l, e);
|
|
993
|
-
}
|
|
994
|
-
_tierCounts(t) {
|
|
995
|
-
return !!this._limitTiers.has(K) || this._limitTiers.has(t);
|
|
996
|
-
}
|
|
997
|
-
_resolveName(t) {
|
|
998
|
-
return t in this._inputMap ? {
|
|
999
|
-
value: this._inputMap[t],
|
|
1000
|
-
tier: Z
|
|
1001
|
-
} : t in this._externalMap ? {
|
|
1002
|
-
value: this._externalMap[t],
|
|
1003
|
-
tier: Z
|
|
1004
|
-
} : t in this._baseMap ? {
|
|
1005
|
-
value: this._baseMap[t],
|
|
1006
|
-
tier: J
|
|
1007
|
-
} : void 0;
|
|
1008
|
-
}
|
|
1009
|
-
_classifyNCR(t) {
|
|
1010
|
-
return 0 === t ? this._ncrNullLevel : t >= 55296 && t <= 57343 || 1 === this._ncrXmlVersion && t >= 1 && t <= 31 && !H.has(t) ? Q.remove : -1;
|
|
1011
|
-
}
|
|
1012
|
-
_applyNCRAction(t, e, n) {
|
|
1013
|
-
switch (t) {
|
|
1014
|
-
case Q.allow: return String.fromCodePoint(n);
|
|
1015
|
-
case Q.remove: return "";
|
|
1016
|
-
case Q.leave: return;
|
|
1017
|
-
case Q.throw: throw new Error(`[EntityDecoder] Prohibited numeric character reference &${e}; (U+${n.toString(16).toUpperCase().padStart(4, "0")})`);
|
|
1018
|
-
default: return String.fromCodePoint(n);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
_resolveNCR(t) {
|
|
1022
|
-
const e = t.charCodeAt(1);
|
|
1023
|
-
let n;
|
|
1024
|
-
if (n = 120 === e || 88 === e ? parseInt(t.slice(2), 16) : parseInt(t.slice(1), 10), Number.isNaN(n) || n < 0 || n > 1114111) return;
|
|
1025
|
-
const i = this._classifyNCR(n);
|
|
1026
|
-
if (!this._numericAllowed && i < Q.remove) return;
|
|
1027
|
-
const s = -1 === i ? this._ncrOnLevel : Math.max(this._ncrOnLevel, i);
|
|
1028
|
-
return this._applyNCRAction(s, t, n);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
function et(t, e) {
|
|
1032
|
-
if (!t) return {};
|
|
1033
|
-
const n = e.attributesGroupName ? t[e.attributesGroupName] : t;
|
|
1034
|
-
if (!n) return {};
|
|
1035
|
-
const i = {};
|
|
1036
|
-
for (const t in n) t.startsWith(e.attributeNamePrefix) ? i[t.substring(e.attributeNamePrefix.length)] = n[t] : i[t] = n[t];
|
|
1037
|
-
return i;
|
|
1038
|
-
}
|
|
1039
|
-
function nt(t) {
|
|
1040
|
-
if (!t || "string" != typeof t) return;
|
|
1041
|
-
const e = t.indexOf(":");
|
|
1042
|
-
if (-1 !== e && e > 0) {
|
|
1043
|
-
const n = t.substring(0, e);
|
|
1044
|
-
if ("xmlns" !== n) return n;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
class it {
|
|
1048
|
-
constructor(t) {
|
|
1049
|
-
var e;
|
|
1050
|
-
this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.parseXml = ht, this.parseTextData = st, this.resolveNameSpace = rt, this.buildAttributesMap = at, this.isItStopNode = ct, this.replaceEntitiesValue = ut, this.readStopNodeData = mt, this.saveTextToParentTag = pt, this.addChild = lt, this.ignoreAttributesFn = "function" == typeof (e = this.options.ignoreAttributes) ? e : Array.isArray(e) ? (t) => {
|
|
1051
|
-
for (const n of e) {
|
|
1052
|
-
if ("string" == typeof n && t === n) return !0;
|
|
1053
|
-
if (n instanceof RegExp && n.test(t)) return !0;
|
|
1054
|
-
}
|
|
1055
|
-
} : () => !1, this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
1056
|
-
let n = { ...W };
|
|
1057
|
-
this.options.entityDecoder ? this.entityDecoder = this.options.entityDecoder : ("object" == typeof this.options.htmlEntities ? n = this.options.htmlEntities : !0 === this.options.htmlEntities && (n = {
|
|
1058
|
-
...X,
|
|
1059
|
-
...U
|
|
1060
|
-
}), this.entityDecoder = new tt({
|
|
1061
|
-
namedEntities: n,
|
|
1062
|
-
numericAllowed: this.options.htmlEntities,
|
|
1063
|
-
limit: {
|
|
1064
|
-
maxTotalExpansions: this.options.processEntities.maxTotalExpansions,
|
|
1065
|
-
maxExpandedLength: this.options.processEntities.maxExpandedLength,
|
|
1066
|
-
applyLimitsTo: this.options.processEntities.appliesTo
|
|
1067
|
-
}
|
|
1068
|
-
})), this.matcher = new R(), this.readonlyMatcher = this.matcher.readOnly(), this.isCurrentNodeStopNode = !1, this.stopNodeExpressionsSet = new B();
|
|
1069
|
-
const i = this.options.stopNodes;
|
|
1070
|
-
if (i && i.length > 0) {
|
|
1071
|
-
for (let t = 0; t < i.length; t++) {
|
|
1072
|
-
const e = i[t];
|
|
1073
|
-
"string" == typeof e ? this.stopNodeExpressionsSet.add(new G(e)) : e instanceof G && this.stopNodeExpressionsSet.add(e);
|
|
1074
|
-
}
|
|
1075
|
-
this.stopNodeExpressionsSet.seal();
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
function st(t, e, n, i, s, r, o) {
|
|
1080
|
-
const a = this.options;
|
|
1081
|
-
if (void 0 !== t && (a.trimValues && !i && (t = t.trim()), t.length > 0)) {
|
|
1082
|
-
o || (t = this.replaceEntitiesValue(t, e, n));
|
|
1083
|
-
const i = a.jPath ? n.toString() : n, h = a.tagValueProcessor(e, t, i, s, r);
|
|
1084
|
-
return null == h ? t : typeof h != typeof t || h !== t ? h : a.trimValues || t.trim() === t ? xt(t, a.parseTagValue, a.numberParseOptions) : t;
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
function rt(t) {
|
|
1088
|
-
if (this.options.removeNSPrefix) {
|
|
1089
|
-
const e = t.split(":"), n = "/" === t.charAt(0) ? "/" : "";
|
|
1090
|
-
if ("xmlns" === e[0]) return "";
|
|
1091
|
-
2 === e.length && (t = n + e[1]);
|
|
1092
|
-
}
|
|
1093
|
-
return t;
|
|
1094
|
-
}
|
|
1095
|
-
const ot = /* @__PURE__ */ new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
1096
|
-
function at(t, e, n, i = !1) {
|
|
1097
|
-
const r = this.options;
|
|
1098
|
-
if (!0 === i || !0 !== r.ignoreAttributes && "string" == typeof t) {
|
|
1099
|
-
const i = s(t, ot), o = i.length, a = {}, h = new Array(o);
|
|
1100
|
-
let l = !1;
|
|
1101
|
-
const u = {};
|
|
1102
|
-
for (let t = 0; t < o; t++) {
|
|
1103
|
-
const e = this.resolveNameSpace(i[t][1]), s = i[t][4];
|
|
1104
|
-
if (e.length && void 0 !== s) {
|
|
1105
|
-
let i = s;
|
|
1106
|
-
r.trimValues && (i = i.trim()), i = this.replaceEntitiesValue(i, n, this.readonlyMatcher), h[t] = i, u[e] = i, l = !0;
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
l && "object" == typeof e && e.updateCurrent && e.updateCurrent(u);
|
|
1110
|
-
const p = r.jPath ? e.toString() : this.readonlyMatcher;
|
|
1111
|
-
let c = !1;
|
|
1112
|
-
for (let t = 0; t < o; t++) {
|
|
1113
|
-
const e = this.resolveNameSpace(i[t][1]);
|
|
1114
|
-
if (this.ignoreAttributesFn(e, p)) continue;
|
|
1115
|
-
let n = r.attributeNamePrefix + e;
|
|
1116
|
-
if (e.length) if (r.transformAttributeName && (n = r.transformAttributeName(n)), n = bt(n, r), void 0 !== i[t][4]) {
|
|
1117
|
-
const i = h[t], s = r.attributeValueProcessor(e, i, p);
|
|
1118
|
-
a[n] = null == s ? i : typeof s != typeof i || s !== i ? s : xt(i, r.parseAttributeValue, r.numberParseOptions), c = !0;
|
|
1119
|
-
} else r.allowBooleanAttributes && (a[n] = !0, c = !0);
|
|
1120
|
-
}
|
|
1121
|
-
if (!c) return;
|
|
1122
|
-
if (r.attributesGroupName) {
|
|
1123
|
-
const t = {};
|
|
1124
|
-
return t[r.attributesGroupName] = a, t;
|
|
1125
|
-
}
|
|
1126
|
-
return a;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
const ht = function(t) {
|
|
1130
|
-
t = t.replace(/\r\n?/g, "\n");
|
|
1131
|
-
const e = new O("!xml");
|
|
1132
|
-
let n = e, i = "";
|
|
1133
|
-
this.matcher.reset(), this.entityDecoder.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
1134
|
-
const s = this.options, r = new $(s.processEntities), o = t.length;
|
|
1135
|
-
for (let a = 0; a < o; a++) if ("<" === t[a]) {
|
|
1136
|
-
const h = t.charCodeAt(a + 1);
|
|
1137
|
-
if (47 === h) {
|
|
1138
|
-
const e = dt(t, ">", a, "Closing Tag is not closed.");
|
|
1139
|
-
let r = t.substring(a + 2, e).trim();
|
|
1140
|
-
if (s.removeNSPrefix) {
|
|
1141
|
-
const t = r.indexOf(":");
|
|
1142
|
-
-1 !== t && (r = r.substr(t + 1));
|
|
1143
|
-
}
|
|
1144
|
-
r = Nt(s.transformTagName, r, "", s).tagName, n && (i = this.saveTextToParentTag(i, n, this.readonlyMatcher));
|
|
1145
|
-
const o = this.matcher.getCurrentTag();
|
|
1146
|
-
if (r && s.unpairedTagsSet.has(r)) throw new Error(`Unpaired tag can not be used as closing tag: </${r}>`);
|
|
1147
|
-
o && s.unpairedTagsSet.has(o) && (this.matcher.pop(), this.tagsNodeStack.pop()), this.matcher.pop(), this.isCurrentNodeStopNode = !1, n = this.tagsNodeStack.pop(), i = "", a = e;
|
|
1148
|
-
} else if (63 === h) {
|
|
1149
|
-
let e = gt(t, a, !1, "?>");
|
|
1150
|
-
if (!e) throw new Error("Pi Tag is not closed.");
|
|
1151
|
-
i = this.saveTextToParentTag(i, n, this.readonlyMatcher);
|
|
1152
|
-
const r = this.buildAttributesMap(e.tagExp, this.matcher, e.tagName, !0);
|
|
1153
|
-
if (r) {
|
|
1154
|
-
const t = r[this.options.attributeNamePrefix + "version"];
|
|
1155
|
-
this.entityDecoder.setXmlVersion(Number(t) || 1);
|
|
1156
|
-
}
|
|
1157
|
-
if (s.ignoreDeclaration && "?xml" === e.tagName || s.ignorePiTags);
|
|
1158
|
-
else {
|
|
1159
|
-
const t = new O(e.tagName);
|
|
1160
|
-
t.add(s.textNodeName, ""), e.tagName !== e.tagExp && e.attrExpPresent && !0 !== s.ignoreAttributes && (t[":@"] = r), this.addChild(n, t, this.readonlyMatcher, a);
|
|
1161
|
-
}
|
|
1162
|
-
a = e.closeIndex + 1;
|
|
1163
|
-
} else if (33 === h && 45 === t.charCodeAt(a + 2) && 45 === t.charCodeAt(a + 3)) {
|
|
1164
|
-
const e = dt(t, "-->", a + 4, "Comment is not closed.");
|
|
1165
|
-
if (s.commentPropName) {
|
|
1166
|
-
const r = t.substring(a + 4, e - 2);
|
|
1167
|
-
i = this.saveTextToParentTag(i, n, this.readonlyMatcher), n.add(s.commentPropName, [{ [s.textNodeName]: r }]);
|
|
1168
|
-
}
|
|
1169
|
-
a = e;
|
|
1170
|
-
} else if (33 === h && 68 === t.charCodeAt(a + 2)) {
|
|
1171
|
-
const e = r.readDocType(t, a);
|
|
1172
|
-
this.entityDecoder.addInputEntities(e.entities), a = e.i;
|
|
1173
|
-
} else if (33 === h && 91 === t.charCodeAt(a + 2)) {
|
|
1174
|
-
const e = dt(t, "]]>", a, "CDATA is not closed.") - 2, r = t.substring(a + 9, e);
|
|
1175
|
-
i = this.saveTextToParentTag(i, n, this.readonlyMatcher);
|
|
1176
|
-
let o = this.parseTextData(r, n.tagname, this.readonlyMatcher, !0, !1, !0, !0);
|
|
1177
|
-
o ??= "", s.cdataPropName ? n.add(s.cdataPropName, [{ [s.textNodeName]: r }]) : n.add(s.textNodeName, o), a = e + 2;
|
|
1178
|
-
} else {
|
|
1179
|
-
let r = gt(t, a, s.removeNSPrefix);
|
|
1180
|
-
if (!r) {
|
|
1181
|
-
const e = t.substring(Math.max(0, a - 50), Math.min(o, a + 50));
|
|
1182
|
-
throw new Error(`readTagExp returned undefined at position ${a}. Context: "${e}"`);
|
|
1183
|
-
}
|
|
1184
|
-
let h = r.tagName;
|
|
1185
|
-
const l = r.rawTagName;
|
|
1186
|
-
let u = r.tagExp, p = r.attrExpPresent, c = r.closeIndex;
|
|
1187
|
-
if ({tagName: h, tagExp: u} = Nt(s.transformTagName, h, u, s), s.strictReservedNames && (h === s.commentPropName || h === s.cdataPropName || h === s.textNodeName || h === s.attributesGroupName)) throw new Error(`Invalid tag name: ${h}`);
|
|
1188
|
-
n && i && "!xml" !== n.tagname && (i = this.saveTextToParentTag(i, n, this.readonlyMatcher, !1));
|
|
1189
|
-
const d = n;
|
|
1190
|
-
d && s.unpairedTagsSet.has(d.tagname) && (n = this.tagsNodeStack.pop(), this.matcher.pop());
|
|
1191
|
-
let f = !1;
|
|
1192
|
-
u.length > 0 && u.lastIndexOf("/") === u.length - 1 && (f = !0, "/" === h[h.length - 1] ? (h = h.substr(0, h.length - 1), u = h) : u = u.substr(0, u.length - 1), p = h !== u);
|
|
1193
|
-
let g, m = null;
|
|
1194
|
-
g = nt(l), h !== e.tagname && this.matcher.push(h, {}, g), h !== u && p && (m = this.buildAttributesMap(u, this.matcher, h), m && et(m, s)), h !== e.tagname && (this.isCurrentNodeStopNode = this.isItStopNode());
|
|
1195
|
-
const N = a;
|
|
1196
|
-
if (this.isCurrentNodeStopNode) {
|
|
1197
|
-
let e = "";
|
|
1198
|
-
if (f) a = r.closeIndex;
|
|
1199
|
-
else if (s.unpairedTagsSet.has(h)) a = r.closeIndex;
|
|
1200
|
-
else {
|
|
1201
|
-
const n = this.readStopNodeData(t, l, c + 1);
|
|
1202
|
-
if (!n) throw new Error(`Unexpected end of ${l}`);
|
|
1203
|
-
a = n.i, e = n.tagContent;
|
|
1204
|
-
}
|
|
1205
|
-
const i = new O(h);
|
|
1206
|
-
m && (i[":@"] = m), i.add(s.textNodeName, e), this.matcher.pop(), this.isCurrentNodeStopNode = !1, this.addChild(n, i, this.readonlyMatcher, N);
|
|
1207
|
-
} else {
|
|
1208
|
-
if (f) {
|
|
1209
|
-
({tagName: h, tagExp: u} = Nt(s.transformTagName, h, u, s));
|
|
1210
|
-
const t = new O(h);
|
|
1211
|
-
m && (t[":@"] = m), this.addChild(n, t, this.readonlyMatcher, N), this.matcher.pop(), this.isCurrentNodeStopNode = !1;
|
|
1212
|
-
} else {
|
|
1213
|
-
if (s.unpairedTagsSet.has(h)) {
|
|
1214
|
-
const t = new O(h);
|
|
1215
|
-
m && (t[":@"] = m), this.addChild(n, t, this.readonlyMatcher, N), this.matcher.pop(), this.isCurrentNodeStopNode = !1, a = r.closeIndex;
|
|
1216
|
-
continue;
|
|
1217
|
-
}
|
|
1218
|
-
{
|
|
1219
|
-
const t = new O(h);
|
|
1220
|
-
if (this.tagsNodeStack.length > s.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
1221
|
-
this.tagsNodeStack.push(n), m && (t[":@"] = m), this.addChild(n, t, this.readonlyMatcher, N), n = t;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
i = "", a = c;
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
} else i += t[a];
|
|
1228
|
-
return e.child;
|
|
1229
|
-
};
|
|
1230
|
-
function lt(t, e, n, i) {
|
|
1231
|
-
this.options.captureMetaData || (i = void 0);
|
|
1232
|
-
const s = this.options.jPath ? n.toString() : n, r = this.options.updateTag(e.tagname, s, e[":@"]);
|
|
1233
|
-
!1 === r || ("string" == typeof r ? (e.tagname = r, t.addChild(e, i)) : t.addChild(e, i));
|
|
1234
|
-
}
|
|
1235
|
-
function ut(t, e, n) {
|
|
1236
|
-
const i = this.options.processEntities;
|
|
1237
|
-
if (!i || !i.enabled) return t;
|
|
1238
|
-
if (i.allowedTags) {
|
|
1239
|
-
const s = this.options.jPath ? n.toString() : n;
|
|
1240
|
-
if (!(Array.isArray(i.allowedTags) ? i.allowedTags.includes(e) : i.allowedTags(e, s))) return t;
|
|
1241
|
-
}
|
|
1242
|
-
if (i.tagFilter) {
|
|
1243
|
-
const s = this.options.jPath ? n.toString() : n;
|
|
1244
|
-
if (!i.tagFilter(e, s)) return t;
|
|
1245
|
-
}
|
|
1246
|
-
return this.entityDecoder.decode(t);
|
|
1247
|
-
}
|
|
1248
|
-
function pt(t, e, n, i) {
|
|
1249
|
-
return t && (void 0 === i && (i = 0 === e.child.length), void 0 !== (t = this.parseTextData(t, e.tagname, n, !1, !!e[":@"] && 0 !== Object.keys(e[":@"]).length, i)) && "" !== t && e.add(this.options.textNodeName, t), t = ""), t;
|
|
1250
|
-
}
|
|
1251
|
-
function ct() {
|
|
1252
|
-
return 0 !== this.stopNodeExpressionsSet.size && this.matcher.matchesAny(this.stopNodeExpressionsSet);
|
|
1253
|
-
}
|
|
1254
|
-
function dt(t, e, n, i) {
|
|
1255
|
-
const s = t.indexOf(e, n);
|
|
1256
|
-
if (-1 === s) throw new Error(i);
|
|
1257
|
-
return s + e.length - 1;
|
|
1258
|
-
}
|
|
1259
|
-
function ft(t, e, n, i) {
|
|
1260
|
-
const s = t.indexOf(e, n);
|
|
1261
|
-
if (-1 === s) throw new Error(i);
|
|
1262
|
-
return s;
|
|
1263
|
-
}
|
|
1264
|
-
function gt(t, e, n, i = ">") {
|
|
1265
|
-
const s = function(t, e, n = ">") {
|
|
1266
|
-
let i = 0;
|
|
1267
|
-
const s = [], r = t.length, o = n.charCodeAt(0), a = n.length > 1 ? n.charCodeAt(1) : -1;
|
|
1268
|
-
for (let n = e; n < r; n++) {
|
|
1269
|
-
const e = t.charCodeAt(n);
|
|
1270
|
-
if (i) e === i && (i = 0);
|
|
1271
|
-
else if (34 === e || 39 === e) i = e;
|
|
1272
|
-
else if (e === o) {
|
|
1273
|
-
if (-1 === a) return {
|
|
1274
|
-
data: String.fromCharCode(...s),
|
|
1275
|
-
index: n
|
|
1276
|
-
};
|
|
1277
|
-
if (t.charCodeAt(n + 1) === a) return {
|
|
1278
|
-
data: String.fromCharCode(...s),
|
|
1279
|
-
index: n
|
|
1280
|
-
};
|
|
1281
|
-
} else if (9 === e) {
|
|
1282
|
-
s.push(32);
|
|
1283
|
-
continue;
|
|
1284
|
-
}
|
|
1285
|
-
s.push(e);
|
|
1286
|
-
}
|
|
1287
|
-
}(t, e + 1, i);
|
|
1288
|
-
if (!s) return;
|
|
1289
|
-
let r = s.data;
|
|
1290
|
-
const o = s.index, a = r.search(/\s/);
|
|
1291
|
-
let h = r, l = !0;
|
|
1292
|
-
-1 !== a && (h = r.substring(0, a), r = r.substring(a + 1).trimStart());
|
|
1293
|
-
const u = h;
|
|
1294
|
-
if (n) {
|
|
1295
|
-
const t = h.indexOf(":");
|
|
1296
|
-
-1 !== t && (h = h.substr(t + 1), l = h !== s.data.substr(t + 1));
|
|
1297
|
-
}
|
|
1298
|
-
return {
|
|
1299
|
-
tagName: h,
|
|
1300
|
-
tagExp: r,
|
|
1301
|
-
closeIndex: o,
|
|
1302
|
-
attrExpPresent: l,
|
|
1303
|
-
rawTagName: u
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
function mt(t, e, n) {
|
|
1307
|
-
const i = n;
|
|
1308
|
-
let s = 1;
|
|
1309
|
-
const r = t.length;
|
|
1310
|
-
for (; n < r; n++) if ("<" === t[n]) {
|
|
1311
|
-
const r = t.charCodeAt(n + 1);
|
|
1312
|
-
if (47 === r) {
|
|
1313
|
-
const r = ft(t, ">", n, `${e} is not closed`);
|
|
1314
|
-
if (t.substring(n + 2, r).trim() === e && (s--, 0 === s)) return {
|
|
1315
|
-
tagContent: t.substring(i, n),
|
|
1316
|
-
i: r
|
|
1317
|
-
};
|
|
1318
|
-
n = r;
|
|
1319
|
-
} else if (63 === r) n = dt(t, "?>", n + 1, "StopNode is not closed.");
|
|
1320
|
-
else if (33 === r && 45 === t.charCodeAt(n + 2) && 45 === t.charCodeAt(n + 3)) n = dt(t, "-->", n + 3, "StopNode is not closed.");
|
|
1321
|
-
else if (33 === r && 91 === t.charCodeAt(n + 2)) n = dt(t, "]]>", n, "StopNode is not closed.") - 2;
|
|
1322
|
-
else {
|
|
1323
|
-
const i = gt(t, n, ">");
|
|
1324
|
-
i && ((i && i.tagName) === e && "/" !== i.tagExp[i.tagExp.length - 1] && s++, n = i.closeIndex);
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
function xt(t, e, n) {
|
|
1329
|
-
if (e && "string" == typeof t) {
|
|
1330
|
-
const e = t.trim();
|
|
1331
|
-
return "true" === e || "false" !== e && function(t, e = {}) {
|
|
1332
|
-
if (e = Object.assign({}, L, e), !t || "string" != typeof t) return t;
|
|
1333
|
-
let n = t.trim();
|
|
1334
|
-
if (0 === n.length) return t;
|
|
1335
|
-
if (void 0 !== e.skipLike && e.skipLike.test(n)) return t;
|
|
1336
|
-
if ("0" === n) return 0;
|
|
1337
|
-
if (e.hex && j.test(n)) return function(t) {
|
|
1338
|
-
if (parseInt) return parseInt(t, 16);
|
|
1339
|
-
if (Number.parseInt) return Number.parseInt(t, 16);
|
|
1340
|
-
if (window && window.parseInt) return window.parseInt(t, 16);
|
|
1341
|
-
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
1342
|
-
}(n);
|
|
1343
|
-
if (isFinite(n)) {
|
|
1344
|
-
if (n.includes("e") || n.includes("E")) return function(t, e, n) {
|
|
1345
|
-
if (!n.eNotation) return t;
|
|
1346
|
-
const i = e.match(k);
|
|
1347
|
-
if (i) {
|
|
1348
|
-
let s = i[1] || "";
|
|
1349
|
-
const r = -1 === i[3].indexOf("e") ? "E" : "e", o = i[2], a = s ? t[o.length + 1] === r : t[o.length] === r;
|
|
1350
|
-
return o.length > 1 && a ? t : (1 !== o.length || !i[3].startsWith(`.${r}`) && i[3][0] !== r) && o.length > 0 ? n.leadingZeros && !a ? (e = (i[1] || "") + i[3], Number(e)) : t : Number(e);
|
|
1351
|
-
}
|
|
1352
|
-
return t;
|
|
1353
|
-
}(t, n, e);
|
|
1354
|
-
{
|
|
1355
|
-
const s = V.exec(n);
|
|
1356
|
-
if (s) {
|
|
1357
|
-
const r = s[1] || "", o = s[2];
|
|
1358
|
-
let a = (i = s[3]) && -1 !== i.indexOf(".") ? ("." === (i = i.replace(/0+$/, "")) ? i = "0" : "." === i[0] ? i = "0" + i : "." === i[i.length - 1] && (i = i.substring(0, i.length - 1)), i) : i;
|
|
1359
|
-
const h = r ? "." === t[o.length + 1] : "." === t[o.length];
|
|
1360
|
-
if (!e.leadingZeros && (o.length > 1 || 1 === o.length && !h)) return t;
|
|
1361
|
-
{
|
|
1362
|
-
const i = Number(n), s = String(i);
|
|
1363
|
-
if (0 === i) return i;
|
|
1364
|
-
if (-1 !== s.search(/[eE]/)) return e.eNotation ? i : t;
|
|
1365
|
-
if (-1 !== n.indexOf(".")) return "0" === s || s === a || s === `${r}${a}` ? i : t;
|
|
1366
|
-
let h = o ? a : n;
|
|
1367
|
-
return o ? h === s || r + h === s ? i : t : h === s || h === r + s ? i : t;
|
|
1368
|
-
}
|
|
1369
|
-
}
|
|
1370
|
-
return t;
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
var i;
|
|
1374
|
-
return function(t, e, n) {
|
|
1375
|
-
const i = e === Infinity;
|
|
1376
|
-
switch (n.infinity.toLowerCase()) {
|
|
1377
|
-
case "null": return null;
|
|
1378
|
-
case "infinity": return e;
|
|
1379
|
-
case "string": return i ? "Infinity" : "-Infinity";
|
|
1380
|
-
default: return t;
|
|
1381
|
-
}
|
|
1382
|
-
}(t, Number(n), e);
|
|
1383
|
-
}(t, n);
|
|
1384
|
-
}
|
|
1385
|
-
return void 0 !== t ? t : "";
|
|
1386
|
-
}
|
|
1387
|
-
function Nt(t, e, n, i) {
|
|
1388
|
-
if (t) {
|
|
1389
|
-
const i = t(e);
|
|
1390
|
-
n === e && (n = i), e = i;
|
|
1391
|
-
}
|
|
1392
|
-
return {
|
|
1393
|
-
tagName: e = bt(e, i),
|
|
1394
|
-
tagExp: n
|
|
1395
|
-
};
|
|
1396
|
-
}
|
|
1397
|
-
function bt(t, e) {
|
|
1398
|
-
if (a.includes(t)) throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);
|
|
1399
|
-
return o.includes(t) ? e.onDangerousProperty(t) : t;
|
|
1400
|
-
}
|
|
1401
|
-
const yt = O.getMetaDataSymbol();
|
|
1402
|
-
function Et(t, e) {
|
|
1403
|
-
if (!t || "object" != typeof t) return {};
|
|
1404
|
-
if (!e) return t;
|
|
1405
|
-
const n = {};
|
|
1406
|
-
for (const i in t) i.startsWith(e) ? n[i.substring(e.length)] = t[i] : n[i] = t[i];
|
|
1407
|
-
return n;
|
|
1408
|
-
}
|
|
1409
|
-
function wt(t, e, n, i) {
|
|
1410
|
-
return vt(t, e, n, i);
|
|
1411
|
-
}
|
|
1412
|
-
function vt(t, e, n, i) {
|
|
1413
|
-
let s;
|
|
1414
|
-
const r = {};
|
|
1415
|
-
for (let o = 0; o < t.length; o++) {
|
|
1416
|
-
const a = t[o], h = St(a);
|
|
1417
|
-
if (void 0 !== h && h !== e.textNodeName) {
|
|
1418
|
-
const t = Et(a[":@"] || {}, e.attributeNamePrefix);
|
|
1419
|
-
n.push(h, t);
|
|
1420
|
-
}
|
|
1421
|
-
if (h === e.textNodeName) void 0 === s ? s = a[h] : s += "" + a[h];
|
|
1422
|
-
else {
|
|
1423
|
-
if (void 0 === h) continue;
|
|
1424
|
-
if (a[h]) {
|
|
1425
|
-
let t = vt(a[h], e, n, i);
|
|
1426
|
-
const s = At(t, e);
|
|
1427
|
-
if (a[":@"] ? _t(t, a[":@"], i, e) : 1 !== Object.keys(t).length || void 0 === t[e.textNodeName] || e.alwaysCreateTextNode ? 0 === Object.keys(t).length && (e.alwaysCreateTextNode ? t[e.textNodeName] = "" : t = "") : t = t[e.textNodeName], void 0 !== a[yt] && "object" == typeof t && null !== t && (t[yt] = a[yt]), void 0 !== r[h] && Object.prototype.hasOwnProperty.call(r, h)) Array.isArray(r[h]) || (r[h] = [r[h]]), r[h].push(t);
|
|
1428
|
-
else {
|
|
1429
|
-
const n = e.jPath ? i.toString() : i;
|
|
1430
|
-
e.isArray(h, n, s) ? r[h] = [t] : r[h] = t;
|
|
1431
|
-
}
|
|
1432
|
-
void 0 !== h && h !== e.textNodeName && n.pop();
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
return "string" == typeof s ? s.length > 0 && (r[e.textNodeName] = s) : void 0 !== s && (r[e.textNodeName] = s), r;
|
|
1437
|
-
}
|
|
1438
|
-
function St(t) {
|
|
1439
|
-
const e = Object.keys(t);
|
|
1440
|
-
for (let t = 0; t < e.length; t++) {
|
|
1441
|
-
const n = e[t];
|
|
1442
|
-
if (":@" !== n) return n;
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
function _t(t, e, n, i) {
|
|
1446
|
-
if (e) {
|
|
1447
|
-
const s = Object.keys(e), r = s.length;
|
|
1448
|
-
for (let o = 0; o < r; o++) {
|
|
1449
|
-
const r = s[o], a = r.startsWith(i.attributeNamePrefix) ? r.substring(i.attributeNamePrefix.length) : r, h = i.jPath ? n.toString() + "." + a : n;
|
|
1450
|
-
i.isArray(r, h, !0, !0) ? t[r] = [e[r]] : t[r] = e[r];
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
function At(t, e) {
|
|
1455
|
-
const { textNodeName: n } = e, i = Object.keys(t).length;
|
|
1456
|
-
return 0 === i || !(1 !== i || !t[n] && "boolean" != typeof t[n] && 0 !== t[n]);
|
|
1457
|
-
}
|
|
1458
|
-
class Tt {
|
|
1459
|
-
constructor(t) {
|
|
1460
|
-
this.externalEntities = {}, this.options = C(t);
|
|
1461
|
-
}
|
|
1462
|
-
parse(t, e) {
|
|
1463
|
-
if ("string" != typeof t && t.toString) t = t.toString();
|
|
1464
|
-
else if ("string" != typeof t) throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1465
|
-
if (e) {
|
|
1466
|
-
!0 === e && (e = {});
|
|
1467
|
-
const n = l(t, e);
|
|
1468
|
-
if (!0 !== n) throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`);
|
|
1469
|
-
}
|
|
1470
|
-
const n = new it(this.options);
|
|
1471
|
-
n.entityDecoder.setExternalEntities(this.externalEntities);
|
|
1472
|
-
const i = n.parseXml(t);
|
|
1473
|
-
return this.options.preserveOrder || void 0 === i ? i : wt(i, this.options, n.matcher, n.readonlyMatcher);
|
|
1474
|
-
}
|
|
1475
|
-
addEntity(t, e) {
|
|
1476
|
-
if (-1 !== e.indexOf("&")) throw new Error("Entity value can't have '&'");
|
|
1477
|
-
if (-1 !== t.indexOf("&") || -1 !== t.indexOf(";")) throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
1478
|
-
if ("&" === e) throw new Error("An entity with value '&' is not permitted");
|
|
1479
|
-
this.externalEntities[t] = e;
|
|
1480
|
-
}
|
|
1481
|
-
static getMetaDataSymbol() {
|
|
1482
|
-
return O.getMetaDataSymbol();
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
function Ct(t, e) {
|
|
1486
|
-
let n = "";
|
|
1487
|
-
e.format && e.indentBy.length > 0 && (n = "\n");
|
|
1488
|
-
const i = [];
|
|
1489
|
-
if (e.stopNodes && Array.isArray(e.stopNodes)) for (let t = 0; t < e.stopNodes.length; t++) {
|
|
1490
|
-
const n = e.stopNodes[t];
|
|
1491
|
-
"string" == typeof n ? i.push(new G(n)) : n instanceof G && i.push(n);
|
|
1492
|
-
}
|
|
1493
|
-
return Pt(t, e, n, new R(), i);
|
|
1494
|
-
}
|
|
1495
|
-
function Pt(t, e, n, i, s) {
|
|
1496
|
-
let r = "", o = !1;
|
|
1497
|
-
if (e.maxNestedTags && i.getDepth() > e.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
1498
|
-
if (!Array.isArray(t)) {
|
|
1499
|
-
if (null != t) {
|
|
1500
|
-
let n = t.toString();
|
|
1501
|
-
return n = Vt(n, e), n;
|
|
1502
|
-
}
|
|
1503
|
-
return "";
|
|
1504
|
-
}
|
|
1505
|
-
for (let a = 0; a < t.length; a++) {
|
|
1506
|
-
const h = t[a], l = Dt(h);
|
|
1507
|
-
if (void 0 === l) continue;
|
|
1508
|
-
const u = Ot(h[":@"], e);
|
|
1509
|
-
i.push(l, u);
|
|
1510
|
-
const p = jt(i, s);
|
|
1511
|
-
if (l === e.textNodeName) {
|
|
1512
|
-
let t = h[l];
|
|
1513
|
-
p || (t = e.tagValueProcessor(l, t), t = Vt(t, e)), o && (r += n), r += t, o = !1, i.pop();
|
|
1514
|
-
continue;
|
|
1515
|
-
}
|
|
1516
|
-
if (l === e.cdataPropName) {
|
|
1517
|
-
o && (r += n);
|
|
1518
|
-
const t = h[l][0][e.textNodeName];
|
|
1519
|
-
r += `<![CDATA[${String(t).replace(/\]\]>/g, "]]]]><![CDATA[>")}]]>`, o = !1, i.pop();
|
|
1520
|
-
continue;
|
|
1521
|
-
}
|
|
1522
|
-
if (l === e.commentPropName) {
|
|
1523
|
-
const t = h[l][0][e.textNodeName];
|
|
1524
|
-
r += n + `\x3c!--${String(t).replace(/--/g, "- -").replace(/-$/, "- ")}--\x3e`, o = !0, i.pop();
|
|
1525
|
-
continue;
|
|
1526
|
-
}
|
|
1527
|
-
if ("?" === l[0]) {
|
|
1528
|
-
const t = Mt(h[":@"], e, p), s = "?xml" === l ? "" : n;
|
|
1529
|
-
let a = h[l][0][e.textNodeName];
|
|
1530
|
-
a = 0 !== a.length ? " " + a : "", r += s + `<${l}${a}${t}?>`, o = !0, i.pop();
|
|
1531
|
-
continue;
|
|
1532
|
-
}
|
|
1533
|
-
let c = n;
|
|
1534
|
-
"" !== c && (c += e.indentBy);
|
|
1535
|
-
const d = n + `<${l}${Mt(h[":@"], e, p)}`;
|
|
1536
|
-
let f;
|
|
1537
|
-
f = p ? $t(h[l], e) : Pt(h[l], e, c, i, s), -1 !== e.unpairedTags.indexOf(l) ? e.suppressUnpairedNode ? r += d + ">" : r += d + "/>" : f && 0 !== f.length || !e.suppressEmptyNode ? f && f.endsWith(">") ? r += d + `>${f}${n}</${l}>` : (r += d + ">", f && "" !== n && (f.includes("/>") || f.includes("</")) ? r += n + e.indentBy + f + n : r += f, r += `</${l}>`) : r += d + "/>", o = !0, i.pop();
|
|
1538
|
-
}
|
|
1539
|
-
return r;
|
|
1540
|
-
}
|
|
1541
|
-
function Ot(t, e) {
|
|
1542
|
-
if (!t || e.ignoreAttributes) return null;
|
|
1543
|
-
const n = {};
|
|
1544
|
-
let i = !1;
|
|
1545
|
-
for (let s in t) Object.prototype.hasOwnProperty.call(t, s) && (n[s.startsWith(e.attributeNamePrefix) ? s.substr(e.attributeNamePrefix.length) : s] = t[s], i = !0);
|
|
1546
|
-
return i ? n : null;
|
|
1547
|
-
}
|
|
1548
|
-
function $t(t, e) {
|
|
1549
|
-
if (!Array.isArray(t)) return null != t ? t.toString() : "";
|
|
1550
|
-
let n = "";
|
|
1551
|
-
for (let i = 0; i < t.length; i++) {
|
|
1552
|
-
const s = t[i], r = Dt(s);
|
|
1553
|
-
if (r === e.textNodeName) n += s[r];
|
|
1554
|
-
else if (r === e.cdataPropName) n += s[r][0][e.textNodeName];
|
|
1555
|
-
else if (r === e.commentPropName) n += s[r][0][e.textNodeName];
|
|
1556
|
-
else {
|
|
1557
|
-
if (r && "?" === r[0]) continue;
|
|
1558
|
-
if (r) {
|
|
1559
|
-
const t = It(s[":@"], e), i = $t(s[r], e);
|
|
1560
|
-
i && 0 !== i.length ? n += `<${r}${t}>${i}</${r}>` : n += `<${r}${t}/>`;
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
}
|
|
1564
|
-
return n;
|
|
1565
|
-
}
|
|
1566
|
-
function It(t, e) {
|
|
1567
|
-
let n = "";
|
|
1568
|
-
if (t && !e.ignoreAttributes) for (let i in t) {
|
|
1569
|
-
if (!Object.prototype.hasOwnProperty.call(t, i)) continue;
|
|
1570
|
-
let s = t[i];
|
|
1571
|
-
!0 === s && e.suppressBooleanAttributes ? n += ` ${i.substr(e.attributeNamePrefix.length)}` : n += ` ${i.substr(e.attributeNamePrefix.length)}="${s}"`;
|
|
1572
|
-
}
|
|
1573
|
-
return n;
|
|
1574
|
-
}
|
|
1575
|
-
function Dt(t) {
|
|
1576
|
-
const e = Object.keys(t);
|
|
1577
|
-
for (let n = 0; n < e.length; n++) {
|
|
1578
|
-
const i = e[n];
|
|
1579
|
-
if (Object.prototype.hasOwnProperty.call(t, i) && ":@" !== i) return i;
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
function Mt(t, e, n) {
|
|
1583
|
-
let i = "";
|
|
1584
|
-
if (t && !e.ignoreAttributes) for (let s in t) {
|
|
1585
|
-
if (!Object.prototype.hasOwnProperty.call(t, s)) continue;
|
|
1586
|
-
let r;
|
|
1587
|
-
n ? r = t[s] : (r = e.attributeValueProcessor(s, t[s]), r = Vt(r, e)), !0 === r && e.suppressBooleanAttributes ? i += ` ${s.substr(e.attributeNamePrefix.length)}` : i += ` ${s.substr(e.attributeNamePrefix.length)}="${r}"`;
|
|
1588
|
-
}
|
|
1589
|
-
return i;
|
|
1590
|
-
}
|
|
1591
|
-
function jt(t, e) {
|
|
1592
|
-
if (!e || 0 === e.length) return !1;
|
|
1593
|
-
for (let n = 0; n < e.length; n++) if (t.matches(e[n])) return !0;
|
|
1594
|
-
return !1;
|
|
1595
|
-
}
|
|
1596
|
-
function Vt(t, e) {
|
|
1597
|
-
if (t && t.length > 0 && e.processEntities) for (let n = 0; n < e.entities.length; n++) {
|
|
1598
|
-
const i = e.entities[n];
|
|
1599
|
-
t = t.replace(i.regex, i.val);
|
|
1600
|
-
}
|
|
1601
|
-
return t;
|
|
1602
|
-
}
|
|
1603
|
-
const Lt = {
|
|
1604
|
-
attributeNamePrefix: "@_",
|
|
1605
|
-
attributesGroupName: !1,
|
|
1606
|
-
textNodeName: "#text",
|
|
1607
|
-
ignoreAttributes: !0,
|
|
1608
|
-
cdataPropName: !1,
|
|
1609
|
-
format: !1,
|
|
1610
|
-
indentBy: " ",
|
|
1611
|
-
suppressEmptyNode: !1,
|
|
1612
|
-
suppressUnpairedNode: !0,
|
|
1613
|
-
suppressBooleanAttributes: !0,
|
|
1614
|
-
tagValueProcessor: function(t, e) {
|
|
1615
|
-
return e;
|
|
1616
|
-
},
|
|
1617
|
-
attributeValueProcessor: function(t, e) {
|
|
1618
|
-
return e;
|
|
1619
|
-
},
|
|
1620
|
-
preserveOrder: !1,
|
|
1621
|
-
commentPropName: !1,
|
|
1622
|
-
unpairedTags: [],
|
|
1623
|
-
entities: [
|
|
1624
|
-
{
|
|
1625
|
-
regex: /* @__PURE__ */ new RegExp("&", "g"),
|
|
1626
|
-
val: "&"
|
|
1627
|
-
},
|
|
1628
|
-
{
|
|
1629
|
-
regex: /* @__PURE__ */ new RegExp(">", "g"),
|
|
1630
|
-
val: ">"
|
|
1631
|
-
},
|
|
1632
|
-
{
|
|
1633
|
-
regex: /* @__PURE__ */ new RegExp("<", "g"),
|
|
1634
|
-
val: "<"
|
|
1635
|
-
},
|
|
1636
|
-
{
|
|
1637
|
-
regex: /* @__PURE__ */ new RegExp("'", "g"),
|
|
1638
|
-
val: "'"
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
regex: /* @__PURE__ */ new RegExp("\"", "g"),
|
|
1642
|
-
val: """
|
|
1643
|
-
}
|
|
1644
|
-
],
|
|
1645
|
-
processEntities: !0,
|
|
1646
|
-
stopNodes: [],
|
|
1647
|
-
oneListGroup: !1,
|
|
1648
|
-
maxNestedTags: 100,
|
|
1649
|
-
jPath: !0
|
|
1650
|
-
};
|
|
1651
|
-
function kt(t) {
|
|
1652
|
-
if (this.options = Object.assign({}, Lt, t), this.options.stopNodes && Array.isArray(this.options.stopNodes) && (this.options.stopNodes = this.options.stopNodes.map((t) => "string" == typeof t && t.startsWith("*.") ? ".." + t.substring(2) : t)), this.stopNodeExpressions = [], this.options.stopNodes && Array.isArray(this.options.stopNodes)) for (let t = 0; t < this.options.stopNodes.length; t++) {
|
|
1653
|
-
const e = this.options.stopNodes[t];
|
|
1654
|
-
"string" == typeof e ? this.stopNodeExpressions.push(new G(e)) : e instanceof G && this.stopNodeExpressions.push(e);
|
|
1655
|
-
}
|
|
1656
|
-
var e;
|
|
1657
|
-
!0 === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
1658
|
-
return !1;
|
|
1659
|
-
} : (this.ignoreAttributesFn = "function" == typeof (e = this.options.ignoreAttributes) ? e : Array.isArray(e) ? (t) => {
|
|
1660
|
-
for (const n of e) {
|
|
1661
|
-
if ("string" == typeof n && t === n) return !0;
|
|
1662
|
-
if (n instanceof RegExp && n.test(t)) return !0;
|
|
1663
|
-
}
|
|
1664
|
-
} : () => !1, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Gt), this.processTextOrObjNode = Ft, this.options.format ? (this.indentate = Rt, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
|
|
1665
|
-
return "";
|
|
1666
|
-
}, this.tagEndChar = ">", this.newLine = "");
|
|
1667
|
-
}
|
|
1668
|
-
function Ft(t, e, n, i) {
|
|
1669
|
-
const s = this.extractAttributes(t);
|
|
1670
|
-
if (i.push(e, s), this.checkStopNode(i)) {
|
|
1671
|
-
const s = this.buildRawContent(t), r = this.buildAttributesForStopNode(t);
|
|
1672
|
-
return i.pop(), this.buildObjectNode(s, e, r, n);
|
|
1673
|
-
}
|
|
1674
|
-
const r = this.j2x(t, n + 1, i);
|
|
1675
|
-
return i.pop(), void 0 !== t[this.options.textNodeName] && 1 === Object.keys(t).length ? this.buildTextValNode(t[this.options.textNodeName], e, r.attrStr, n, i) : this.buildObjectNode(r.val, e, r.attrStr, n);
|
|
1676
|
-
}
|
|
1677
|
-
function Rt(t) {
|
|
1678
|
-
return this.options.indentBy.repeat(t);
|
|
1679
|
-
}
|
|
1680
|
-
function Gt(t) {
|
|
1681
|
-
return !(!t.startsWith(this.options.attributeNamePrefix) || t === this.options.textNodeName) && t.substr(this.attrPrefixLen);
|
|
1682
|
-
}
|
|
1683
|
-
kt.prototype.build = function(t) {
|
|
1684
|
-
if (this.options.preserveOrder) return Ct(t, this.options);
|
|
1685
|
-
{
|
|
1686
|
-
Array.isArray(t) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t = { [this.options.arrayNodeName]: t });
|
|
1687
|
-
const e = new R();
|
|
1688
|
-
return this.j2x(t, 0, e).val;
|
|
1689
|
-
}
|
|
1690
|
-
}, kt.prototype.j2x = function(t, e, n) {
|
|
1691
|
-
let i = "", s = "";
|
|
1692
|
-
if (this.options.maxNestedTags && n.getDepth() >= this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
|
|
1693
|
-
const r = this.options.jPath ? n.toString() : n, o = this.checkStopNode(n);
|
|
1694
|
-
for (let a in t) if (Object.prototype.hasOwnProperty.call(t, a)) if (void 0 === t[a]) this.isAttribute(a) && (s += "");
|
|
1695
|
-
else if (null === t[a]) this.isAttribute(a) || a === this.options.cdataPropName ? s += "" : "?" === a[0] ? s += this.indentate(e) + "<" + a + "?" + this.tagEndChar : s += this.indentate(e) + "<" + a + "/" + this.tagEndChar;
|
|
1696
|
-
else if (t[a] instanceof Date) s += this.buildTextValNode(t[a], a, "", e, n);
|
|
1697
|
-
else if ("object" != typeof t[a]) {
|
|
1698
|
-
const h = this.isAttribute(a);
|
|
1699
|
-
if (h && !this.ignoreAttributesFn(h, r)) i += this.buildAttrPairStr(h, "" + t[a], o);
|
|
1700
|
-
else if (!h) if (a === this.options.textNodeName) {
|
|
1701
|
-
let e = this.options.tagValueProcessor(a, "" + t[a]);
|
|
1702
|
-
s += this.replaceEntitiesValue(e);
|
|
1703
|
-
} else {
|
|
1704
|
-
n.push(a);
|
|
1705
|
-
const i = this.checkStopNode(n);
|
|
1706
|
-
if (n.pop(), i) {
|
|
1707
|
-
const n = "" + t[a];
|
|
1708
|
-
s += "" === n ? this.indentate(e) + "<" + a + this.closeTag(a) + this.tagEndChar : this.indentate(e) + "<" + a + ">" + n + "</" + a + this.tagEndChar;
|
|
1709
|
-
} else s += this.buildTextValNode(t[a], a, "", e, n);
|
|
1710
|
-
}
|
|
1711
|
-
} else if (Array.isArray(t[a])) {
|
|
1712
|
-
const i = t[a].length;
|
|
1713
|
-
let r = "", o = "";
|
|
1714
|
-
for (let h = 0; h < i; h++) {
|
|
1715
|
-
const i = t[a][h];
|
|
1716
|
-
if (void 0 === i);
|
|
1717
|
-
else if (null === i) "?" === a[0] ? s += this.indentate(e) + "<" + a + "?" + this.tagEndChar : s += this.indentate(e) + "<" + a + "/" + this.tagEndChar;
|
|
1718
|
-
else if ("object" == typeof i) if (this.options.oneListGroup) {
|
|
1719
|
-
n.push(a);
|
|
1720
|
-
const t = this.j2x(i, e + 1, n);
|
|
1721
|
-
n.pop(), r += t.val, this.options.attributesGroupName && i.hasOwnProperty(this.options.attributesGroupName) && (o += t.attrStr);
|
|
1722
|
-
} else r += this.processTextOrObjNode(i, a, e, n);
|
|
1723
|
-
else if (this.options.oneListGroup) {
|
|
1724
|
-
let t = this.options.tagValueProcessor(a, i);
|
|
1725
|
-
t = this.replaceEntitiesValue(t), r += t;
|
|
1726
|
-
} else {
|
|
1727
|
-
n.push(a);
|
|
1728
|
-
const t = this.checkStopNode(n);
|
|
1729
|
-
if (n.pop(), t) {
|
|
1730
|
-
const t = "" + i;
|
|
1731
|
-
r += "" === t ? this.indentate(e) + "<" + a + this.closeTag(a) + this.tagEndChar : this.indentate(e) + "<" + a + ">" + t + "</" + a + this.tagEndChar;
|
|
1732
|
-
} else r += this.buildTextValNode(i, a, "", e, n);
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
this.options.oneListGroup && (r = this.buildObjectNode(r, a, o, e)), s += r;
|
|
1736
|
-
} else if (this.options.attributesGroupName && a === this.options.attributesGroupName) {
|
|
1737
|
-
const e = Object.keys(t[a]), n = e.length;
|
|
1738
|
-
for (let s = 0; s < n; s++) i += this.buildAttrPairStr(e[s], "" + t[a][e[s]], o);
|
|
1739
|
-
} else s += this.processTextOrObjNode(t[a], a, e, n);
|
|
1740
|
-
return {
|
|
1741
|
-
attrStr: i,
|
|
1742
|
-
val: s
|
|
1743
|
-
};
|
|
1744
|
-
}, kt.prototype.buildAttrPairStr = function(t, e, n) {
|
|
1745
|
-
return n || (e = this.options.attributeValueProcessor(t, "" + e), e = this.replaceEntitiesValue(e)), this.options.suppressBooleanAttributes && "true" === e ? " " + t : " " + t + "=\"" + e + "\"";
|
|
1746
|
-
}, kt.prototype.extractAttributes = function(t) {
|
|
1747
|
-
if (!t || "object" != typeof t) return null;
|
|
1748
|
-
const e = {};
|
|
1749
|
-
let n = !1;
|
|
1750
|
-
if (this.options.attributesGroupName && t[this.options.attributesGroupName]) {
|
|
1751
|
-
const i = t[this.options.attributesGroupName];
|
|
1752
|
-
for (let t in i) Object.prototype.hasOwnProperty.call(i, t) && (e[t.startsWith(this.options.attributeNamePrefix) ? t.substring(this.options.attributeNamePrefix.length) : t] = i[t], n = !0);
|
|
1753
|
-
} else for (let i in t) {
|
|
1754
|
-
if (!Object.prototype.hasOwnProperty.call(t, i)) continue;
|
|
1755
|
-
const s = this.isAttribute(i);
|
|
1756
|
-
s && (e[s] = t[i], n = !0);
|
|
1757
|
-
}
|
|
1758
|
-
return n ? e : null;
|
|
1759
|
-
}, kt.prototype.buildRawContent = function(t) {
|
|
1760
|
-
if ("string" == typeof t) return t;
|
|
1761
|
-
if ("object" != typeof t || null === t) return String(t);
|
|
1762
|
-
if (void 0 !== t[this.options.textNodeName]) return t[this.options.textNodeName];
|
|
1763
|
-
let e = "";
|
|
1764
|
-
for (let n in t) {
|
|
1765
|
-
if (!Object.prototype.hasOwnProperty.call(t, n)) continue;
|
|
1766
|
-
if (this.isAttribute(n)) continue;
|
|
1767
|
-
if (this.options.attributesGroupName && n === this.options.attributesGroupName) continue;
|
|
1768
|
-
const i = t[n];
|
|
1769
|
-
if (n === this.options.textNodeName) e += i;
|
|
1770
|
-
else if (Array.isArray(i)) {
|
|
1771
|
-
for (let t of i) if ("string" == typeof t || "number" == typeof t) e += `<${n}>${t}</${n}>`;
|
|
1772
|
-
else if ("object" == typeof t && null !== t) {
|
|
1773
|
-
const i = this.buildRawContent(t), s = this.buildAttributesForStopNode(t);
|
|
1774
|
-
e += "" === i ? `<${n}${s}/>` : `<${n}${s}>${i}</${n}>`;
|
|
1775
|
-
}
|
|
1776
|
-
} else if ("object" == typeof i && null !== i) {
|
|
1777
|
-
const t = this.buildRawContent(i), s = this.buildAttributesForStopNode(i);
|
|
1778
|
-
e += "" === t ? `<${n}${s}/>` : `<${n}${s}>${t}</${n}>`;
|
|
1779
|
-
} else e += `<${n}>${i}</${n}>`;
|
|
1780
|
-
}
|
|
1781
|
-
return e;
|
|
1782
|
-
}, kt.prototype.buildAttributesForStopNode = function(t) {
|
|
1783
|
-
if (!t || "object" != typeof t) return "";
|
|
1784
|
-
let e = "";
|
|
1785
|
-
if (this.options.attributesGroupName && t[this.options.attributesGroupName]) {
|
|
1786
|
-
const n = t[this.options.attributesGroupName];
|
|
1787
|
-
for (let t in n) {
|
|
1788
|
-
if (!Object.prototype.hasOwnProperty.call(n, t)) continue;
|
|
1789
|
-
const i = t.startsWith(this.options.attributeNamePrefix) ? t.substring(this.options.attributeNamePrefix.length) : t, s = n[t];
|
|
1790
|
-
!0 === s && this.options.suppressBooleanAttributes ? e += " " + i : e += " " + i + "=\"" + s + "\"";
|
|
1791
|
-
}
|
|
1792
|
-
} else for (let n in t) {
|
|
1793
|
-
if (!Object.prototype.hasOwnProperty.call(t, n)) continue;
|
|
1794
|
-
const i = this.isAttribute(n);
|
|
1795
|
-
if (i) {
|
|
1796
|
-
const s = t[n];
|
|
1797
|
-
!0 === s && this.options.suppressBooleanAttributes ? e += " " + i : e += " " + i + "=\"" + s + "\"";
|
|
1798
|
-
}
|
|
1799
|
-
}
|
|
1800
|
-
return e;
|
|
1801
|
-
}, kt.prototype.buildObjectNode = function(t, e, n, i) {
|
|
1802
|
-
if ("" === t) return "?" === e[0] ? this.indentate(i) + "<" + e + n + "?" + this.tagEndChar : this.indentate(i) + "<" + e + n + this.closeTag(e) + this.tagEndChar;
|
|
1803
|
-
{
|
|
1804
|
-
let s = "</" + e + this.tagEndChar, r = "";
|
|
1805
|
-
return "?" === e[0] && (r = "?", s = ""), !n && "" !== n || -1 !== t.indexOf("<") ? !1 !== this.options.commentPropName && e === this.options.commentPropName && 0 === r.length ? this.indentate(i) + `\x3c!--${t}--\x3e` + this.newLine : this.indentate(i) + "<" + e + n + r + this.tagEndChar + t + this.indentate(i) + s : this.indentate(i) + "<" + e + n + r + ">" + t + s;
|
|
1806
|
-
}
|
|
1807
|
-
}, kt.prototype.closeTag = function(t) {
|
|
1808
|
-
let e = "";
|
|
1809
|
-
return -1 !== this.options.unpairedTags.indexOf(t) ? this.options.suppressUnpairedNode || (e = "/") : e = this.options.suppressEmptyNode ? "/" : `></${t}`, e;
|
|
1810
|
-
}, kt.prototype.checkStopNode = function(t) {
|
|
1811
|
-
if (!this.stopNodeExpressions || 0 === this.stopNodeExpressions.length) return !1;
|
|
1812
|
-
for (let e = 0; e < this.stopNodeExpressions.length; e++) if (t.matches(this.stopNodeExpressions[e])) return !0;
|
|
1813
|
-
return !1;
|
|
1814
|
-
}, kt.prototype.buildTextValNode = function(t, e, n, i, s) {
|
|
1815
|
-
if (!1 !== this.options.cdataPropName && e === this.options.cdataPropName) {
|
|
1816
|
-
const e = String(t).replace(/\]\]>/g, "]]]]><![CDATA[>");
|
|
1817
|
-
return this.indentate(i) + `<![CDATA[${e}]]>` + this.newLine;
|
|
1818
|
-
}
|
|
1819
|
-
if (!1 !== this.options.commentPropName && e === this.options.commentPropName) {
|
|
1820
|
-
const e = String(t).replace(/--/g, "- -").replace(/-$/, "- ");
|
|
1821
|
-
return this.indentate(i) + `\x3c!--${e}--\x3e` + this.newLine;
|
|
1822
|
-
}
|
|
1823
|
-
if ("?" === e[0]) return this.indentate(i) + "<" + e + n + "?" + this.tagEndChar;
|
|
1824
|
-
{
|
|
1825
|
-
let s = this.options.tagValueProcessor(e, t);
|
|
1826
|
-
return s = this.replaceEntitiesValue(s), "" === s ? this.indentate(i) + "<" + e + n + this.closeTag(e) + this.tagEndChar : this.indentate(i) + "<" + e + n + ">" + s + "</" + e + this.tagEndChar;
|
|
1827
|
-
}
|
|
1828
|
-
}, kt.prototype.replaceEntitiesValue = function(t) {
|
|
1829
|
-
if (t && t.length > 0 && this.options.processEntities) for (let e = 0; e < this.options.entities.length; e++) {
|
|
1830
|
-
const n = this.options.entities[e];
|
|
1831
|
-
t = t.replace(n.regex, n.val);
|
|
1832
|
-
}
|
|
1833
|
-
return t;
|
|
1834
|
-
};
|
|
1835
|
-
const Bt = kt, Ut = { validate: l };
|
|
1836
|
-
module.exports = e;
|
|
1837
|
-
})();
|
|
1838
|
-
}));
|
|
1839
|
-
//#endregion
|
|
1840
|
-
//#region ../../../node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js
|
|
1841
|
-
var require_xml_parser = /* @__PURE__ */ require_stream_collector.__commonJSMin(((exports) => {
|
|
1842
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1843
|
-
exports.parseXML = parseXML;
|
|
1844
|
-
var parser = new (require_fxp()).XMLParser({
|
|
1845
|
-
attributeNamePrefix: "",
|
|
1846
|
-
processEntities: {
|
|
1847
|
-
enabled: true,
|
|
1848
|
-
maxTotalExpansions: Infinity
|
|
1849
|
-
},
|
|
1850
|
-
htmlEntities: true,
|
|
1851
|
-
ignoreAttributes: false,
|
|
1852
|
-
ignoreDeclaration: true,
|
|
1853
|
-
parseTagValue: false,
|
|
1854
|
-
trimValues: false,
|
|
1855
|
-
tagValueProcessor: (_, val) => val.trim() === "" && val.includes("\n") ? "" : void 0,
|
|
1856
|
-
maxNestedTags: Infinity
|
|
1857
|
-
});
|
|
1858
|
-
function parseXML(xmlString) {
|
|
1859
|
-
return parser.parse(xmlString, true);
|
|
1860
|
-
}
|
|
1861
|
-
}));
|
|
1862
|
-
//#endregion
|
|
1863
|
-
//#region ../../../node_modules/@aws-sdk/xml-builder/dist-cjs/index.js
|
|
1864
|
-
var require_dist_cjs = /* @__PURE__ */ require_stream_collector.__commonJSMin(((exports) => {
|
|
1865
|
-
var xmlParser = require_xml_parser();
|
|
1866
|
-
var ATTR_ESCAPE_RE = /[&<>"]/g;
|
|
1867
|
-
var ATTR_ESCAPE_MAP = {
|
|
1868
|
-
"&": "&",
|
|
1869
|
-
"<": "<",
|
|
1870
|
-
">": ">",
|
|
1871
|
-
"\"": """
|
|
1872
|
-
};
|
|
1873
|
-
function escapeAttribute(value) {
|
|
1874
|
-
return value.replace(ATTR_ESCAPE_RE, (ch) => ATTR_ESCAPE_MAP[ch]);
|
|
1875
|
-
}
|
|
1876
|
-
var ELEMENT_ESCAPE_RE = /[&"'<>\r\n\u0085\u2028]/g;
|
|
1877
|
-
var ELEMENT_ESCAPE_MAP = {
|
|
1878
|
-
"&": "&",
|
|
1879
|
-
"\"": """,
|
|
1880
|
-
"'": "'",
|
|
1881
|
-
"<": "<",
|
|
1882
|
-
">": ">",
|
|
1883
|
-
"\r": "
",
|
|
1884
|
-
"\n": "
",
|
|
1885
|
-
"
": "…",
|
|
1886
|
-
"\u2028": "
"
|
|
1887
|
-
};
|
|
1888
|
-
function escapeElement(value) {
|
|
1889
|
-
return value.replace(ELEMENT_ESCAPE_RE, (ch) => ELEMENT_ESCAPE_MAP[ch]);
|
|
1890
|
-
}
|
|
1891
|
-
var XmlText = class {
|
|
1892
|
-
value;
|
|
1893
|
-
constructor(value) {
|
|
1894
|
-
this.value = value;
|
|
1895
|
-
}
|
|
1896
|
-
toString() {
|
|
1897
|
-
return escapeElement("" + this.value);
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1900
|
-
var XmlNode = class XmlNode {
|
|
1901
|
-
name;
|
|
1902
|
-
children;
|
|
1903
|
-
attributes = {};
|
|
1904
|
-
static of(name, childText, withName) {
|
|
1905
|
-
const node = new XmlNode(name);
|
|
1906
|
-
if (childText !== void 0) node.addChildNode(new XmlText(childText));
|
|
1907
|
-
if (withName !== void 0) node.withName(withName);
|
|
1908
|
-
return node;
|
|
1909
|
-
}
|
|
1910
|
-
constructor(name, children = []) {
|
|
1911
|
-
this.name = name;
|
|
1912
|
-
this.children = children;
|
|
1913
|
-
}
|
|
1914
|
-
withName(name) {
|
|
1915
|
-
this.name = name;
|
|
1916
|
-
return this;
|
|
1917
|
-
}
|
|
1918
|
-
addAttribute(name, value) {
|
|
1919
|
-
this.attributes[name] = value;
|
|
1920
|
-
return this;
|
|
1921
|
-
}
|
|
1922
|
-
addChildNode(child) {
|
|
1923
|
-
this.children.push(child);
|
|
1924
|
-
return this;
|
|
1925
|
-
}
|
|
1926
|
-
removeAttribute(name) {
|
|
1927
|
-
delete this.attributes[name];
|
|
1928
|
-
return this;
|
|
1929
|
-
}
|
|
1930
|
-
n(name) {
|
|
1931
|
-
this.name = name;
|
|
1932
|
-
return this;
|
|
1933
|
-
}
|
|
1934
|
-
c(child) {
|
|
1935
|
-
this.children.push(child);
|
|
1936
|
-
return this;
|
|
1937
|
-
}
|
|
1938
|
-
a(name, value) {
|
|
1939
|
-
if (value != null) this.attributes[name] = value;
|
|
1940
|
-
return this;
|
|
1941
|
-
}
|
|
1942
|
-
cc(input, field, withName = field) {
|
|
1943
|
-
if (input[field] != null) {
|
|
1944
|
-
const node = XmlNode.of(field, input[field]).withName(withName);
|
|
1945
|
-
this.c(node);
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
l(input, listName, memberName, valueProvider) {
|
|
1949
|
-
if (input[listName] != null) valueProvider().map((node) => {
|
|
1950
|
-
node.withName(memberName);
|
|
1951
|
-
this.c(node);
|
|
1952
|
-
});
|
|
1953
|
-
}
|
|
1954
|
-
lc(input, listName, memberName, valueProvider) {
|
|
1955
|
-
if (input[listName] != null) {
|
|
1956
|
-
const nodes = valueProvider();
|
|
1957
|
-
const containerNode = new XmlNode(memberName);
|
|
1958
|
-
nodes.map((node) => {
|
|
1959
|
-
containerNode.c(node);
|
|
1960
|
-
});
|
|
1961
|
-
this.c(containerNode);
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
toString() {
|
|
1965
|
-
const hasChildren = Boolean(this.children.length);
|
|
1966
|
-
let xmlText = `<${this.name}`;
|
|
1967
|
-
const attributes = this.attributes;
|
|
1968
|
-
for (const attributeName of Object.keys(attributes)) {
|
|
1969
|
-
const attribute = attributes[attributeName];
|
|
1970
|
-
if (attribute != null) xmlText += ` ${attributeName}="${escapeAttribute("" + attribute)}"`;
|
|
1971
|
-
}
|
|
1972
|
-
return xmlText += !hasChildren ? "/>" : `>${this.children.map((c) => c.toString()).join("")}</${this.name}>`;
|
|
1973
|
-
}
|
|
1974
|
-
};
|
|
1975
|
-
exports.parseXML = xmlParser.parseXML;
|
|
1976
|
-
exports.XmlNode = XmlNode;
|
|
1977
|
-
exports.XmlText = XmlText;
|
|
1978
|
-
}));
|
|
1979
|
-
//#endregion
|
|
1980
|
-
//#region ../../../node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js
|
|
1981
|
-
var import_dist_cjs = require_dist_cjs();
|
|
1982
|
-
var XmlShapeDeserializer = class extends require_extensions.SerdeContextConfig {
|
|
1983
|
-
settings;
|
|
1984
|
-
stringDeserializer;
|
|
1985
|
-
constructor(settings) {
|
|
1986
|
-
super();
|
|
1987
|
-
this.settings = settings;
|
|
1988
|
-
this.stringDeserializer = new require_extensions.FromStringShapeDeserializer(settings);
|
|
1989
|
-
}
|
|
1990
|
-
setSerdeContext(serdeContext) {
|
|
1991
|
-
this.serdeContext = serdeContext;
|
|
1992
|
-
this.stringDeserializer.setSerdeContext(serdeContext);
|
|
1993
|
-
}
|
|
1994
|
-
read(schema, bytes, key) {
|
|
1995
|
-
const ns = require_extensions.NormalizedSchema.of(schema);
|
|
1996
|
-
const memberSchemas = ns.getMemberSchemas();
|
|
1997
|
-
if (ns.isStructSchema() && ns.isMemberSchema() && !!Object.values(memberSchemas).find((memberNs) => {
|
|
1998
|
-
return !!memberNs.getMemberTraits().eventPayload;
|
|
1999
|
-
})) {
|
|
2000
|
-
const output = {};
|
|
2001
|
-
const memberName = Object.keys(memberSchemas)[0];
|
|
2002
|
-
if (memberSchemas[memberName].isBlobSchema()) output[memberName] = bytes;
|
|
2003
|
-
else output[memberName] = this.read(memberSchemas[memberName], bytes);
|
|
2004
|
-
return output;
|
|
2005
|
-
}
|
|
2006
|
-
const xmlString = (this.serdeContext?.utf8Encoder ?? require_date_utils.toUtf8)(bytes);
|
|
2007
|
-
const parsedObject = this.parseXml(xmlString);
|
|
2008
|
-
return this.readSchema(schema, key ? parsedObject[key] : parsedObject);
|
|
2009
|
-
}
|
|
2010
|
-
readSchema(_schema, value) {
|
|
2011
|
-
const ns = require_extensions.NormalizedSchema.of(_schema);
|
|
2012
|
-
if (ns.isUnitSchema()) return;
|
|
2013
|
-
const traits = ns.getMergedTraits();
|
|
2014
|
-
if (ns.isListSchema() && !Array.isArray(value)) return this.readSchema(ns, [value]);
|
|
2015
|
-
if (value == null) return value;
|
|
2016
|
-
if (typeof value === "object") {
|
|
2017
|
-
const flat = !!traits.xmlFlattened;
|
|
2018
|
-
if (ns.isListSchema()) {
|
|
2019
|
-
const listValue = ns.getValueSchema();
|
|
2020
|
-
const buffer = [];
|
|
2021
|
-
const sourceKey = listValue.getMergedTraits().xmlName ?? "member";
|
|
2022
|
-
const source = flat ? value : (value[0] ?? value)[sourceKey];
|
|
2023
|
-
if (source == null) return buffer;
|
|
2024
|
-
const sourceArray = Array.isArray(source) ? source : [source];
|
|
2025
|
-
for (const v of sourceArray) buffer.push(this.readSchema(listValue, v));
|
|
2026
|
-
return buffer;
|
|
2027
|
-
}
|
|
2028
|
-
const buffer = {};
|
|
2029
|
-
if (ns.isMapSchema()) {
|
|
2030
|
-
const keyNs = ns.getKeySchema();
|
|
2031
|
-
const memberNs = ns.getValueSchema();
|
|
2032
|
-
let entries;
|
|
2033
|
-
if (flat) entries = Array.isArray(value) ? value : [value];
|
|
2034
|
-
else entries = Array.isArray(value.entry) ? value.entry : [value.entry];
|
|
2035
|
-
const keyProperty = keyNs.getMergedTraits().xmlName ?? "key";
|
|
2036
|
-
const valueProperty = memberNs.getMergedTraits().xmlName ?? "value";
|
|
2037
|
-
for (const entry of entries) {
|
|
2038
|
-
const key = entry[keyProperty];
|
|
2039
|
-
const value = entry[valueProperty];
|
|
2040
|
-
buffer[key] = this.readSchema(memberNs, value);
|
|
2041
|
-
}
|
|
2042
|
-
return buffer;
|
|
2043
|
-
}
|
|
2044
|
-
if (ns.isStructSchema()) {
|
|
2045
|
-
const union = ns.isUnionSchema();
|
|
2046
|
-
let unionSerde;
|
|
2047
|
-
if (union) unionSerde = new require_extensions.UnionSerde(value, buffer);
|
|
2048
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
2049
|
-
const memberTraits = memberSchema.getMergedTraits();
|
|
2050
|
-
const xmlObjectKey = !memberTraits.httpPayload ? memberSchema.getMemberTraits().xmlName ?? memberName : memberTraits.xmlName ?? memberSchema.getName();
|
|
2051
|
-
if (union) unionSerde.mark(xmlObjectKey);
|
|
2052
|
-
if (value[xmlObjectKey] != null) buffer[memberName] = this.readSchema(memberSchema, value[xmlObjectKey]);
|
|
2053
|
-
}
|
|
2054
|
-
if (union) unionSerde.writeUnknown();
|
|
2055
|
-
return buffer;
|
|
2056
|
-
}
|
|
2057
|
-
if (ns.isDocumentSchema()) return value;
|
|
2058
|
-
throw new Error(`@aws-sdk/core/protocols - xml deserializer unhandled schema type for ${ns.getName(true)}`);
|
|
2059
|
-
}
|
|
2060
|
-
if (ns.isListSchema()) return [];
|
|
2061
|
-
if (ns.isMapSchema() || ns.isStructSchema()) return {};
|
|
2062
|
-
return this.stringDeserializer.read(ns, value);
|
|
2063
|
-
}
|
|
2064
|
-
parseXml(xml) {
|
|
2065
|
-
if (xml.length) {
|
|
2066
|
-
let parsedObj;
|
|
2067
|
-
try {
|
|
2068
|
-
parsedObj = (0, import_dist_cjs.parseXML)(xml);
|
|
2069
|
-
} catch (e) {
|
|
2070
|
-
if (e && typeof e === "object") Object.defineProperty(e, "$responseBodyText", { value: xml });
|
|
2071
|
-
throw e;
|
|
2072
|
-
}
|
|
2073
|
-
const textNodeName = "#text";
|
|
2074
|
-
const key = Object.keys(parsedObj)[0];
|
|
2075
|
-
const parsedObjToReturn = parsedObj[key];
|
|
2076
|
-
if (parsedObjToReturn[textNodeName]) {
|
|
2077
|
-
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
2078
|
-
delete parsedObjToReturn[textNodeName];
|
|
2079
|
-
}
|
|
2080
|
-
return getValueFromTextNode(parsedObjToReturn);
|
|
2081
|
-
}
|
|
2082
|
-
return {};
|
|
2083
|
-
}
|
|
2084
|
-
};
|
|
2085
|
-
//#endregion
|
|
2086
|
-
Object.defineProperty(exports, "XmlShapeDeserializer", {
|
|
2087
|
-
enumerable: true,
|
|
2088
|
-
get: function() {
|
|
2089
|
-
return XmlShapeDeserializer;
|
|
2090
|
-
}
|
|
2091
|
-
});
|
|
2092
|
-
Object.defineProperty(exports, "require_dist_cjs", {
|
|
2093
|
-
enumerable: true,
|
|
2094
|
-
get: function() {
|
|
2095
|
-
return require_dist_cjs;
|
|
2096
|
-
}
|
|
2097
|
-
});
|