@abaplint/cli 2.116.1 → 2.117.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1009 -481
- package/package.json +4 -4
package/build/cli.js
CHANGED
|
@@ -8799,9 +8799,10 @@ const combi_1 = __webpack_require__(/*! ../combi */ "./node_modules/@abaplint/co
|
|
|
8799
8799
|
const _1 = __webpack_require__(/*! . */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
8800
8800
|
const wparen_leftw_1 = __webpack_require__(/*! ../../1_lexer/tokens/wparen_leftw */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/wparen_leftw.js");
|
|
8801
8801
|
const wparen_left_1 = __webpack_require__(/*! ../../1_lexer/tokens/wparen_left */ "./node_modules/@abaplint/core/build/src/abap/1_lexer/tokens/wparen_left.js");
|
|
8802
|
+
const version_1 = __webpack_require__(/*! ../../../version */ "./node_modules/@abaplint/core/build/src/version.js");
|
|
8802
8803
|
class SQLIntoList extends combi_1.Expression {
|
|
8803
8804
|
getRunnable() {
|
|
8804
|
-
const intoList = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(wparen_left_1.WParenLeft), (0, combi_1.tok)(wparen_leftw_1.WParenLeftW)), (0, combi_1.starPrio)((0, combi_1.seq)(_1.SQLTarget, ",")), _1.SQLTarget, ")");
|
|
8805
|
+
const intoList = (0, combi_1.seq)((0, combi_1.altPrio)((0, combi_1.tok)(wparen_left_1.WParenLeft), (0, combi_1.ver)(version_1.Version.v740sp02, (0, combi_1.tok)(wparen_leftw_1.WParenLeftW))), (0, combi_1.starPrio)((0, combi_1.seq)(_1.SQLTarget, ",")), _1.SQLTarget, ")");
|
|
8805
8806
|
return (0, combi_1.seq)("INTO", intoList);
|
|
8806
8807
|
}
|
|
8807
8808
|
}
|
|
@@ -29012,36 +29013,36 @@ class SQLCompare {
|
|
|
29012
29013
|
if (sqlin) {
|
|
29013
29014
|
sql_in_1.SQLIn.runSyntax(sqlin, input);
|
|
29014
29015
|
}
|
|
29015
|
-
const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
29016
|
+
const fieldName = (_b = node.findDirectExpression(Expressions.SQLFieldName)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
|
|
29016
29017
|
if (fieldName && sourceType && token) {
|
|
29017
29018
|
// check compatibility for rule sql_value_conversion
|
|
29018
29019
|
const targetType = this.findType(fieldName, tables, input.scope);
|
|
29019
29020
|
let message = "";
|
|
29020
29021
|
if (sourceType instanceof basic_1.IntegerType
|
|
29021
29022
|
&& targetType instanceof basic_1.CharacterType) {
|
|
29022
|
-
message =
|
|
29023
|
+
message = `${fieldName}: Integer to CHAR conversion`;
|
|
29023
29024
|
}
|
|
29024
29025
|
else if (sourceType instanceof basic_1.IntegerType
|
|
29025
29026
|
&& targetType instanceof basic_1.NumericType) {
|
|
29026
|
-
message =
|
|
29027
|
+
message = `${fieldName}: Integer to NUMC conversion`;
|
|
29027
29028
|
}
|
|
29028
29029
|
else if (sourceType instanceof basic_1.NumericType
|
|
29029
29030
|
&& targetType instanceof basic_1.IntegerType) {
|
|
29030
|
-
message =
|
|
29031
|
+
message = `${fieldName}: NUMC to Integer conversion`;
|
|
29031
29032
|
}
|
|
29032
29033
|
else if (sourceType instanceof basic_1.CharacterType
|
|
29033
29034
|
&& targetType instanceof basic_1.IntegerType) {
|
|
29034
|
-
message =
|
|
29035
|
+
message = `${fieldName}: CHAR to Integer conversion`;
|
|
29035
29036
|
}
|
|
29036
29037
|
else if (sourceType instanceof basic_1.CharacterType
|
|
29037
29038
|
&& targetType instanceof basic_1.CharacterType
|
|
29038
29039
|
&& sourceType.getLength() > targetType.getLength()) {
|
|
29039
|
-
message =
|
|
29040
|
+
message = `${fieldName}: Source field longer than database field, CHAR -> CHAR`;
|
|
29040
29041
|
}
|
|
29041
29042
|
else if (sourceType instanceof basic_1.NumericType
|
|
29042
29043
|
&& targetType instanceof basic_1.NumericType
|
|
29043
29044
|
&& sourceType.getLength() > targetType.getLength()) {
|
|
29044
|
-
message =
|
|
29045
|
+
message = `${fieldName}: Source field longer than database field, NUMC -> NUMC`;
|
|
29045
29046
|
}
|
|
29046
29047
|
if (message !== "") {
|
|
29047
29048
|
input.scope.addSQLConversion(fieldName, message, token);
|
|
@@ -47104,6 +47105,12 @@ exports.AbstractObject = AbstractObject;
|
|
|
47104
47105
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
47105
47106
|
exports.parseDynpros = parseDynpros;
|
|
47106
47107
|
const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
|
|
47108
|
+
function parseNumber(value) {
|
|
47109
|
+
if (value === undefined) {
|
|
47110
|
+
return 0;
|
|
47111
|
+
}
|
|
47112
|
+
return parseInt(value, 10);
|
|
47113
|
+
}
|
|
47107
47114
|
function parseDynpros(parsed) {
|
|
47108
47115
|
var _a, _b, _c, _d;
|
|
47109
47116
|
const dynpros = [];
|
|
@@ -47115,7 +47122,10 @@ function parseDynpros(parsed) {
|
|
|
47115
47122
|
fields.push({
|
|
47116
47123
|
name: f.NAME,
|
|
47117
47124
|
type: f.TYPE,
|
|
47118
|
-
length: f.LENGTH,
|
|
47125
|
+
length: parseNumber(f.LENGTH),
|
|
47126
|
+
line: parseNumber(f.LINE),
|
|
47127
|
+
column: parseNumber(f.COLUMN),
|
|
47128
|
+
height: parseNumber(f.HEIGHT),
|
|
47119
47129
|
});
|
|
47120
47130
|
}
|
|
47121
47131
|
dynpros.push({
|
|
@@ -52638,6 +52648,10 @@ class Program extends _abap_object_1.ABAPObject {
|
|
|
52638
52648
|
this.parseXML();
|
|
52639
52649
|
return this.parsedXML.dynpros || [];
|
|
52640
52650
|
}
|
|
52651
|
+
getSelectionTexts() {
|
|
52652
|
+
this.parseXML();
|
|
52653
|
+
return this.parsedXML.selectionTexts;
|
|
52654
|
+
}
|
|
52641
52655
|
////////////////////////////
|
|
52642
52656
|
parseXML() {
|
|
52643
52657
|
var _a, _b, _c;
|
|
@@ -52652,14 +52666,19 @@ class Program extends _abap_object_1.ABAPObject {
|
|
|
52652
52666
|
isModulePool: false,
|
|
52653
52667
|
description: undefined,
|
|
52654
52668
|
dynpros: [],
|
|
52669
|
+
selectionTexts: {},
|
|
52655
52670
|
};
|
|
52656
52671
|
return;
|
|
52657
52672
|
}
|
|
52658
52673
|
let description = "";
|
|
52674
|
+
const selectionTexts = {};
|
|
52659
52675
|
for (const t of (0, xml_utils_1.xmlToArray)((_c = (_b = (_a = parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.TPOOL) === null || _c === void 0 ? void 0 : _c.item)) {
|
|
52660
52676
|
if ((t === null || t === void 0 ? void 0 : t.ID) === "R") {
|
|
52661
52677
|
description = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "";
|
|
52662
52678
|
}
|
|
52679
|
+
else if ((t === null || t === void 0 ? void 0 : t.ID) === "S" && t.KEY !== undefined) {
|
|
52680
|
+
selectionTexts[t.KEY.toUpperCase()] = t.ENTRY ? (0, xml_utils_1.unescape)(t.ENTRY) : "";
|
|
52681
|
+
}
|
|
52663
52682
|
}
|
|
52664
52683
|
const dynpros = (0, _dynpros_1.parseDynpros)(parsed);
|
|
52665
52684
|
this.parsedXML = {
|
|
@@ -52667,6 +52686,7 @@ class Program extends _abap_object_1.ABAPObject {
|
|
|
52667
52686
|
isModulePool: file ? file.getRaw().includes("<SUBC>M</SUBC>") : false,
|
|
52668
52687
|
dynpros: dynpros,
|
|
52669
52688
|
description: description,
|
|
52689
|
+
selectionTexts: selectionTexts,
|
|
52670
52690
|
};
|
|
52671
52691
|
}
|
|
52672
52692
|
}
|
|
@@ -55795,7 +55815,7 @@ class Registry {
|
|
|
55795
55815
|
}
|
|
55796
55816
|
static abaplintVersion() {
|
|
55797
55817
|
// magic, see build script "version.sh"
|
|
55798
|
-
return "2.
|
|
55818
|
+
return "2.117.1";
|
|
55799
55819
|
}
|
|
55800
55820
|
getDDICReferences() {
|
|
55801
55821
|
return this.ddicReferences;
|
|
@@ -64099,7 +64119,7 @@ class DynproChecks {
|
|
|
64099
64119
|
key: "dynpro_checks",
|
|
64100
64120
|
title: "Dynpro Checks",
|
|
64101
64121
|
shortDescription: `Various Dynpro checks`,
|
|
64102
|
-
extendedInformation: `* Check length of PUSH elements less than 132`,
|
|
64122
|
+
extendedInformation: `* Check length of PUSH elements less than 132\n* Check for overlapping screen elements`,
|
|
64103
64123
|
tags: [_irule_1.RuleTag.Syntax],
|
|
64104
64124
|
};
|
|
64105
64125
|
}
|
|
@@ -64128,9 +64148,43 @@ class DynproChecks {
|
|
|
64128
64148
|
ret.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.getConfig().severity));
|
|
64129
64149
|
}
|
|
64130
64150
|
}
|
|
64151
|
+
ret.push(...this.findOverlappingFields(dynpro, file));
|
|
64152
|
+
}
|
|
64153
|
+
return ret;
|
|
64154
|
+
}
|
|
64155
|
+
findOverlappingFields(dynpro, file) {
|
|
64156
|
+
const ret = [];
|
|
64157
|
+
for (let index = 0; index < dynpro.fields.length; index++) {
|
|
64158
|
+
const current = dynpro.fields[index];
|
|
64159
|
+
if (current.name === undefined) {
|
|
64160
|
+
continue;
|
|
64161
|
+
}
|
|
64162
|
+
for (let compare = index + 1; compare < dynpro.fields.length; compare++) {
|
|
64163
|
+
const other = dynpro.fields[compare];
|
|
64164
|
+
if (other.name === undefined || this.overlaps(current, other) === false) {
|
|
64165
|
+
continue;
|
|
64166
|
+
}
|
|
64167
|
+
const message = `Screen ${dynpro.number}, fields ${current.name} and ${other.name} are overlapping`;
|
|
64168
|
+
ret.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.getConfig().severity));
|
|
64169
|
+
}
|
|
64131
64170
|
}
|
|
64132
64171
|
return ret;
|
|
64133
64172
|
}
|
|
64173
|
+
overlaps(first, second) {
|
|
64174
|
+
if (first.line === 0 || second.line === 0 || first.column === 0 || second.column === 0) {
|
|
64175
|
+
return false;
|
|
64176
|
+
}
|
|
64177
|
+
const firstHeight = Math.max(first.height, 1);
|
|
64178
|
+
const secondHeight = Math.max(second.height, 1);
|
|
64179
|
+
const firstLastLine = first.line + firstHeight - 1;
|
|
64180
|
+
const secondLastLine = second.line + secondHeight - 1;
|
|
64181
|
+
if (firstLastLine < second.line || secondLastLine < first.line) {
|
|
64182
|
+
return false;
|
|
64183
|
+
}
|
|
64184
|
+
const firstLastColumn = first.column + Math.max(first.length, 1) - 1;
|
|
64185
|
+
const secondLastColumn = second.column + Math.max(second.length, 1) - 1;
|
|
64186
|
+
return first.column <= secondLastColumn && second.column <= firstLastColumn;
|
|
64187
|
+
}
|
|
64134
64188
|
}
|
|
64135
64189
|
exports.DynproChecks = DynproChecks;
|
|
64136
64190
|
//# sourceMappingURL=dynpro_checks.js.map
|
|
@@ -67450,6 +67504,7 @@ __exportStar(__webpack_require__(/*! ./select_add_order_by */ "./node_modules/@a
|
|
|
67450
67504
|
__exportStar(__webpack_require__(/*! ./select_performance */ "./node_modules/@abaplint/core/build/src/rules/select_performance.js"), exports);
|
|
67451
67505
|
__exportStar(__webpack_require__(/*! ./select_single_full_key */ "./node_modules/@abaplint/core/build/src/rules/select_single_full_key.js"), exports);
|
|
67452
67506
|
__exportStar(__webpack_require__(/*! ./selection_screen_naming */ "./node_modules/@abaplint/core/build/src/rules/selection_screen_naming.js"), exports);
|
|
67507
|
+
__exportStar(__webpack_require__(/*! ./selection_screen_texts_missing */ "./node_modules/@abaplint/core/build/src/rules/selection_screen_texts_missing.js"), exports);
|
|
67453
67508
|
__exportStar(__webpack_require__(/*! ./sequential_blank */ "./node_modules/@abaplint/core/build/src/rules/sequential_blank.js"), exports);
|
|
67454
67509
|
__exportStar(__webpack_require__(/*! ./short_case */ "./node_modules/@abaplint/core/build/src/rules/short_case.js"), exports);
|
|
67455
67510
|
__exportStar(__webpack_require__(/*! ./sicf_consistency */ "./node_modules/@abaplint/core/build/src/rules/sicf_consistency.js"), exports);
|
|
@@ -75029,6 +75084,95 @@ exports.SelectionScreenNaming = SelectionScreenNaming;
|
|
|
75029
75084
|
|
|
75030
75085
|
/***/ },
|
|
75031
75086
|
|
|
75087
|
+
/***/ "./node_modules/@abaplint/core/build/src/rules/selection_screen_texts_missing.js"
|
|
75088
|
+
/*!***************************************************************************************!*\
|
|
75089
|
+
!*** ./node_modules/@abaplint/core/build/src/rules/selection_screen_texts_missing.js ***!
|
|
75090
|
+
\***************************************************************************************/
|
|
75091
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
75092
|
+
|
|
75093
|
+
"use strict";
|
|
75094
|
+
|
|
75095
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75096
|
+
exports.SelectionScreenTextsMissing = exports.SelectionScreenTextsMissingConf = void 0;
|
|
75097
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "./node_modules/@abaplint/core/build/src/issue.js");
|
|
75098
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "./node_modules/@abaplint/core/build/src/rules/_basic_rule_config.js");
|
|
75099
|
+
const statements_1 = __webpack_require__(/*! ../abap/2_statements/statements */ "./node_modules/@abaplint/core/build/src/abap/2_statements/statements/index.js");
|
|
75100
|
+
const expressions_1 = __webpack_require__(/*! ../abap/2_statements/expressions */ "./node_modules/@abaplint/core/build/src/abap/2_statements/expressions/index.js");
|
|
75101
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "./node_modules/@abaplint/core/build/src/objects/index.js");
|
|
75102
|
+
class SelectionScreenTextsMissingConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
75103
|
+
}
|
|
75104
|
+
exports.SelectionScreenTextsMissingConf = SelectionScreenTextsMissingConf;
|
|
75105
|
+
class SelectionScreenTextsMissing {
|
|
75106
|
+
constructor() {
|
|
75107
|
+
this.conf = new SelectionScreenTextsMissingConf();
|
|
75108
|
+
}
|
|
75109
|
+
getMetadata() {
|
|
75110
|
+
return {
|
|
75111
|
+
key: "selection_screen_texts_missing",
|
|
75112
|
+
title: "Selection screen texts missing",
|
|
75113
|
+
shortDescription: `Checks that selection screen parameters and select-options have selection texts`,
|
|
75114
|
+
};
|
|
75115
|
+
}
|
|
75116
|
+
getConfig() {
|
|
75117
|
+
return this.conf;
|
|
75118
|
+
}
|
|
75119
|
+
setConfig(conf) {
|
|
75120
|
+
this.conf = conf;
|
|
75121
|
+
}
|
|
75122
|
+
initialize(reg) {
|
|
75123
|
+
this.reg = reg;
|
|
75124
|
+
return this;
|
|
75125
|
+
}
|
|
75126
|
+
run(obj) {
|
|
75127
|
+
if (!(obj instanceof objects_1.Program)) {
|
|
75128
|
+
return [];
|
|
75129
|
+
}
|
|
75130
|
+
if (obj.isInclude()) {
|
|
75131
|
+
return [];
|
|
75132
|
+
}
|
|
75133
|
+
const selTexts = obj.getSelectionTexts();
|
|
75134
|
+
const output = [];
|
|
75135
|
+
const checked = new Set();
|
|
75136
|
+
this.checkFile(obj.getMainABAPFile(), selTexts, output, checked);
|
|
75137
|
+
return output;
|
|
75138
|
+
}
|
|
75139
|
+
checkFile(file, selTexts, output, checked) {
|
|
75140
|
+
if (file === undefined) {
|
|
75141
|
+
return;
|
|
75142
|
+
}
|
|
75143
|
+
if (checked.has(file.getFilename())) {
|
|
75144
|
+
return;
|
|
75145
|
+
}
|
|
75146
|
+
checked.add(file.getFilename());
|
|
75147
|
+
for (const stat of file.getStatements()) {
|
|
75148
|
+
const s = stat.get();
|
|
75149
|
+
if (s instanceof statements_1.Parameter || s instanceof statements_1.SelectOption) {
|
|
75150
|
+
const fieldNode = stat.findFirstExpression(expressions_1.FieldSub);
|
|
75151
|
+
if (fieldNode) {
|
|
75152
|
+
const fieldName = fieldNode.getFirstToken().getStr().toUpperCase();
|
|
75153
|
+
if (selTexts[fieldName] === undefined) {
|
|
75154
|
+
output.push(issue_1.Issue.atToken(file, fieldNode.getFirstToken(), `Selection text missing for "${fieldName}"`, this.getMetadata().key, this.conf.severity));
|
|
75155
|
+
}
|
|
75156
|
+
}
|
|
75157
|
+
}
|
|
75158
|
+
else if (s instanceof statements_1.Include) {
|
|
75159
|
+
const nameNode = stat.findFirstExpression(expressions_1.IncludeName);
|
|
75160
|
+
if (nameNode) {
|
|
75161
|
+
const inclName = nameNode.getFirstToken().getStr().toUpperCase();
|
|
75162
|
+
const inclObj = this.reg.getObject("PROG", inclName);
|
|
75163
|
+
if (inclObj) {
|
|
75164
|
+
this.checkFile(inclObj.getMainABAPFile(), selTexts, output, checked);
|
|
75165
|
+
}
|
|
75166
|
+
}
|
|
75167
|
+
}
|
|
75168
|
+
}
|
|
75169
|
+
}
|
|
75170
|
+
}
|
|
75171
|
+
exports.SelectionScreenTextsMissing = SelectionScreenTextsMissing;
|
|
75172
|
+
//# sourceMappingURL=selection_screen_texts_missing.js.map
|
|
75173
|
+
|
|
75174
|
+
/***/ },
|
|
75175
|
+
|
|
75032
75176
|
/***/ "./node_modules/@abaplint/core/build/src/rules/sequential_blank.js"
|
|
75033
75177
|
/*!*************************************************************************!*\
|
|
75034
75178
|
!*** ./node_modules/@abaplint/core/build/src/rules/sequential_blank.js ***!
|
|
@@ -85937,289 +86081,14 @@ module.exports = require("zlib");
|
|
|
85937
86081
|
|
|
85938
86082
|
/***/ },
|
|
85939
86083
|
|
|
85940
|
-
/***/ "./node_modules/@isaacs/balanced-match/dist/commonjs/index.js"
|
|
85941
|
-
/*!********************************************************************!*\
|
|
85942
|
-
!*** ./node_modules/@isaacs/balanced-match/dist/commonjs/index.js ***!
|
|
85943
|
-
\********************************************************************/
|
|
85944
|
-
(__unused_webpack_module, exports) {
|
|
85945
|
-
|
|
85946
|
-
"use strict";
|
|
85947
|
-
|
|
85948
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
85949
|
-
exports.range = exports.balanced = void 0;
|
|
85950
|
-
const balanced = (a, b, str) => {
|
|
85951
|
-
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
85952
|
-
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
85953
|
-
const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
|
|
85954
|
-
return (r && {
|
|
85955
|
-
start: r[0],
|
|
85956
|
-
end: r[1],
|
|
85957
|
-
pre: str.slice(0, r[0]),
|
|
85958
|
-
body: str.slice(r[0] + ma.length, r[1]),
|
|
85959
|
-
post: str.slice(r[1] + mb.length),
|
|
85960
|
-
});
|
|
85961
|
-
};
|
|
85962
|
-
exports.balanced = balanced;
|
|
85963
|
-
const maybeMatch = (reg, str) => {
|
|
85964
|
-
const m = str.match(reg);
|
|
85965
|
-
return m ? m[0] : null;
|
|
85966
|
-
};
|
|
85967
|
-
const range = (a, b, str) => {
|
|
85968
|
-
let begs, beg, left, right = undefined, result;
|
|
85969
|
-
let ai = str.indexOf(a);
|
|
85970
|
-
let bi = str.indexOf(b, ai + 1);
|
|
85971
|
-
let i = ai;
|
|
85972
|
-
if (ai >= 0 && bi > 0) {
|
|
85973
|
-
if (a === b) {
|
|
85974
|
-
return [ai, bi];
|
|
85975
|
-
}
|
|
85976
|
-
begs = [];
|
|
85977
|
-
left = str.length;
|
|
85978
|
-
while (i >= 0 && !result) {
|
|
85979
|
-
if (i === ai) {
|
|
85980
|
-
begs.push(i);
|
|
85981
|
-
ai = str.indexOf(a, i + 1);
|
|
85982
|
-
}
|
|
85983
|
-
else if (begs.length === 1) {
|
|
85984
|
-
const r = begs.pop();
|
|
85985
|
-
if (r !== undefined)
|
|
85986
|
-
result = [r, bi];
|
|
85987
|
-
}
|
|
85988
|
-
else {
|
|
85989
|
-
beg = begs.pop();
|
|
85990
|
-
if (beg !== undefined && beg < left) {
|
|
85991
|
-
left = beg;
|
|
85992
|
-
right = bi;
|
|
85993
|
-
}
|
|
85994
|
-
bi = str.indexOf(b, i + 1);
|
|
85995
|
-
}
|
|
85996
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
85997
|
-
}
|
|
85998
|
-
if (begs.length && right !== undefined) {
|
|
85999
|
-
result = [left, right];
|
|
86000
|
-
}
|
|
86001
|
-
}
|
|
86002
|
-
return result;
|
|
86003
|
-
};
|
|
86004
|
-
exports.range = range;
|
|
86005
|
-
//# sourceMappingURL=index.js.map
|
|
86006
|
-
|
|
86007
|
-
/***/ },
|
|
86008
|
-
|
|
86009
|
-
/***/ "./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js"
|
|
86010
|
-
/*!*********************************************************************!*\
|
|
86011
|
-
!*** ./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js ***!
|
|
86012
|
-
\*********************************************************************/
|
|
86013
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
86014
|
-
|
|
86015
|
-
"use strict";
|
|
86016
|
-
|
|
86017
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
86018
|
-
exports.expand = expand;
|
|
86019
|
-
const balanced_match_1 = __webpack_require__(/*! @isaacs/balanced-match */ "./node_modules/@isaacs/balanced-match/dist/commonjs/index.js");
|
|
86020
|
-
const escSlash = '\0SLASH' + Math.random() + '\0';
|
|
86021
|
-
const escOpen = '\0OPEN' + Math.random() + '\0';
|
|
86022
|
-
const escClose = '\0CLOSE' + Math.random() + '\0';
|
|
86023
|
-
const escComma = '\0COMMA' + Math.random() + '\0';
|
|
86024
|
-
const escPeriod = '\0PERIOD' + Math.random() + '\0';
|
|
86025
|
-
const escSlashPattern = new RegExp(escSlash, 'g');
|
|
86026
|
-
const escOpenPattern = new RegExp(escOpen, 'g');
|
|
86027
|
-
const escClosePattern = new RegExp(escClose, 'g');
|
|
86028
|
-
const escCommaPattern = new RegExp(escComma, 'g');
|
|
86029
|
-
const escPeriodPattern = new RegExp(escPeriod, 'g');
|
|
86030
|
-
const slashPattern = /\\\\/g;
|
|
86031
|
-
const openPattern = /\\{/g;
|
|
86032
|
-
const closePattern = /\\}/g;
|
|
86033
|
-
const commaPattern = /\\,/g;
|
|
86034
|
-
const periodPattern = /\\./g;
|
|
86035
|
-
function numeric(str) {
|
|
86036
|
-
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
86037
|
-
}
|
|
86038
|
-
function escapeBraces(str) {
|
|
86039
|
-
return str
|
|
86040
|
-
.replace(slashPattern, escSlash)
|
|
86041
|
-
.replace(openPattern, escOpen)
|
|
86042
|
-
.replace(closePattern, escClose)
|
|
86043
|
-
.replace(commaPattern, escComma)
|
|
86044
|
-
.replace(periodPattern, escPeriod);
|
|
86045
|
-
}
|
|
86046
|
-
function unescapeBraces(str) {
|
|
86047
|
-
return str
|
|
86048
|
-
.replace(escSlashPattern, '\\')
|
|
86049
|
-
.replace(escOpenPattern, '{')
|
|
86050
|
-
.replace(escClosePattern, '}')
|
|
86051
|
-
.replace(escCommaPattern, ',')
|
|
86052
|
-
.replace(escPeriodPattern, '.');
|
|
86053
|
-
}
|
|
86054
|
-
/**
|
|
86055
|
-
* Basically just str.split(","), but handling cases
|
|
86056
|
-
* where we have nested braced sections, which should be
|
|
86057
|
-
* treated as individual members, like {a,{b,c},d}
|
|
86058
|
-
*/
|
|
86059
|
-
function parseCommaParts(str) {
|
|
86060
|
-
if (!str) {
|
|
86061
|
-
return [''];
|
|
86062
|
-
}
|
|
86063
|
-
const parts = [];
|
|
86064
|
-
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
86065
|
-
if (!m) {
|
|
86066
|
-
return str.split(',');
|
|
86067
|
-
}
|
|
86068
|
-
const { pre, body, post } = m;
|
|
86069
|
-
const p = pre.split(',');
|
|
86070
|
-
p[p.length - 1] += '{' + body + '}';
|
|
86071
|
-
const postParts = parseCommaParts(post);
|
|
86072
|
-
if (post.length) {
|
|
86073
|
-
;
|
|
86074
|
-
p[p.length - 1] += postParts.shift();
|
|
86075
|
-
p.push.apply(p, postParts);
|
|
86076
|
-
}
|
|
86077
|
-
parts.push.apply(parts, p);
|
|
86078
|
-
return parts;
|
|
86079
|
-
}
|
|
86080
|
-
function expand(str) {
|
|
86081
|
-
if (!str) {
|
|
86082
|
-
return [];
|
|
86083
|
-
}
|
|
86084
|
-
// I don't know why Bash 4.3 does this, but it does.
|
|
86085
|
-
// Anything starting with {} will have the first two bytes preserved
|
|
86086
|
-
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
86087
|
-
// but a{},b}c will be expanded to [a}c,abc].
|
|
86088
|
-
// One could argue that this is a bug in Bash, but since the goal of
|
|
86089
|
-
// this module is to match Bash's rules, we escape a leading {}
|
|
86090
|
-
if (str.slice(0, 2) === '{}') {
|
|
86091
|
-
str = '\\{\\}' + str.slice(2);
|
|
86092
|
-
}
|
|
86093
|
-
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
86094
|
-
}
|
|
86095
|
-
function embrace(str) {
|
|
86096
|
-
return '{' + str + '}';
|
|
86097
|
-
}
|
|
86098
|
-
function isPadded(el) {
|
|
86099
|
-
return /^-?0\d/.test(el);
|
|
86100
|
-
}
|
|
86101
|
-
function lte(i, y) {
|
|
86102
|
-
return i <= y;
|
|
86103
|
-
}
|
|
86104
|
-
function gte(i, y) {
|
|
86105
|
-
return i >= y;
|
|
86106
|
-
}
|
|
86107
|
-
function expand_(str, isTop) {
|
|
86108
|
-
/** @type {string[]} */
|
|
86109
|
-
const expansions = [];
|
|
86110
|
-
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
86111
|
-
if (!m)
|
|
86112
|
-
return [str];
|
|
86113
|
-
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
86114
|
-
const pre = m.pre;
|
|
86115
|
-
const post = m.post.length ? expand_(m.post, false) : [''];
|
|
86116
|
-
if (/\$$/.test(m.pre)) {
|
|
86117
|
-
for (let k = 0; k < post.length; k++) {
|
|
86118
|
-
const expansion = pre + '{' + m.body + '}' + post[k];
|
|
86119
|
-
expansions.push(expansion);
|
|
86120
|
-
}
|
|
86121
|
-
}
|
|
86122
|
-
else {
|
|
86123
|
-
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
86124
|
-
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
86125
|
-
const isSequence = isNumericSequence || isAlphaSequence;
|
|
86126
|
-
const isOptions = m.body.indexOf(',') >= 0;
|
|
86127
|
-
if (!isSequence && !isOptions) {
|
|
86128
|
-
// {a},b}
|
|
86129
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
86130
|
-
str = m.pre + '{' + m.body + escClose + m.post;
|
|
86131
|
-
return expand_(str);
|
|
86132
|
-
}
|
|
86133
|
-
return [str];
|
|
86134
|
-
}
|
|
86135
|
-
let n;
|
|
86136
|
-
if (isSequence) {
|
|
86137
|
-
n = m.body.split(/\.\./);
|
|
86138
|
-
}
|
|
86139
|
-
else {
|
|
86140
|
-
n = parseCommaParts(m.body);
|
|
86141
|
-
if (n.length === 1 && n[0] !== undefined) {
|
|
86142
|
-
// x{{a,b}}y ==> x{a}y x{b}y
|
|
86143
|
-
n = expand_(n[0], false).map(embrace);
|
|
86144
|
-
//XXX is this necessary? Can't seem to hit it in tests.
|
|
86145
|
-
/* c8 ignore start */
|
|
86146
|
-
if (n.length === 1) {
|
|
86147
|
-
return post.map(p => m.pre + n[0] + p);
|
|
86148
|
-
}
|
|
86149
|
-
/* c8 ignore stop */
|
|
86150
|
-
}
|
|
86151
|
-
}
|
|
86152
|
-
// at this point, n is the parts, and we know it's not a comma set
|
|
86153
|
-
// with a single entry.
|
|
86154
|
-
let N;
|
|
86155
|
-
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
|
86156
|
-
const x = numeric(n[0]);
|
|
86157
|
-
const y = numeric(n[1]);
|
|
86158
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
86159
|
-
let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
|
|
86160
|
-
let test = lte;
|
|
86161
|
-
const reverse = y < x;
|
|
86162
|
-
if (reverse) {
|
|
86163
|
-
incr *= -1;
|
|
86164
|
-
test = gte;
|
|
86165
|
-
}
|
|
86166
|
-
const pad = n.some(isPadded);
|
|
86167
|
-
N = [];
|
|
86168
|
-
for (let i = x; test(i, y); i += incr) {
|
|
86169
|
-
let c;
|
|
86170
|
-
if (isAlphaSequence) {
|
|
86171
|
-
c = String.fromCharCode(i);
|
|
86172
|
-
if (c === '\\') {
|
|
86173
|
-
c = '';
|
|
86174
|
-
}
|
|
86175
|
-
}
|
|
86176
|
-
else {
|
|
86177
|
-
c = String(i);
|
|
86178
|
-
if (pad) {
|
|
86179
|
-
const need = width - c.length;
|
|
86180
|
-
if (need > 0) {
|
|
86181
|
-
const z = new Array(need + 1).join('0');
|
|
86182
|
-
if (i < 0) {
|
|
86183
|
-
c = '-' + z + c.slice(1);
|
|
86184
|
-
}
|
|
86185
|
-
else {
|
|
86186
|
-
c = z + c;
|
|
86187
|
-
}
|
|
86188
|
-
}
|
|
86189
|
-
}
|
|
86190
|
-
}
|
|
86191
|
-
N.push(c);
|
|
86192
|
-
}
|
|
86193
|
-
}
|
|
86194
|
-
else {
|
|
86195
|
-
N = [];
|
|
86196
|
-
for (let j = 0; j < n.length; j++) {
|
|
86197
|
-
N.push.apply(N, expand_(n[j], false));
|
|
86198
|
-
}
|
|
86199
|
-
}
|
|
86200
|
-
for (let j = 0; j < N.length; j++) {
|
|
86201
|
-
for (let k = 0; k < post.length; k++) {
|
|
86202
|
-
const expansion = pre + N[j] + post[k];
|
|
86203
|
-
if (!isTop || isSequence || expansion) {
|
|
86204
|
-
expansions.push(expansion);
|
|
86205
|
-
}
|
|
86206
|
-
}
|
|
86207
|
-
}
|
|
86208
|
-
}
|
|
86209
|
-
return expansions;
|
|
86210
|
-
}
|
|
86211
|
-
//# sourceMappingURL=index.js.map
|
|
86212
|
-
|
|
86213
|
-
/***/ },
|
|
86214
|
-
|
|
86215
86084
|
/***/ "./node_modules/fast-xml-parser/lib/fxp.cjs"
|
|
86216
86085
|
/*!**************************************************!*\
|
|
86217
86086
|
!*** ./node_modules/fast-xml-parser/lib/fxp.cjs ***!
|
|
86218
86087
|
\**************************************************/
|
|
86219
86088
|
(module) {
|
|
86220
86089
|
|
|
86221
|
-
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>vt,XMLParser:()=>ht,XMLValidator:()=>Tt});const i=":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",n=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function s(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i}const r=function(t){return!(null==n.exec(t))},o={allowBooleanAttributes:!1,unpairedTags:[]};function a(t,e){e=Object.assign({},o,e);const i=[];let n=!1,s=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let r=0;r<t.length;r++)if("<"===t[r]&&"?"===t[r+1]){if(r+=2,r=l(t,r),r.err)return r}else{if("<"!==t[r]){if(h(t[r]))continue;return x("InvalidChar","char '"+t[r]+"' is not expected.",E(t,r))}{let o=r;if(r++,"!"===t[r]){r=p(t,r);continue}{let a=!1;"/"===t[r]&&(a=!0,r++);let u="";for(;r<t.length&&">"!==t[r]&&" "!==t[r]&&"\t"!==t[r]&&"\n"!==t[r]&&"\r"!==t[r];r++)u+=t[r];if(u=u.trim(),"/"===u[u.length-1]&&(u=u.substring(0,u.length-1),r--),!b(u)){let e;return e=0===u.trim().length?"Invalid space after '<'.":"Tag '"+u+"' is an invalid name.",x("InvalidTag",e,E(t,r))}const c=d(t,r);if(!1===c)return x("InvalidAttr","Attributes for '"+u+"' have open quote.",E(t,r));let f=c.value;if(r=c.index,"/"===f[f.length-1]){const i=r-f.length;f=f.substring(0,f.length-1);const s=g(f,e);if(!0!==s)return x(s.err.code,s.err.msg,E(t,i+s.err.line));n=!0}else if(a){if(!c.tagClosed)return x("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",E(t,r));if(f.trim().length>0)return x("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",E(t,o));if(0===i.length)return x("InvalidTag","Closing tag '"+u+"' has not been opened.",E(t,o));{const e=i.pop();if(u!==e.tagName){let i=E(t,e.tagStartPos);return x("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+u+"'.",E(t,o))}0==i.length&&(s=!0)}}else{const a=g(f,e);if(!0!==a)return x(a.err.code,a.err.msg,E(t,r-f.length+a.err.line));if(!0===s)return x("InvalidXml","Multiple possible root nodes found.",E(t,r));-1!==e.unpairedTags.indexOf(u)||i.push({tagName:u,tagStartPos:o}),n=!0}for(r++;r<t.length;r++)if("<"===t[r]){if("!"===t[r+1]){r++,r=p(t,r);continue}if("?"!==t[r+1])break;if(r=l(t,++r),r.err)return r}else if("&"===t[r]){const e=m(t,r);if(-1==e)return x("InvalidChar","char '&' is not expected.",E(t,r));r=e}else if(!0===s&&!h(t[r]))return x("InvalidXml","Extra text at the end",E(t,r));"<"===t[r]&&r--}}}return n?1==i.length?x("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",E(t,i[0].tagStartPos)):!(i.length>0)||x("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):x("InvalidXml","Start tag expected.",1)}function h(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function l(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const n=t.substr(i,e-i);if(e>5&&"xml"===n)return x("InvalidXml","XML declaration allowed only at the start of the document.",E(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function p(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}const u='"',c="'";function d(t,e){let i="",n="",s=!1;for(;e<t.length;e++){if(t[e]===u||t[e]===c)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){s=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:s}}const f=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function g(t,e){const i=s(t,f),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return x("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",y(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return x("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",y(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return x("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",y(i[t]));const s=i[t][2];if(!N(s))return x("InvalidAttr","Attribute '"+s+"' is an invalid name.",y(i[t]));if(Object.prototype.hasOwnProperty.call(n,s))return x("InvalidAttr","Attribute '"+s+"' is repeated.",y(i[t]));n[s]=1}return!0}function m(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function x(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function N(t){return r(t)}function b(t){return r(t)}function E(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function y(t){return t.startIndex+t[1].length}const w={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0};function v(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,maxEntityCount:t.maxEntityCount??100,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:v(!0)}const T=function(t){const e=Object.assign({},w,t);return e.processEntities=v(e.processEntities),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),e};let P;P="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class S{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][P]={startIndex:e})}static getMetaDataSymbol(){return P}}class A{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){const i=Object.create(null);let n=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let s=1,r=!1,o=!1,a="";for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,s--):s--,0===s)break}else"["===t[e]?r=!0:a+=t[e];else{if(r&&C(t,"!ENTITY",e)){let s,r;if(e+=7,[s,r,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===r.indexOf("&")){if(!1!==this.options.enabled&&this.options.maxEntityCount&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=s.replace(/[.\-+*:]/g,"\\.");i[s]={regx:RegExp(`&${t};`,"g"),val:r},n++}}else if(r&&C(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(r&&C(t,"!ATTLIST",e))e+=8;else if(r&&C(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!C(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}s++,a=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)i+=t[e],e++;if(I(i),e=O(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let n="";if([e,n]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&this.options.maxEntitySize&&n.length>this.options.maxEntitySize)throw new Error(`Entity "${i}" size (${n.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[i,n,--e]}readNotationExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;!this.suppressValidationErr&&I(i),e=O(t,e);const n=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==n&&"PUBLIC"!==n)throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);e+=n.length,e=O(t,e);let s=null,r=null;if("PUBLIC"===n)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=O(t,e)]&&"'"!==t[e]||([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===n&&([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!r))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:s,systemIdentifier:r,index:--e}}readIdentifierVal(t,e,i){let n="";const s=t[e];if('"'!==s&&"'"!==s)throw new Error(`Expected quoted string, found "${s}"`);for(e++;e<t.length&&t[e]!==s;)n+=t[e],e++;if(t[e]!==s)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!this.suppressValidationErr&&!r(i))throw new Error(`Invalid element name: "${i}"`);let n="";if("E"===t[e=O(t,e)]&&C(t,"MPTY",e))e+=4;else if("A"===t[e]&&C(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)n+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:i,contentModel:n.trim(),index:e}}readAttlistExp(t,e){e=O(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;I(i),e=O(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;if(!I(n))throw new Error(`Invalid attribute name: "${n}"`);e=O(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=O(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){let n="";for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)n+=t[e],e++;if(n=n.trim(),!I(n))throw new Error(`Invalid notation name: "${n}"`);i.push(n),"|"===t[e]&&(e++,e=O(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+i.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)s+=t[e],e++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=O(t,e);let r="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(r="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(r="#IMPLIED",e+=7):[e,r]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:i,attributeName:n,attributeType:s,defaultValue:r,index:e}}}const O=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function C(t,e,i){for(let n=0;n<e.length;n++)if(e[n]!==t[i+n+1])return!1;return!0}function I(t){if(r(t))return t;throw new Error(`Invalid entity name ${t}`)}const $=/^[-+]?0x[a-fA-F0-9]+$/,j=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,V={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const D=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class _{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,e=null,i=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);const s=this.siblingStacks[n],r=i?`${i}:${t}`:t,o=s.get(r)||0;let a=0;for(const t of s.values())a+=t;s.set(r,o+1);const h={tag:t,position:a,counter:o};null!=i&&(h.namespace=i),null!=e&&(h.values=e),this.path.push(h)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const e=this.path[this.path.length-1];return e.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++){const i=t[e],n=this.path[e],s=e===this.path.length-1;if(!this._matchSegment(i,n,s))return!1}return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const n=t[i];if("deep-wildcard"===n.type){if(i--,i<0)return!0;const n=t[i];let s=!1;for(let t=e;t>=0;t--){const r=t===this.path.length-1;if(this._matchSegment(n,this.path[t],r)){e=t-1,i--,s=!0;break}}if(!s)return!1}else{const t=e===this.path.length-1;if(!this._matchSegment(n,this.path[e],t))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue){const i=e.values[t.attrName];if(String(i)!==String(t.attrValue))return!1}}if(void 0!==t.position){if(!i)return!1;const n=e.counter??0;if("first"===t.position&&0!==n)return!1;if("odd"===t.position&&n%2!=1)return!1;if("even"===t.position&&n%2!=0)return!1;if("nth"===t.position&&n!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>new Map(t))}}class k{constructor(t,e={}){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,n=t;const s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(n=s[1]+s[3],s[2])){const t=s[2].slice(1,-1);t&&(i=t)}let r,o,a=n;if(n.includes("::")){const e=n.indexOf("::");if(r=n.substring(0,e).trim(),a=n.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let h=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,h=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(h){const t=h.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=h}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}function F(t,e){if(!t)return{};const i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};const n={};for(const t in i)t.startsWith(e.attributeNamePrefix)?n[t.substring(e.attributeNamePrefix.length)]=i[t]:n[t]=i[t];return n}function M(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const i=t.substring(0,e);if("xmlns"!==i)return i}}class L{constructor(t){var e;if(this.options=t,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:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>tt(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>tt(e,16,"&#x")}},this.addExternalEntities=R,this.parseXml=Y,this.parseTextData=G,this.resolveNameSpace=B,this.buildAttributesMap=W,this.isItStopNode=Z,this.replaceEntitiesValue=z,this.readStopNodeData=J,this.saveTextToParentTag=q,this.addChild=X,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new _,this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new k(e)):e instanceof k&&this.stopNodeExpressions.push(e)}}}}function R(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function G(t,e,i,n,s,r,o){if(void 0!==t&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));const n=this.options.jPath?i.toString():i,a=this.options.tagValueProcessor(e,t,n,s,r);return null==a?t:typeof a!=typeof t||a!==t?a:this.options.trimValues||t.trim()===t?H(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function B(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const U=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function W(t,e,i){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const n=s(t,U),r=n.length,o={},a={};for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=n[t][4];if(s.length&&void 0!==r){let t=r;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,i,e),a[s]=t}}Object.keys(a).length>0&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(a);for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=this.options.jPath?e.toString():e;if(this.ignoreAttributesFn(s,r))continue;let a=n[t][4],h=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(h=this.options.transformAttributeName(h)),"__proto__"===h&&(h="#__proto__"),void 0!==a){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,i,e);const t=this.options.jPath?e.toString():e,n=this.options.attributeValueProcessor(s,a,t);o[h]=null==n?a:typeof n!=typeof a||n!==a?n:H(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[h]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const Y=function(t){t=t.replace(/\r\n?/g,"\n");const e=new S("!xml");let i=e,n="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new A(this.options.processEntities);for(let r=0;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){const e=K(t,">",r,"Closing Tag is not closed.");let s=t.substring(r+2,e).trim();if(this.options.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),i&&(n=this.saveTextToParentTag(n,i,this.matcher));const o=this.matcher.getCurrentTag();if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);o&&-1!==this.options.unpairedTags.indexOf(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=this.tagsNodeStack.pop(),n="",r=e}else if("?"===t[r+1]){let e=Q(t,r,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,i,this.matcher),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new S(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,this.matcher,e.tagName)),this.addChild(i,t,this.matcher,r)}r=e.closeIndex+1}else if("!--"===t.substr(r+1,3)){const e=K(t,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const s=t.substring(r+4,e-2);n=this.saveTextToParentTag(n,i,this.matcher),i.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}r=e}else if("!D"===t.substr(r+1,2)){const e=s.readDocType(t,r);this.docTypeEntities=e.entities,r=e.i}else if("!["===t.substr(r+1,2)){const e=K(t,"]]>",r,"CDATA is not closed.")-2,s=t.substring(r+9,e);n=this.saveTextToParentTag(n,i,this.matcher);let o=this.parseTextData(s,i.tagname,this.matcher,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):i.add(this.options.textNodeName,o),r=e+2}else{let s=Q(t,r,this.options.removeNSPrefix);if(!s){const e=t.substring(Math.max(0,r-50),Math.min(t.length,r+50));throw new Error(`readTagExp returned undefined at position ${r}. Context: "${e}"`)}let o=s.tagName;const a=s.rawTagName;let h=s.tagExp,l=s.attrExpPresent,p=s.closeIndex;if(this.options.transformTagName){const t=this.options.transformTagName(o);h===o&&(h=t),o=t}if(this.options.strictReservedNames&&(o===this.options.commentPropName||o===this.options.cdataPropName))throw new Error(`Invalid tag name: ${o}`);i&&n&&"!xml"!==i.tagname&&(n=this.saveTextToParentTag(n,i,this.matcher,!1));const u=i;u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),this.matcher.pop());let c=!1;h.length>0&&h.lastIndexOf("/")===h.length-1&&(c=!0,"/"===o[o.length-1]?(o=o.substr(0,o.length-1),h=o):h=h.substr(0,h.length-1),l=o!==h);let d,f=null,g={};d=M(a),o!==e.tagname&&this.matcher.push(o,{},d),o!==h&&l&&(f=this.buildAttributesMap(h,this.matcher,o),f&&(g=F(f,this.options))),o!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const m=r;if(this.isCurrentNodeStopNode){let e="";if(c)r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(o))r=s.closeIndex;else{const i=this.readStopNodeData(t,a,p+1);if(!i)throw new Error(`Unexpected end of ${a}`);r=i.i,e=i.tagContent}const n=new S(o);f&&(n[":@"]=f),n.add(this.options.textNodeName,e),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(i,n,this.matcher,m)}else{if(c){if(this.options.transformTagName){const t=this.options.transformTagName(o);h===o&&(h=t),o=t}const t=new S(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(o)){const t=new S(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=s.closeIndex;continue}{const t=new S(o);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(i),f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),i=t}}n="",r=p}}else n+=t[r];return e.child};function X(t,e,i,n){this.options.captureMetaData||(n=void 0);const s=this.options.jPath?i.toString():i,r=this.options.updateTag(e.tagname,s,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e,n)):t.addChild(e,n))}function z(t,e,i){const n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){const s=this.options.jPath?i.toString():i;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,s)))return t}if(n.tagFilter){const s=this.options.jPath?i.toString():i;if(!n.tagFilter(e,s))return t}for(let e in this.docTypeEntities){const i=this.docTypeEntities[e],s=t.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);const e=t.length;if(t=t.replace(i.regx,i.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-e,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(-1===t.indexOf("&"))return t;for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function q(t,e,i,n){return t&&(void 0===n&&(n=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function Z(t,e){if(!t||0===t.length)return!1;for(let i=0;i<t.length;i++)if(e.matches(t[i]))return!0;return!1}function K(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function Q(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r<t.length;r++){let e=t[r];if(n)e===n&&(n="");else if('"'===e||"'"===e)n=e;else if(e===i[0]){if(!i[1])return{data:s,index:r};if(t[r+1]===i[1])return{data:s,index:r}}else"\t"===e&&(e=" ");s+=e}}(t,e+1,n);if(!s)return;let r=s.data;const o=s.index,a=r.search(/\s/);let h=r,l=!0;-1!==a&&(h=r.substring(0,a),r=r.substring(a+1).trimStart());const p=h;if(i){const t=h.indexOf(":");-1!==t&&(h=h.substr(t+1),l=h!==s.data.substr(t+1))}return{tagName:h,tagExp:r,closeIndex:o,attrExpPresent:l,rawTagName:p}}function J(t,e,i){const n=i;let s=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){const r=K(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(s--,0===s))return{tagContent:t.substring(n,i),i:r};i=r}else if("?"===t[i+1])i=K(t,"?>",i+1,"StopNode is not closed.");else if("!--"===t.substr(i+1,3))i=K(t,"--\x3e",i+3,"StopNode is not closed.");else if("!["===t.substr(i+1,2))i=K(t,"]]>",i,"StopNode is not closed.")-2;else{const n=Q(t,i,">");n&&((n&&n.tagName)===e&&"/"!==n.tagExp[n.tagExp.length-1]&&s++,i=n.closeIndex)}}function H(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&function(t,e={}){if(e=Object.assign({},V,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&$.test(i))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(i);if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const n=e.match(D);if(n){let s=n[1]||"";const r=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=s?t[o.length+1]===r:t[o.length]===r;return o.length>1&&a?t:1!==o.length||!n[3].startsWith(`.${r}`)&&n[3][0]!==r?i.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t:Number(e)}return t}(t,i,e);{const s=j.exec(i);if(s){const r=s[1]||"",o=s[2];let a=(n=s[3])&&-1!==n.indexOf(".")?("."===(n=n.replace(/0+$/,""))?n="0":"."===n[0]?n="0"+n:"."===n[n.length-1]&&(n=n.substring(0,n.length-1)),n):n;const h=r?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!h))return t;{const n=Number(i),s=String(n);if(0===n)return n;if(-1!==s.search(/[eE]/))return e.eNotation?n:t;if(-1!==i.indexOf("."))return"0"===s||s===a||s===`${r}${a}`?n:t;let h=o?a:i;return o?h===s||r+h===s?n:t:h===s||h===r+s?n:t}}return t}// removed by dead control flow
|
|
86222
|
-
var n; }(t,i)}return void 0!==t?t:""}function tt(t,e,i){const n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):i+t+";"}const et=S.getMetaDataSymbol();function it(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const i={};for(const n in t)n.startsWith(e)?i[n.substring(e.length)]=t[n]:i[n]=t[n];return i}function nt(t,e,i){return st(t,e,i)}function st(t,e,i){let n;const s={};for(let r=0;r<t.length;r++){const o=t[r],a=rt(o);if(void 0!==a&&a!==e.textNodeName){const t=it(o[":@"]||{},e.attributeNamePrefix);i.push(a,t)}if(a===e.textNodeName)void 0===n?n=o[a]:n+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=st(o[a],e,i);const n=at(t,e);if(o[":@"]?ot(t,o[":@"],i,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==o[et]&&"object"==typeof t&&null!==t&&(t[et]=o[et]),void 0!==s[a]&&Object.prototype.hasOwnProperty.call(s,a))Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(t);else{const r=e.jPath?i.toString():i;e.isArray(a,r,n)?s[a]=[t]:s[a]=t}void 0!==a&&a!==e.textNodeName&&i.pop()}}}return"string"==typeof n?n.length>0&&(s[e.textNodeName]=n):void 0!==n&&(s[e.textNodeName]=n),s}function rt(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ot(t,e,i,n){if(e){const s=Object.keys(e),r=s.length;for(let o=0;o<r;o++){const r=s[o],a=r.startsWith(n.attributeNamePrefix)?r.substring(n.attributeNamePrefix.length):r,h=n.jPath?i.toString()+"."+a:i;n.isArray(r,h,!0,!0)?t[r]=[e[r]]:t[r]=e[r]}}}function at(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}class ht{constructor(t){this.externalEntities={},this.options=T(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=a(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new L(this.options);i.addExternalEntities(this.externalEntities);const n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:nt(n,this.options,i.matcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return S.getMetaDataSymbol()}}function lt(t,e){let i="";e.format&&e.indentBy.length>0&&(i="\n");const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?n.push(new k(i)):i instanceof k&&n.push(i)}return pt(t,e,i,new _,n)}function pt(t,e,i,n,s){let r="",o=!1;if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=xt(i,e),i}return""}for(let a=0;a<t.length;a++){const h=t[a],l=ft(h);if(void 0===l)continue;const p=ut(h[":@"],e);n.push(l,p);const u=mt(n,s);if(l===e.textNodeName){let t=h[l];u||(t=e.tagValueProcessor(l,t),t=xt(t,e)),o&&(r+=i),r+=t,o=!1,n.pop();continue}if(l===e.cdataPropName){o&&(r+=i),r+=`<![CDATA[${h[l][0][e.textNodeName]}]]>`,o=!1,n.pop();continue}if(l===e.commentPropName){r+=i+`\x3c!--${h[l][0][e.textNodeName]}--\x3e`,o=!0,n.pop();continue}if("?"===l[0]){const t=gt(h[":@"],e,u),s="?xml"===l?"":i;let a=h[l][0][e.textNodeName];a=0!==a.length?" "+a:"",r+=s+`<${l}${a}${t}?>`,o=!0,n.pop();continue}let c=i;""!==c&&(c+=e.indentBy);const d=i+`<${l}${gt(h[":@"],e,u)}`;let f;f=u?ct(h[l],e):pt(h[l],e,c,n,s),-1!==e.unpairedTags.indexOf(l)?e.suppressUnpairedNode?r+=d+">":r+=d+"/>":f&&0!==f.length||!e.suppressEmptyNode?f&&f.endsWith(">")?r+=d+`>${f}${i}</${l}>`:(r+=d+">",f&&""!==i&&(f.includes("/>")||f.includes("</"))?r+=i+e.indentBy+f+i:r+=f,r+=`</${l}>`):r+=d+"/>",o=!0,n.pop()}return r}function ut(t,e){if(!t||e.ignoreAttributes)return null;const i={};let n=!1;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s.startsWith(e.attributeNamePrefix)?s.substr(e.attributeNamePrefix.length):s]=t[s],n=!0);return n?i:null}function ct(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let n=0;n<t.length;n++){const s=t[n],r=ft(s);if(r===e.textNodeName)i+=s[r];else if(r===e.cdataPropName)i+=s[r][0][e.textNodeName];else if(r===e.commentPropName)i+=s[r][0][e.textNodeName];else{if(r&&"?"===r[0])continue;if(r){const t=dt(s[":@"],e),n=ct(s[r],e);n&&0!==n.length?i+=`<${r}${t}>${n}</${r}>`:i+=`<${r}${t}/>`}}}return i}function dt(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=t[n];!0===s&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return i}function ft(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(Object.prototype.hasOwnProperty.call(t,n)&&":@"!==n)return n}}function gt(t,e,i){let n="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let r;i?r=t[s]:(r=e.attributeValueProcessor(s,t[s]),r=xt(r,e)),!0===r&&e.suppressBooleanAttributes?n+=` ${s.substr(e.attributeNamePrefix.length)}`:n+=` ${s.substr(e.attributeNamePrefix.length)}="${r}"`}return n}function mt(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function xt(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const Nt={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,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:!0,stopNodes:[],oneListGroup:!1,jPath:!0};function bt(t){if(this.options=Object.assign({},Nt,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new k(e)):e instanceof k&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=wt),this.processTextOrObjNode=Et,this.options.format?(this.indentate=yt,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function Et(t,e,i,n){const s=this.extractAttributes(t);if(n.push(e,s),this.checkStopNode(n)){const s=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(s,e,r,i)}const r=this.j2x(t,i+1,n);return n.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,i,n):this.buildObjectNode(r.val,e,r.attrStr,i)}function yt(t){return this.options.indentBy.repeat(t)}function wt(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}bt.prototype.build=function(t){if(this.options.preserveOrder)return lt(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new _;return this.j2x(t,0,e).val}},bt.prototype.j2x=function(t,e,i){let n="",s="";const r=this.options.jPath?i.toString():i,o=this.checkStopNode(i);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(s+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?s+="":"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)s+=this.buildTextValNode(t[a],a,"",e,i);else if("object"!=typeof t[a]){const h=this.isAttribute(a);if(h&&!this.ignoreAttributesFn(h,r))n+=this.buildAttrPairStr(h,""+t[a],o);else if(!h)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);s+=this.replaceEntitiesValue(e)}else{i.push(a);const n=this.checkStopNode(i);if(i.pop(),n){const i=""+t[a];s+=""===i?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+i+"</"+a+this.tagEndChar}else s+=this.buildTextValNode(t[a],a,"",e,i)}}else if(Array.isArray(t[a])){const n=t[a].length;let r="",o="";for(let h=0;h<n;h++){const n=t[a][h];if(void 0===n);else if(null===n)"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){i.push(a);const t=this.j2x(n,e+1,i);i.pop(),r+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else r+=this.processTextOrObjNode(n,a,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,n);t=this.replaceEntitiesValue(t),r+=t}else{i.push(a);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+n;r+=""===t?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+t+"</"+a+this.tagEndChar}else r+=this.buildTextValNode(n,a,"",e,i)}}this.options.oneListGroup&&(r=this.buildObjectNode(r,a,o,e)),s+=r}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),i=e.length;for(let s=0;s<i;s++)n+=this.buildAttrPairStr(e[s],""+t[a][e[s]],o)}else s+=this.processTextOrObjNode(t[a],a,e,i);return{attrStr:n,val:s}},bt.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},bt.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=n[t],i=!0)}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=this.isAttribute(n);s&&(e[s]=t[n],i=!0)}return i?e:null},bt.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const n=t[i];if(i===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let t of n)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const n=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);e+=""===n?`<${i}${s}/>`:`<${i}${s}>${n}</${i}>`}}else if("object"==typeof n&&null!==n){const t=this.buildRawContent(n),s=this.buildAttributesForStopNode(n);e+=""===t?`<${i}${s}/>`:`<${i}${s}>${t}</${i}>`}else e+=`<${i}>${n}</${i}>`}return e},bt.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const n=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,s=i[t];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);if(n){const s=t[i];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}return e},bt.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",s=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+r+this.tagEndChar+t+this.indentate(n)+s:this.indentate(n)+"<"+e+i+r+">"+t+s}},bt.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},bt.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},bt.prototype.buildTextValNode=function(t,e,i,n,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),""===s?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+s+"</"+e+this.tagEndChar}},bt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const vt=bt,Tt={validate:a};module.exports=e})();
|
|
86090
|
+
(()=>{"use strict";var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{XMLBuilder:()=>Ct,XMLParser:()=>ft,XMLValidator:()=>It});const i=":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",n=new RegExp("^["+i+"]["+i+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function s(t,e){const i=[];let n=e.exec(t);for(;n;){const s=[];s.startIndex=e.lastIndex-n[0].length;const r=n.length;for(let t=0;t<r;t++)s.push(n[t]);i.push(s),n=e.exec(t)}return i}const r=function(t){return!(null==n.exec(t))},o=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],a=["__proto__","constructor","prototype"],l={allowBooleanAttributes:!1,unpairedTags:[]};function h(t,e){e=Object.assign({},l,e);const i=[];let n=!1,s=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let r=0;r<t.length;r++)if("<"===t[r]&&"?"===t[r+1]){if(r+=2,r=u(t,r),r.err)return r}else{if("<"!==t[r]){if(p(t[r]))continue;return b("InvalidChar","char '"+t[r]+"' is not expected.",w(t,r))}{let o=r;if(r++,"!"===t[r]){r=c(t,r);continue}{let a=!1;"/"===t[r]&&(a=!0,r++);let l="";for(;r<t.length&&">"!==t[r]&&" "!==t[r]&&"\t"!==t[r]&&"\n"!==t[r]&&"\r"!==t[r];r++)l+=t[r];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),r--),!y(l)){let e;return e=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",b("InvalidTag",e,w(t,r))}const h=g(t,r);if(!1===h)return b("InvalidAttr","Attributes for '"+l+"' have open quote.",w(t,r));let d=h.value;if(r=h.index,"/"===d[d.length-1]){const i=r-d.length;d=d.substring(0,d.length-1);const s=x(d,e);if(!0!==s)return b(s.err.code,s.err.msg,w(t,i+s.err.line));n=!0}else if(a){if(!h.tagClosed)return b("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",w(t,r));if(d.trim().length>0)return b("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",w(t,o));if(0===i.length)return b("InvalidTag","Closing tag '"+l+"' has not been opened.",w(t,o));{const e=i.pop();if(l!==e.tagName){let i=w(t,e.tagStartPos);return b("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+i.line+", col "+i.col+") instead of closing tag '"+l+"'.",w(t,o))}0==i.length&&(s=!0)}}else{const a=x(d,e);if(!0!==a)return b(a.err.code,a.err.msg,w(t,r-d.length+a.err.line));if(!0===s)return b("InvalidXml","Multiple possible root nodes found.",w(t,r));-1!==e.unpairedTags.indexOf(l)||i.push({tagName:l,tagStartPos:o}),n=!0}for(r++;r<t.length;r++)if("<"===t[r]){if("!"===t[r+1]){r++,r=c(t,r);continue}if("?"!==t[r+1])break;if(r=u(t,++r),r.err)return r}else if("&"===t[r]){const e=N(t,r);if(-1==e)return b("InvalidChar","char '&' is not expected.",w(t,r));r=e}else if(!0===s&&!p(t[r]))return b("InvalidXml","Extra text at the end",w(t,r));"<"===t[r]&&r--}}}return n?1==i.length?b("InvalidTag","Unclosed tag '"+i[0].tagName+"'.",w(t,i[0].tagStartPos)):!(i.length>0)||b("InvalidXml","Invalid '"+JSON.stringify(i.map(t=>t.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):b("InvalidXml","Start tag expected.",1)}function p(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function u(t,e){const i=e;for(;e<t.length;e++)if("?"==t[e]||" "==t[e]){const n=t.substr(i,e-i);if(e>5&&"xml"===n)return b("InvalidXml","XML declaration allowed only at the start of the document.",w(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}continue}return e}function c(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let i=1;for(e+=8;e<t.length;e++)if("<"===t[e])i++;else if(">"===t[e]&&(i--,0===i))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}const d='"',f="'";function g(t,e){let i="",n="",s=!1;for(;e<t.length;e++){if(t[e]===d||t[e]===f)""===n?n=t[e]:n!==t[e]||(n="");else if(">"===t[e]&&""===n){s=!0;break}i+=t[e]}return""===n&&{value:i,index:e,tagClosed:s}}const m=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function x(t,e){const i=s(t,m),n={};for(let t=0;t<i.length;t++){if(0===i[t][1].length)return b("InvalidAttr","Attribute '"+i[t][2]+"' has no space in starting.",v(i[t]));if(void 0!==i[t][3]&&void 0===i[t][4])return b("InvalidAttr","Attribute '"+i[t][2]+"' is without value.",v(i[t]));if(void 0===i[t][3]&&!e.allowBooleanAttributes)return b("InvalidAttr","boolean attribute '"+i[t][2]+"' is not allowed.",v(i[t]));const s=i[t][2];if(!E(s))return b("InvalidAttr","Attribute '"+s+"' is an invalid name.",v(i[t]));if(Object.prototype.hasOwnProperty.call(n,s))return b("InvalidAttr","Attribute '"+s+"' is repeated.",v(i[t]));n[s]=1}return!0}function N(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let i=/\d/;for("x"===t[e]&&(e++,i=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(i))break}return-1}(t,++e);let i=0;for(;e<t.length;e++,i++)if(!(t[e].match(/\w/)&&i<20)){if(";"===t[e])break;return-1}return e}function b(t,e,i){return{err:{code:t,msg:e,line:i.line||i,col:i.col}}}function E(t){return r(t)}function y(t){return r(t)}function w(t,e){const i=t.substring(0,e).split(/\r?\n/);return{line:i.length,col:i[i.length-1].length+1}}function v(t){return t.startIndex+t[1].length}const P=t=>o.includes(t)?"__"+t:t,T={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,i){return t},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:P};function S(t,e){if("string"!=typeof t)return;const i=t.toLowerCase();if(o.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);if(a.some(t=>i===t.toLowerCase()))throw new Error(`[SECURITY] Invalid ${e}: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`)}function A(t){return"boolean"==typeof t?{enabled:t,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,allowedTags:null,tagFilter:null}:"object"==typeof t&&null!==t?{enabled:!1!==t.enabled,maxEntitySize:t.maxEntitySize??1e4,maxExpansionDepth:t.maxExpansionDepth??10,maxTotalExpansions:t.maxTotalExpansions??1e3,maxExpandedLength:t.maxExpandedLength??1e5,maxEntityCount:t.maxEntityCount??100,allowedTags:t.allowedTags??null,tagFilter:t.tagFilter??null}:A(!0)}const O=function(t){const e=Object.assign({},T,t),i=[{value:e.attributeNamePrefix,name:"attributeNamePrefix"},{value:e.attributesGroupName,name:"attributesGroupName"},{value:e.textNodeName,name:"textNodeName"},{value:e.cdataPropName,name:"cdataPropName"},{value:e.commentPropName,name:"commentPropName"}];for(const{value:t,name:e}of i)t&&S(t,e);return null===e.onDangerousProperty&&(e.onDangerousProperty=P),e.processEntities=A(e.processEntities),e.stopNodes&&Array.isArray(e.stopNodes)&&(e.stopNodes=e.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),e};let C;C="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class I{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t,e){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),void 0!==e&&(this.child[this.child.length-1][C]={startIndex:e})}static getMetaDataSymbol(){return C}}class ${constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,e){const i=Object.create(null);let n=0;if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let s=1,r=!1,o=!1,a="";for(;e<t.length;e++)if("<"!==t[e]||o)if(">"===t[e]){if(o?"-"===t[e-1]&&"-"===t[e-2]&&(o=!1,s--):s--,0===s)break}else"["===t[e]?r=!0:a+=t[e];else{if(r&&_(t,"!ENTITY",e)){let s,r;if(e+=7,[s,r,e]=this.readEntityExp(t,e+1,this.suppressValidationErr),-1===r.indexOf("&")){if(!1!==this.options.enabled&&this.options.maxEntityCount&&n>=this.options.maxEntityCount)throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const t=s.replace(/[.\-+*:]/g,"\\.");i[s]={regx:RegExp(`&${t};`,"g"),val:r},n++}}else if(r&&_(t,"!ELEMENT",e)){e+=8;const{index:i}=this.readElementExp(t,e+1);e=i}else if(r&&_(t,"!ATTLIST",e))e+=8;else if(r&&_(t,"!NOTATION",e)){e+=9;const{index:i}=this.readNotationExp(t,e+1,this.suppressValidationErr);e=i}else{if(!_(t,"!--",e))throw new Error("Invalid DOCTYPE");o=!0}s++,a=""}if(0!==s)throw new Error("Unclosed DOCTYPE")}return{entities:i,i:e}}readEntityExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e])&&'"'!==t[e]&&"'"!==t[e];)i+=t[e],e++;if(V(i),e=j(t,e),!this.suppressValidationErr){if("SYSTEM"===t.substring(e,e+6).toUpperCase())throw new Error("External entities are not supported");if("%"===t[e])throw new Error("Parameter entities are not supported")}let n="";if([e,n]=this.readIdentifierVal(t,e,"entity"),!1!==this.options.enabled&&this.options.maxEntitySize&&n.length>this.options.maxEntitySize)throw new Error(`Entity "${i}" size (${n.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[i,n,--e]}readNotationExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;!this.suppressValidationErr&&V(i),e=j(t,e);const n=t.substring(e,e+6).toUpperCase();if(!this.suppressValidationErr&&"SYSTEM"!==n&&"PUBLIC"!==n)throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);e+=n.length,e=j(t,e);let s=null,r=null;if("PUBLIC"===n)[e,s]=this.readIdentifierVal(t,e,"publicIdentifier"),'"'!==t[e=j(t,e)]&&"'"!==t[e]||([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"));else if("SYSTEM"===n&&([e,r]=this.readIdentifierVal(t,e,"systemIdentifier"),!this.suppressValidationErr&&!r))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:i,publicIdentifier:s,systemIdentifier:r,index:--e}}readIdentifierVal(t,e,i){let n="";const s=t[e];if('"'!==s&&"'"!==s)throw new Error(`Expected quoted string, found "${s}"`);for(e++;e<t.length&&t[e]!==s;)n+=t[e],e++;if(t[e]!==s)throw new Error(`Unterminated ${i} value`);return[++e,n]}readElementExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;if(!this.suppressValidationErr&&!r(i))throw new Error(`Invalid element name: "${i}"`);let n="";if("E"===t[e=j(t,e)]&&_(t,"MPTY",e))e+=4;else if("A"===t[e]&&_(t,"NY",e))e+=2;else if("("===t[e]){for(e++;e<t.length&&")"!==t[e];)n+=t[e],e++;if(")"!==t[e])throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[e]}"`);return{elementName:i,contentModel:n.trim(),index:e}}readAttlistExp(t,e){e=j(t,e);let i="";for(;e<t.length&&!/\s/.test(t[e]);)i+=t[e],e++;V(i),e=j(t,e);let n="";for(;e<t.length&&!/\s/.test(t[e]);)n+=t[e],e++;if(!V(n))throw new Error(`Invalid attribute name: "${n}"`);e=j(t,e);let s="";if("NOTATION"===t.substring(e,e+8).toUpperCase()){if(s="NOTATION","("!==t[e=j(t,e+=8)])throw new Error(`Expected '(', found "${t[e]}"`);e++;let i=[];for(;e<t.length&&")"!==t[e];){let n="";for(;e<t.length&&"|"!==t[e]&&")"!==t[e];)n+=t[e],e++;if(n=n.trim(),!V(n))throw new Error(`Invalid notation name: "${n}"`);i.push(n),"|"===t[e]&&(e++,e=j(t,e))}if(")"!==t[e])throw new Error("Unterminated list of notations");e++,s+=" ("+i.join("|")+")"}else{for(;e<t.length&&!/\s/.test(t[e]);)s+=t[e],e++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}e=j(t,e);let r="";return"#REQUIRED"===t.substring(e,e+8).toUpperCase()?(r="#REQUIRED",e+=8):"#IMPLIED"===t.substring(e,e+7).toUpperCase()?(r="#IMPLIED",e+=7):[e,r]=this.readIdentifierVal(t,e,"ATTLIST"),{elementName:i,attributeName:n,attributeType:s,defaultValue:r,index:e}}}const j=(t,e)=>{for(;e<t.length&&/\s/.test(t[e]);)e++;return e};function _(t,e,i){for(let n=0;n<e.length;n++)if(e[n]!==t[i+n+1])return!1;return!0}function V(t){if(r(t))return t;throw new Error(`Invalid entity name ${t}`)}const D=/^[-+]?0x[a-fA-F0-9]+$/,k=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,F={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};const L=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class M{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,e=null,i=null){this.path.length>0&&(this.path[this.path.length-1].values=void 0);const n=this.path.length;this.siblingStacks[n]||(this.siblingStacks[n]=new Map);const s=this.siblingStacks[n],r=i?`${i}:${t}`:t,o=s.get(r)||0;let a=0;for(const t of s.values())a+=t;s.set(r,o+1);const l={tag:t,position:a,counter:o};null!=i&&(l.namespace=i),null!=e&&(l.values=e),this.path.push(l)}pop(){if(0===this.path.length)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const e=this.path[this.path.length-1];null!=t&&(e.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){if(0===this.path.length)return;const e=this.path[this.path.length-1];return e.values?.[t]}hasAttr(t){if(0===this.path.length)return!1;const e=this.path[this.path.length-1];return void 0!==e.values&&t in e.values}getPosition(){return 0===this.path.length?-1:this.path[this.path.length-1].position??0}getCounter(){return 0===this.path.length?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,e=!0){const i=t||this.separator;return this.path.map(t=>e&&t.namespace?`${t.namespace}:${t.tag}`:t.tag).join(i)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const e=t.segments;return 0!==e.length&&(t.hasDeepWildcard()?this._matchWithDeepWildcard(e):this._matchSimple(e))}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let e=0;e<t.length;e++){const i=t[e],n=this.path[e],s=e===this.path.length-1;if(!this._matchSegment(i,n,s))return!1}return!0}_matchWithDeepWildcard(t){let e=this.path.length-1,i=t.length-1;for(;i>=0&&e>=0;){const n=t[i];if("deep-wildcard"===n.type){if(i--,i<0)return!0;const n=t[i];let s=!1;for(let t=e;t>=0;t--){const r=t===this.path.length-1;if(this._matchSegment(n,this.path[t],r)){e=t-1,i--,s=!0;break}}if(!s)return!1}else{const t=e===this.path.length-1;if(!this._matchSegment(n,this.path[e],t))return!1;e--,i--}}return i<0}_matchSegment(t,e,i){if("*"!==t.tag&&t.tag!==e.tag)return!1;if(void 0!==t.namespace&&"*"!==t.namespace&&t.namespace!==e.namespace)return!1;if(void 0!==t.attrName){if(!i)return!1;if(!e.values||!(t.attrName in e.values))return!1;if(void 0!==t.attrValue){const i=e.values[t.attrName];if(String(i)!==String(t.attrValue))return!1}}if(void 0!==t.position){if(!i)return!1;const n=e.counter??0;if("first"===t.position&&0!==n)return!1;if("odd"===t.position&&n%2!=1)return!1;if("even"===t.position&&n%2!=0)return!1;if("nth"===t.position&&n!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(t=>({...t})),this.siblingStacks=t.siblingStacks.map(t=>new Map(t))}}class G{constructor(t,e={}){this.pattern=t,this.separator=e.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(t=>"deep-wildcard"===t.type),this._hasAttributeCondition=this.segments.some(t=>void 0!==t.attrName),this._hasPositionSelector=this.segments.some(t=>void 0!==t.position)}_parse(t){const e=[];let i=0,n="";for(;i<t.length;)t[i]===this.separator?i+1<t.length&&t[i+1]===this.separator?(n.trim()&&(e.push(this._parseSegment(n.trim())),n=""),e.push({type:"deep-wildcard"}),i+=2):(n.trim()&&e.push(this._parseSegment(n.trim())),n="",i++):(n+=t[i],i++);return n.trim()&&e.push(this._parseSegment(n.trim())),e}_parseSegment(t){const e={type:"tag"};let i=null,n=t;const s=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(s&&(n=s[1]+s[3],s[2])){const t=s[2].slice(1,-1);t&&(i=t)}let r,o,a=n;if(n.includes("::")){const e=n.indexOf("::");if(r=n.substring(0,e).trim(),a=n.substring(e+2).trim(),!r)throw new Error(`Invalid namespace in pattern: ${t}`)}let l=null;if(a.includes(":")){const t=a.lastIndexOf(":"),e=a.substring(0,t).trim(),i=a.substring(t+1).trim();["first","last","odd","even"].includes(i)||/^nth\(\d+\)$/.test(i)?(o=e,l=i):o=a}else o=a;if(!o)throw new Error(`Invalid segment pattern: ${t}`);if(e.tag=o,r&&(e.namespace=r),i)if(i.includes("=")){const t=i.indexOf("=");e.attrName=i.substring(0,t).trim(),e.attrValue=i.substring(t+1).trim()}else e.attrName=i.trim();if(l){const t=l.match(/^nth\((\d+)\)$/);t?(e.position="nth",e.positionValue=parseInt(t[1],10)):e.position=l}return e}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}function R(t,e){if(!t)return{};const i=e.attributesGroupName?t[e.attributesGroupName]:t;if(!i)return{};const n={};for(const t in i)t.startsWith(e.attributeNamePrefix)?n[t.substring(e.attributeNamePrefix.length)]=i[t]:n[t]=i[t];return n}function U(t){if(!t||"string"!=typeof t)return;const e=t.indexOf(":");if(-1!==e&&e>0){const i=t.substring(0,e);if("xmlns"!==i)return i}}class B{constructor(t){var e;if(this.options=t,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:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>st(e,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>st(e,16,"&#x")}},this.addExternalEntities=W,this.parseXml=Z,this.parseTextData=Y,this.resolveNameSpace=X,this.buildAttributesMap=q,this.isItStopNode=H,this.replaceEntitiesValue=K,this.readStopNodeData=it,this.saveTextToParentTag=Q,this.addChild=J,this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new M,this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new G(e)):e instanceof G&&this.stopNodeExpressions.push(e)}}}}function W(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i],s=n.replace(/[.\-+*:]/g,"\\.");this.lastEntities[n]={regex:new RegExp("&"+s+";","g"),val:t[n]}}}function Y(t,e,i,n,s,r,o){if(void 0!==t&&(this.options.trimValues&&!n&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t,e,i));const n=this.options.jPath?i.toString():i,a=this.options.tagValueProcessor(e,t,n,s,r);return null==a?t:typeof a!=typeof t||a!==t?a:this.options.trimValues||t.trim()===t?nt(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function X(t){if(this.options.removeNSPrefix){const e=t.split(":"),i="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=i+e[1])}return t}const z=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function q(t,e,i){if(!0!==this.options.ignoreAttributes&&"string"==typeof t){const n=s(t,z),r=n.length,o={},a={};for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=n[t][4];if(s.length&&void 0!==r){let t=r;this.options.trimValues&&(t=t.trim()),t=this.replaceEntitiesValue(t,i,e),a[s]=t}}Object.keys(a).length>0&&"object"==typeof e&&e.updateCurrent&&e.updateCurrent(a);for(let t=0;t<r;t++){const s=this.resolveNameSpace(n[t][1]),r=this.options.jPath?e.toString():e;if(this.ignoreAttributesFn(s,r))continue;let a=n[t][4],l=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l=ot(l,this.options),void 0!==a){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a,i,e);const t=this.options.jPath?e.toString():e,n=this.options.attributeValueProcessor(s,a,t);o[l]=null==n?a:typeof n!=typeof a||n!==a?n:nt(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[l]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=o,t}return o}}const Z=function(t){t=t.replace(/\r\n?/g,"\n");const e=new I("!xml");let i=e,n="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const s=new $(this.options.processEntities);for(let r=0;r<t.length;r++)if("<"===t[r])if("/"===t[r+1]){const e=tt(t,">",r,"Closing Tag is not closed.");let s=t.substring(r+2,e).trim();if(this.options.removeNSPrefix){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}s=rt(this.options.transformTagName,s,"",this.options).tagName,i&&(n=this.saveTextToParentTag(n,i,this.matcher));const o=this.matcher.getCurrentTag();if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);o&&-1!==this.options.unpairedTags.indexOf(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=this.tagsNodeStack.pop(),n="",r=e}else if("?"===t[r+1]){let e=et(t,r,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,i,this.matcher),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new I(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,this.matcher,e.tagName)),this.addChild(i,t,this.matcher,r)}r=e.closeIndex+1}else if("!--"===t.substr(r+1,3)){const e=tt(t,"--\x3e",r+4,"Comment is not closed.");if(this.options.commentPropName){const s=t.substring(r+4,e-2);n=this.saveTextToParentTag(n,i,this.matcher),i.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}r=e}else if("!D"===t.substr(r+1,2)){const e=s.readDocType(t,r);this.docTypeEntities=e.entities,r=e.i}else if("!["===t.substr(r+1,2)){const e=tt(t,"]]>",r,"CDATA is not closed.")-2,s=t.substring(r+9,e);n=this.saveTextToParentTag(n,i,this.matcher);let o=this.parseTextData(s,i.tagname,this.matcher,!0,!1,!0,!0);null==o&&(o=""),this.options.cdataPropName?i.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):i.add(this.options.textNodeName,o),r=e+2}else{let s=et(t,r,this.options.removeNSPrefix);if(!s){const e=t.substring(Math.max(0,r-50),Math.min(t.length,r+50));throw new Error(`readTagExp returned undefined at position ${r}. Context: "${e}"`)}let o=s.tagName;const a=s.rawTagName;let l=s.tagExp,h=s.attrExpPresent,p=s.closeIndex;if(({tagName:o,tagExp:l}=rt(this.options.transformTagName,o,l,this.options)),this.options.strictReservedNames&&(o===this.options.commentPropName||o===this.options.cdataPropName))throw new Error(`Invalid tag name: ${o}`);i&&n&&"!xml"!==i.tagname&&(n=this.saveTextToParentTag(n,i,this.matcher,!1));const u=i;u&&-1!==this.options.unpairedTags.indexOf(u.tagname)&&(i=this.tagsNodeStack.pop(),this.matcher.pop());let c=!1;l.length>0&&l.lastIndexOf("/")===l.length-1&&(c=!0,"/"===o[o.length-1]?(o=o.substr(0,o.length-1),l=o):l=l.substr(0,l.length-1),h=o!==l);let d,f=null,g={};d=U(a),o!==e.tagname&&this.matcher.push(o,{},d),o!==l&&h&&(f=this.buildAttributesMap(l,this.matcher,o),f&&(g=R(f,this.options))),o!==e.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const m=r;if(this.isCurrentNodeStopNode){let e="";if(c)r=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(o))r=s.closeIndex;else{const i=this.readStopNodeData(t,a,p+1);if(!i)throw new Error(`Unexpected end of ${a}`);r=i.i,e=i.tagContent}const n=new I(o);f&&(n[":@"]=f),n.add(this.options.textNodeName,e),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(i,n,this.matcher,m)}else{if(c){({tagName:o,tagExp:l}=rt(this.options.transformTagName,o,l,this.options));const t=new I(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(-1!==this.options.unpairedTags.indexOf(o)){const t=new I(o);f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),this.matcher.pop(),this.isCurrentNodeStopNode=!1,r=s.closeIndex;continue}{const t=new I(o);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(i),f&&(t[":@"]=f),this.addChild(i,t,this.matcher,m),i=t}}n="",r=p}}else n+=t[r];return e.child};function J(t,e,i,n){this.options.captureMetaData||(n=void 0);const s=this.options.jPath?i.toString():i,r=this.options.updateTag(e.tagname,s,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e,n)):t.addChild(e,n))}function K(t,e,i){const n=this.options.processEntities;if(!n||!n.enabled)return t;if(n.allowedTags){const s=this.options.jPath?i.toString():i;if(!(Array.isArray(n.allowedTags)?n.allowedTags.includes(e):n.allowedTags(e,s)))return t}if(n.tagFilter){const s=this.options.jPath?i.toString():i;if(!n.tagFilter(e,s))return t}for(let e in this.docTypeEntities){const i=this.docTypeEntities[e],s=t.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,n.maxTotalExpansions&&this.entityExpansionCount>n.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n.maxTotalExpansions}`);const e=t.length;if(t=t.replace(i.regx,i.val),n.maxExpandedLength&&(this.currentExpandedLength+=t.length-e,this.currentExpandedLength>n.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n.maxExpandedLength}`)}}if(-1===t.indexOf("&"))return t;for(let e in this.lastEntities){const i=this.lastEntities[e];t=t.replace(i.regex,i.val)}if(-1===t.indexOf("&"))return t;if(this.options.htmlEntities)for(let e in this.htmlEntities){const i=this.htmlEntities[e];t=t.replace(i.regex,i.val)}return t.replace(this.ampEntity.regex,this.ampEntity.val)}function Q(t,e,i,n){return t&&(void 0===n&&(n=0===e.child.length),void 0!==(t=this.parseTextData(t,e.tagname,i,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,n))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function H(t,e){if(!t||0===t.length)return!1;for(let i=0;i<t.length;i++)if(e.matches(t[i]))return!0;return!1}function tt(t,e,i,n){const s=t.indexOf(e,i);if(-1===s)throw new Error(n);return s+e.length-1}function et(t,e,i,n=">"){const s=function(t,e,i=">"){let n,s="";for(let r=e;r<t.length;r++){let e=t[r];if(n)e===n&&(n="");else if('"'===e||"'"===e)n=e;else if(e===i[0]){if(!i[1])return{data:s,index:r};if(t[r+1]===i[1])return{data:s,index:r}}else"\t"===e&&(e=" ");s+=e}}(t,e+1,n);if(!s)return;let r=s.data;const o=s.index,a=r.search(/\s/);let l=r,h=!0;-1!==a&&(l=r.substring(0,a),r=r.substring(a+1).trimStart());const p=l;if(i){const t=l.indexOf(":");-1!==t&&(l=l.substr(t+1),h=l!==s.data.substr(t+1))}return{tagName:l,tagExp:r,closeIndex:o,attrExpPresent:h,rawTagName:p}}function it(t,e,i){const n=i;let s=1;for(;i<t.length;i++)if("<"===t[i])if("/"===t[i+1]){const r=tt(t,">",i,`${e} is not closed`);if(t.substring(i+2,r).trim()===e&&(s--,0===s))return{tagContent:t.substring(n,i),i:r};i=r}else if("?"===t[i+1])i=tt(t,"?>",i+1,"StopNode is not closed.");else if("!--"===t.substr(i+1,3))i=tt(t,"--\x3e",i+3,"StopNode is not closed.");else if("!["===t.substr(i+1,2))i=tt(t,"]]>",i,"StopNode is not closed.")-2;else{const n=et(t,i,">");n&&((n&&n.tagName)===e&&"/"!==n.tagExp[n.tagExp.length-1]&&s++,i=n.closeIndex)}}function nt(t,e,i){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&function(t,e={}){if(e=Object.assign({},F,e),!t||"string"!=typeof t)return t;let i=t.trim();if(void 0!==e.skipLike&&e.skipLike.test(i))return t;if("0"===t)return 0;if(e.hex&&D.test(i))return function(t){if(parseInt)return parseInt(t,16);if(Number.parseInt)return Number.parseInt(t,16);if(window&&window.parseInt)return window.parseInt(t,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}(i);if(i.includes("e")||i.includes("E"))return function(t,e,i){if(!i.eNotation)return t;const n=e.match(L);if(n){let s=n[1]||"";const r=-1===n[3].indexOf("e")?"E":"e",o=n[2],a=s?t[o.length+1]===r:t[o.length]===r;return o.length>1&&a?t:1!==o.length||!n[3].startsWith(`.${r}`)&&n[3][0]!==r?i.leadingZeros&&!a?(e=(n[1]||"")+n[3],Number(e)):t:Number(e)}return t}(t,i,e);{const s=k.exec(i);if(s){const r=s[1]||"",o=s[2];let a=(n=s[3])&&-1!==n.indexOf(".")?("."===(n=n.replace(/0+$/,""))?n="0":"."===n[0]?n="0"+n:"."===n[n.length-1]&&(n=n.substring(0,n.length-1)),n):n;const l=r?"."===t[o.length+1]:"."===t[o.length];if(!e.leadingZeros&&(o.length>1||1===o.length&&!l))return t;{const n=Number(i),s=String(n);if(0===n)return n;if(-1!==s.search(/[eE]/))return e.eNotation?n:t;if(-1!==i.indexOf("."))return"0"===s||s===a||s===`${r}${a}`?n:t;let l=o?a:i;return o?l===s||r+l===s?n:t:l===s||l===r+s?n:t}}return t}// removed by dead control flow
|
|
86091
|
+
var n; }(t,i)}return void 0!==t?t:""}function st(t,e,i){const n=Number.parseInt(t,e);return n>=0&&n<=1114111?String.fromCodePoint(n):i+t+";"}function rt(t,e,i,n){if(t){const n=t(e);i===e&&(i=n),e=n}return{tagName:e=ot(e,n),tagExp:i}}function ot(t,e){if(a.includes(t))throw new Error(`[SECURITY] Invalid name: "${t}" is a reserved JavaScript keyword that could cause prototype pollution`);return o.includes(t)?e.onDangerousProperty(t):t}const at=I.getMetaDataSymbol();function lt(t,e){if(!t||"object"!=typeof t)return{};if(!e)return t;const i={};for(const n in t)n.startsWith(e)?i[n.substring(e.length)]=t[n]:i[n]=t[n];return i}function ht(t,e,i){return pt(t,e,i)}function pt(t,e,i){let n;const s={};for(let r=0;r<t.length;r++){const o=t[r],a=ut(o);if(void 0!==a&&a!==e.textNodeName){const t=lt(o[":@"]||{},e.attributeNamePrefix);i.push(a,t)}if(a===e.textNodeName)void 0===n?n=o[a]:n+=""+o[a];else{if(void 0===a)continue;if(o[a]){let t=pt(o[a],e,i);const n=dt(t,e);if(o[":@"]?ct(t,o[":@"],i,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==o[at]&&"object"==typeof t&&null!==t&&(t[at]=o[at]),void 0!==s[a]&&Object.prototype.hasOwnProperty.call(s,a))Array.isArray(s[a])||(s[a]=[s[a]]),s[a].push(t);else{const r=e.jPath?i.toString():i;e.isArray(a,r,n)?s[a]=[t]:s[a]=t}void 0!==a&&a!==e.textNodeName&&i.pop()}}}return"string"==typeof n?n.length>0&&(s[e.textNodeName]=n):void 0!==n&&(s[e.textNodeName]=n),s}function ut(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const i=e[t];if(":@"!==i)return i}}function ct(t,e,i,n){if(e){const s=Object.keys(e),r=s.length;for(let o=0;o<r;o++){const r=s[o],a=r.startsWith(n.attributeNamePrefix)?r.substring(n.attributeNamePrefix.length):r,l=n.jPath?i.toString()+"."+a:i;n.isArray(r,l,!0,!0)?t[r]=[e[r]]:t[r]=e[r]}}}function dt(t,e){const{textNodeName:i}=e,n=Object.keys(t).length;return 0===n||!(1!==n||!t[i]&&"boolean"!=typeof t[i]&&0!==t[i])}class ft{constructor(t){this.externalEntities={},this.options=O(t)}parse(t,e){if("string"!=typeof t&&t.toString)t=t.toString();else if("string"!=typeof t)throw new Error("XML data is accepted in String or Bytes[] form.");if(e){!0===e&&(e={});const i=h(t,e);if(!0!==i)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const i=new B(this.options);i.addExternalEntities(this.externalEntities);const n=i.parseXml(t);return this.options.preserveOrder||void 0===n?n:ht(n,this.options,i.matcher)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}static getMetaDataSymbol(){return I.getMetaDataSymbol()}}function gt(t,e){let i="";e.format&&e.indentBy.length>0&&(i="\n");const n=[];if(e.stopNodes&&Array.isArray(e.stopNodes))for(let t=0;t<e.stopNodes.length;t++){const i=e.stopNodes[t];"string"==typeof i?n.push(new G(i)):i instanceof G&&n.push(i)}return mt(t,e,i,new M,n)}function mt(t,e,i,n,s){let r="",o=!1;if(!Array.isArray(t)){if(null!=t){let i=t.toString();return i=vt(i,e),i}return""}for(let a=0;a<t.length;a++){const l=t[a],h=Et(l);if(void 0===h)continue;const p=xt(l[":@"],e);n.push(h,p);const u=wt(n,s);if(h===e.textNodeName){let t=l[h];u||(t=e.tagValueProcessor(h,t),t=vt(t,e)),o&&(r+=i),r+=t,o=!1,n.pop();continue}if(h===e.cdataPropName){o&&(r+=i),r+=`<![CDATA[${l[h][0][e.textNodeName]}]]>`,o=!1,n.pop();continue}if(h===e.commentPropName){r+=i+`\x3c!--${l[h][0][e.textNodeName]}--\x3e`,o=!0,n.pop();continue}if("?"===h[0]){const t=yt(l[":@"],e,u),s="?xml"===h?"":i;let a=l[h][0][e.textNodeName];a=0!==a.length?" "+a:"",r+=s+`<${h}${a}${t}?>`,o=!0,n.pop();continue}let c=i;""!==c&&(c+=e.indentBy);const d=i+`<${h}${yt(l[":@"],e,u)}`;let f;f=u?Nt(l[h],e):mt(l[h],e,c,n,s),-1!==e.unpairedTags.indexOf(h)?e.suppressUnpairedNode?r+=d+">":r+=d+"/>":f&&0!==f.length||!e.suppressEmptyNode?f&&f.endsWith(">")?r+=d+`>${f}${i}</${h}>`:(r+=d+">",f&&""!==i&&(f.includes("/>")||f.includes("</"))?r+=i+e.indentBy+f+i:r+=f,r+=`</${h}>`):r+=d+"/>",o=!0,n.pop()}return r}function xt(t,e){if(!t||e.ignoreAttributes)return null;const i={};let n=!1;for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s.startsWith(e.attributeNamePrefix)?s.substr(e.attributeNamePrefix.length):s]=t[s],n=!0);return n?i:null}function Nt(t,e){if(!Array.isArray(t))return null!=t?t.toString():"";let i="";for(let n=0;n<t.length;n++){const s=t[n],r=Et(s);if(r===e.textNodeName)i+=s[r];else if(r===e.cdataPropName)i+=s[r][0][e.textNodeName];else if(r===e.commentPropName)i+=s[r][0][e.textNodeName];else{if(r&&"?"===r[0])continue;if(r){const t=bt(s[":@"],e),n=Nt(s[r],e);n&&0!==n.length?i+=`<${r}${t}>${n}</${r}>`:i+=`<${r}${t}/>`}}}return i}function bt(t,e){let i="";if(t&&!e.ignoreAttributes)for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=t[n];!0===s&&e.suppressBooleanAttributes?i+=` ${n.substr(e.attributeNamePrefix.length)}`:i+=` ${n.substr(e.attributeNamePrefix.length)}="${s}"`}return i}function Et(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const n=e[i];if(Object.prototype.hasOwnProperty.call(t,n)&&":@"!==n)return n}}function yt(t,e,i){let n="";if(t&&!e.ignoreAttributes)for(let s in t){if(!Object.prototype.hasOwnProperty.call(t,s))continue;let r;i?r=t[s]:(r=e.attributeValueProcessor(s,t[s]),r=vt(r,e)),!0===r&&e.suppressBooleanAttributes?n+=` ${s.substr(e.attributeNamePrefix.length)}`:n+=` ${s.substr(e.attributeNamePrefix.length)}="${r}"`}return n}function wt(t,e){if(!e||0===e.length)return!1;for(let i=0;i<e.length;i++)if(t.matches(e[i]))return!0;return!1}function vt(t,e){if(t&&t.length>0&&e.processEntities)for(let i=0;i<e.entities.length;i++){const n=e.entities[i];t=t.replace(n.regex,n.val)}return t}const Pt={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,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:!0,stopNodes:[],oneListGroup:!1,jPath:!0};function Tt(t){if(this.options=Object.assign({},Pt,t),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>"string"==typeof t&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const e=this.options.stopNodes[t];"string"==typeof e?this.stopNodeExpressions.push(new G(e)):e instanceof G&&this.stopNodeExpressions.push(e)}var e;!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn="function"==typeof(e=this.options.ignoreAttributes)?e:Array.isArray(e)?t=>{for(const i of e){if("string"==typeof i&&t===i)return!0;if(i instanceof RegExp&&i.test(t))return!0}}:()=>!1,this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ot),this.processTextOrObjNode=St,this.options.format?(this.indentate=At,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function St(t,e,i,n){const s=this.extractAttributes(t);if(n.push(e,s),this.checkStopNode(n)){const s=this.buildRawContent(t),r=this.buildAttributesForStopNode(t);return n.pop(),this.buildObjectNode(s,e,r,i)}const r=this.j2x(t,i+1,n);return n.pop(),void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,i,n):this.buildObjectNode(r.val,e,r.attrStr,i)}function At(t){return this.options.indentBy.repeat(t)}function Ot(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}Tt.prototype.build=function(t){if(this.options.preserveOrder)return gt(t,this.options);{Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t});const e=new M;return this.j2x(t,0,e).val}},Tt.prototype.j2x=function(t,e,i){let n="",s="";const r=this.options.jPath?i.toString():i,o=this.checkStopNode(i);for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a))if(void 0===t[a])this.isAttribute(a)&&(s+="");else if(null===t[a])this.isAttribute(a)||a===this.options.cdataPropName?s+="":"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if(t[a]instanceof Date)s+=this.buildTextValNode(t[a],a,"",e,i);else if("object"!=typeof t[a]){const l=this.isAttribute(a);if(l&&!this.ignoreAttributesFn(l,r))n+=this.buildAttrPairStr(l,""+t[a],o);else if(!l)if(a===this.options.textNodeName){let e=this.options.tagValueProcessor(a,""+t[a]);s+=this.replaceEntitiesValue(e)}else{i.push(a);const n=this.checkStopNode(i);if(i.pop(),n){const i=""+t[a];s+=""===i?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+i+"</"+a+this.tagEndChar}else s+=this.buildTextValNode(t[a],a,"",e,i)}}else if(Array.isArray(t[a])){const n=t[a].length;let r="",o="";for(let l=0;l<n;l++){const n=t[a][l];if(void 0===n);else if(null===n)"?"===a[0]?s+=this.indentate(e)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(e)+"<"+a+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){i.push(a);const t=this.j2x(n,e+1,i);i.pop(),r+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else r+=this.processTextOrObjNode(n,a,e,i);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(a,n);t=this.replaceEntitiesValue(t),r+=t}else{i.push(a);const t=this.checkStopNode(i);if(i.pop(),t){const t=""+n;r+=""===t?this.indentate(e)+"<"+a+this.closeTag(a)+this.tagEndChar:this.indentate(e)+"<"+a+">"+t+"</"+a+this.tagEndChar}else r+=this.buildTextValNode(n,a,"",e,i)}}this.options.oneListGroup&&(r=this.buildObjectNode(r,a,o,e)),s+=r}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const e=Object.keys(t[a]),i=e.length;for(let s=0;s<i;s++)n+=this.buildAttrPairStr(e[s],""+t[a][e[s]],o)}else s+=this.processTextOrObjNode(t[a],a,e,i);return{attrStr:n,val:s}},Tt.prototype.buildAttrPairStr=function(t,e,i){return i||(e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e)),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},Tt.prototype.extractAttributes=function(t){if(!t||"object"!=typeof t)return null;const e={};let i=!1;if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const n=t[this.options.attributesGroupName];for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t]=n[t],i=!0)}else for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const s=this.isAttribute(n);s&&(e[s]=t[n],i=!0)}return i?e:null},Tt.prototype.buildRawContent=function(t){if("string"==typeof t)return t;if("object"!=typeof t||null===t)return String(t);if(void 0!==t[this.options.textNodeName])return t[this.options.textNodeName];let e="";for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;if(this.isAttribute(i))continue;if(this.options.attributesGroupName&&i===this.options.attributesGroupName)continue;const n=t[i];if(i===this.options.textNodeName)e+=n;else if(Array.isArray(n)){for(let t of n)if("string"==typeof t||"number"==typeof t)e+=`<${i}>${t}</${i}>`;else if("object"==typeof t&&null!==t){const n=this.buildRawContent(t),s=this.buildAttributesForStopNode(t);e+=""===n?`<${i}${s}/>`:`<${i}${s}>${n}</${i}>`}}else if("object"==typeof n&&null!==n){const t=this.buildRawContent(n),s=this.buildAttributesForStopNode(n);e+=""===t?`<${i}${s}/>`:`<${i}${s}>${t}</${i}>`}else e+=`<${i}>${n}</${i}>`}return e},Tt.prototype.buildAttributesForStopNode=function(t){if(!t||"object"!=typeof t)return"";let e="";if(this.options.attributesGroupName&&t[this.options.attributesGroupName]){const i=t[this.options.attributesGroupName];for(let t in i){if(!Object.prototype.hasOwnProperty.call(i,t))continue;const n=t.startsWith(this.options.attributeNamePrefix)?t.substring(this.options.attributeNamePrefix.length):t,s=i[t];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}else for(let i in t){if(!Object.prototype.hasOwnProperty.call(t,i))continue;const n=this.isAttribute(i);if(n){const s=t[i];!0===s&&this.options.suppressBooleanAttributes?e+=" "+n:e+=" "+n+'="'+s+'"'}}return e},Tt.prototype.buildObjectNode=function(t,e,i,n){if(""===t)return"?"===e[0]?this.indentate(n)+"<"+e+i+"?"+this.tagEndChar:this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar;{let s="</"+e+this.tagEndChar,r="";return"?"===e[0]&&(r="?",s=""),!i&&""!==i||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===r.length?this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(n)+"<"+e+i+r+this.tagEndChar+t+this.indentate(n)+s:this.indentate(n)+"<"+e+i+r+">"+t+s}},Tt.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},Tt.prototype.checkStopNode=function(t){if(!this.stopNodeExpressions||0===this.stopNodeExpressions.length)return!1;for(let e=0;e<this.stopNodeExpressions.length;e++)if(t.matches(this.stopNodeExpressions[e]))return!0;return!1},Tt.prototype.buildTextValNode=function(t,e,i,n,s){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(n)+"<"+e+i+"?"+this.tagEndChar;{let s=this.options.tagValueProcessor(e,t);return s=this.replaceEntitiesValue(s),""===s?this.indentate(n)+"<"+e+i+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+i+">"+s+"</"+e+this.tagEndChar}},Tt.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const i=this.options.entities[e];t=t.replace(i.regex,i.val)}return t};const Ct=Tt,It={validate:h};module.exports=e})();
|
|
86223
86092
|
|
|
86224
86093
|
/***/ },
|
|
86225
86094
|
|
|
@@ -87661,6 +87530,284 @@ exports.GlobStream = GlobStream;
|
|
|
87661
87530
|
|
|
87662
87531
|
/***/ },
|
|
87663
87532
|
|
|
87533
|
+
/***/ "./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js"
|
|
87534
|
+
/*!******************************************************************************!*\
|
|
87535
|
+
!*** ./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js ***!
|
|
87536
|
+
\******************************************************************************/
|
|
87537
|
+
(__unused_webpack_module, exports) {
|
|
87538
|
+
|
|
87539
|
+
"use strict";
|
|
87540
|
+
|
|
87541
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87542
|
+
exports.range = exports.balanced = void 0;
|
|
87543
|
+
const balanced = (a, b, str) => {
|
|
87544
|
+
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
87545
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
87546
|
+
const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
|
|
87547
|
+
return (r && {
|
|
87548
|
+
start: r[0],
|
|
87549
|
+
end: r[1],
|
|
87550
|
+
pre: str.slice(0, r[0]),
|
|
87551
|
+
body: str.slice(r[0] + ma.length, r[1]),
|
|
87552
|
+
post: str.slice(r[1] + mb.length),
|
|
87553
|
+
});
|
|
87554
|
+
};
|
|
87555
|
+
exports.balanced = balanced;
|
|
87556
|
+
const maybeMatch = (reg, str) => {
|
|
87557
|
+
const m = str.match(reg);
|
|
87558
|
+
return m ? m[0] : null;
|
|
87559
|
+
};
|
|
87560
|
+
const range = (a, b, str) => {
|
|
87561
|
+
let begs, beg, left, right = undefined, result;
|
|
87562
|
+
let ai = str.indexOf(a);
|
|
87563
|
+
let bi = str.indexOf(b, ai + 1);
|
|
87564
|
+
let i = ai;
|
|
87565
|
+
if (ai >= 0 && bi > 0) {
|
|
87566
|
+
if (a === b) {
|
|
87567
|
+
return [ai, bi];
|
|
87568
|
+
}
|
|
87569
|
+
begs = [];
|
|
87570
|
+
left = str.length;
|
|
87571
|
+
while (i >= 0 && !result) {
|
|
87572
|
+
if (i === ai) {
|
|
87573
|
+
begs.push(i);
|
|
87574
|
+
ai = str.indexOf(a, i + 1);
|
|
87575
|
+
}
|
|
87576
|
+
else if (begs.length === 1) {
|
|
87577
|
+
const r = begs.pop();
|
|
87578
|
+
if (r !== undefined)
|
|
87579
|
+
result = [r, bi];
|
|
87580
|
+
}
|
|
87581
|
+
else {
|
|
87582
|
+
beg = begs.pop();
|
|
87583
|
+
if (beg !== undefined && beg < left) {
|
|
87584
|
+
left = beg;
|
|
87585
|
+
right = bi;
|
|
87586
|
+
}
|
|
87587
|
+
bi = str.indexOf(b, i + 1);
|
|
87588
|
+
}
|
|
87589
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
87590
|
+
}
|
|
87591
|
+
if (begs.length && right !== undefined) {
|
|
87592
|
+
result = [left, right];
|
|
87593
|
+
}
|
|
87594
|
+
}
|
|
87595
|
+
return result;
|
|
87596
|
+
};
|
|
87597
|
+
exports.range = range;
|
|
87598
|
+
//# sourceMappingURL=index.js.map
|
|
87599
|
+
|
|
87600
|
+
/***/ },
|
|
87601
|
+
|
|
87602
|
+
/***/ "./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js"
|
|
87603
|
+
/*!*******************************************************************************!*\
|
|
87604
|
+
!*** ./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js ***!
|
|
87605
|
+
\*******************************************************************************/
|
|
87606
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
87607
|
+
|
|
87608
|
+
"use strict";
|
|
87609
|
+
|
|
87610
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87611
|
+
exports.EXPANSION_MAX = void 0;
|
|
87612
|
+
exports.expand = expand;
|
|
87613
|
+
const balanced_match_1 = __webpack_require__(/*! balanced-match */ "./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js");
|
|
87614
|
+
const escSlash = '\0SLASH' + Math.random() + '\0';
|
|
87615
|
+
const escOpen = '\0OPEN' + Math.random() + '\0';
|
|
87616
|
+
const escClose = '\0CLOSE' + Math.random() + '\0';
|
|
87617
|
+
const escComma = '\0COMMA' + Math.random() + '\0';
|
|
87618
|
+
const escPeriod = '\0PERIOD' + Math.random() + '\0';
|
|
87619
|
+
const escSlashPattern = new RegExp(escSlash, 'g');
|
|
87620
|
+
const escOpenPattern = new RegExp(escOpen, 'g');
|
|
87621
|
+
const escClosePattern = new RegExp(escClose, 'g');
|
|
87622
|
+
const escCommaPattern = new RegExp(escComma, 'g');
|
|
87623
|
+
const escPeriodPattern = new RegExp(escPeriod, 'g');
|
|
87624
|
+
const slashPattern = /\\\\/g;
|
|
87625
|
+
const openPattern = /\\{/g;
|
|
87626
|
+
const closePattern = /\\}/g;
|
|
87627
|
+
const commaPattern = /\\,/g;
|
|
87628
|
+
const periodPattern = /\\\./g;
|
|
87629
|
+
exports.EXPANSION_MAX = 100_000;
|
|
87630
|
+
function numeric(str) {
|
|
87631
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
87632
|
+
}
|
|
87633
|
+
function escapeBraces(str) {
|
|
87634
|
+
return str
|
|
87635
|
+
.replace(slashPattern, escSlash)
|
|
87636
|
+
.replace(openPattern, escOpen)
|
|
87637
|
+
.replace(closePattern, escClose)
|
|
87638
|
+
.replace(commaPattern, escComma)
|
|
87639
|
+
.replace(periodPattern, escPeriod);
|
|
87640
|
+
}
|
|
87641
|
+
function unescapeBraces(str) {
|
|
87642
|
+
return str
|
|
87643
|
+
.replace(escSlashPattern, '\\')
|
|
87644
|
+
.replace(escOpenPattern, '{')
|
|
87645
|
+
.replace(escClosePattern, '}')
|
|
87646
|
+
.replace(escCommaPattern, ',')
|
|
87647
|
+
.replace(escPeriodPattern, '.');
|
|
87648
|
+
}
|
|
87649
|
+
/**
|
|
87650
|
+
* Basically just str.split(","), but handling cases
|
|
87651
|
+
* where we have nested braced sections, which should be
|
|
87652
|
+
* treated as individual members, like {a,{b,c},d}
|
|
87653
|
+
*/
|
|
87654
|
+
function parseCommaParts(str) {
|
|
87655
|
+
if (!str) {
|
|
87656
|
+
return [''];
|
|
87657
|
+
}
|
|
87658
|
+
const parts = [];
|
|
87659
|
+
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
87660
|
+
if (!m) {
|
|
87661
|
+
return str.split(',');
|
|
87662
|
+
}
|
|
87663
|
+
const { pre, body, post } = m;
|
|
87664
|
+
const p = pre.split(',');
|
|
87665
|
+
p[p.length - 1] += '{' + body + '}';
|
|
87666
|
+
const postParts = parseCommaParts(post);
|
|
87667
|
+
if (post.length) {
|
|
87668
|
+
;
|
|
87669
|
+
p[p.length - 1] += postParts.shift();
|
|
87670
|
+
p.push.apply(p, postParts);
|
|
87671
|
+
}
|
|
87672
|
+
parts.push.apply(parts, p);
|
|
87673
|
+
return parts;
|
|
87674
|
+
}
|
|
87675
|
+
function expand(str, options = {}) {
|
|
87676
|
+
if (!str) {
|
|
87677
|
+
return [];
|
|
87678
|
+
}
|
|
87679
|
+
const { max = exports.EXPANSION_MAX } = options;
|
|
87680
|
+
// I don't know why Bash 4.3 does this, but it does.
|
|
87681
|
+
// Anything starting with {} will have the first two bytes preserved
|
|
87682
|
+
// but *only* at the top level, so {},a}b will not expand to anything,
|
|
87683
|
+
// but a{},b}c will be expanded to [a}c,abc].
|
|
87684
|
+
// One could argue that this is a bug in Bash, but since the goal of
|
|
87685
|
+
// this module is to match Bash's rules, we escape a leading {}
|
|
87686
|
+
if (str.slice(0, 2) === '{}') {
|
|
87687
|
+
str = '\\{\\}' + str.slice(2);
|
|
87688
|
+
}
|
|
87689
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
87690
|
+
}
|
|
87691
|
+
function embrace(str) {
|
|
87692
|
+
return '{' + str + '}';
|
|
87693
|
+
}
|
|
87694
|
+
function isPadded(el) {
|
|
87695
|
+
return /^-?0\d/.test(el);
|
|
87696
|
+
}
|
|
87697
|
+
function lte(i, y) {
|
|
87698
|
+
return i <= y;
|
|
87699
|
+
}
|
|
87700
|
+
function gte(i, y) {
|
|
87701
|
+
return i >= y;
|
|
87702
|
+
}
|
|
87703
|
+
function expand_(str, max, isTop) {
|
|
87704
|
+
/** @type {string[]} */
|
|
87705
|
+
const expansions = [];
|
|
87706
|
+
const m = (0, balanced_match_1.balanced)('{', '}', str);
|
|
87707
|
+
if (!m)
|
|
87708
|
+
return [str];
|
|
87709
|
+
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
87710
|
+
const pre = m.pre;
|
|
87711
|
+
const post = m.post.length ? expand_(m.post, max, false) : [''];
|
|
87712
|
+
if (/\$$/.test(m.pre)) {
|
|
87713
|
+
for (let k = 0; k < post.length && k < max; k++) {
|
|
87714
|
+
const expansion = pre + '{' + m.body + '}' + post[k];
|
|
87715
|
+
expansions.push(expansion);
|
|
87716
|
+
}
|
|
87717
|
+
}
|
|
87718
|
+
else {
|
|
87719
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
87720
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
87721
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
87722
|
+
const isOptions = m.body.indexOf(',') >= 0;
|
|
87723
|
+
if (!isSequence && !isOptions) {
|
|
87724
|
+
// {a},b}
|
|
87725
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
87726
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
|
87727
|
+
return expand_(str, max, true);
|
|
87728
|
+
}
|
|
87729
|
+
return [str];
|
|
87730
|
+
}
|
|
87731
|
+
let n;
|
|
87732
|
+
if (isSequence) {
|
|
87733
|
+
n = m.body.split(/\.\./);
|
|
87734
|
+
}
|
|
87735
|
+
else {
|
|
87736
|
+
n = parseCommaParts(m.body);
|
|
87737
|
+
if (n.length === 1 && n[0] !== undefined) {
|
|
87738
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
|
87739
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
87740
|
+
//XXX is this necessary? Can't seem to hit it in tests.
|
|
87741
|
+
/* c8 ignore start */
|
|
87742
|
+
if (n.length === 1) {
|
|
87743
|
+
return post.map(p => m.pre + n[0] + p);
|
|
87744
|
+
}
|
|
87745
|
+
/* c8 ignore stop */
|
|
87746
|
+
}
|
|
87747
|
+
}
|
|
87748
|
+
// at this point, n is the parts, and we know it's not a comma set
|
|
87749
|
+
// with a single entry.
|
|
87750
|
+
let N;
|
|
87751
|
+
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
|
87752
|
+
const x = numeric(n[0]);
|
|
87753
|
+
const y = numeric(n[1]);
|
|
87754
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
87755
|
+
let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
|
|
87756
|
+
let test = lte;
|
|
87757
|
+
const reverse = y < x;
|
|
87758
|
+
if (reverse) {
|
|
87759
|
+
incr *= -1;
|
|
87760
|
+
test = gte;
|
|
87761
|
+
}
|
|
87762
|
+
const pad = n.some(isPadded);
|
|
87763
|
+
N = [];
|
|
87764
|
+
for (let i = x; test(i, y); i += incr) {
|
|
87765
|
+
let c;
|
|
87766
|
+
if (isAlphaSequence) {
|
|
87767
|
+
c = String.fromCharCode(i);
|
|
87768
|
+
if (c === '\\') {
|
|
87769
|
+
c = '';
|
|
87770
|
+
}
|
|
87771
|
+
}
|
|
87772
|
+
else {
|
|
87773
|
+
c = String(i);
|
|
87774
|
+
if (pad) {
|
|
87775
|
+
const need = width - c.length;
|
|
87776
|
+
if (need > 0) {
|
|
87777
|
+
const z = new Array(need + 1).join('0');
|
|
87778
|
+
if (i < 0) {
|
|
87779
|
+
c = '-' + z + c.slice(1);
|
|
87780
|
+
}
|
|
87781
|
+
else {
|
|
87782
|
+
c = z + c;
|
|
87783
|
+
}
|
|
87784
|
+
}
|
|
87785
|
+
}
|
|
87786
|
+
}
|
|
87787
|
+
N.push(c);
|
|
87788
|
+
}
|
|
87789
|
+
}
|
|
87790
|
+
else {
|
|
87791
|
+
N = [];
|
|
87792
|
+
for (let j = 0; j < n.length; j++) {
|
|
87793
|
+
N.push.apply(N, expand_(n[j], max, false));
|
|
87794
|
+
}
|
|
87795
|
+
}
|
|
87796
|
+
for (let j = 0; j < N.length; j++) {
|
|
87797
|
+
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
87798
|
+
const expansion = pre + N[j] + post[k];
|
|
87799
|
+
if (!isTop || isSequence || expansion) {
|
|
87800
|
+
expansions.push(expansion);
|
|
87801
|
+
}
|
|
87802
|
+
}
|
|
87803
|
+
}
|
|
87804
|
+
}
|
|
87805
|
+
return expansions;
|
|
87806
|
+
}
|
|
87807
|
+
//# sourceMappingURL=index.js.map
|
|
87808
|
+
|
|
87809
|
+
/***/ },
|
|
87810
|
+
|
|
87664
87811
|
/***/ "./node_modules/glob/node_modules/lru-cache/dist/commonjs/index.js"
|
|
87665
87812
|
/*!*************************************************************************!*\
|
|
87666
87813
|
!*** ./node_modules/glob/node_modules/lru-cache/dist/commonjs/index.js ***!
|
|
@@ -89268,12 +89415,114 @@ exports.assertValidPattern = assertValidPattern;
|
|
|
89268
89415
|
"use strict";
|
|
89269
89416
|
|
|
89270
89417
|
// parse a single path portion
|
|
89418
|
+
var _a;
|
|
89271
89419
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
89272
89420
|
exports.AST = void 0;
|
|
89273
89421
|
const brace_expressions_js_1 = __webpack_require__(/*! ./brace-expressions.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js");
|
|
89274
89422
|
const unescape_js_1 = __webpack_require__(/*! ./unescape.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js");
|
|
89275
89423
|
const types = new Set(['!', '?', '+', '*', '@']);
|
|
89276
89424
|
const isExtglobType = (c) => types.has(c);
|
|
89425
|
+
const isExtglobAST = (c) => isExtglobType(c.type);
|
|
89426
|
+
// Map of which extglob types can adopt the children of a nested extglob
|
|
89427
|
+
//
|
|
89428
|
+
// anything but ! can adopt a matching type:
|
|
89429
|
+
// +(a|+(b|c)|d) => +(a|b|c|d)
|
|
89430
|
+
// *(a|*(b|c)|d) => *(a|b|c|d)
|
|
89431
|
+
// @(a|@(b|c)|d) => @(a|b|c|d)
|
|
89432
|
+
// ?(a|?(b|c)|d) => ?(a|b|c|d)
|
|
89433
|
+
//
|
|
89434
|
+
// * can adopt anything, because 0 or repetition is allowed
|
|
89435
|
+
// *(a|?(b|c)|d) => *(a|b|c|d)
|
|
89436
|
+
// *(a|+(b|c)|d) => *(a|b|c|d)
|
|
89437
|
+
// *(a|@(b|c)|d) => *(a|b|c|d)
|
|
89438
|
+
//
|
|
89439
|
+
// + can adopt @, because 1 or repetition is allowed
|
|
89440
|
+
// +(a|@(b|c)|d) => +(a|b|c|d)
|
|
89441
|
+
//
|
|
89442
|
+
// + and @ CANNOT adopt *, because 0 would be allowed
|
|
89443
|
+
// +(a|*(b|c)|d) => would match "", on *(b|c)
|
|
89444
|
+
// @(a|*(b|c)|d) => would match "", on *(b|c)
|
|
89445
|
+
//
|
|
89446
|
+
// + and @ CANNOT adopt ?, because 0 would be allowed
|
|
89447
|
+
// +(a|?(b|c)|d) => would match "", on ?(b|c)
|
|
89448
|
+
// @(a|?(b|c)|d) => would match "", on ?(b|c)
|
|
89449
|
+
//
|
|
89450
|
+
// ? can adopt @, because 0 or 1 is allowed
|
|
89451
|
+
// ?(a|@(b|c)|d) => ?(a|b|c|d)
|
|
89452
|
+
//
|
|
89453
|
+
// ? and @ CANNOT adopt * or +, because >1 would be allowed
|
|
89454
|
+
// ?(a|*(b|c)|d) => would match bbb on *(b|c)
|
|
89455
|
+
// @(a|*(b|c)|d) => would match bbb on *(b|c)
|
|
89456
|
+
// ?(a|+(b|c)|d) => would match bbb on +(b|c)
|
|
89457
|
+
// @(a|+(b|c)|d) => would match bbb on +(b|c)
|
|
89458
|
+
//
|
|
89459
|
+
// ! CANNOT adopt ! (nothing else can either)
|
|
89460
|
+
// !(a|!(b|c)|d) => !(a|b|c|d) would fail to match on b (not not b|c)
|
|
89461
|
+
//
|
|
89462
|
+
// ! can adopt @
|
|
89463
|
+
// !(a|@(b|c)|d) => !(a|b|c|d)
|
|
89464
|
+
//
|
|
89465
|
+
// ! CANNOT adopt *
|
|
89466
|
+
// !(a|*(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
|
|
89467
|
+
//
|
|
89468
|
+
// ! CANNOT adopt +
|
|
89469
|
+
// !(a|+(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
|
|
89470
|
+
//
|
|
89471
|
+
// ! CANNOT adopt ?
|
|
89472
|
+
// x!(a|?(b|c)|d) => x!(a|b|c|d) would fail to match "x"
|
|
89473
|
+
const adoptionMap = new Map([
|
|
89474
|
+
['!', ['@']],
|
|
89475
|
+
['?', ['?', '@']],
|
|
89476
|
+
['@', ['@']],
|
|
89477
|
+
['*', ['*', '+', '?', '@']],
|
|
89478
|
+
['+', ['+', '@']],
|
|
89479
|
+
]);
|
|
89480
|
+
// nested extglobs that can be adopted in, but with the addition of
|
|
89481
|
+
// a blank '' element.
|
|
89482
|
+
const adoptionWithSpaceMap = new Map([
|
|
89483
|
+
['!', ['?']],
|
|
89484
|
+
['@', ['?']],
|
|
89485
|
+
['+', ['?', '*']],
|
|
89486
|
+
]);
|
|
89487
|
+
// union of the previous two maps
|
|
89488
|
+
const adoptionAnyMap = new Map([
|
|
89489
|
+
['!', ['?', '@']],
|
|
89490
|
+
['?', ['?', '@']],
|
|
89491
|
+
['@', ['?', '@']],
|
|
89492
|
+
['*', ['*', '+', '?', '@']],
|
|
89493
|
+
['+', ['+', '@', '?', '*']],
|
|
89494
|
+
]);
|
|
89495
|
+
// Extglobs that can take over their parent if they are the only child
|
|
89496
|
+
// the key is parent, value maps child to resulting extglob parent type
|
|
89497
|
+
// '@' is omitted because it's a special case. An `@` extglob with a single
|
|
89498
|
+
// member can always be usurped by that subpattern.
|
|
89499
|
+
const usurpMap = new Map([
|
|
89500
|
+
['!', new Map([['!', '@']])],
|
|
89501
|
+
[
|
|
89502
|
+
'?',
|
|
89503
|
+
new Map([
|
|
89504
|
+
['*', '*'],
|
|
89505
|
+
['+', '*'],
|
|
89506
|
+
]),
|
|
89507
|
+
],
|
|
89508
|
+
[
|
|
89509
|
+
'@',
|
|
89510
|
+
new Map([
|
|
89511
|
+
['!', '!'],
|
|
89512
|
+
['?', '?'],
|
|
89513
|
+
['@', '@'],
|
|
89514
|
+
['*', '*'],
|
|
89515
|
+
['+', '+'],
|
|
89516
|
+
]),
|
|
89517
|
+
],
|
|
89518
|
+
[
|
|
89519
|
+
'+',
|
|
89520
|
+
new Map([
|
|
89521
|
+
['?', '*'],
|
|
89522
|
+
['*', '*'],
|
|
89523
|
+
]),
|
|
89524
|
+
],
|
|
89525
|
+
]);
|
|
89277
89526
|
// Patterns that get prepended to bind to the start of either the
|
|
89278
89527
|
// entire string, or just a single path portion, to prevent dots
|
|
89279
89528
|
// and/or traversal patterns, when needed.
|
|
@@ -89297,6 +89546,7 @@ const star = qmark + '*?';
|
|
|
89297
89546
|
const starNoEmpty = qmark + '+?';
|
|
89298
89547
|
// remove the \ chars that we added if we end up doing a nonmagic compare
|
|
89299
89548
|
// const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
|
|
89549
|
+
let ID = 0;
|
|
89300
89550
|
class AST {
|
|
89301
89551
|
type;
|
|
89302
89552
|
#root;
|
|
@@ -89312,6 +89562,22 @@ class AST {
|
|
|
89312
89562
|
// set to true if it's an extglob with no children
|
|
89313
89563
|
// (which really means one child of '')
|
|
89314
89564
|
#emptyExt = false;
|
|
89565
|
+
id = ++ID;
|
|
89566
|
+
get depth() {
|
|
89567
|
+
return (this.#parent?.depth ?? -1) + 1;
|
|
89568
|
+
}
|
|
89569
|
+
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
89570
|
+
return {
|
|
89571
|
+
'@@type': 'AST',
|
|
89572
|
+
id: this.id,
|
|
89573
|
+
type: this.type,
|
|
89574
|
+
root: this.#root.id,
|
|
89575
|
+
parent: this.#parent?.id,
|
|
89576
|
+
depth: this.depth,
|
|
89577
|
+
partsLength: this.#parts.length,
|
|
89578
|
+
parts: this.#parts,
|
|
89579
|
+
};
|
|
89580
|
+
}
|
|
89315
89581
|
constructor(type, parent, options = {}) {
|
|
89316
89582
|
this.type = type;
|
|
89317
89583
|
// extglobs are inherently magical
|
|
@@ -89390,7 +89656,8 @@ class AST {
|
|
|
89390
89656
|
if (p === '')
|
|
89391
89657
|
continue;
|
|
89392
89658
|
/* c8 ignore start */
|
|
89393
|
-
if (typeof p !== 'string' &&
|
|
89659
|
+
if (typeof p !== 'string' &&
|
|
89660
|
+
!(p instanceof _a && p.#parent === this)) {
|
|
89394
89661
|
throw new Error('invalid part: ' + p);
|
|
89395
89662
|
}
|
|
89396
89663
|
/* c8 ignore stop */
|
|
@@ -89398,8 +89665,10 @@ class AST {
|
|
|
89398
89665
|
}
|
|
89399
89666
|
}
|
|
89400
89667
|
toJSON() {
|
|
89401
|
-
const ret = this.type === null
|
|
89402
|
-
|
|
89668
|
+
const ret = this.type === null ?
|
|
89669
|
+
this.#parts
|
|
89670
|
+
.slice()
|
|
89671
|
+
.map(p => (typeof p === 'string' ? p : p.toJSON()))
|
|
89403
89672
|
: [this.type, ...this.#parts.map(p => p.toJSON())];
|
|
89404
89673
|
if (this.isStart() && !this.type)
|
|
89405
89674
|
ret.unshift([]);
|
|
@@ -89422,7 +89691,7 @@ class AST {
|
|
|
89422
89691
|
const p = this.#parent;
|
|
89423
89692
|
for (let i = 0; i < this.#parentIndex; i++) {
|
|
89424
89693
|
const pp = p.#parts[i];
|
|
89425
|
-
if (!(pp instanceof
|
|
89694
|
+
if (!(pp instanceof _a && pp.type === '!')) {
|
|
89426
89695
|
return false;
|
|
89427
89696
|
}
|
|
89428
89697
|
}
|
|
@@ -89450,13 +89719,14 @@ class AST {
|
|
|
89450
89719
|
this.push(part.clone(this));
|
|
89451
89720
|
}
|
|
89452
89721
|
clone(parent) {
|
|
89453
|
-
const c = new
|
|
89722
|
+
const c = new _a(this.type, parent);
|
|
89454
89723
|
for (const p of this.#parts) {
|
|
89455
89724
|
c.copyIn(p);
|
|
89456
89725
|
}
|
|
89457
89726
|
return c;
|
|
89458
89727
|
}
|
|
89459
|
-
static #parseAST(str, ast, pos, opt) {
|
|
89728
|
+
static #parseAST(str, ast, pos, opt, extDepth) {
|
|
89729
|
+
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
89460
89730
|
let escaping = false;
|
|
89461
89731
|
let inBrace = false;
|
|
89462
89732
|
let braceStart = -1;
|
|
@@ -89493,11 +89763,17 @@ class AST {
|
|
|
89493
89763
|
acc += c;
|
|
89494
89764
|
continue;
|
|
89495
89765
|
}
|
|
89496
|
-
|
|
89766
|
+
// we don't have to check for adoption here, because that's
|
|
89767
|
+
// done at the other recursion point.
|
|
89768
|
+
const doRecurse = !opt.noext &&
|
|
89769
|
+
isExtglobType(c) &&
|
|
89770
|
+
str.charAt(i) === '(' &&
|
|
89771
|
+
extDepth <= maxDepth;
|
|
89772
|
+
if (doRecurse) {
|
|
89497
89773
|
ast.push(acc);
|
|
89498
89774
|
acc = '';
|
|
89499
|
-
const ext = new
|
|
89500
|
-
i =
|
|
89775
|
+
const ext = new _a(c, ast);
|
|
89776
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
89501
89777
|
ast.push(ext);
|
|
89502
89778
|
continue;
|
|
89503
89779
|
}
|
|
@@ -89509,7 +89785,7 @@ class AST {
|
|
|
89509
89785
|
// some kind of extglob, pos is at the (
|
|
89510
89786
|
// find the next | or )
|
|
89511
89787
|
let i = pos + 1;
|
|
89512
|
-
let part = new
|
|
89788
|
+
let part = new _a(null, ast);
|
|
89513
89789
|
const parts = [];
|
|
89514
89790
|
let acc = '';
|
|
89515
89791
|
while (i < str.length) {
|
|
@@ -89540,19 +89816,26 @@ class AST {
|
|
|
89540
89816
|
acc += c;
|
|
89541
89817
|
continue;
|
|
89542
89818
|
}
|
|
89543
|
-
|
|
89819
|
+
const doRecurse = !opt.noext &&
|
|
89820
|
+
isExtglobType(c) &&
|
|
89821
|
+
str.charAt(i) === '(' &&
|
|
89822
|
+
/* c8 ignore start - the maxDepth is sufficient here */
|
|
89823
|
+
(extDepth <= maxDepth || (ast && ast.#canAdoptType(c)));
|
|
89824
|
+
/* c8 ignore stop */
|
|
89825
|
+
if (doRecurse) {
|
|
89826
|
+
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
89544
89827
|
part.push(acc);
|
|
89545
89828
|
acc = '';
|
|
89546
|
-
const ext = new
|
|
89829
|
+
const ext = new _a(c, part);
|
|
89547
89830
|
part.push(ext);
|
|
89548
|
-
i =
|
|
89831
|
+
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
89549
89832
|
continue;
|
|
89550
89833
|
}
|
|
89551
89834
|
if (c === '|') {
|
|
89552
89835
|
part.push(acc);
|
|
89553
89836
|
acc = '';
|
|
89554
89837
|
parts.push(part);
|
|
89555
|
-
part = new
|
|
89838
|
+
part = new _a(null, ast);
|
|
89556
89839
|
continue;
|
|
89557
89840
|
}
|
|
89558
89841
|
if (c === ')') {
|
|
@@ -89574,9 +89857,82 @@ class AST {
|
|
|
89574
89857
|
ast.#parts = [str.substring(pos - 1)];
|
|
89575
89858
|
return i;
|
|
89576
89859
|
}
|
|
89860
|
+
#canAdoptWithSpace(child) {
|
|
89861
|
+
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
89862
|
+
}
|
|
89863
|
+
#canAdopt(child, map = adoptionMap) {
|
|
89864
|
+
if (!child ||
|
|
89865
|
+
typeof child !== 'object' ||
|
|
89866
|
+
child.type !== null ||
|
|
89867
|
+
child.#parts.length !== 1 ||
|
|
89868
|
+
this.type === null) {
|
|
89869
|
+
return false;
|
|
89870
|
+
}
|
|
89871
|
+
const gc = child.#parts[0];
|
|
89872
|
+
if (!gc || typeof gc !== 'object' || gc.type === null) {
|
|
89873
|
+
return false;
|
|
89874
|
+
}
|
|
89875
|
+
return this.#canAdoptType(gc.type, map);
|
|
89876
|
+
}
|
|
89877
|
+
#canAdoptType(c, map = adoptionAnyMap) {
|
|
89878
|
+
return !!map.get(this.type)?.includes(c);
|
|
89879
|
+
}
|
|
89880
|
+
#adoptWithSpace(child, index) {
|
|
89881
|
+
const gc = child.#parts[0];
|
|
89882
|
+
const blank = new _a(null, gc, this.options);
|
|
89883
|
+
blank.#parts.push('');
|
|
89884
|
+
gc.push(blank);
|
|
89885
|
+
this.#adopt(child, index);
|
|
89886
|
+
}
|
|
89887
|
+
#adopt(child, index) {
|
|
89888
|
+
const gc = child.#parts[0];
|
|
89889
|
+
this.#parts.splice(index, 1, ...gc.#parts);
|
|
89890
|
+
for (const p of gc.#parts) {
|
|
89891
|
+
if (typeof p === 'object')
|
|
89892
|
+
p.#parent = this;
|
|
89893
|
+
}
|
|
89894
|
+
this.#toString = undefined;
|
|
89895
|
+
}
|
|
89896
|
+
#canUsurpType(c) {
|
|
89897
|
+
const m = usurpMap.get(this.type);
|
|
89898
|
+
return !!(m?.has(c));
|
|
89899
|
+
}
|
|
89900
|
+
#canUsurp(child) {
|
|
89901
|
+
if (!child ||
|
|
89902
|
+
typeof child !== 'object' ||
|
|
89903
|
+
child.type !== null ||
|
|
89904
|
+
child.#parts.length !== 1 ||
|
|
89905
|
+
this.type === null ||
|
|
89906
|
+
this.#parts.length !== 1) {
|
|
89907
|
+
return false;
|
|
89908
|
+
}
|
|
89909
|
+
const gc = child.#parts[0];
|
|
89910
|
+
if (!gc || typeof gc !== 'object' || gc.type === null) {
|
|
89911
|
+
return false;
|
|
89912
|
+
}
|
|
89913
|
+
return this.#canUsurpType(gc.type);
|
|
89914
|
+
}
|
|
89915
|
+
#usurp(child) {
|
|
89916
|
+
const m = usurpMap.get(this.type);
|
|
89917
|
+
const gc = child.#parts[0];
|
|
89918
|
+
const nt = m?.get(gc.type);
|
|
89919
|
+
/* c8 ignore start - impossible */
|
|
89920
|
+
if (!nt)
|
|
89921
|
+
return false;
|
|
89922
|
+
/* c8 ignore stop */
|
|
89923
|
+
this.#parts = gc.#parts;
|
|
89924
|
+
for (const p of this.#parts) {
|
|
89925
|
+
if (typeof p === 'object') {
|
|
89926
|
+
p.#parent = this;
|
|
89927
|
+
}
|
|
89928
|
+
}
|
|
89929
|
+
this.type = nt;
|
|
89930
|
+
this.#toString = undefined;
|
|
89931
|
+
this.#emptyExt = false;
|
|
89932
|
+
}
|
|
89577
89933
|
static fromGlob(pattern, options = {}) {
|
|
89578
|
-
const ast = new
|
|
89579
|
-
|
|
89934
|
+
const ast = new _a(null, undefined, options);
|
|
89935
|
+
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
89580
89936
|
return ast;
|
|
89581
89937
|
}
|
|
89582
89938
|
// returns the regular expression if there's magic, or the unescaped
|
|
@@ -89680,14 +90036,18 @@ class AST {
|
|
|
89680
90036
|
// or start or whatever) and prepend ^ or / at the Regexp construction.
|
|
89681
90037
|
toRegExpSource(allowDot) {
|
|
89682
90038
|
const dot = allowDot ?? !!this.#options.dot;
|
|
89683
|
-
if (this.#root === this)
|
|
90039
|
+
if (this.#root === this) {
|
|
90040
|
+
this.#flatten();
|
|
89684
90041
|
this.#fillNegs();
|
|
89685
|
-
|
|
89686
|
-
|
|
90042
|
+
}
|
|
90043
|
+
if (!isExtglobAST(this)) {
|
|
90044
|
+
const noEmpty = this.isStart() &&
|
|
90045
|
+
this.isEnd() &&
|
|
90046
|
+
!this.#parts.some(s => typeof s !== 'string');
|
|
89687
90047
|
const src = this.#parts
|
|
89688
90048
|
.map(p => {
|
|
89689
|
-
const [re, _, hasMagic, uflag] = typeof p === 'string'
|
|
89690
|
-
|
|
90049
|
+
const [re, _, hasMagic, uflag] = typeof p === 'string' ?
|
|
90050
|
+
_a.#parseGlob(p, this.#hasMagic, noEmpty)
|
|
89691
90051
|
: p.toRegExpSource(allowDot);
|
|
89692
90052
|
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
89693
90053
|
this.#uflag = this.#uflag || uflag;
|
|
@@ -89716,7 +90076,10 @@ class AST {
|
|
|
89716
90076
|
// no need to prevent dots if it can't match a dot, or if a
|
|
89717
90077
|
// sub-pattern will be preventing it anyway.
|
|
89718
90078
|
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
89719
|
-
start =
|
|
90079
|
+
start =
|
|
90080
|
+
needNoTrav ? startNoTraversal
|
|
90081
|
+
: needNoDot ? startNoDot
|
|
90082
|
+
: '';
|
|
89720
90083
|
}
|
|
89721
90084
|
}
|
|
89722
90085
|
}
|
|
@@ -89746,14 +90109,14 @@ class AST {
|
|
|
89746
90109
|
// invalid extglob, has to at least be *something* present, if it's
|
|
89747
90110
|
// the entire path portion.
|
|
89748
90111
|
const s = this.toString();
|
|
89749
|
-
|
|
89750
|
-
|
|
89751
|
-
|
|
90112
|
+
const me = this;
|
|
90113
|
+
me.#parts = [s];
|
|
90114
|
+
me.type = null;
|
|
90115
|
+
me.#hasMagic = undefined;
|
|
89752
90116
|
return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
|
|
89753
90117
|
}
|
|
89754
|
-
|
|
89755
|
-
|
|
89756
|
-
? ''
|
|
90118
|
+
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ?
|
|
90119
|
+
''
|
|
89757
90120
|
: this.#partsToRegExp(true);
|
|
89758
90121
|
if (bodyDotAllowed === body) {
|
|
89759
90122
|
bodyDotAllowed = '';
|
|
@@ -89767,20 +90130,16 @@ class AST {
|
|
|
89767
90130
|
final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
|
|
89768
90131
|
}
|
|
89769
90132
|
else {
|
|
89770
|
-
const close = this.type === '!'
|
|
89771
|
-
|
|
89772
|
-
|
|
89773
|
-
|
|
89774
|
-
|
|
89775
|
-
|
|
89776
|
-
: this.type === '@'
|
|
89777
|
-
? ')'
|
|
89778
|
-
|
|
89779
|
-
|
|
89780
|
-
: this.type === '+' && bodyDotAllowed
|
|
89781
|
-
? ')'
|
|
89782
|
-
: this.type === '*' && bodyDotAllowed
|
|
89783
|
-
? `)?`
|
|
90133
|
+
const close = this.type === '!' ?
|
|
90134
|
+
// !() must match something,but !(x) can match ''
|
|
90135
|
+
'))' +
|
|
90136
|
+
(this.isStart() && !dot && !allowDot ? startNoDot : '') +
|
|
90137
|
+
star +
|
|
90138
|
+
')'
|
|
90139
|
+
: this.type === '@' ? ')'
|
|
90140
|
+
: this.type === '?' ? ')?'
|
|
90141
|
+
: this.type === '+' && bodyDotAllowed ? ')'
|
|
90142
|
+
: this.type === '*' && bodyDotAllowed ? `)?`
|
|
89784
90143
|
: `)${this.type}`;
|
|
89785
90144
|
final = start + body + close;
|
|
89786
90145
|
}
|
|
@@ -89791,6 +90150,42 @@ class AST {
|
|
|
89791
90150
|
this.#uflag,
|
|
89792
90151
|
];
|
|
89793
90152
|
}
|
|
90153
|
+
#flatten() {
|
|
90154
|
+
if (!isExtglobAST(this)) {
|
|
90155
|
+
for (const p of this.#parts) {
|
|
90156
|
+
if (typeof p === 'object') {
|
|
90157
|
+
p.#flatten();
|
|
90158
|
+
}
|
|
90159
|
+
}
|
|
90160
|
+
}
|
|
90161
|
+
else {
|
|
90162
|
+
// do up to 10 passes to flatten as much as possible
|
|
90163
|
+
let iterations = 0;
|
|
90164
|
+
let done = false;
|
|
90165
|
+
do {
|
|
90166
|
+
done = true;
|
|
90167
|
+
for (let i = 0; i < this.#parts.length; i++) {
|
|
90168
|
+
const c = this.#parts[i];
|
|
90169
|
+
if (typeof c === 'object') {
|
|
90170
|
+
c.#flatten();
|
|
90171
|
+
if (this.#canAdopt(c)) {
|
|
90172
|
+
done = false;
|
|
90173
|
+
this.#adopt(c, i);
|
|
90174
|
+
}
|
|
90175
|
+
else if (this.#canAdoptWithSpace(c)) {
|
|
90176
|
+
done = false;
|
|
90177
|
+
this.#adoptWithSpace(c, i);
|
|
90178
|
+
}
|
|
90179
|
+
else if (this.#canUsurp(c)) {
|
|
90180
|
+
done = false;
|
|
90181
|
+
this.#usurp(c);
|
|
90182
|
+
}
|
|
90183
|
+
}
|
|
90184
|
+
}
|
|
90185
|
+
} while (!done && ++iterations < 10);
|
|
90186
|
+
}
|
|
90187
|
+
this.#toString = undefined;
|
|
90188
|
+
}
|
|
89794
90189
|
#partsToRegExp(dot) {
|
|
89795
90190
|
return this.#parts
|
|
89796
90191
|
.map(p => {
|
|
@@ -89812,6 +90207,8 @@ class AST {
|
|
|
89812
90207
|
let escaping = false;
|
|
89813
90208
|
let re = '';
|
|
89814
90209
|
let uflag = false;
|
|
90210
|
+
// multiple stars that aren't globstars coalesce into one *
|
|
90211
|
+
let inStar = false;
|
|
89815
90212
|
for (let i = 0; i < glob.length; i++) {
|
|
89816
90213
|
const c = glob.charAt(i);
|
|
89817
90214
|
if (escaping) {
|
|
@@ -89819,6 +90216,17 @@ class AST {
|
|
|
89819
90216
|
re += (reSpecials.has(c) ? '\\' : '') + c;
|
|
89820
90217
|
continue;
|
|
89821
90218
|
}
|
|
90219
|
+
if (c === '*') {
|
|
90220
|
+
if (inStar)
|
|
90221
|
+
continue;
|
|
90222
|
+
inStar = true;
|
|
90223
|
+
re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
|
|
90224
|
+
hasMagic = true;
|
|
90225
|
+
continue;
|
|
90226
|
+
}
|
|
90227
|
+
else {
|
|
90228
|
+
inStar = false;
|
|
90229
|
+
}
|
|
89822
90230
|
if (c === '\\') {
|
|
89823
90231
|
if (i === glob.length - 1) {
|
|
89824
90232
|
re += '\\\\';
|
|
@@ -89838,14 +90246,6 @@ class AST {
|
|
|
89838
90246
|
continue;
|
|
89839
90247
|
}
|
|
89840
90248
|
}
|
|
89841
|
-
if (c === '*') {
|
|
89842
|
-
if (noEmpty && glob === '*')
|
|
89843
|
-
re += starNoEmpty;
|
|
89844
|
-
else
|
|
89845
|
-
re += star;
|
|
89846
|
-
hasMagic = true;
|
|
89847
|
-
continue;
|
|
89848
|
-
}
|
|
89849
90249
|
if (c === '?') {
|
|
89850
90250
|
re += qmark;
|
|
89851
90251
|
hasMagic = true;
|
|
@@ -89857,6 +90257,7 @@ class AST {
|
|
|
89857
90257
|
}
|
|
89858
90258
|
}
|
|
89859
90259
|
exports.AST = AST;
|
|
90260
|
+
_a = AST;
|
|
89860
90261
|
//# sourceMappingURL=ast.js.map
|
|
89861
90262
|
|
|
89862
90263
|
/***/ },
|
|
@@ -90011,10 +90412,8 @@ const parseClass = (glob, position) => {
|
|
|
90011
90412
|
}
|
|
90012
90413
|
const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
|
|
90013
90414
|
const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
|
|
90014
|
-
const comb = ranges.length && negs.length
|
|
90015
|
-
|
|
90016
|
-
: ranges.length
|
|
90017
|
-
? sranges
|
|
90415
|
+
const comb = ranges.length && negs.length ? '(' + sranges + '|' + snegs + ')'
|
|
90416
|
+
: ranges.length ? sranges
|
|
90018
90417
|
: snegs;
|
|
90019
90418
|
return [comb, uflag, endPos - pos, true];
|
|
90020
90419
|
};
|
|
@@ -90036,18 +90435,26 @@ exports.escape = void 0;
|
|
|
90036
90435
|
/**
|
|
90037
90436
|
* Escape all magic characters in a glob pattern.
|
|
90038
90437
|
*
|
|
90039
|
-
* If the {@link
|
|
90438
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape}
|
|
90040
90439
|
* option is used, then characters are escaped by wrapping in `[]`, because
|
|
90041
90440
|
* a magic character wrapped in a character class can only be satisfied by
|
|
90042
90441
|
* that exact character. In this mode, `\` is _not_ escaped, because it is
|
|
90043
90442
|
* not interpreted as a magic character, but instead as a path separator.
|
|
90443
|
+
*
|
|
90444
|
+
* If the {@link MinimatchOptions.magicalBraces} option is used,
|
|
90445
|
+
* then braces (`{` and `}`) will be escaped.
|
|
90044
90446
|
*/
|
|
90045
|
-
const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
|
|
90447
|
+
const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}) => {
|
|
90046
90448
|
// don't need to escape +@! because we escape the parens
|
|
90047
90449
|
// that make those magic, and escaping ! as [!] isn't valid,
|
|
90048
90450
|
// because [!]] is a valid glob class meaning not ']'.
|
|
90049
|
-
|
|
90050
|
-
|
|
90451
|
+
if (magicalBraces) {
|
|
90452
|
+
return windowsPathsNoEscape ?
|
|
90453
|
+
s.replace(/[?*()[\]{}]/g, '[$&]')
|
|
90454
|
+
: s.replace(/[?*()[\]\\{}]/g, '\\$&');
|
|
90455
|
+
}
|
|
90456
|
+
return windowsPathsNoEscape ?
|
|
90457
|
+
s.replace(/[?*()[\]]/g, '[$&]')
|
|
90051
90458
|
: s.replace(/[?*()[\]\\]/g, '\\$&');
|
|
90052
90459
|
};
|
|
90053
90460
|
exports.escape = escape;
|
|
@@ -90065,7 +90472,7 @@ exports.escape = escape;
|
|
|
90065
90472
|
|
|
90066
90473
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
90067
90474
|
exports.unescape = exports.escape = exports.AST = exports.Minimatch = exports.match = exports.makeRe = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
|
|
90068
|
-
const brace_expansion_1 = __webpack_require__(/*!
|
|
90475
|
+
const brace_expansion_1 = __webpack_require__(/*! brace-expansion */ "./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js");
|
|
90069
90476
|
const assert_valid_pattern_js_1 = __webpack_require__(/*! ./assert-valid-pattern.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js");
|
|
90070
90477
|
const ast_js_1 = __webpack_require__(/*! ./ast.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js");
|
|
90071
90478
|
const escape_js_1 = __webpack_require__(/*! ./escape.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js");
|
|
@@ -90131,8 +90538,8 @@ const qmarksTestNoExtDot = ([$0]) => {
|
|
|
90131
90538
|
return (f) => f.length === len && f !== '.' && f !== '..';
|
|
90132
90539
|
};
|
|
90133
90540
|
/* c8 ignore start */
|
|
90134
|
-
const defaultPlatform = (typeof process === 'object' && process
|
|
90135
|
-
|
|
90541
|
+
const defaultPlatform = (typeof process === 'object' && process ?
|
|
90542
|
+
(typeof process.env === 'object' &&
|
|
90136
90543
|
process.env &&
|
|
90137
90544
|
process.env.__MINIMATCH_TESTING_PLATFORM__) ||
|
|
90138
90545
|
process.platform
|
|
@@ -90218,7 +90625,7 @@ const braceExpand = (pattern, options = {}) => {
|
|
|
90218
90625
|
// shortcut. no need to expand.
|
|
90219
90626
|
return [pattern];
|
|
90220
90627
|
}
|
|
90221
|
-
return (0, brace_expansion_1.expand)(pattern);
|
|
90628
|
+
return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
|
|
90222
90629
|
};
|
|
90223
90630
|
exports.braceExpand = braceExpand;
|
|
90224
90631
|
exports.minimatch.braceExpand = exports.braceExpand;
|
|
@@ -90266,16 +90673,20 @@ class Minimatch {
|
|
|
90266
90673
|
isWindows;
|
|
90267
90674
|
platform;
|
|
90268
90675
|
windowsNoMagicRoot;
|
|
90676
|
+
maxGlobstarRecursion;
|
|
90269
90677
|
regexp;
|
|
90270
90678
|
constructor(pattern, options = {}) {
|
|
90271
90679
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
90272
90680
|
options = options || {};
|
|
90273
90681
|
this.options = options;
|
|
90682
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
|
|
90274
90683
|
this.pattern = pattern;
|
|
90275
90684
|
this.platform = options.platform || defaultPlatform;
|
|
90276
90685
|
this.isWindows = this.platform === 'win32';
|
|
90686
|
+
// avoid the annoying deprecation flag lol
|
|
90687
|
+
const awe = ('allowWindow' + 'sEscape');
|
|
90277
90688
|
this.windowsPathsNoEscape =
|
|
90278
|
-
!!options.windowsPathsNoEscape || options
|
|
90689
|
+
!!options.windowsPathsNoEscape || options[awe] === false;
|
|
90279
90690
|
if (this.windowsPathsNoEscape) {
|
|
90280
90691
|
this.pattern = this.pattern.replace(/\\/g, '/');
|
|
90281
90692
|
}
|
|
@@ -90288,8 +90699,8 @@ class Minimatch {
|
|
|
90288
90699
|
this.partial = !!options.partial;
|
|
90289
90700
|
this.nocase = !!this.options.nocase;
|
|
90290
90701
|
this.windowsNoMagicRoot =
|
|
90291
|
-
options.windowsNoMagicRoot !== undefined
|
|
90292
|
-
|
|
90702
|
+
options.windowsNoMagicRoot !== undefined ?
|
|
90703
|
+
options.windowsNoMagicRoot
|
|
90293
90704
|
: !!(this.isWindows && this.nocase);
|
|
90294
90705
|
this.globSet = [];
|
|
90295
90706
|
this.globParts = [];
|
|
@@ -90352,7 +90763,10 @@ class Minimatch {
|
|
|
90352
90763
|
!globMagic.test(s[3]);
|
|
90353
90764
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
90354
90765
|
if (isUNC) {
|
|
90355
|
-
return [
|
|
90766
|
+
return [
|
|
90767
|
+
...s.slice(0, 4),
|
|
90768
|
+
...s.slice(4).map(ss => this.parse(ss)),
|
|
90769
|
+
];
|
|
90356
90770
|
}
|
|
90357
90771
|
else if (isDrive) {
|
|
90358
90772
|
return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
|
|
@@ -90384,7 +90798,7 @@ class Minimatch {
|
|
|
90384
90798
|
// to the right as possible, even if it increases the number
|
|
90385
90799
|
// of patterns that we have to process.
|
|
90386
90800
|
preprocess(globParts) {
|
|
90387
|
-
// if we're not in globstar mode, then turn
|
|
90801
|
+
// if we're not in globstar mode, then turn ** into *
|
|
90388
90802
|
if (this.options.noglobstar) {
|
|
90389
90803
|
for (let i = 0; i < globParts.length; i++) {
|
|
90390
90804
|
for (let j = 0; j < globParts[i].length; j++) {
|
|
@@ -90670,7 +91084,8 @@ class Minimatch {
|
|
|
90670
91084
|
// out of pattern, then that's fine, as long as all
|
|
90671
91085
|
// the parts match.
|
|
90672
91086
|
matchOne(file, pattern, partial = false) {
|
|
90673
|
-
|
|
91087
|
+
let fileStartIndex = 0;
|
|
91088
|
+
let patternStartIndex = 0;
|
|
90674
91089
|
// UNC paths like //?/X:/... can match X:/... and vice versa
|
|
90675
91090
|
// Drive letters in absolute drive or unc paths are always compared
|
|
90676
91091
|
// case-insensitively.
|
|
@@ -90688,120 +91103,210 @@ class Minimatch {
|
|
|
90688
91103
|
pattern[2] === '?' &&
|
|
90689
91104
|
typeof pattern[3] === 'string' &&
|
|
90690
91105
|
/^[a-z]:$/i.test(pattern[3]);
|
|
90691
|
-
const fdi = fileUNC ? 3
|
|
90692
|
-
|
|
91106
|
+
const fdi = fileUNC ? 3
|
|
91107
|
+
: fileDrive ? 0
|
|
91108
|
+
: undefined;
|
|
91109
|
+
const pdi = patternUNC ? 3
|
|
91110
|
+
: patternDrive ? 0
|
|
91111
|
+
: undefined;
|
|
90693
91112
|
if (typeof fdi === 'number' && typeof pdi === 'number') {
|
|
90694
|
-
const [fd, pd] = [
|
|
91113
|
+
const [fd, pd] = [
|
|
91114
|
+
file[fdi],
|
|
91115
|
+
pattern[pdi],
|
|
91116
|
+
];
|
|
91117
|
+
// start matching at the drive letter index of each
|
|
90695
91118
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
90696
91119
|
pattern[pdi] = fd;
|
|
90697
|
-
|
|
90698
|
-
|
|
90699
|
-
}
|
|
90700
|
-
else if (fdi > pdi) {
|
|
90701
|
-
file = file.slice(fdi);
|
|
90702
|
-
}
|
|
91120
|
+
patternStartIndex = pdi;
|
|
91121
|
+
fileStartIndex = fdi;
|
|
90703
91122
|
}
|
|
90704
91123
|
}
|
|
90705
91124
|
}
|
|
90706
91125
|
// resolve and reduce . and .. portions in the file as well.
|
|
90707
|
-
//
|
|
91126
|
+
// don't need to do the second phase, because it's only one string[]
|
|
90708
91127
|
const { optimizationLevel = 1 } = this.options;
|
|
90709
91128
|
if (optimizationLevel >= 2) {
|
|
90710
91129
|
file = this.levelTwoFileOptimize(file);
|
|
90711
91130
|
}
|
|
90712
|
-
|
|
90713
|
-
|
|
90714
|
-
|
|
91131
|
+
if (pattern.includes(exports.GLOBSTAR)) {
|
|
91132
|
+
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
91133
|
+
}
|
|
91134
|
+
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
91135
|
+
}
|
|
91136
|
+
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
91137
|
+
// split the pattern into head, tail, and middle of ** delimited parts
|
|
91138
|
+
const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
|
|
91139
|
+
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
|
91140
|
+
// split the pattern up into globstar-delimited sections
|
|
91141
|
+
// the tail has to be at the end, and the others just have
|
|
91142
|
+
// to be found in order from the head.
|
|
91143
|
+
const [head, body, tail] = partial ? [
|
|
91144
|
+
pattern.slice(patternIndex, firstgs),
|
|
91145
|
+
pattern.slice(firstgs + 1),
|
|
91146
|
+
[],
|
|
91147
|
+
] : [
|
|
91148
|
+
pattern.slice(patternIndex, firstgs),
|
|
91149
|
+
pattern.slice(firstgs + 1, lastgs),
|
|
91150
|
+
pattern.slice(lastgs + 1),
|
|
91151
|
+
];
|
|
91152
|
+
// check the head, from the current file/pattern index.
|
|
91153
|
+
if (head.length) {
|
|
91154
|
+
const fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
91155
|
+
if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
|
|
91156
|
+
return false;
|
|
91157
|
+
}
|
|
91158
|
+
fileIndex += head.length;
|
|
91159
|
+
patternIndex += head.length;
|
|
91160
|
+
}
|
|
91161
|
+
// now we know the head matches!
|
|
91162
|
+
// if the last portion is not empty, it MUST match the end
|
|
91163
|
+
// check the tail
|
|
91164
|
+
let fileTailMatch = 0;
|
|
91165
|
+
if (tail.length) {
|
|
91166
|
+
// if head + tail > file, then we cannot possibly match
|
|
91167
|
+
if (tail.length + fileIndex > file.length)
|
|
91168
|
+
return false;
|
|
91169
|
+
// try to match the tail
|
|
91170
|
+
let tailStart = file.length - tail.length;
|
|
91171
|
+
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
91172
|
+
fileTailMatch = tail.length;
|
|
91173
|
+
}
|
|
91174
|
+
else {
|
|
91175
|
+
// affordance for stuff like a/**/* matching a/b/
|
|
91176
|
+
// if the last file portion is '', and there's more to the pattern
|
|
91177
|
+
// then try without the '' bit.
|
|
91178
|
+
if (file[file.length - 1] !== '' ||
|
|
91179
|
+
fileIndex + tail.length === file.length) {
|
|
91180
|
+
return false;
|
|
91181
|
+
}
|
|
91182
|
+
tailStart--;
|
|
91183
|
+
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
91184
|
+
return false;
|
|
91185
|
+
}
|
|
91186
|
+
fileTailMatch = tail.length + 1;
|
|
91187
|
+
}
|
|
91188
|
+
}
|
|
91189
|
+
// now we know the tail matches!
|
|
91190
|
+
// the middle is zero or more portions wrapped in **, possibly
|
|
91191
|
+
// containing more ** sections.
|
|
91192
|
+
// so a/**/b/**/c/**/d has become **/b/**/c/**
|
|
91193
|
+
// if it's empty, it means a/**/b, just verify we have no bad dots
|
|
91194
|
+
// if there's no tail, so it ends on /**, then we must have *something*
|
|
91195
|
+
// after the head, or it's not a matc
|
|
91196
|
+
if (!body.length) {
|
|
91197
|
+
let sawSome = !!fileTailMatch;
|
|
91198
|
+
for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
91199
|
+
const f = String(file[i]);
|
|
91200
|
+
sawSome = true;
|
|
91201
|
+
if (f === '.' ||
|
|
91202
|
+
f === '..' ||
|
|
91203
|
+
(!this.options.dot && f.startsWith('.'))) {
|
|
91204
|
+
return false;
|
|
91205
|
+
}
|
|
91206
|
+
}
|
|
91207
|
+
// in partial mode, we just need to get past all file parts
|
|
91208
|
+
return partial || sawSome;
|
|
91209
|
+
}
|
|
91210
|
+
// now we know that there's one or more body sections, which can
|
|
91211
|
+
// be matched anywhere from the 0 index (because the head was pruned)
|
|
91212
|
+
// through to the length-fileTailMatch index.
|
|
91213
|
+
// split the body up into sections, and note the minimum index it can
|
|
91214
|
+
// be found at (start with the length of all previous segments)
|
|
91215
|
+
// [section, before, after]
|
|
91216
|
+
const bodySegments = [[[], 0]];
|
|
91217
|
+
let currentBody = bodySegments[0];
|
|
91218
|
+
let nonGsParts = 0;
|
|
91219
|
+
const nonGsPartsSums = [0];
|
|
91220
|
+
for (const b of body) {
|
|
91221
|
+
if (b === exports.GLOBSTAR) {
|
|
91222
|
+
nonGsPartsSums.push(nonGsParts);
|
|
91223
|
+
currentBody = [[], 0];
|
|
91224
|
+
bodySegments.push(currentBody);
|
|
91225
|
+
}
|
|
91226
|
+
else {
|
|
91227
|
+
currentBody[0].push(b);
|
|
91228
|
+
nonGsParts++;
|
|
91229
|
+
}
|
|
91230
|
+
}
|
|
91231
|
+
let i = bodySegments.length - 1;
|
|
91232
|
+
const fileLength = file.length - fileTailMatch;
|
|
91233
|
+
for (const b of bodySegments) {
|
|
91234
|
+
b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
|
|
91235
|
+
}
|
|
91236
|
+
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
91237
|
+
}
|
|
91238
|
+
// return false for "nope, not matching"
|
|
91239
|
+
// return null for "not matching, cannot keep trying"
|
|
91240
|
+
#matchGlobStarBodySections(file,
|
|
91241
|
+
// pattern section, last possible position for it
|
|
91242
|
+
bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
91243
|
+
// take the first body segment, and walk from fileIndex to its "after"
|
|
91244
|
+
// value at the end
|
|
91245
|
+
// If it doesn't match at that position, we increment, until we hit
|
|
91246
|
+
// that final possible position, and give up.
|
|
91247
|
+
// If it does match, then advance and try to rest.
|
|
91248
|
+
// If any of them fail we keep walking forward.
|
|
91249
|
+
// this is still a bit recursively painful, but it's more constrained
|
|
91250
|
+
// than previous implementations, because we never test something that
|
|
91251
|
+
// can't possibly be a valid matching condition.
|
|
91252
|
+
const bs = bodySegments[bodyIndex];
|
|
91253
|
+
if (!bs) {
|
|
91254
|
+
// just make sure that there's no bad dots
|
|
91255
|
+
for (let i = fileIndex; i < file.length; i++) {
|
|
91256
|
+
sawTail = true;
|
|
91257
|
+
const f = file[i];
|
|
91258
|
+
if (f === '.' ||
|
|
91259
|
+
f === '..' ||
|
|
91260
|
+
(!this.options.dot && f.startsWith('.'))) {
|
|
91261
|
+
return false;
|
|
91262
|
+
}
|
|
91263
|
+
}
|
|
91264
|
+
return sawTail;
|
|
91265
|
+
}
|
|
91266
|
+
// have a non-globstar body section to test
|
|
91267
|
+
const [body, after] = bs;
|
|
91268
|
+
while (fileIndex <= after) {
|
|
91269
|
+
const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
|
91270
|
+
// if limit exceeded, no match. intentional false negative,
|
|
91271
|
+
// acceptable break in correctness for security.
|
|
91272
|
+
if (m && globStarDepth < this.maxGlobstarRecursion) {
|
|
91273
|
+
// match! see if the rest match. if so, we're done!
|
|
91274
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
91275
|
+
if (sub !== false) {
|
|
91276
|
+
return sub;
|
|
91277
|
+
}
|
|
91278
|
+
}
|
|
91279
|
+
const f = file[fileIndex];
|
|
91280
|
+
if (f === '.' ||
|
|
91281
|
+
f === '..' ||
|
|
91282
|
+
(!this.options.dot && f.startsWith('.'))) {
|
|
91283
|
+
return false;
|
|
91284
|
+
}
|
|
91285
|
+
fileIndex++;
|
|
91286
|
+
}
|
|
91287
|
+
// walked off. no point continuing
|
|
91288
|
+
return partial || null;
|
|
91289
|
+
}
|
|
91290
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
91291
|
+
let fi;
|
|
91292
|
+
let pi;
|
|
91293
|
+
let pl;
|
|
91294
|
+
let fl;
|
|
91295
|
+
for (fi = fileIndex,
|
|
91296
|
+
pi = patternIndex,
|
|
91297
|
+
fl = file.length,
|
|
91298
|
+
pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
90715
91299
|
this.debug('matchOne loop');
|
|
90716
|
-
|
|
90717
|
-
|
|
91300
|
+
let p = pattern[pi];
|
|
91301
|
+
let f = file[fi];
|
|
90718
91302
|
this.debug(pattern, p, f);
|
|
90719
91303
|
// should be impossible.
|
|
90720
91304
|
// some invalid regexp stuff in the set.
|
|
90721
91305
|
/* c8 ignore start */
|
|
90722
|
-
if (p === false) {
|
|
91306
|
+
if (p === false || p === exports.GLOBSTAR) {
|
|
90723
91307
|
return false;
|
|
90724
91308
|
}
|
|
90725
91309
|
/* c8 ignore stop */
|
|
90726
|
-
if (p === exports.GLOBSTAR) {
|
|
90727
|
-
this.debug('GLOBSTAR', [pattern, p, f]);
|
|
90728
|
-
// "**"
|
|
90729
|
-
// a/**/b/**/c would match the following:
|
|
90730
|
-
// a/b/x/y/z/c
|
|
90731
|
-
// a/x/y/z/b/c
|
|
90732
|
-
// a/b/x/b/x/c
|
|
90733
|
-
// a/b/c
|
|
90734
|
-
// To do this, take the rest of the pattern after
|
|
90735
|
-
// the **, and see if it would match the file remainder.
|
|
90736
|
-
// If so, return success.
|
|
90737
|
-
// If not, the ** "swallows" a segment, and try again.
|
|
90738
|
-
// This is recursively awful.
|
|
90739
|
-
//
|
|
90740
|
-
// a/**/b/**/c matching a/b/x/y/z/c
|
|
90741
|
-
// - a matches a
|
|
90742
|
-
// - doublestar
|
|
90743
|
-
// - matchOne(b/x/y/z/c, b/**/c)
|
|
90744
|
-
// - b matches b
|
|
90745
|
-
// - doublestar
|
|
90746
|
-
// - matchOne(x/y/z/c, c) -> no
|
|
90747
|
-
// - matchOne(y/z/c, c) -> no
|
|
90748
|
-
// - matchOne(z/c, c) -> no
|
|
90749
|
-
// - matchOne(c, c) yes, hit
|
|
90750
|
-
var fr = fi;
|
|
90751
|
-
var pr = pi + 1;
|
|
90752
|
-
if (pr === pl) {
|
|
90753
|
-
this.debug('** at the end');
|
|
90754
|
-
// a ** at the end will just swallow the rest.
|
|
90755
|
-
// We have found a match.
|
|
90756
|
-
// however, it will not swallow /.x, unless
|
|
90757
|
-
// options.dot is set.
|
|
90758
|
-
// . and .. are *never* matched by **, for explosively
|
|
90759
|
-
// exponential reasons.
|
|
90760
|
-
for (; fi < fl; fi++) {
|
|
90761
|
-
if (file[fi] === '.' ||
|
|
90762
|
-
file[fi] === '..' ||
|
|
90763
|
-
(!options.dot && file[fi].charAt(0) === '.'))
|
|
90764
|
-
return false;
|
|
90765
|
-
}
|
|
90766
|
-
return true;
|
|
90767
|
-
}
|
|
90768
|
-
// ok, let's see if we can swallow whatever we can.
|
|
90769
|
-
while (fr < fl) {
|
|
90770
|
-
var swallowee = file[fr];
|
|
90771
|
-
this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
|
|
90772
|
-
// XXX remove this slice. Just pass the start index.
|
|
90773
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
90774
|
-
this.debug('globstar found match!', fr, fl, swallowee);
|
|
90775
|
-
// found a match.
|
|
90776
|
-
return true;
|
|
90777
|
-
}
|
|
90778
|
-
else {
|
|
90779
|
-
// can't swallow "." or ".." ever.
|
|
90780
|
-
// can only swallow ".foo" when explicitly asked.
|
|
90781
|
-
if (swallowee === '.' ||
|
|
90782
|
-
swallowee === '..' ||
|
|
90783
|
-
(!options.dot && swallowee.charAt(0) === '.')) {
|
|
90784
|
-
this.debug('dot detected!', file, fr, pattern, pr);
|
|
90785
|
-
break;
|
|
90786
|
-
}
|
|
90787
|
-
// ** swallows a segment, and continue.
|
|
90788
|
-
this.debug('globstar swallow a segment, and continue');
|
|
90789
|
-
fr++;
|
|
90790
|
-
}
|
|
90791
|
-
}
|
|
90792
|
-
// no match was found.
|
|
90793
|
-
// However, in partial mode, we can't say this is necessarily over.
|
|
90794
|
-
/* c8 ignore start */
|
|
90795
|
-
if (partial) {
|
|
90796
|
-
// ran out of file
|
|
90797
|
-
this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
|
|
90798
|
-
if (fr === fl) {
|
|
90799
|
-
return true;
|
|
90800
|
-
}
|
|
90801
|
-
}
|
|
90802
|
-
/* c8 ignore stop */
|
|
90803
|
-
return false;
|
|
90804
|
-
}
|
|
90805
91310
|
// something other than **
|
|
90806
91311
|
// non-magic patterns just have to match exactly
|
|
90807
91312
|
// patterns with magic have been turned into regexps.
|
|
@@ -90872,21 +91377,19 @@ class Minimatch {
|
|
|
90872
91377
|
fastTest = options.dot ? starTestDot : starTest;
|
|
90873
91378
|
}
|
|
90874
91379
|
else if ((m = pattern.match(starDotExtRE))) {
|
|
90875
|
-
fastTest = (options.nocase
|
|
90876
|
-
|
|
90877
|
-
|
|
91380
|
+
fastTest = (options.nocase ?
|
|
91381
|
+
options.dot ?
|
|
91382
|
+
starDotExtTestNocaseDot
|
|
90878
91383
|
: starDotExtTestNocase
|
|
90879
|
-
: options.dot
|
|
90880
|
-
? starDotExtTestDot
|
|
91384
|
+
: options.dot ? starDotExtTestDot
|
|
90881
91385
|
: starDotExtTest)(m[1]);
|
|
90882
91386
|
}
|
|
90883
91387
|
else if ((m = pattern.match(qmarksRE))) {
|
|
90884
|
-
fastTest = (options.nocase
|
|
90885
|
-
|
|
90886
|
-
|
|
91388
|
+
fastTest = (options.nocase ?
|
|
91389
|
+
options.dot ?
|
|
91390
|
+
qmarksTestNocaseDot
|
|
90887
91391
|
: qmarksTestNocase
|
|
90888
|
-
: options.dot
|
|
90889
|
-
? qmarksTestDot
|
|
91392
|
+
: options.dot ? qmarksTestDot
|
|
90890
91393
|
: qmarksTest)(m);
|
|
90891
91394
|
}
|
|
90892
91395
|
else if ((m = pattern.match(starDotStarRE))) {
|
|
@@ -90917,10 +91420,8 @@ class Minimatch {
|
|
|
90917
91420
|
return this.regexp;
|
|
90918
91421
|
}
|
|
90919
91422
|
const options = this.options;
|
|
90920
|
-
const twoStar = options.noglobstar
|
|
90921
|
-
?
|
|
90922
|
-
: options.dot
|
|
90923
|
-
? twoStarDot
|
|
91423
|
+
const twoStar = options.noglobstar ? star
|
|
91424
|
+
: options.dot ? twoStarDot
|
|
90924
91425
|
: twoStarNoDot;
|
|
90925
91426
|
const flags = new Set(options.nocase ? ['i'] : []);
|
|
90926
91427
|
// regexpify non-globstar patterns
|
|
@@ -90936,11 +91437,9 @@ class Minimatch {
|
|
|
90936
91437
|
for (const f of p.flags.split(''))
|
|
90937
91438
|
flags.add(f);
|
|
90938
91439
|
}
|
|
90939
|
-
return typeof p === 'string'
|
|
90940
|
-
?
|
|
90941
|
-
|
|
90942
|
-
? exports.GLOBSTAR
|
|
90943
|
-
: p._src;
|
|
91440
|
+
return (typeof p === 'string' ? regExpEscape(p)
|
|
91441
|
+
: p === exports.GLOBSTAR ? exports.GLOBSTAR
|
|
91442
|
+
: p._src);
|
|
90944
91443
|
});
|
|
90945
91444
|
pp.forEach((p, i) => {
|
|
90946
91445
|
const next = pp[i + 1];
|
|
@@ -90957,14 +91456,25 @@ class Minimatch {
|
|
|
90957
91456
|
}
|
|
90958
91457
|
}
|
|
90959
91458
|
else if (next === undefined) {
|
|
90960
|
-
pp[i - 1] = prev + '(
|
|
91459
|
+
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
|
|
90961
91460
|
}
|
|
90962
91461
|
else if (next !== exports.GLOBSTAR) {
|
|
90963
91462
|
pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
|
|
90964
91463
|
pp[i + 1] = exports.GLOBSTAR;
|
|
90965
91464
|
}
|
|
90966
91465
|
});
|
|
90967
|
-
|
|
91466
|
+
const filtered = pp.filter(p => p !== exports.GLOBSTAR);
|
|
91467
|
+
// For partial matches, we need to make the pattern match
|
|
91468
|
+
// any prefix of the full path. We do this by generating
|
|
91469
|
+
// alternative patterns that match progressively longer prefixes.
|
|
91470
|
+
if (this.partial && filtered.length >= 1) {
|
|
91471
|
+
const prefixes = [];
|
|
91472
|
+
for (let i = 1; i <= filtered.length; i++) {
|
|
91473
|
+
prefixes.push(filtered.slice(0, i).join('/'));
|
|
91474
|
+
}
|
|
91475
|
+
return '(?:' + prefixes.join('|') + ')';
|
|
91476
|
+
}
|
|
91477
|
+
return filtered.join('/');
|
|
90968
91478
|
})
|
|
90969
91479
|
.join('|');
|
|
90970
91480
|
// need to wrap in parens if we had more than one thing with |,
|
|
@@ -90973,6 +91483,10 @@ class Minimatch {
|
|
|
90973
91483
|
// must match entire pattern
|
|
90974
91484
|
// ending in a * or ** will make it less strict.
|
|
90975
91485
|
re = '^' + open + re + close + '$';
|
|
91486
|
+
// In partial mode, '/' should always match as it's a valid prefix for any pattern
|
|
91487
|
+
if (this.partial) {
|
|
91488
|
+
re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
|
|
91489
|
+
}
|
|
90976
91490
|
// can match anything, as long as it's not this.
|
|
90977
91491
|
if (this.negate)
|
|
90978
91492
|
re = '^(?!' + re + ').+$';
|
|
@@ -91092,21 +91606,35 @@ exports.unescape = void 0;
|
|
|
91092
91606
|
/**
|
|
91093
91607
|
* Un-escape a string that has been escaped with {@link escape}.
|
|
91094
91608
|
*
|
|
91095
|
-
* If the {@link windowsPathsNoEscape} option is used, then
|
|
91096
|
-
* escapes are removed, but not backslash escapes.
|
|
91097
|
-
* the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
|
|
91098
|
-
* becuase `\` is a path separator in `windowsPathsNoEscape` mode.
|
|
91609
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
|
|
91610
|
+
* square-bracket escapes are removed, but not backslash escapes.
|
|
91099
91611
|
*
|
|
91100
|
-
*
|
|
91612
|
+
* For example, it will turn the string `'[*]'` into `*`, but it will not
|
|
91613
|
+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
|
|
91614
|
+
* `windowsPathsNoEscape` mode.
|
|
91615
|
+
*
|
|
91616
|
+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
|
|
91101
91617
|
* backslash escapes are removed.
|
|
91102
91618
|
*
|
|
91103
91619
|
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
91104
91620
|
* or unescaped.
|
|
91621
|
+
*
|
|
91622
|
+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
|
|
91623
|
+
* unescaped.
|
|
91105
91624
|
*/
|
|
91106
|
-
const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
|
|
91107
|
-
|
|
91108
|
-
|
|
91109
|
-
|
|
91625
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
|
|
91626
|
+
if (magicalBraces) {
|
|
91627
|
+
return windowsPathsNoEscape ?
|
|
91628
|
+
s.replace(/\[([^\/\\])\]/g, '$1')
|
|
91629
|
+
: s
|
|
91630
|
+
.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
|
|
91631
|
+
.replace(/\\([^\/])/g, '$1');
|
|
91632
|
+
}
|
|
91633
|
+
return windowsPathsNoEscape ?
|
|
91634
|
+
s.replace(/\[([^\/\\{}])\]/g, '$1')
|
|
91635
|
+
: s
|
|
91636
|
+
.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
|
|
91637
|
+
.replace(/\\([^\/{}])/g, '$1');
|
|
91110
91638
|
};
|
|
91111
91639
|
exports.unescape = unescape;
|
|
91112
91640
|
//# sourceMappingURL=unescape.js.map
|