From a0735d7c2a4e5ab75f8ec2352c65276639d18444 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:21:34 +0000 Subject: [PATCH 1/2] Bump fast-xml-parser from 5.3.6 to 5.4.1 Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.3.6 to 5.4.1. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.3.6...v5.4.1) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-version: 5.4.1 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 203901544b..aaba27333b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5629,10 +5629,22 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-xml-builder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.0.0.tgz", + "integrity": "sha512-fpZuDogrAgnyt9oDDz+5DBz0zgPdPZz6D4IR7iESxRXElrlGTRkHJ9eEt+SACRJwT0FNFrt71DFQIUFBJfX/uQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/fast-xml-parser": { - "version": "5.3.6", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.3.6.tgz", - "integrity": "sha512-QNI3sAvSvaOiaMl8FYU4trnEzCwiRr8XMWgAHzlrWpTSj+QaCSvOf1h82OEP1s4hiAXhnbXSyFWCf4ldZzZRVA==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.4.1.tgz", + "integrity": "sha512-BQ30U1mKkvXQXXkAGcuyUA/GA26oEB7NzOtsxCDtyu62sjGw5QraKFhx2Em3WQNjPw9PG6MQ9yuIIgkSDfGu5A==", "funding": [ { "type": "github", @@ -5641,6 +5653,7 @@ ], "license": "MIT", "dependencies": { + "fast-xml-builder": "^1.0.0", "strnum": "^2.1.2" }, "bin": { From 236fbf764571acc510c143138f363a2dd3455c30 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 13:23:30 +0000 Subject: [PATCH 2/2] Rebuild --- lib/analyze-action-post.js | 345 +++++++++++++++-------------- lib/analyze-action.js | 345 +++++++++++++++-------------- lib/autobuild-action.js | 345 +++++++++++++++-------------- lib/init-action-post.js | 349 ++++++++++++++++-------------- lib/init-action.js | 345 +++++++++++++++-------------- lib/resolve-environment-action.js | 345 +++++++++++++++-------------- lib/setup-codeql-action.js | 345 +++++++++++++++-------------- lib/start-proxy-action-post.js | 345 +++++++++++++++-------------- lib/start-proxy-action.js | 345 +++++++++++++++-------------- lib/upload-lib.js | 345 +++++++++++++++-------------- lib/upload-sarif-action-post.js | 345 +++++++++++++++-------------- lib/upload-sarif-action.js | 345 +++++++++++++++-------------- 12 files changed, 2210 insertions(+), 1934 deletions(-) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 976b62311e..5b07af5689 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _2, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _2(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _2), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 9e0920d528..1d8c680638 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 01add7fd5f..f5acaddfb1 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 6b62621a18..c5660e0002 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); - } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); + } + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; - } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; + } + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _2, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _2(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _2), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/init-action.js b/lib/init-action.js index 70dfa92d9c..d6128331f6 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -61991,7 +61991,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -62013,90 +62013,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -62114,11 +62114,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -62127,16 +62127,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62164,49 +62164,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62215,23 +62218,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62241,10 +62244,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62253,15 +62256,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62274,13 +62277,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62288,24 +62291,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62314,45 +62317,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62366,7 +62367,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62374,10 +62375,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62396,12 +62397,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62441,26 +62442,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62468,18 +62470,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62540,12 +62550,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62566,19 +62576,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62587,7 +62597,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62595,7 +62605,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62629,7 +62639,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62657,7 +62667,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62667,7 +62677,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62688,6 +62698,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62711,10 +62728,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62722,13 +62739,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62746,15 +62763,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62762,15 +62785,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62805,18 +62828,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62824,14 +62847,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 7c8bbe7e35..964ec56304 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index fbba903f72..e27fe56910 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -60543,7 +60543,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -60565,90 +60565,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -60666,11 +60666,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -60679,16 +60679,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -60716,49 +60716,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -60767,23 +60770,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -60793,10 +60796,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -60805,15 +60808,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -60826,13 +60829,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -60840,24 +60843,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -60866,45 +60869,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -60918,7 +60919,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -60926,10 +60927,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -60948,12 +60949,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -60993,26 +60994,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -61020,18 +61022,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -61092,12 +61102,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -61118,19 +61128,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -61139,7 +61149,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -61147,7 +61157,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -61181,7 +61191,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -61209,7 +61219,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -61219,7 +61229,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -61240,6 +61250,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -61263,10 +61280,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -61274,13 +61291,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -61298,15 +61315,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -61314,15 +61337,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -61357,18 +61380,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -61376,14 +61399,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index bfe40922af..284a192386 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _2, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _2(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _2), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 3586bfa5ec..e814f698d4 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -60543,7 +60543,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -60565,90 +60565,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -60666,11 +60666,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -60679,16 +60679,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -60716,49 +60716,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -60767,23 +60770,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -60793,10 +60796,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -60805,15 +60808,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -60826,13 +60829,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -60840,24 +60843,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -60866,45 +60869,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -60918,7 +60919,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -60926,10 +60927,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -60948,12 +60949,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -60993,26 +60994,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -61020,18 +61022,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -61092,12 +61102,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -61118,19 +61128,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -61139,7 +61149,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -61147,7 +61157,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -61181,7 +61191,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -61209,7 +61219,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -61219,7 +61229,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -61240,6 +61250,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -61263,10 +61280,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -61274,13 +61291,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -61298,15 +61315,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -61314,15 +61337,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -61357,18 +61380,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -61376,14 +61399,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 135a18e5f8..1d29a086b9 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -61840,7 +61840,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -61862,90 +61862,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -61963,11 +61963,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -61976,16 +61976,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -62013,49 +62013,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -62064,23 +62067,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -62090,10 +62093,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -62102,15 +62105,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -62123,13 +62126,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -62137,24 +62140,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -62163,45 +62166,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -62215,7 +62216,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -62223,10 +62224,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -62245,12 +62246,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -62290,26 +62291,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -62317,18 +62319,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -62389,12 +62399,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -62415,19 +62425,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -62436,7 +62446,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -62444,7 +62454,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -62478,7 +62488,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -62506,7 +62516,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -62516,7 +62526,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -62537,6 +62547,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -62560,10 +62577,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -62571,13 +62588,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -62595,15 +62612,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -62611,15 +62634,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -62654,18 +62677,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -62673,14 +62696,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index 01a0406f5b..e09ffa74c1 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -64151,7 +64151,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -64173,90 +64173,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -64274,11 +64274,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -64287,16 +64287,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -64324,49 +64324,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -64375,23 +64378,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -64401,10 +64404,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -64413,15 +64416,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -64434,13 +64437,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -64448,24 +64451,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -64474,45 +64477,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _2, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -64526,7 +64527,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _2(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -64534,10 +64535,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _2 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _2), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -64556,12 +64557,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -64601,26 +64602,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -64628,18 +64630,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -64700,12 +64710,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -64726,19 +64736,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -64747,7 +64757,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -64755,7 +64765,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -64789,7 +64799,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -64817,7 +64827,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -64827,7 +64837,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -64848,6 +64858,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -64871,10 +64888,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -64882,13 +64899,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -64906,15 +64923,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -64922,15 +64945,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -64965,18 +64988,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -64984,14 +65007,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); } diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index d31044fda2..bdb1925a4b 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -60543,7 +60543,7 @@ var require_fxp = __commonJS({ }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; - t.r(e), t.d(e, { XMLBuilder: () => dt, XMLParser: () => it, XMLValidator: () => gt }); + t.r(e), t.d(e, { XMLBuilder: () => gt, XMLParser: () => it, XMLValidator: () => xt }); const n = ":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", i = new RegExp("^[" + n + "][" + n + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"); function s(t2, e2) { const n2 = []; @@ -60565,90 +60565,90 @@ var require_fxp = __commonJS({ const n2 = []; let i2 = false, s2 = false; "\uFEFF" === t2[0] && (t2 = t2.substr(1)); - for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2] && "?" === t2[o2 + 1]) { - if (o2 += 2, o2 = u(t2, o2), o2.err) return o2; + for (let r2 = 0; r2 < t2.length; r2++) if ("<" === t2[r2] && "?" === t2[r2 + 1]) { + if (r2 += 2, r2 = u(t2, r2), r2.err) return r2; } else { - if ("<" !== t2[o2]) { - if (l(t2[o2])) continue; - return m("InvalidChar", "char '" + t2[o2] + "' is not expected.", b(t2, o2)); + if ("<" !== t2[r2]) { + if (l(t2[r2])) continue; + return m("InvalidChar", "char '" + t2[r2] + "' is not expected.", N(t2, r2)); } { - let a2 = o2; - if (o2++, "!" === t2[o2]) { - o2 = h(t2, o2); + let o2 = r2; + if (r2++, "!" === t2[r2]) { + r2 = d(t2, r2); continue; } { - let d2 = false; - "/" === t2[o2] && (d2 = true, o2++); - let p2 = ""; - for (; o2 < t2.length && ">" !== t2[o2] && " " !== t2[o2] && " " !== t2[o2] && "\n" !== t2[o2] && "\r" !== t2[o2]; o2++) p2 += t2[o2]; - if (p2 = p2.trim(), "/" === p2[p2.length - 1] && (p2 = p2.substring(0, p2.length - 1), o2--), !r(p2)) { + let a2 = false; + "/" === t2[r2] && (a2 = true, r2++); + let h2 = ""; + for (; r2 < t2.length && ">" !== t2[r2] && " " !== t2[r2] && " " !== t2[r2] && "\n" !== t2[r2] && "\r" !== t2[r2]; r2++) h2 += t2[r2]; + if (h2 = h2.trim(), "/" === h2[h2.length - 1] && (h2 = h2.substring(0, h2.length - 1), r2--), !b(h2)) { let e3; - return e3 = 0 === p2.trim().length ? "Invalid space after '<'." : "Tag '" + p2 + "' is an invalid name.", m("InvalidTag", e3, b(t2, o2)); + return e3 = 0 === h2.trim().length ? "Invalid space after '<'." : "Tag '" + h2 + "' is an invalid name.", m("InvalidTag", e3, N(t2, r2)); } - const c2 = f(t2, o2); - if (false === c2) return m("InvalidAttr", "Attributes for '" + p2 + "' have open quote.", b(t2, o2)); - let E2 = c2.value; - if (o2 = c2.index, "/" === E2[E2.length - 1]) { - const n3 = o2 - E2.length; - E2 = E2.substring(0, E2.length - 1); - const s3 = g(E2, e2); - if (true !== s3) return m(s3.err.code, s3.err.msg, b(t2, n3 + s3.err.line)); + const p2 = c(t2, r2); + if (false === p2) return m("InvalidAttr", "Attributes for '" + h2 + "' have open quote.", N(t2, r2)); + let f2 = p2.value; + if (r2 = p2.index, "/" === f2[f2.length - 1]) { + const n3 = r2 - f2.length; + f2 = f2.substring(0, f2.length - 1); + const s3 = g(f2, e2); + if (true !== s3) return m(s3.err.code, s3.err.msg, N(t2, n3 + s3.err.line)); i2 = true; - } else if (d2) { - if (!c2.tagClosed) return m("InvalidTag", "Closing tag '" + p2 + "' doesn't have proper closing.", b(t2, o2)); - if (E2.trim().length > 0) return m("InvalidTag", "Closing tag '" + p2 + "' can't have attributes or invalid starting.", b(t2, a2)); - if (0 === n2.length) return m("InvalidTag", "Closing tag '" + p2 + "' has not been opened.", b(t2, a2)); + } else if (a2) { + if (!p2.tagClosed) return m("InvalidTag", "Closing tag '" + h2 + "' doesn't have proper closing.", N(t2, r2)); + if (f2.trim().length > 0) return m("InvalidTag", "Closing tag '" + h2 + "' can't have attributes or invalid starting.", N(t2, o2)); + if (0 === n2.length) return m("InvalidTag", "Closing tag '" + h2 + "' has not been opened.", N(t2, o2)); { const e3 = n2.pop(); - if (p2 !== e3.tagName) { - let n3 = b(t2, e3.tagStartPos); - return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + p2 + "'.", b(t2, a2)); + if (h2 !== e3.tagName) { + let n3 = N(t2, e3.tagStartPos); + return m("InvalidTag", "Expected closing tag '" + e3.tagName + "' (opened in line " + n3.line + ", col " + n3.col + ") instead of closing tag '" + h2 + "'.", N(t2, o2)); } 0 == n2.length && (s2 = true); } } else { - const r2 = g(E2, e2); - if (true !== r2) return m(r2.err.code, r2.err.msg, b(t2, o2 - E2.length + r2.err.line)); - if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", b(t2, o2)); - -1 !== e2.unpairedTags.indexOf(p2) || n2.push({ tagName: p2, tagStartPos: a2 }), i2 = true; + const a3 = g(f2, e2); + if (true !== a3) return m(a3.err.code, a3.err.msg, N(t2, r2 - f2.length + a3.err.line)); + if (true === s2) return m("InvalidXml", "Multiple possible root nodes found.", N(t2, r2)); + -1 !== e2.unpairedTags.indexOf(h2) || n2.push({ tagName: h2, tagStartPos: o2 }), i2 = true; } - for (o2++; o2 < t2.length; o2++) if ("<" === t2[o2]) { - if ("!" === t2[o2 + 1]) { - o2++, o2 = h(t2, o2); + for (r2++; r2 < t2.length; r2++) if ("<" === t2[r2]) { + if ("!" === t2[r2 + 1]) { + r2++, r2 = d(t2, r2); continue; } - if ("?" !== t2[o2 + 1]) break; - if (o2 = u(t2, ++o2), o2.err) return o2; - } else if ("&" === t2[o2]) { - const e3 = x(t2, o2); - if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", b(t2, o2)); - o2 = e3; - } else if (true === s2 && !l(t2[o2])) return m("InvalidXml", "Extra text at the end", b(t2, o2)); - "<" === t2[o2] && o2--; + if ("?" !== t2[r2 + 1]) break; + if (r2 = u(t2, ++r2), r2.err) return r2; + } else if ("&" === t2[r2]) { + const e3 = x(t2, r2); + if (-1 == e3) return m("InvalidChar", "char '&' is not expected.", N(t2, r2)); + r2 = e3; + } else if (true === s2 && !l(t2[r2])) return m("InvalidXml", "Extra text at the end", N(t2, r2)); + "<" === t2[r2] && r2--; } } } - return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", b(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map(((t3) => t3.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); + return i2 ? 1 == n2.length ? m("InvalidTag", "Unclosed tag '" + n2[0].tagName + "'.", N(t2, n2[0].tagStartPos)) : !(n2.length > 0) || m("InvalidXml", "Invalid '" + JSON.stringify(n2.map((t3) => t3.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m("InvalidXml", "Start tag expected.", 1); } function l(t2) { return " " === t2 || " " === t2 || "\n" === t2 || "\r" === t2; } function u(t2, e2) { const n2 = e2; - for (; e2 < t2.length; e2++) if ("?" != t2[e2] && " " != t2[e2]) ; - else { + for (; e2 < t2.length; e2++) if ("?" == t2[e2] || " " == t2[e2]) { const i2 = t2.substr(n2, e2 - n2); - if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", b(t2, e2)); + if (e2 > 5 && "xml" === i2) return m("InvalidXml", "XML declaration allowed only at the start of the document.", N(t2, e2)); if ("?" == t2[e2] && ">" == t2[e2 + 1]) { e2++; break; } + continue; } return e2; } - function h(t2, e2) { + function d(t2, e2) { if (t2.length > e2 + 5 && "-" === t2[e2 + 1] && "-" === t2[e2 + 2]) { for (e2 += 3; e2 < t2.length; e2++) if ("-" === t2[e2] && "-" === t2[e2 + 1] && ">" === t2[e2 + 2]) { e2 += 2; @@ -60666,11 +60666,11 @@ var require_fxp = __commonJS({ } return e2; } - const d = '"', p = "'"; - function f(t2, e2) { + const h = '"', p = "'"; + function c(t2, e2) { let n2 = "", i2 = "", s2 = false; for (; e2 < t2.length; e2++) { - if (t2[e2] === d || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); + if (t2[e2] === h || t2[e2] === p) "" === i2 ? i2 = t2[e2] : i2 !== t2[e2] || (i2 = ""); else if (">" === t2[e2] && "" === i2) { s2 = true; break; @@ -60679,16 +60679,16 @@ var require_fxp = __commonJS({ } return "" === i2 && { value: n2, index: e2, tagClosed: s2 }; } - const c = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); + const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function g(t2, e2) { - const n2 = s(t2, c), i2 = {}; + const n2 = s(t2, f), i2 = {}; for (let t3 = 0; t3 < n2.length; t3++) { - if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", N(n2[t3])); - if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", N(n2[t3])); - if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", N(n2[t3])); + if (0 === n2[t3][1].length) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' has no space in starting.", y(n2[t3])); + if (void 0 !== n2[t3][3] && void 0 === n2[t3][4]) return m("InvalidAttr", "Attribute '" + n2[t3][2] + "' is without value.", y(n2[t3])); + if (void 0 === n2[t3][3] && !e2.allowBooleanAttributes) return m("InvalidAttr", "boolean attribute '" + n2[t3][2] + "' is not allowed.", y(n2[t3])); const s2 = n2[t3][2]; - if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", N(n2[t3])); - if (i2.hasOwnProperty(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", N(n2[t3])); + if (!E(s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is an invalid name.", y(n2[t3])); + if (Object.prototype.hasOwnProperty.call(i2, s2)) return m("InvalidAttr", "Attribute '" + s2 + "' is repeated.", y(n2[t3])); i2[s2] = 1; } return true; @@ -60716,49 +60716,52 @@ var require_fxp = __commonJS({ function E(t2) { return r(t2); } - function b(t2, e2) { + function b(t2) { + return r(t2); + } + function N(t2, e2) { const n2 = t2.substring(0, e2).split(/\r?\n/); return { line: n2.length, col: n2[n2.length - 1].length + 1 }; } - function N(t2) { + function y(t2) { return t2.startIndex + t2[1].length; } - const y = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { + const T = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t2, e2, n2) { return t2; - }, captureMetaData: false }; - function T(t2) { - return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : T(true); + }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true }; + function w(t2) { + return "boolean" == typeof t2 ? { enabled: t2, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t2 && null !== t2 ? { enabled: false !== t2.enabled, maxEntitySize: t2.maxEntitySize ?? 1e4, maxExpansionDepth: t2.maxExpansionDepth ?? 10, maxTotalExpansions: t2.maxTotalExpansions ?? 1e3, maxExpandedLength: t2.maxExpandedLength ?? 1e5, allowedTags: t2.allowedTags ?? null, tagFilter: t2.tagFilter ?? null } : w(true); } - const w = function(t2) { - const e2 = Object.assign({}, y, t2); - return e2.processEntities = T(e2.processEntities), e2; + const v = function(t2) { + const e2 = Object.assign({}, T, t2); + return e2.processEntities = w(e2.processEntities), e2; }; - let v; - v = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); + let O; + O = "function" != typeof Symbol ? "@@xmlMetadata" : /* @__PURE__ */ Symbol("XML Node Metadata"); class I { constructor(t2) { - this.tagname = t2, this.child = [], this[":@"] = {}; + this.tagname = t2, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null); } add(t2, e2) { "__proto__" === t2 && (t2 = "#__proto__"), this.child.push({ [t2]: e2 }); } addChild(t2, e2) { - "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][v] = { startIndex: e2 }); + "__proto__" === t2.tagname && (t2.tagname = "#__proto__"), t2[":@"] && Object.keys(t2[":@"]).length > 0 ? this.child.push({ [t2.tagname]: t2.child, ":@": t2[":@"] }) : this.child.push({ [t2.tagname]: t2.child }), void 0 !== e2 && (this.child[this.child.length - 1][O] = { startIndex: e2 }); } static getMetaDataSymbol() { - return v; + return O; } } - class O { + class P { constructor(t2) { this.suppressValidationErr = !t2, this.options = t2; } readDocType(t2, e2) { - const n2 = {}; + const n2 = /* @__PURE__ */ Object.create(null); if ("O" !== t2[e2 + 3] || "C" !== t2[e2 + 4] || "T" !== t2[e2 + 5] || "Y" !== t2[e2 + 6] || "P" !== t2[e2 + 7] || "E" !== t2[e2 + 8]) throw new Error("Invalid Tag instead of DOCTYPE"); { e2 += 9; @@ -60767,23 +60770,23 @@ var require_fxp = __commonJS({ if (r2 ? "-" === t2[e2 - 1] && "-" === t2[e2 - 2] && (r2 = false, i2--) : i2--, 0 === i2) break; } else "[" === t2[e2] ? s2 = true : o2 += t2[e2]; else { - if (s2 && A(t2, "!ENTITY", e2)) { + if (s2 && S(t2, "!ENTITY", e2)) { let i3, s3; if (e2 += 7, [i3, s3, e2] = this.readEntityExp(t2, e2 + 1, this.suppressValidationErr), -1 === s3.indexOf("&")) { const t3 = i3.replace(/[.\-+*:]/g, "\\."); n2[i3] = { regx: RegExp(`&${t3};`, "g"), val: s3 }; } - } else if (s2 && A(t2, "!ELEMENT", e2)) { + } else if (s2 && S(t2, "!ELEMENT", e2)) { e2 += 8; const { index: n3 } = this.readElementExp(t2, e2 + 1); e2 = n3; - } else if (s2 && A(t2, "!ATTLIST", e2)) e2 += 8; - else if (s2 && A(t2, "!NOTATION", e2)) { + } else if (s2 && S(t2, "!ATTLIST", e2)) e2 += 8; + else if (s2 && S(t2, "!NOTATION", e2)) { e2 += 9; const { index: n3 } = this.readNotationExp(t2, e2 + 1, this.suppressValidationErr); e2 = n3; } else { - if (!A(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); + if (!S(t2, "!--", e2)) throw new Error("Invalid DOCTYPE"); r2 = true; } i2++, o2 = ""; @@ -60793,10 +60796,10 @@ var require_fxp = __commonJS({ return { entities: n2, i: e2 }; } readEntityExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]) && '"' !== t2[e2] && "'" !== t2[e2]; ) n2 += t2[e2], e2++; - if (S(n2), e2 = P(t2, e2), !this.suppressValidationErr) { + if (C(n2), e2 = A(t2, e2), !this.suppressValidationErr) { if ("SYSTEM" === t2.substring(e2, e2 + 6).toUpperCase()) throw new Error("External entities are not supported"); if ("%" === t2[e2]) throw new Error("Parameter entities are not supported"); } @@ -60805,15 +60808,15 @@ var require_fxp = __commonJS({ return [n2, i2, --e2]; } readNotationExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - !this.suppressValidationErr && S(n2), e2 = P(t2, e2); + !this.suppressValidationErr && C(n2), e2 = A(t2, e2); const i2 = t2.substring(e2, e2 + 6).toUpperCase(); if (!this.suppressValidationErr && "SYSTEM" !== i2 && "PUBLIC" !== i2) throw new Error(`Expected SYSTEM or PUBLIC, found "${i2}"`); - e2 += i2.length, e2 = P(t2, e2); + e2 += i2.length, e2 = A(t2, e2); let s2 = null, r2 = null; - if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = P(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); + if ("PUBLIC" === i2) [e2, s2] = this.readIdentifierVal(t2, e2, "publicIdentifier"), '"' !== t2[e2 = A(t2, e2)] && "'" !== t2[e2] || ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier")); else if ("SYSTEM" === i2 && ([e2, r2] = this.readIdentifierVal(t2, e2, "systemIdentifier"), !this.suppressValidationErr && !r2)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: n2, publicIdentifier: s2, systemIdentifier: r2, index: --e2 }; } @@ -60826,13 +60829,13 @@ var require_fxp = __commonJS({ return [++e2, i2]; } readElementExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; if (!this.suppressValidationErr && !r(n2)) throw new Error(`Invalid element name: "${n2}"`); let i2 = ""; - if ("E" === t2[e2 = P(t2, e2)] && A(t2, "MPTY", e2)) e2 += 4; - else if ("A" === t2[e2] && A(t2, "NY", e2)) e2 += 2; + if ("E" === t2[e2 = A(t2, e2)] && S(t2, "MPTY", e2)) e2 += 4; + else if ("A" === t2[e2] && S(t2, "NY", e2)) e2 += 2; else if ("(" === t2[e2]) { for (e2++; e2 < t2.length && ")" !== t2[e2]; ) i2 += t2[e2], e2++; if (")" !== t2[e2]) throw new Error("Unterminated content model"); @@ -60840,24 +60843,24 @@ var require_fxp = __commonJS({ return { elementName: n2, contentModel: i2.trim(), index: e2 }; } readAttlistExp(t2, e2) { - e2 = P(t2, e2); + e2 = A(t2, e2); let n2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) n2 += t2[e2], e2++; - S(n2), e2 = P(t2, e2); + C(n2), e2 = A(t2, e2); let i2 = ""; for (; e2 < t2.length && !/\s/.test(t2[e2]); ) i2 += t2[e2], e2++; - if (!S(i2)) throw new Error(`Invalid attribute name: "${i2}"`); - e2 = P(t2, e2); + if (!C(i2)) throw new Error(`Invalid attribute name: "${i2}"`); + e2 = A(t2, e2); let s2 = ""; if ("NOTATION" === t2.substring(e2, e2 + 8).toUpperCase()) { - if (s2 = "NOTATION", "(" !== t2[e2 = P(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); + if (s2 = "NOTATION", "(" !== t2[e2 = A(t2, e2 += 8)]) throw new Error(`Expected '(', found "${t2[e2]}"`); e2++; let n3 = []; for (; e2 < t2.length && ")" !== t2[e2]; ) { let i3 = ""; for (; e2 < t2.length && "|" !== t2[e2] && ")" !== t2[e2]; ) i3 += t2[e2], e2++; - if (i3 = i3.trim(), !S(i3)) throw new Error(`Invalid notation name: "${i3}"`); - n3.push(i3), "|" === t2[e2] && (e2++, e2 = P(t2, e2)); + if (i3 = i3.trim(), !C(i3)) throw new Error(`Invalid notation name: "${i3}"`); + n3.push(i3), "|" === t2[e2] && (e2++, e2 = A(t2, e2)); } if (")" !== t2[e2]) throw new Error("Unterminated list of notations"); e2++, s2 += " (" + n3.join("|") + ")"; @@ -60866,45 +60869,43 @@ var require_fxp = __commonJS({ const n3 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"]; if (!this.suppressValidationErr && !n3.includes(s2.toUpperCase())) throw new Error(`Invalid attribute type: "${s2}"`); } - e2 = P(t2, e2); + e2 = A(t2, e2); let r2 = ""; return "#REQUIRED" === t2.substring(e2, e2 + 8).toUpperCase() ? (r2 = "#REQUIRED", e2 += 8) : "#IMPLIED" === t2.substring(e2, e2 + 7).toUpperCase() ? (r2 = "#IMPLIED", e2 += 7) : [e2, r2] = this.readIdentifierVal(t2, e2, "ATTLIST"), { elementName: n2, attributeName: i2, attributeType: s2, defaultValue: r2, index: e2 }; } } - const P = (t2, e2) => { + const A = (t2, e2) => { for (; e2 < t2.length && /\s/.test(t2[e2]); ) e2++; return e2; }; - function A(t2, e2, n2) { + function S(t2, e2, n2) { for (let i2 = 0; i2 < e2.length; i2++) if (e2[i2] !== t2[n2 + i2 + 1]) return false; return true; } - function S(t2) { + function C(t2) { if (r(t2)) return t2; throw new Error(`Invalid entity name ${t2}`); } - const C = /^[-+]?0x[a-fA-F0-9]+$/, $ = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; - const D = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; - function L(t2) { - return "function" == typeof t2 ? t2 : Array.isArray(t2) ? (e2) => { - for (const n2 of t2) { - if ("string" == typeof n2 && e2 === n2) return true; - if (n2 instanceof RegExp && n2.test(e2)) return true; - } - } : () => false; - } - class F { + const $ = /^[-+]?0x[a-fA-F0-9]+$/, V = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true }; + const j = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/; + class L { constructor(t2) { - if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e2) => K(e2, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e2) => K(e2, 16, "&#x") } }, this.addExternalEntities = j, this.parseXml = B, this.parseTextData = M, this.resolveNameSpace = _, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = R, this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { + var e2; + if (this.options = t2, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t3, e3) => K(e3, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t3, e3) => K(e3, 16, "&#x") } }, this.addExternalEntities = F, this.parseXml = R, this.parseTextData = M, this.resolveNameSpace = k, this.buildAttributesMap = U, this.isItStopNode = X, this.replaceEntitiesValue = Y, this.readStopNodeData = q, this.saveTextToParentTag = G, this.addChild = B, this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) { this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set(); for (let t3 = 0; t3 < this.options.stopNodes.length; t3++) { - const e2 = this.options.stopNodes[t3]; - "string" == typeof e2 && (e2.startsWith("*.") ? this.stopNodesWildcard.add(e2.substring(2)) : this.stopNodesExact.add(e2)); + const e3 = this.options.stopNodes[t3]; + "string" == typeof e3 && (e3.startsWith("*.") ? this.stopNodesWildcard.add(e3.substring(2)) : this.stopNodesExact.add(e3)); } } } } - function j(t2) { + function F(t2) { const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2], s2 = i2.replace(/[.\-+*:]/g, "\\."); @@ -60918,7 +60919,7 @@ var require_fxp = __commonJS({ return null == i3 ? t2 : typeof i3 != typeof t2 || i3 !== t2 ? i3 : this.options.trimValues || t2.trim() === t2 ? Z(t2, this.options.parseTagValue, this.options.numberParseOptions) : t2; } } - function _(t2) { + function k(t2) { if (this.options.removeNSPrefix) { const e2 = t2.split(":"), n2 = "/" === t2.charAt(0) ? "/" : ""; if ("xmlns" === e2[0]) return ""; @@ -60926,10 +60927,10 @@ var require_fxp = __commonJS({ } return t2; } - const k = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); + const _ = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function U(t2, e2, n2) { if (true !== this.options.ignoreAttributes && "string" == typeof t2) { - const i2 = s(t2, k), r2 = i2.length, o2 = {}; + const i2 = s(t2, _), r2 = i2.length, o2 = {}; for (let t3 = 0; t3 < r2; t3++) { const s2 = this.resolveNameSpace(i2[t3][1]); if (this.ignoreAttributesFn(s2, e2)) continue; @@ -60948,12 +60949,12 @@ var require_fxp = __commonJS({ return o2; } } - const B = function(t2) { + const R = function(t2) { t2 = t2.replace(/\r\n?/g, "\n"); const e2 = new I("!xml"); let n2 = e2, i2 = "", s2 = ""; this.entityExpansionCount = 0, this.currentExpandedLength = 0; - const r2 = new O(this.options.processEntities); + const r2 = new P(this.options.processEntities); for (let o2 = 0; o2 < t2.length; o2++) if ("<" === t2[o2]) if ("/" === t2[o2 + 1]) { const e3 = z(t2, ">", o2, "Closing Tag is not closed."); let r3 = t2.substring(o2 + 2, e3).trim(); @@ -60993,26 +60994,27 @@ var require_fxp = __commonJS({ } else { let r3 = W(t2, o2, this.options.removeNSPrefix), a2 = r3.tagName; const l2 = r3.rawTagName; - let u2 = r3.tagExp, h2 = r3.attrExpPresent, d2 = r3.closeIndex; + let u2 = r3.tagExp, d2 = r3.attrExpPresent, h2 = r3.closeIndex; if (this.options.transformTagName) { const t3 = this.options.transformTagName(a2); u2 === a2 && (u2 = t3), a2 = t3; } + if (this.options.strictReservedNames && (a2 === this.options.commentPropName || a2 === this.options.cdataPropName)) throw new Error(`Invalid tag name: ${a2}`); n2 && i2 && "!xml" !== n2.tagname && (i2 = this.saveTextToParentTag(i2, n2, s2, false)); const p2 = n2; p2 && -1 !== this.options.unpairedTags.indexOf(p2.tagname) && (n2 = this.tagsNodeStack.pop(), s2 = s2.substring(0, s2.lastIndexOf("."))), a2 !== e2.tagname && (s2 += s2 ? "." + a2 : a2); - const f2 = o2; + const c2 = o2; if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s2, a2)) { let e3 = ""; if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) "/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), o2 = r3.closeIndex; else if (-1 !== this.options.unpairedTags.indexOf(a2)) o2 = r3.closeIndex; else { - const n3 = this.readStopNodeData(t2, l2, d2 + 1); + const n3 = this.readStopNodeData(t2, l2, h2 + 1); if (!n3) throw new Error(`Unexpected end of ${l2}`); o2 = n3.i, e3 = n3.tagContent; } const i3 = new I(a2); - a2 !== u2 && h2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, h2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, f2); + a2 !== u2 && d2 && (i3[":@"] = this.buildAttributesMap(u2, s2, a2)), e3 && (e3 = this.parseTextData(e3, a2, s2, true, d2, true, true)), s2 = s2.substr(0, s2.lastIndexOf(".")), i3.add(this.options.textNodeName, e3), this.addChild(n2, i3, s2, c2); } else { if (u2.length > 0 && u2.lastIndexOf("/") === u2.length - 1) { if ("/" === a2[a2.length - 1] ? (a2 = a2.substr(0, a2.length - 1), s2 = s2.substr(0, s2.length - 1), u2 = a2) : u2 = u2.substr(0, u2.length - 1), this.options.transformTagName) { @@ -61020,18 +61022,26 @@ var require_fxp = __commonJS({ u2 === a2 && (u2 = t4), a2 = t4; } const t3 = new I(a2); - a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), s2 = s2.substr(0, s2.lastIndexOf(".")); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")); } else { - const t3 = new I(a2); - this.tagsNodeStack.push(n2), a2 !== u2 && h2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, f2), n2 = t3; + if (-1 !== this.options.unpairedTags.indexOf(a2)) { + const t3 = new I(a2); + a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2)), this.addChild(n2, t3, s2, c2), s2 = s2.substr(0, s2.lastIndexOf(".")), o2 = r3.closeIndex; + continue; + } + { + const t3 = new I(a2); + if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded"); + this.tagsNodeStack.push(n2), a2 !== u2 && d2 && (t3[":@"] = this.buildAttributesMap(u2, s2, a2)), this.addChild(n2, t3, s2, c2), n2 = t3; + } } - i2 = "", o2 = d2; + i2 = "", o2 = h2; } } else i2 += t2[o2]; return e2.child; }; - function R(t2, e2, n2, i2) { + function B(t2, e2, n2, i2) { this.options.captureMetaData || (i2 = void 0); const s2 = this.options.updateTag(e2.tagname, n2, e2[":@"]); false === s2 || ("string" == typeof s2 ? (e2.tagname = s2, t2.addChild(e2, i2)) : t2.addChild(e2, i2)); @@ -61092,12 +61102,12 @@ var require_fxp = __commonJS({ const o2 = s2.index, a2 = r2.search(/\s/); let l2 = r2, u2 = true; -1 !== a2 && (l2 = r2.substring(0, a2), r2 = r2.substring(a2 + 1).trimStart()); - const h2 = l2; + const d2 = l2; if (n2) { const t3 = l2.indexOf(":"); -1 !== t3 && (l2 = l2.substr(t3 + 1), u2 = l2 !== s2.data.substr(t3 + 1)); } - return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: h2 }; + return { tagName: l2, tagExp: r2, closeIndex: o2, attrExpPresent: u2, rawTagName: d2 }; } function q(t2, e2, n2) { const i2 = n2; @@ -61118,19 +61128,19 @@ var require_fxp = __commonJS({ if (e2 && "string" == typeof t2) { const e3 = t2.trim(); return "true" === e3 || "false" !== e3 && (function(t3, e4 = {}) { - if (e4 = Object.assign({}, V, e4), !t3 || "string" != typeof t3) return t3; + if (e4 = Object.assign({}, D, e4), !t3 || "string" != typeof t3) return t3; let n3 = t3.trim(); if (void 0 !== e4.skipLike && e4.skipLike.test(n3)) return t3; if ("0" === t3) return 0; - if (e4.hex && C.test(n3)) return (function(t4) { + if (e4.hex && $.test(n3)) return (function(t4) { if (parseInt) return parseInt(t4, 16); if (Number.parseInt) return Number.parseInt(t4, 16); if (window && window.parseInt) return window.parseInt(t4, 16); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); })(n3); - if (-1 !== n3.search(/.+[eE].+/)) return (function(t4, e5, n4) { + if (n3.includes("e") || n3.includes("E")) return (function(t4, e5, n4) { if (!n4.eNotation) return t4; - const i3 = e5.match(D); + const i3 = e5.match(j); if (i3) { let s2 = i3[1] || ""; const r2 = -1 === i3[3].indexOf("e") ? "E" : "e", o2 = i3[2], a2 = s2 ? t4[o2.length + 1] === r2 : t4[o2.length] === r2; @@ -61139,7 +61149,7 @@ var require_fxp = __commonJS({ return t4; })(t3, n3, e4); { - const s2 = $.exec(n3); + const s2 = V.exec(n3); if (s2) { const r2 = s2[1] || "", o2 = s2[2]; let a2 = (i2 = s2[3]) && -1 !== i2.indexOf(".") ? ("." === (i2 = i2.replace(/0+$/, "")) ? i2 = "0" : "." === i2[0] ? i2 = "0" + i2 : "." === i2[i2.length - 1] && (i2 = i2.substring(0, i2.length - 1)), i2) : i2; @@ -61147,7 +61157,7 @@ var require_fxp = __commonJS({ if (!e4.leadingZeros && (o2.length > 1 || 1 === o2.length && !l2)) return t3; { const i3 = Number(n3), s3 = String(i3); - if (0 === i3 || -0 === i3) return i3; + if (0 === i3) return i3; if (-1 !== s3.search(/[eE]/)) return e4.eNotation ? i3 : t3; if (-1 !== n3.indexOf(".")) return "0" === s3 || s3 === a2 || s3 === `${r2}${a2}` ? i3 : t3; let l3 = o2 ? a2 : n3; @@ -61181,7 +61191,7 @@ var require_fxp = __commonJS({ if (o2[a2]) { let t3 = H(o2[a2], e2, l2); const n3 = nt(t3, e2); - void 0 !== o2[Q] && (t3[Q] = o2[Q]), o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== s2[a2] && s2.hasOwnProperty(a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; + o2[":@"] ? et(t3, o2[":@"], l2, e2) : 1 !== Object.keys(t3).length || void 0 === t3[e2.textNodeName] || e2.alwaysCreateTextNode ? 0 === Object.keys(t3).length && (e2.alwaysCreateTextNode ? t3[e2.textNodeName] = "" : t3 = "") : t3 = t3[e2.textNodeName], void 0 !== o2[Q] && "object" == typeof t3 && null !== t3 && (t3[Q] = o2[Q]), void 0 !== s2[a2] && Object.prototype.hasOwnProperty.call(s2, a2) ? (Array.isArray(s2[a2]) || (s2[a2] = [s2[a2]]), s2[a2].push(t3)) : e2.isArray(a2, l2, n3) ? s2[a2] = [t3] : s2[a2] = t3; } } } @@ -61209,7 +61219,7 @@ var require_fxp = __commonJS({ } class it { constructor(t2) { - this.externalEntities = {}, this.options = w(t2); + this.externalEntities = {}, this.options = v(t2); } parse(t2, e2) { if ("string" != typeof t2 && t2.toString) t2 = t2.toString(); @@ -61219,7 +61229,7 @@ var require_fxp = __commonJS({ const n3 = a(t2, e2); if (true !== n3) throw Error(`${n3.err.msg}:${n3.err.line}:${n3.err.col}`); } - const n2 = new F(this.options); + const n2 = new L(this.options); n2.addExternalEntities(this.externalEntities); const i2 = n2.parseXml(t2); return this.options.preserveOrder || void 0 === i2 ? i2 : J(i2, this.options); @@ -61240,6 +61250,13 @@ var require_fxp = __commonJS({ } function rt(t2, e2, n2, i2) { let s2 = "", r2 = false; + if (!Array.isArray(t2)) { + if (null != t2) { + let n3 = t2.toString(); + return n3 = ut(n3, e2), n3; + } + return ""; + } for (let o2 = 0; o2 < t2.length; o2++) { const a2 = t2[o2], l2 = ot(a2); if (void 0 === l2) continue; @@ -61263,10 +61280,10 @@ var require_fxp = __commonJS({ o3 = 0 !== o3.length ? " " + o3 : "", s2 += n3 + `<${l2}${o3}${t3}?>`, r2 = true; continue; } - let h2 = i2; - "" !== h2 && (h2 += e2.indentBy); - const d2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, h2); - -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += d2 + ">" : s2 += d2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += d2 + `>${p2}${i2}` : (s2 += d2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += d2 + "/>", r2 = true; + let d2 = i2; + "" !== d2 && (d2 += e2.indentBy); + const h2 = i2 + `<${l2}${at(a2[":@"], e2)}`, p2 = rt(a2[l2], e2, u2, d2); + -1 !== e2.unpairedTags.indexOf(l2) ? e2.suppressUnpairedNode ? s2 += h2 + ">" : s2 += h2 + "/>" : p2 && 0 !== p2.length || !e2.suppressEmptyNode ? p2 && p2.endsWith(">") ? s2 += h2 + `>${p2}${i2}` : (s2 += h2 + ">", p2 && "" !== i2 && (p2.includes("/>") || p2.includes("`) : s2 += h2 + "/>", r2 = true; } return s2; } @@ -61274,13 +61291,13 @@ var require_fxp = __commonJS({ const e2 = Object.keys(t2); for (let n2 = 0; n2 < e2.length; n2++) { const i2 = e2[n2]; - if (t2.hasOwnProperty(i2) && ":@" !== i2) return i2; + if (Object.prototype.hasOwnProperty.call(t2, i2) && ":@" !== i2) return i2; } } function at(t2, e2) { let n2 = ""; if (t2 && !e2.ignoreAttributes) for (let i2 in t2) { - if (!t2.hasOwnProperty(i2)) continue; + if (!Object.prototype.hasOwnProperty.call(t2, i2)) continue; let s2 = e2.attributeValueProcessor(i2, t2[i2]); s2 = ut(s2, e2), true === s2 && e2.suppressBooleanAttributes ? n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}` : n2 += ` ${i2.substr(e2.attributeNamePrefix.length)}="${s2}"`; } @@ -61298,15 +61315,21 @@ var require_fxp = __commonJS({ } return t2; } - const ht = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { + const dt = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t2, e2) { return e2; }, attributeValueProcessor: function(t2, e2) { return e2; }, preserveOrder: false, commentPropName: false, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&" }, { regex: new RegExp(">", "g"), val: ">" }, { regex: new RegExp("<", "g"), val: "<" }, { regex: new RegExp("'", "g"), val: "'" }, { regex: new RegExp('"', "g"), val: """ }], processEntities: true, stopNodes: [], oneListGroup: false }; - function dt(t2) { - this.options = Object.assign({}, ht, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { + function ht(t2) { + var e2; + this.options = Object.assign({}, dt, t2), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() { return false; - } : (this.ignoreAttributesFn = L(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ct), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ft, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { + } : (this.ignoreAttributesFn = "function" == typeof (e2 = this.options.ignoreAttributes) ? e2 : Array.isArray(e2) ? (t3) => { + for (const n2 of e2) { + if ("string" == typeof n2 && t3 === n2) return true; + if (n2 instanceof RegExp && n2.test(t3)) return true; + } + } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = ft), this.processTextOrObjNode = pt, this.options.format ? (this.indentate = ct, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() { return ""; }, this.tagEndChar = ">", this.newLine = ""); } @@ -61314,15 +61337,15 @@ var require_fxp = __commonJS({ const s2 = this.j2x(t2, n2 + 1, i2.concat(e2)); return void 0 !== t2[this.options.textNodeName] && 1 === Object.keys(t2).length ? this.buildTextValNode(t2[this.options.textNodeName], e2, s2.attrStr, n2) : this.buildObjectNode(s2.val, e2, s2.attrStr, n2); } - function ft(t2) { + function ct(t2) { return this.options.indentBy.repeat(t2); } - function ct(t2) { + function ft(t2) { return !(!t2.startsWith(this.options.attributeNamePrefix) || t2 === this.options.textNodeName) && t2.substr(this.attrPrefixLen); } - dt.prototype.build = function(t2) { + ht.prototype.build = function(t2) { return this.options.preserveOrder ? st(t2, this.options) : (Array.isArray(t2) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t2 = { [this.options.arrayNodeName]: t2 }), this.j2x(t2, 0, []).val); - }, dt.prototype.j2x = function(t2, e2, n2) { + }, ht.prototype.j2x = function(t2, e2, n2) { let i2 = "", s2 = ""; const r2 = n2.join("."); for (let o2 in t2) if (Object.prototype.hasOwnProperty.call(t2, o2)) if (void 0 === t2[o2]) this.isAttribute(o2) && (s2 += ""); @@ -61357,18 +61380,18 @@ var require_fxp = __commonJS({ for (let s3 = 0; s3 < n3; s3++) i2 += this.buildAttrPairStr(e3[s3], "" + t2[o2][e3[s3]]); } else s2 += this.processTextOrObjNode(t2[o2], o2, e2, n2); return { attrStr: i2, val: s2 }; - }, dt.prototype.buildAttrPairStr = function(t2, e2) { + }, ht.prototype.buildAttrPairStr = function(t2, e2) { return e2 = this.options.attributeValueProcessor(t2, "" + e2), e2 = this.replaceEntitiesValue(e2), this.options.suppressBooleanAttributes && "true" === e2 ? " " + t2 : " " + t2 + '="' + e2 + '"'; - }, dt.prototype.buildObjectNode = function(t2, e2, n2, i2) { + }, ht.prototype.buildObjectNode = function(t2, e2, n2, i2) { if ("" === t2) return "?" === e2[0] ? this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar; { let s2 = "` + this.newLine : this.indentate(i2) + "<" + e2 + n2 + r2 + this.tagEndChar + t2 + this.indentate(i2) + s2 : this.indentate(i2) + "<" + e2 + n2 + r2 + ">" + t2 + s2; } - }, dt.prototype.closeTag = function(t2) { + }, ht.prototype.closeTag = function(t2) { let e2 = ""; return -1 !== this.options.unpairedTags.indexOf(t2) ? this.options.suppressUnpairedNode || (e2 = "/") : e2 = this.options.suppressEmptyNode ? "/" : `>` + this.newLine; if (false !== this.options.commentPropName && e2 === this.options.commentPropName) return this.indentate(i2) + `` + this.newLine; if ("?" === e2[0]) return this.indentate(i2) + "<" + e2 + n2 + "?" + this.tagEndChar; @@ -61376,14 +61399,14 @@ var require_fxp = __commonJS({ let s2 = this.options.tagValueProcessor(e2, t2); return s2 = this.replaceEntitiesValue(s2), "" === s2 ? this.indentate(i2) + "<" + e2 + n2 + this.closeTag(e2) + this.tagEndChar : this.indentate(i2) + "<" + e2 + n2 + ">" + s2 + " 0 && this.options.processEntities) for (let e2 = 0; e2 < this.options.entities.length; e2++) { const n2 = this.options.entities[e2]; t2 = t2.replace(n2.regex, n2.val); } return t2; }; - const gt = { validate: a }; + const gt = ht, xt = { validate: a }; module2.exports = e; })(); }