@abaplint/cli 2.117.0 → 2.117.2

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.
Files changed (2) hide show
  1. package/build/cli.js +919 -483
  2. 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 = "Integer to CHAR conversion";
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 = "Integer to NUMC conversion";
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 = "NUMC to Integer conversion";
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 = "CHAR to Integer conversion";
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 = "Source field longer than database field, CHAR -> CHAR";
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 = "Source field longer than database field, NUMC -> NUMC";
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,11 @@ 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
+ vislength: parseNumber(f.VISLENGTH),
47127
+ line: parseNumber(f.LINE),
47128
+ column: parseNumber(f.COLUMN),
47129
+ height: parseNumber(f.HEIGHT),
47119
47130
  });
47120
47131
  }
47121
47132
  dynpros.push({
@@ -55805,7 +55816,7 @@ class Registry {
55805
55816
  }
55806
55817
  static abaplintVersion() {
55807
55818
  // magic, see build script "version.sh"
55808
- return "2.117.0";
55819
+ return "2.117.2";
55809
55820
  }
55810
55821
  getDDICReferences() {
55811
55822
  return this.ddicReferences;
@@ -64109,7 +64120,7 @@ class DynproChecks {
64109
64120
  key: "dynpro_checks",
64110
64121
  title: "Dynpro Checks",
64111
64122
  shortDescription: `Various Dynpro checks`,
64112
- extendedInformation: `* Check length of PUSH elements less than 132`,
64123
+ extendedInformation: `* Check length of PUSH elements less than 132\n* Check for overlapping screen elements`,
64113
64124
  tags: [_irule_1.RuleTag.Syntax],
64114
64125
  };
64115
64126
  }
@@ -64138,9 +64149,43 @@ class DynproChecks {
64138
64149
  ret.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.getConfig().severity));
64139
64150
  }
64140
64151
  }
64152
+ ret.push(...this.findOverlappingFields(dynpro, file));
64153
+ }
64154
+ return ret;
64155
+ }
64156
+ findOverlappingFields(dynpro, file) {
64157
+ const ret = [];
64158
+ for (let index = 0; index < dynpro.fields.length; index++) {
64159
+ const current = dynpro.fields[index];
64160
+ if (current.name === undefined || current.type === "FRAME") {
64161
+ continue;
64162
+ }
64163
+ for (let compare = index + 1; compare < dynpro.fields.length; compare++) {
64164
+ const other = dynpro.fields[compare];
64165
+ if (other.name === undefined || other.type === "FRAME" || this.overlaps(current, other) === false) {
64166
+ continue;
64167
+ }
64168
+ const message = `Screen ${dynpro.number}, ${current.type} ${current.name} and ${other.type} ${other.name} are overlapping`;
64169
+ ret.push(issue_1.Issue.atPosition(file, new position_1.Position(1, 1), message, this.getMetadata().key, this.getConfig().severity));
64170
+ }
64141
64171
  }
64142
64172
  return ret;
64143
64173
  }
64174
+ overlaps(first, second) {
64175
+ if (first.line === 0 || second.line === 0 || first.column === 0 || second.column === 0) {
64176
+ return false;
64177
+ }
64178
+ const firstHeight = Math.max(first.height, 1);
64179
+ const secondHeight = Math.max(second.height, 1);
64180
+ const firstLastLine = first.line + firstHeight - 1;
64181
+ const secondLastLine = second.line + secondHeight - 1;
64182
+ if (firstLastLine < second.line || secondLastLine < first.line) {
64183
+ return false;
64184
+ }
64185
+ const firstLastColumn = first.column + Math.max(first.vislength || first.length, 1) - 1;
64186
+ const secondLastColumn = second.column + Math.max(second.vislength || second.length, 1) - 1;
64187
+ return first.column <= secondLastColumn && second.column <= firstLastColumn;
64188
+ }
64144
64189
  }
64145
64190
  exports.DynproChecks = DynproChecks;
64146
64191
  //# sourceMappingURL=dynpro_checks.js.map
@@ -70271,7 +70316,8 @@ class MSAGConsistency {
70271
70316
  key: "msag_consistency",
70272
70317
  title: "MSAG consistency check",
70273
70318
  shortDescription: `Checks the validity of messages in message classes`,
70274
- extendedInformation: `Message numbers must be 3 digits, message text must not be empty, no message number duplicates`,
70319
+ extendedInformation: `Message numbers must be 3 digits, message text must not be empty,\n` +
70320
+ `message text must not exceed 73 characters, no message number duplicates`,
70275
70321
  };
70276
70322
  }
70277
70323
  getDescription(reason) {
@@ -70307,6 +70353,12 @@ class MSAGConsistency {
70307
70353
  const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
70308
70354
  issues.push(issue);
70309
70355
  }
70356
+ if (message.getMessage().length > 73) {
70357
+ const text = `Message text too long (max 73 characters): message ${message.getNumber()}`;
70358
+ const position = new position_1.Position(1, 1);
70359
+ const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
70360
+ issues.push(issue);
70361
+ }
70310
70362
  const num = message.getNumber();
70311
70363
  if (numbers.has(num)) {
70312
70364
  const text = "Duplicate message number " + num;
@@ -70320,7 +70372,7 @@ class MSAGConsistency {
70320
70372
  if (this.getConfig().numericParameters === true) {
70321
70373
  const placeholderCount = message.getPlaceholderCount();
70322
70374
  if (placeholderCount > 4) {
70323
- const text = `More than 4 placeholders in mesasge ${message.getNumber()}`;
70375
+ const text = `More than 4 placeholders in message ${message.getNumber()}`;
70324
70376
  const position = new position_1.Position(1, 1);
70325
70377
  const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
70326
70378
  issues.push(issue);
@@ -86037,289 +86089,14 @@ module.exports = require("zlib");
86037
86089
 
86038
86090
  /***/ },
86039
86091
 
86040
- /***/ "./node_modules/@isaacs/balanced-match/dist/commonjs/index.js"
86041
- /*!********************************************************************!*\
86042
- !*** ./node_modules/@isaacs/balanced-match/dist/commonjs/index.js ***!
86043
- \********************************************************************/
86044
- (__unused_webpack_module, exports) {
86045
-
86046
- "use strict";
86047
-
86048
- Object.defineProperty(exports, "__esModule", ({ value: true }));
86049
- exports.range = exports.balanced = void 0;
86050
- const balanced = (a, b, str) => {
86051
- const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
86052
- const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
86053
- const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
86054
- return (r && {
86055
- start: r[0],
86056
- end: r[1],
86057
- pre: str.slice(0, r[0]),
86058
- body: str.slice(r[0] + ma.length, r[1]),
86059
- post: str.slice(r[1] + mb.length),
86060
- });
86061
- };
86062
- exports.balanced = balanced;
86063
- const maybeMatch = (reg, str) => {
86064
- const m = str.match(reg);
86065
- return m ? m[0] : null;
86066
- };
86067
- const range = (a, b, str) => {
86068
- let begs, beg, left, right = undefined, result;
86069
- let ai = str.indexOf(a);
86070
- let bi = str.indexOf(b, ai + 1);
86071
- let i = ai;
86072
- if (ai >= 0 && bi > 0) {
86073
- if (a === b) {
86074
- return [ai, bi];
86075
- }
86076
- begs = [];
86077
- left = str.length;
86078
- while (i >= 0 && !result) {
86079
- if (i === ai) {
86080
- begs.push(i);
86081
- ai = str.indexOf(a, i + 1);
86082
- }
86083
- else if (begs.length === 1) {
86084
- const r = begs.pop();
86085
- if (r !== undefined)
86086
- result = [r, bi];
86087
- }
86088
- else {
86089
- beg = begs.pop();
86090
- if (beg !== undefined && beg < left) {
86091
- left = beg;
86092
- right = bi;
86093
- }
86094
- bi = str.indexOf(b, i + 1);
86095
- }
86096
- i = ai < bi && ai >= 0 ? ai : bi;
86097
- }
86098
- if (begs.length && right !== undefined) {
86099
- result = [left, right];
86100
- }
86101
- }
86102
- return result;
86103
- };
86104
- exports.range = range;
86105
- //# sourceMappingURL=index.js.map
86106
-
86107
- /***/ },
86108
-
86109
- /***/ "./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js"
86110
- /*!*********************************************************************!*\
86111
- !*** ./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js ***!
86112
- \*********************************************************************/
86113
- (__unused_webpack_module, exports, __webpack_require__) {
86114
-
86115
- "use strict";
86116
-
86117
- Object.defineProperty(exports, "__esModule", ({ value: true }));
86118
- exports.expand = expand;
86119
- const balanced_match_1 = __webpack_require__(/*! @isaacs/balanced-match */ "./node_modules/@isaacs/balanced-match/dist/commonjs/index.js");
86120
- const escSlash = '\0SLASH' + Math.random() + '\0';
86121
- const escOpen = '\0OPEN' + Math.random() + '\0';
86122
- const escClose = '\0CLOSE' + Math.random() + '\0';
86123
- const escComma = '\0COMMA' + Math.random() + '\0';
86124
- const escPeriod = '\0PERIOD' + Math.random() + '\0';
86125
- const escSlashPattern = new RegExp(escSlash, 'g');
86126
- const escOpenPattern = new RegExp(escOpen, 'g');
86127
- const escClosePattern = new RegExp(escClose, 'g');
86128
- const escCommaPattern = new RegExp(escComma, 'g');
86129
- const escPeriodPattern = new RegExp(escPeriod, 'g');
86130
- const slashPattern = /\\\\/g;
86131
- const openPattern = /\\{/g;
86132
- const closePattern = /\\}/g;
86133
- const commaPattern = /\\,/g;
86134
- const periodPattern = /\\./g;
86135
- function numeric(str) {
86136
- return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
86137
- }
86138
- function escapeBraces(str) {
86139
- return str
86140
- .replace(slashPattern, escSlash)
86141
- .replace(openPattern, escOpen)
86142
- .replace(closePattern, escClose)
86143
- .replace(commaPattern, escComma)
86144
- .replace(periodPattern, escPeriod);
86145
- }
86146
- function unescapeBraces(str) {
86147
- return str
86148
- .replace(escSlashPattern, '\\')
86149
- .replace(escOpenPattern, '{')
86150
- .replace(escClosePattern, '}')
86151
- .replace(escCommaPattern, ',')
86152
- .replace(escPeriodPattern, '.');
86153
- }
86154
- /**
86155
- * Basically just str.split(","), but handling cases
86156
- * where we have nested braced sections, which should be
86157
- * treated as individual members, like {a,{b,c},d}
86158
- */
86159
- function parseCommaParts(str) {
86160
- if (!str) {
86161
- return [''];
86162
- }
86163
- const parts = [];
86164
- const m = (0, balanced_match_1.balanced)('{', '}', str);
86165
- if (!m) {
86166
- return str.split(',');
86167
- }
86168
- const { pre, body, post } = m;
86169
- const p = pre.split(',');
86170
- p[p.length - 1] += '{' + body + '}';
86171
- const postParts = parseCommaParts(post);
86172
- if (post.length) {
86173
- ;
86174
- p[p.length - 1] += postParts.shift();
86175
- p.push.apply(p, postParts);
86176
- }
86177
- parts.push.apply(parts, p);
86178
- return parts;
86179
- }
86180
- function expand(str) {
86181
- if (!str) {
86182
- return [];
86183
- }
86184
- // I don't know why Bash 4.3 does this, but it does.
86185
- // Anything starting with {} will have the first two bytes preserved
86186
- // but *only* at the top level, so {},a}b will not expand to anything,
86187
- // but a{},b}c will be expanded to [a}c,abc].
86188
- // One could argue that this is a bug in Bash, but since the goal of
86189
- // this module is to match Bash's rules, we escape a leading {}
86190
- if (str.slice(0, 2) === '{}') {
86191
- str = '\\{\\}' + str.slice(2);
86192
- }
86193
- return expand_(escapeBraces(str), true).map(unescapeBraces);
86194
- }
86195
- function embrace(str) {
86196
- return '{' + str + '}';
86197
- }
86198
- function isPadded(el) {
86199
- return /^-?0\d/.test(el);
86200
- }
86201
- function lte(i, y) {
86202
- return i <= y;
86203
- }
86204
- function gte(i, y) {
86205
- return i >= y;
86206
- }
86207
- function expand_(str, isTop) {
86208
- /** @type {string[]} */
86209
- const expansions = [];
86210
- const m = (0, balanced_match_1.balanced)('{', '}', str);
86211
- if (!m)
86212
- return [str];
86213
- // no need to expand pre, since it is guaranteed to be free of brace-sets
86214
- const pre = m.pre;
86215
- const post = m.post.length ? expand_(m.post, false) : [''];
86216
- if (/\$$/.test(m.pre)) {
86217
- for (let k = 0; k < post.length; k++) {
86218
- const expansion = pre + '{' + m.body + '}' + post[k];
86219
- expansions.push(expansion);
86220
- }
86221
- }
86222
- else {
86223
- const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
86224
- const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
86225
- const isSequence = isNumericSequence || isAlphaSequence;
86226
- const isOptions = m.body.indexOf(',') >= 0;
86227
- if (!isSequence && !isOptions) {
86228
- // {a},b}
86229
- if (m.post.match(/,(?!,).*\}/)) {
86230
- str = m.pre + '{' + m.body + escClose + m.post;
86231
- return expand_(str);
86232
- }
86233
- return [str];
86234
- }
86235
- let n;
86236
- if (isSequence) {
86237
- n = m.body.split(/\.\./);
86238
- }
86239
- else {
86240
- n = parseCommaParts(m.body);
86241
- if (n.length === 1 && n[0] !== undefined) {
86242
- // x{{a,b}}y ==> x{a}y x{b}y
86243
- n = expand_(n[0], false).map(embrace);
86244
- //XXX is this necessary? Can't seem to hit it in tests.
86245
- /* c8 ignore start */
86246
- if (n.length === 1) {
86247
- return post.map(p => m.pre + n[0] + p);
86248
- }
86249
- /* c8 ignore stop */
86250
- }
86251
- }
86252
- // at this point, n is the parts, and we know it's not a comma set
86253
- // with a single entry.
86254
- let N;
86255
- if (isSequence && n[0] !== undefined && n[1] !== undefined) {
86256
- const x = numeric(n[0]);
86257
- const y = numeric(n[1]);
86258
- const width = Math.max(n[0].length, n[1].length);
86259
- let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
86260
- let test = lte;
86261
- const reverse = y < x;
86262
- if (reverse) {
86263
- incr *= -1;
86264
- test = gte;
86265
- }
86266
- const pad = n.some(isPadded);
86267
- N = [];
86268
- for (let i = x; test(i, y); i += incr) {
86269
- let c;
86270
- if (isAlphaSequence) {
86271
- c = String.fromCharCode(i);
86272
- if (c === '\\') {
86273
- c = '';
86274
- }
86275
- }
86276
- else {
86277
- c = String(i);
86278
- if (pad) {
86279
- const need = width - c.length;
86280
- if (need > 0) {
86281
- const z = new Array(need + 1).join('0');
86282
- if (i < 0) {
86283
- c = '-' + z + c.slice(1);
86284
- }
86285
- else {
86286
- c = z + c;
86287
- }
86288
- }
86289
- }
86290
- }
86291
- N.push(c);
86292
- }
86293
- }
86294
- else {
86295
- N = [];
86296
- for (let j = 0; j < n.length; j++) {
86297
- N.push.apply(N, expand_(n[j], false));
86298
- }
86299
- }
86300
- for (let j = 0; j < N.length; j++) {
86301
- for (let k = 0; k < post.length; k++) {
86302
- const expansion = pre + N[j] + post[k];
86303
- if (!isTop || isSequence || expansion) {
86304
- expansions.push(expansion);
86305
- }
86306
- }
86307
- }
86308
- }
86309
- return expansions;
86310
- }
86311
- //# sourceMappingURL=index.js.map
86312
-
86313
- /***/ },
86314
-
86315
86092
  /***/ "./node_modules/fast-xml-parser/lib/fxp.cjs"
86316
86093
  /*!**************************************************!*\
86317
86094
  !*** ./node_modules/fast-xml-parser/lib/fxp.cjs ***!
86318
86095
  \**************************************************/
86319
86096
  (module) {
86320
86097
 
86321
- (()=>{"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
86322
- 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 '&#xD;'");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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],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})();
86098
+ (()=>{"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
86099
+ 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 '&#xD;'");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:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],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})();
86323
86100
 
86324
86101
  /***/ },
86325
86102
 
@@ -87761,6 +87538,284 @@ exports.GlobStream = GlobStream;
87761
87538
 
87762
87539
  /***/ },
87763
87540
 
87541
+ /***/ "./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js"
87542
+ /*!******************************************************************************!*\
87543
+ !*** ./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js ***!
87544
+ \******************************************************************************/
87545
+ (__unused_webpack_module, exports) {
87546
+
87547
+ "use strict";
87548
+
87549
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
87550
+ exports.range = exports.balanced = void 0;
87551
+ const balanced = (a, b, str) => {
87552
+ const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
87553
+ const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
87554
+ const r = ma !== null && mb != null && (0, exports.range)(ma, mb, str);
87555
+ return (r && {
87556
+ start: r[0],
87557
+ end: r[1],
87558
+ pre: str.slice(0, r[0]),
87559
+ body: str.slice(r[0] + ma.length, r[1]),
87560
+ post: str.slice(r[1] + mb.length),
87561
+ });
87562
+ };
87563
+ exports.balanced = balanced;
87564
+ const maybeMatch = (reg, str) => {
87565
+ const m = str.match(reg);
87566
+ return m ? m[0] : null;
87567
+ };
87568
+ const range = (a, b, str) => {
87569
+ let begs, beg, left, right = undefined, result;
87570
+ let ai = str.indexOf(a);
87571
+ let bi = str.indexOf(b, ai + 1);
87572
+ let i = ai;
87573
+ if (ai >= 0 && bi > 0) {
87574
+ if (a === b) {
87575
+ return [ai, bi];
87576
+ }
87577
+ begs = [];
87578
+ left = str.length;
87579
+ while (i >= 0 && !result) {
87580
+ if (i === ai) {
87581
+ begs.push(i);
87582
+ ai = str.indexOf(a, i + 1);
87583
+ }
87584
+ else if (begs.length === 1) {
87585
+ const r = begs.pop();
87586
+ if (r !== undefined)
87587
+ result = [r, bi];
87588
+ }
87589
+ else {
87590
+ beg = begs.pop();
87591
+ if (beg !== undefined && beg < left) {
87592
+ left = beg;
87593
+ right = bi;
87594
+ }
87595
+ bi = str.indexOf(b, i + 1);
87596
+ }
87597
+ i = ai < bi && ai >= 0 ? ai : bi;
87598
+ }
87599
+ if (begs.length && right !== undefined) {
87600
+ result = [left, right];
87601
+ }
87602
+ }
87603
+ return result;
87604
+ };
87605
+ exports.range = range;
87606
+ //# sourceMappingURL=index.js.map
87607
+
87608
+ /***/ },
87609
+
87610
+ /***/ "./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js"
87611
+ /*!*******************************************************************************!*\
87612
+ !*** ./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js ***!
87613
+ \*******************************************************************************/
87614
+ (__unused_webpack_module, exports, __webpack_require__) {
87615
+
87616
+ "use strict";
87617
+
87618
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
87619
+ exports.EXPANSION_MAX = void 0;
87620
+ exports.expand = expand;
87621
+ const balanced_match_1 = __webpack_require__(/*! balanced-match */ "./node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js");
87622
+ const escSlash = '\0SLASH' + Math.random() + '\0';
87623
+ const escOpen = '\0OPEN' + Math.random() + '\0';
87624
+ const escClose = '\0CLOSE' + Math.random() + '\0';
87625
+ const escComma = '\0COMMA' + Math.random() + '\0';
87626
+ const escPeriod = '\0PERIOD' + Math.random() + '\0';
87627
+ const escSlashPattern = new RegExp(escSlash, 'g');
87628
+ const escOpenPattern = new RegExp(escOpen, 'g');
87629
+ const escClosePattern = new RegExp(escClose, 'g');
87630
+ const escCommaPattern = new RegExp(escComma, 'g');
87631
+ const escPeriodPattern = new RegExp(escPeriod, 'g');
87632
+ const slashPattern = /\\\\/g;
87633
+ const openPattern = /\\{/g;
87634
+ const closePattern = /\\}/g;
87635
+ const commaPattern = /\\,/g;
87636
+ const periodPattern = /\\\./g;
87637
+ exports.EXPANSION_MAX = 100_000;
87638
+ function numeric(str) {
87639
+ return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
87640
+ }
87641
+ function escapeBraces(str) {
87642
+ return str
87643
+ .replace(slashPattern, escSlash)
87644
+ .replace(openPattern, escOpen)
87645
+ .replace(closePattern, escClose)
87646
+ .replace(commaPattern, escComma)
87647
+ .replace(periodPattern, escPeriod);
87648
+ }
87649
+ function unescapeBraces(str) {
87650
+ return str
87651
+ .replace(escSlashPattern, '\\')
87652
+ .replace(escOpenPattern, '{')
87653
+ .replace(escClosePattern, '}')
87654
+ .replace(escCommaPattern, ',')
87655
+ .replace(escPeriodPattern, '.');
87656
+ }
87657
+ /**
87658
+ * Basically just str.split(","), but handling cases
87659
+ * where we have nested braced sections, which should be
87660
+ * treated as individual members, like {a,{b,c},d}
87661
+ */
87662
+ function parseCommaParts(str) {
87663
+ if (!str) {
87664
+ return [''];
87665
+ }
87666
+ const parts = [];
87667
+ const m = (0, balanced_match_1.balanced)('{', '}', str);
87668
+ if (!m) {
87669
+ return str.split(',');
87670
+ }
87671
+ const { pre, body, post } = m;
87672
+ const p = pre.split(',');
87673
+ p[p.length - 1] += '{' + body + '}';
87674
+ const postParts = parseCommaParts(post);
87675
+ if (post.length) {
87676
+ ;
87677
+ p[p.length - 1] += postParts.shift();
87678
+ p.push.apply(p, postParts);
87679
+ }
87680
+ parts.push.apply(parts, p);
87681
+ return parts;
87682
+ }
87683
+ function expand(str, options = {}) {
87684
+ if (!str) {
87685
+ return [];
87686
+ }
87687
+ const { max = exports.EXPANSION_MAX } = options;
87688
+ // I don't know why Bash 4.3 does this, but it does.
87689
+ // Anything starting with {} will have the first two bytes preserved
87690
+ // but *only* at the top level, so {},a}b will not expand to anything,
87691
+ // but a{},b}c will be expanded to [a}c,abc].
87692
+ // One could argue that this is a bug in Bash, but since the goal of
87693
+ // this module is to match Bash's rules, we escape a leading {}
87694
+ if (str.slice(0, 2) === '{}') {
87695
+ str = '\\{\\}' + str.slice(2);
87696
+ }
87697
+ return expand_(escapeBraces(str), max, true).map(unescapeBraces);
87698
+ }
87699
+ function embrace(str) {
87700
+ return '{' + str + '}';
87701
+ }
87702
+ function isPadded(el) {
87703
+ return /^-?0\d/.test(el);
87704
+ }
87705
+ function lte(i, y) {
87706
+ return i <= y;
87707
+ }
87708
+ function gte(i, y) {
87709
+ return i >= y;
87710
+ }
87711
+ function expand_(str, max, isTop) {
87712
+ /** @type {string[]} */
87713
+ const expansions = [];
87714
+ const m = (0, balanced_match_1.balanced)('{', '}', str);
87715
+ if (!m)
87716
+ return [str];
87717
+ // no need to expand pre, since it is guaranteed to be free of brace-sets
87718
+ const pre = m.pre;
87719
+ const post = m.post.length ? expand_(m.post, max, false) : [''];
87720
+ if (/\$$/.test(m.pre)) {
87721
+ for (let k = 0; k < post.length && k < max; k++) {
87722
+ const expansion = pre + '{' + m.body + '}' + post[k];
87723
+ expansions.push(expansion);
87724
+ }
87725
+ }
87726
+ else {
87727
+ const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
87728
+ const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
87729
+ const isSequence = isNumericSequence || isAlphaSequence;
87730
+ const isOptions = m.body.indexOf(',') >= 0;
87731
+ if (!isSequence && !isOptions) {
87732
+ // {a},b}
87733
+ if (m.post.match(/,(?!,).*\}/)) {
87734
+ str = m.pre + '{' + m.body + escClose + m.post;
87735
+ return expand_(str, max, true);
87736
+ }
87737
+ return [str];
87738
+ }
87739
+ let n;
87740
+ if (isSequence) {
87741
+ n = m.body.split(/\.\./);
87742
+ }
87743
+ else {
87744
+ n = parseCommaParts(m.body);
87745
+ if (n.length === 1 && n[0] !== undefined) {
87746
+ // x{{a,b}}y ==> x{a}y x{b}y
87747
+ n = expand_(n[0], max, false).map(embrace);
87748
+ //XXX is this necessary? Can't seem to hit it in tests.
87749
+ /* c8 ignore start */
87750
+ if (n.length === 1) {
87751
+ return post.map(p => m.pre + n[0] + p);
87752
+ }
87753
+ /* c8 ignore stop */
87754
+ }
87755
+ }
87756
+ // at this point, n is the parts, and we know it's not a comma set
87757
+ // with a single entry.
87758
+ let N;
87759
+ if (isSequence && n[0] !== undefined && n[1] !== undefined) {
87760
+ const x = numeric(n[0]);
87761
+ const y = numeric(n[1]);
87762
+ const width = Math.max(n[0].length, n[1].length);
87763
+ let incr = n.length === 3 && n[2] !== undefined ? Math.abs(numeric(n[2])) : 1;
87764
+ let test = lte;
87765
+ const reverse = y < x;
87766
+ if (reverse) {
87767
+ incr *= -1;
87768
+ test = gte;
87769
+ }
87770
+ const pad = n.some(isPadded);
87771
+ N = [];
87772
+ for (let i = x; test(i, y); i += incr) {
87773
+ let c;
87774
+ if (isAlphaSequence) {
87775
+ c = String.fromCharCode(i);
87776
+ if (c === '\\') {
87777
+ c = '';
87778
+ }
87779
+ }
87780
+ else {
87781
+ c = String(i);
87782
+ if (pad) {
87783
+ const need = width - c.length;
87784
+ if (need > 0) {
87785
+ const z = new Array(need + 1).join('0');
87786
+ if (i < 0) {
87787
+ c = '-' + z + c.slice(1);
87788
+ }
87789
+ else {
87790
+ c = z + c;
87791
+ }
87792
+ }
87793
+ }
87794
+ }
87795
+ N.push(c);
87796
+ }
87797
+ }
87798
+ else {
87799
+ N = [];
87800
+ for (let j = 0; j < n.length; j++) {
87801
+ N.push.apply(N, expand_(n[j], max, false));
87802
+ }
87803
+ }
87804
+ for (let j = 0; j < N.length; j++) {
87805
+ for (let k = 0; k < post.length && expansions.length < max; k++) {
87806
+ const expansion = pre + N[j] + post[k];
87807
+ if (!isTop || isSequence || expansion) {
87808
+ expansions.push(expansion);
87809
+ }
87810
+ }
87811
+ }
87812
+ }
87813
+ return expansions;
87814
+ }
87815
+ //# sourceMappingURL=index.js.map
87816
+
87817
+ /***/ },
87818
+
87764
87819
  /***/ "./node_modules/glob/node_modules/lru-cache/dist/commonjs/index.js"
87765
87820
  /*!*************************************************************************!*\
87766
87821
  !*** ./node_modules/glob/node_modules/lru-cache/dist/commonjs/index.js ***!
@@ -89368,12 +89423,114 @@ exports.assertValidPattern = assertValidPattern;
89368
89423
  "use strict";
89369
89424
 
89370
89425
  // parse a single path portion
89426
+ var _a;
89371
89427
  Object.defineProperty(exports, "__esModule", ({ value: true }));
89372
89428
  exports.AST = void 0;
89373
89429
  const brace_expressions_js_1 = __webpack_require__(/*! ./brace-expressions.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js");
89374
89430
  const unescape_js_1 = __webpack_require__(/*! ./unescape.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js");
89375
89431
  const types = new Set(['!', '?', '+', '*', '@']);
89376
89432
  const isExtglobType = (c) => types.has(c);
89433
+ const isExtglobAST = (c) => isExtglobType(c.type);
89434
+ // Map of which extglob types can adopt the children of a nested extglob
89435
+ //
89436
+ // anything but ! can adopt a matching type:
89437
+ // +(a|+(b|c)|d) => +(a|b|c|d)
89438
+ // *(a|*(b|c)|d) => *(a|b|c|d)
89439
+ // @(a|@(b|c)|d) => @(a|b|c|d)
89440
+ // ?(a|?(b|c)|d) => ?(a|b|c|d)
89441
+ //
89442
+ // * can adopt anything, because 0 or repetition is allowed
89443
+ // *(a|?(b|c)|d) => *(a|b|c|d)
89444
+ // *(a|+(b|c)|d) => *(a|b|c|d)
89445
+ // *(a|@(b|c)|d) => *(a|b|c|d)
89446
+ //
89447
+ // + can adopt @, because 1 or repetition is allowed
89448
+ // +(a|@(b|c)|d) => +(a|b|c|d)
89449
+ //
89450
+ // + and @ CANNOT adopt *, because 0 would be allowed
89451
+ // +(a|*(b|c)|d) => would match "", on *(b|c)
89452
+ // @(a|*(b|c)|d) => would match "", on *(b|c)
89453
+ //
89454
+ // + and @ CANNOT adopt ?, because 0 would be allowed
89455
+ // +(a|?(b|c)|d) => would match "", on ?(b|c)
89456
+ // @(a|?(b|c)|d) => would match "", on ?(b|c)
89457
+ //
89458
+ // ? can adopt @, because 0 or 1 is allowed
89459
+ // ?(a|@(b|c)|d) => ?(a|b|c|d)
89460
+ //
89461
+ // ? and @ CANNOT adopt * or +, because >1 would be allowed
89462
+ // ?(a|*(b|c)|d) => would match bbb on *(b|c)
89463
+ // @(a|*(b|c)|d) => would match bbb on *(b|c)
89464
+ // ?(a|+(b|c)|d) => would match bbb on +(b|c)
89465
+ // @(a|+(b|c)|d) => would match bbb on +(b|c)
89466
+ //
89467
+ // ! CANNOT adopt ! (nothing else can either)
89468
+ // !(a|!(b|c)|d) => !(a|b|c|d) would fail to match on b (not not b|c)
89469
+ //
89470
+ // ! can adopt @
89471
+ // !(a|@(b|c)|d) => !(a|b|c|d)
89472
+ //
89473
+ // ! CANNOT adopt *
89474
+ // !(a|*(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
89475
+ //
89476
+ // ! CANNOT adopt +
89477
+ // !(a|+(b|c)|d) => !(a|b|c|d) would match on bbb, not allowed
89478
+ //
89479
+ // ! CANNOT adopt ?
89480
+ // x!(a|?(b|c)|d) => x!(a|b|c|d) would fail to match "x"
89481
+ const adoptionMap = new Map([
89482
+ ['!', ['@']],
89483
+ ['?', ['?', '@']],
89484
+ ['@', ['@']],
89485
+ ['*', ['*', '+', '?', '@']],
89486
+ ['+', ['+', '@']],
89487
+ ]);
89488
+ // nested extglobs that can be adopted in, but with the addition of
89489
+ // a blank '' element.
89490
+ const adoptionWithSpaceMap = new Map([
89491
+ ['!', ['?']],
89492
+ ['@', ['?']],
89493
+ ['+', ['?', '*']],
89494
+ ]);
89495
+ // union of the previous two maps
89496
+ const adoptionAnyMap = new Map([
89497
+ ['!', ['?', '@']],
89498
+ ['?', ['?', '@']],
89499
+ ['@', ['?', '@']],
89500
+ ['*', ['*', '+', '?', '@']],
89501
+ ['+', ['+', '@', '?', '*']],
89502
+ ]);
89503
+ // Extglobs that can take over their parent if they are the only child
89504
+ // the key is parent, value maps child to resulting extglob parent type
89505
+ // '@' is omitted because it's a special case. An `@` extglob with a single
89506
+ // member can always be usurped by that subpattern.
89507
+ const usurpMap = new Map([
89508
+ ['!', new Map([['!', '@']])],
89509
+ [
89510
+ '?',
89511
+ new Map([
89512
+ ['*', '*'],
89513
+ ['+', '*'],
89514
+ ]),
89515
+ ],
89516
+ [
89517
+ '@',
89518
+ new Map([
89519
+ ['!', '!'],
89520
+ ['?', '?'],
89521
+ ['@', '@'],
89522
+ ['*', '*'],
89523
+ ['+', '+'],
89524
+ ]),
89525
+ ],
89526
+ [
89527
+ '+',
89528
+ new Map([
89529
+ ['?', '*'],
89530
+ ['*', '*'],
89531
+ ]),
89532
+ ],
89533
+ ]);
89377
89534
  // Patterns that get prepended to bind to the start of either the
89378
89535
  // entire string, or just a single path portion, to prevent dots
89379
89536
  // and/or traversal patterns, when needed.
@@ -89397,6 +89554,7 @@ const star = qmark + '*?';
89397
89554
  const starNoEmpty = qmark + '+?';
89398
89555
  // remove the \ chars that we added if we end up doing a nonmagic compare
89399
89556
  // const deslash = (s: string) => s.replace(/\\(.)/g, '$1')
89557
+ let ID = 0;
89400
89558
  class AST {
89401
89559
  type;
89402
89560
  #root;
@@ -89412,6 +89570,22 @@ class AST {
89412
89570
  // set to true if it's an extglob with no children
89413
89571
  // (which really means one child of '')
89414
89572
  #emptyExt = false;
89573
+ id = ++ID;
89574
+ get depth() {
89575
+ return (this.#parent?.depth ?? -1) + 1;
89576
+ }
89577
+ [Symbol.for('nodejs.util.inspect.custom')]() {
89578
+ return {
89579
+ '@@type': 'AST',
89580
+ id: this.id,
89581
+ type: this.type,
89582
+ root: this.#root.id,
89583
+ parent: this.#parent?.id,
89584
+ depth: this.depth,
89585
+ partsLength: this.#parts.length,
89586
+ parts: this.#parts,
89587
+ };
89588
+ }
89415
89589
  constructor(type, parent, options = {}) {
89416
89590
  this.type = type;
89417
89591
  // extglobs are inherently magical
@@ -89490,7 +89664,8 @@ class AST {
89490
89664
  if (p === '')
89491
89665
  continue;
89492
89666
  /* c8 ignore start */
89493
- if (typeof p !== 'string' && !(p instanceof AST && p.#parent === this)) {
89667
+ if (typeof p !== 'string' &&
89668
+ !(p instanceof _a && p.#parent === this)) {
89494
89669
  throw new Error('invalid part: ' + p);
89495
89670
  }
89496
89671
  /* c8 ignore stop */
@@ -89498,8 +89673,10 @@ class AST {
89498
89673
  }
89499
89674
  }
89500
89675
  toJSON() {
89501
- const ret = this.type === null
89502
- ? this.#parts.slice().map(p => (typeof p === 'string' ? p : p.toJSON()))
89676
+ const ret = this.type === null ?
89677
+ this.#parts
89678
+ .slice()
89679
+ .map(p => (typeof p === 'string' ? p : p.toJSON()))
89503
89680
  : [this.type, ...this.#parts.map(p => p.toJSON())];
89504
89681
  if (this.isStart() && !this.type)
89505
89682
  ret.unshift([]);
@@ -89522,7 +89699,7 @@ class AST {
89522
89699
  const p = this.#parent;
89523
89700
  for (let i = 0; i < this.#parentIndex; i++) {
89524
89701
  const pp = p.#parts[i];
89525
- if (!(pp instanceof AST && pp.type === '!')) {
89702
+ if (!(pp instanceof _a && pp.type === '!')) {
89526
89703
  return false;
89527
89704
  }
89528
89705
  }
@@ -89550,13 +89727,14 @@ class AST {
89550
89727
  this.push(part.clone(this));
89551
89728
  }
89552
89729
  clone(parent) {
89553
- const c = new AST(this.type, parent);
89730
+ const c = new _a(this.type, parent);
89554
89731
  for (const p of this.#parts) {
89555
89732
  c.copyIn(p);
89556
89733
  }
89557
89734
  return c;
89558
89735
  }
89559
- static #parseAST(str, ast, pos, opt) {
89736
+ static #parseAST(str, ast, pos, opt, extDepth) {
89737
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
89560
89738
  let escaping = false;
89561
89739
  let inBrace = false;
89562
89740
  let braceStart = -1;
@@ -89593,11 +89771,17 @@ class AST {
89593
89771
  acc += c;
89594
89772
  continue;
89595
89773
  }
89596
- if (!opt.noext && isExtglobType(c) && str.charAt(i) === '(') {
89774
+ // we don't have to check for adoption here, because that's
89775
+ // done at the other recursion point.
89776
+ const doRecurse = !opt.noext &&
89777
+ isExtglobType(c) &&
89778
+ str.charAt(i) === '(' &&
89779
+ extDepth <= maxDepth;
89780
+ if (doRecurse) {
89597
89781
  ast.push(acc);
89598
89782
  acc = '';
89599
- const ext = new AST(c, ast);
89600
- i = AST.#parseAST(str, ext, i, opt);
89783
+ const ext = new _a(c, ast);
89784
+ i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
89601
89785
  ast.push(ext);
89602
89786
  continue;
89603
89787
  }
@@ -89609,7 +89793,7 @@ class AST {
89609
89793
  // some kind of extglob, pos is at the (
89610
89794
  // find the next | or )
89611
89795
  let i = pos + 1;
89612
- let part = new AST(null, ast);
89796
+ let part = new _a(null, ast);
89613
89797
  const parts = [];
89614
89798
  let acc = '';
89615
89799
  while (i < str.length) {
@@ -89640,19 +89824,26 @@ class AST {
89640
89824
  acc += c;
89641
89825
  continue;
89642
89826
  }
89643
- if (isExtglobType(c) && str.charAt(i) === '(') {
89827
+ const doRecurse = !opt.noext &&
89828
+ isExtglobType(c) &&
89829
+ str.charAt(i) === '(' &&
89830
+ /* c8 ignore start - the maxDepth is sufficient here */
89831
+ (extDepth <= maxDepth || (ast && ast.#canAdoptType(c)));
89832
+ /* c8 ignore stop */
89833
+ if (doRecurse) {
89834
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
89644
89835
  part.push(acc);
89645
89836
  acc = '';
89646
- const ext = new AST(c, part);
89837
+ const ext = new _a(c, part);
89647
89838
  part.push(ext);
89648
- i = AST.#parseAST(str, ext, i, opt);
89839
+ i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
89649
89840
  continue;
89650
89841
  }
89651
89842
  if (c === '|') {
89652
89843
  part.push(acc);
89653
89844
  acc = '';
89654
89845
  parts.push(part);
89655
- part = new AST(null, ast);
89846
+ part = new _a(null, ast);
89656
89847
  continue;
89657
89848
  }
89658
89849
  if (c === ')') {
@@ -89674,9 +89865,82 @@ class AST {
89674
89865
  ast.#parts = [str.substring(pos - 1)];
89675
89866
  return i;
89676
89867
  }
89868
+ #canAdoptWithSpace(child) {
89869
+ return this.#canAdopt(child, adoptionWithSpaceMap);
89870
+ }
89871
+ #canAdopt(child, map = adoptionMap) {
89872
+ if (!child ||
89873
+ typeof child !== 'object' ||
89874
+ child.type !== null ||
89875
+ child.#parts.length !== 1 ||
89876
+ this.type === null) {
89877
+ return false;
89878
+ }
89879
+ const gc = child.#parts[0];
89880
+ if (!gc || typeof gc !== 'object' || gc.type === null) {
89881
+ return false;
89882
+ }
89883
+ return this.#canAdoptType(gc.type, map);
89884
+ }
89885
+ #canAdoptType(c, map = adoptionAnyMap) {
89886
+ return !!map.get(this.type)?.includes(c);
89887
+ }
89888
+ #adoptWithSpace(child, index) {
89889
+ const gc = child.#parts[0];
89890
+ const blank = new _a(null, gc, this.options);
89891
+ blank.#parts.push('');
89892
+ gc.push(blank);
89893
+ this.#adopt(child, index);
89894
+ }
89895
+ #adopt(child, index) {
89896
+ const gc = child.#parts[0];
89897
+ this.#parts.splice(index, 1, ...gc.#parts);
89898
+ for (const p of gc.#parts) {
89899
+ if (typeof p === 'object')
89900
+ p.#parent = this;
89901
+ }
89902
+ this.#toString = undefined;
89903
+ }
89904
+ #canUsurpType(c) {
89905
+ const m = usurpMap.get(this.type);
89906
+ return !!(m?.has(c));
89907
+ }
89908
+ #canUsurp(child) {
89909
+ if (!child ||
89910
+ typeof child !== 'object' ||
89911
+ child.type !== null ||
89912
+ child.#parts.length !== 1 ||
89913
+ this.type === null ||
89914
+ this.#parts.length !== 1) {
89915
+ return false;
89916
+ }
89917
+ const gc = child.#parts[0];
89918
+ if (!gc || typeof gc !== 'object' || gc.type === null) {
89919
+ return false;
89920
+ }
89921
+ return this.#canUsurpType(gc.type);
89922
+ }
89923
+ #usurp(child) {
89924
+ const m = usurpMap.get(this.type);
89925
+ const gc = child.#parts[0];
89926
+ const nt = m?.get(gc.type);
89927
+ /* c8 ignore start - impossible */
89928
+ if (!nt)
89929
+ return false;
89930
+ /* c8 ignore stop */
89931
+ this.#parts = gc.#parts;
89932
+ for (const p of this.#parts) {
89933
+ if (typeof p === 'object') {
89934
+ p.#parent = this;
89935
+ }
89936
+ }
89937
+ this.type = nt;
89938
+ this.#toString = undefined;
89939
+ this.#emptyExt = false;
89940
+ }
89677
89941
  static fromGlob(pattern, options = {}) {
89678
- const ast = new AST(null, undefined, options);
89679
- AST.#parseAST(pattern, ast, 0, options);
89942
+ const ast = new _a(null, undefined, options);
89943
+ _a.#parseAST(pattern, ast, 0, options, 0);
89680
89944
  return ast;
89681
89945
  }
89682
89946
  // returns the regular expression if there's magic, or the unescaped
@@ -89780,14 +90044,18 @@ class AST {
89780
90044
  // or start or whatever) and prepend ^ or / at the Regexp construction.
89781
90045
  toRegExpSource(allowDot) {
89782
90046
  const dot = allowDot ?? !!this.#options.dot;
89783
- if (this.#root === this)
90047
+ if (this.#root === this) {
90048
+ this.#flatten();
89784
90049
  this.#fillNegs();
89785
- if (!this.type) {
89786
- const noEmpty = this.isStart() && this.isEnd();
90050
+ }
90051
+ if (!isExtglobAST(this)) {
90052
+ const noEmpty = this.isStart() &&
90053
+ this.isEnd() &&
90054
+ !this.#parts.some(s => typeof s !== 'string');
89787
90055
  const src = this.#parts
89788
90056
  .map(p => {
89789
- const [re, _, hasMagic, uflag] = typeof p === 'string'
89790
- ? AST.#parseGlob(p, this.#hasMagic, noEmpty)
90057
+ const [re, _, hasMagic, uflag] = typeof p === 'string' ?
90058
+ _a.#parseGlob(p, this.#hasMagic, noEmpty)
89791
90059
  : p.toRegExpSource(allowDot);
89792
90060
  this.#hasMagic = this.#hasMagic || hasMagic;
89793
90061
  this.#uflag = this.#uflag || uflag;
@@ -89816,7 +90084,10 @@ class AST {
89816
90084
  // no need to prevent dots if it can't match a dot, or if a
89817
90085
  // sub-pattern will be preventing it anyway.
89818
90086
  const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
89819
- start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : '';
90087
+ start =
90088
+ needNoTrav ? startNoTraversal
90089
+ : needNoDot ? startNoDot
90090
+ : '';
89820
90091
  }
89821
90092
  }
89822
90093
  }
@@ -89846,14 +90117,14 @@ class AST {
89846
90117
  // invalid extglob, has to at least be *something* present, if it's
89847
90118
  // the entire path portion.
89848
90119
  const s = this.toString();
89849
- this.#parts = [s];
89850
- this.type = null;
89851
- this.#hasMagic = undefined;
90120
+ const me = this;
90121
+ me.#parts = [s];
90122
+ me.type = null;
90123
+ me.#hasMagic = undefined;
89852
90124
  return [s, (0, unescape_js_1.unescape)(this.toString()), false, false];
89853
90125
  }
89854
- // XXX abstract out this map method
89855
- let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot
89856
- ? ''
90126
+ let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ?
90127
+ ''
89857
90128
  : this.#partsToRegExp(true);
89858
90129
  if (bodyDotAllowed === body) {
89859
90130
  bodyDotAllowed = '';
@@ -89867,20 +90138,16 @@ class AST {
89867
90138
  final = (this.isStart() && !dot ? startNoDot : '') + starNoEmpty;
89868
90139
  }
89869
90140
  else {
89870
- const close = this.type === '!'
89871
- ? // !() must match something,but !(x) can match ''
89872
- '))' +
89873
- (this.isStart() && !dot && !allowDot ? startNoDot : '') +
89874
- star +
89875
- ')'
89876
- : this.type === '@'
89877
- ? ')'
89878
- : this.type === '?'
89879
- ? ')?'
89880
- : this.type === '+' && bodyDotAllowed
89881
- ? ')'
89882
- : this.type === '*' && bodyDotAllowed
89883
- ? `)?`
90141
+ const close = this.type === '!' ?
90142
+ // !() must match something,but !(x) can match ''
90143
+ '))' +
90144
+ (this.isStart() && !dot && !allowDot ? startNoDot : '') +
90145
+ star +
90146
+ ')'
90147
+ : this.type === '@' ? ')'
90148
+ : this.type === '?' ? ')?'
90149
+ : this.type === '+' && bodyDotAllowed ? ')'
90150
+ : this.type === '*' && bodyDotAllowed ? `)?`
89884
90151
  : `)${this.type}`;
89885
90152
  final = start + body + close;
89886
90153
  }
@@ -89891,6 +90158,42 @@ class AST {
89891
90158
  this.#uflag,
89892
90159
  ];
89893
90160
  }
90161
+ #flatten() {
90162
+ if (!isExtglobAST(this)) {
90163
+ for (const p of this.#parts) {
90164
+ if (typeof p === 'object') {
90165
+ p.#flatten();
90166
+ }
90167
+ }
90168
+ }
90169
+ else {
90170
+ // do up to 10 passes to flatten as much as possible
90171
+ let iterations = 0;
90172
+ let done = false;
90173
+ do {
90174
+ done = true;
90175
+ for (let i = 0; i < this.#parts.length; i++) {
90176
+ const c = this.#parts[i];
90177
+ if (typeof c === 'object') {
90178
+ c.#flatten();
90179
+ if (this.#canAdopt(c)) {
90180
+ done = false;
90181
+ this.#adopt(c, i);
90182
+ }
90183
+ else if (this.#canAdoptWithSpace(c)) {
90184
+ done = false;
90185
+ this.#adoptWithSpace(c, i);
90186
+ }
90187
+ else if (this.#canUsurp(c)) {
90188
+ done = false;
90189
+ this.#usurp(c);
90190
+ }
90191
+ }
90192
+ }
90193
+ } while (!done && ++iterations < 10);
90194
+ }
90195
+ this.#toString = undefined;
90196
+ }
89894
90197
  #partsToRegExp(dot) {
89895
90198
  return this.#parts
89896
90199
  .map(p => {
@@ -89912,6 +90215,8 @@ class AST {
89912
90215
  let escaping = false;
89913
90216
  let re = '';
89914
90217
  let uflag = false;
90218
+ // multiple stars that aren't globstars coalesce into one *
90219
+ let inStar = false;
89915
90220
  for (let i = 0; i < glob.length; i++) {
89916
90221
  const c = glob.charAt(i);
89917
90222
  if (escaping) {
@@ -89919,6 +90224,17 @@ class AST {
89919
90224
  re += (reSpecials.has(c) ? '\\' : '') + c;
89920
90225
  continue;
89921
90226
  }
90227
+ if (c === '*') {
90228
+ if (inStar)
90229
+ continue;
90230
+ inStar = true;
90231
+ re += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
90232
+ hasMagic = true;
90233
+ continue;
90234
+ }
90235
+ else {
90236
+ inStar = false;
90237
+ }
89922
90238
  if (c === '\\') {
89923
90239
  if (i === glob.length - 1) {
89924
90240
  re += '\\\\';
@@ -89938,14 +90254,6 @@ class AST {
89938
90254
  continue;
89939
90255
  }
89940
90256
  }
89941
- if (c === '*') {
89942
- if (noEmpty && glob === '*')
89943
- re += starNoEmpty;
89944
- else
89945
- re += star;
89946
- hasMagic = true;
89947
- continue;
89948
- }
89949
90257
  if (c === '?') {
89950
90258
  re += qmark;
89951
90259
  hasMagic = true;
@@ -89957,6 +90265,7 @@ class AST {
89957
90265
  }
89958
90266
  }
89959
90267
  exports.AST = AST;
90268
+ _a = AST;
89960
90269
  //# sourceMappingURL=ast.js.map
89961
90270
 
89962
90271
  /***/ },
@@ -90111,10 +90420,8 @@ const parseClass = (glob, position) => {
90111
90420
  }
90112
90421
  const sranges = '[' + (negate ? '^' : '') + rangesToString(ranges) + ']';
90113
90422
  const snegs = '[' + (negate ? '' : '^') + rangesToString(negs) + ']';
90114
- const comb = ranges.length && negs.length
90115
- ? '(' + sranges + '|' + snegs + ')'
90116
- : ranges.length
90117
- ? sranges
90423
+ const comb = ranges.length && negs.length ? '(' + sranges + '|' + snegs + ')'
90424
+ : ranges.length ? sranges
90118
90425
  : snegs;
90119
90426
  return [comb, uflag, endPos - pos, true];
90120
90427
  };
@@ -90136,18 +90443,26 @@ exports.escape = void 0;
90136
90443
  /**
90137
90444
  * Escape all magic characters in a glob pattern.
90138
90445
  *
90139
- * If the {@link windowsPathsNoEscape | GlobOptions.windowsPathsNoEscape}
90446
+ * If the {@link MinimatchOptions.windowsPathsNoEscape}
90140
90447
  * option is used, then characters are escaped by wrapping in `[]`, because
90141
90448
  * a magic character wrapped in a character class can only be satisfied by
90142
90449
  * that exact character. In this mode, `\` is _not_ escaped, because it is
90143
90450
  * not interpreted as a magic character, but instead as a path separator.
90451
+ *
90452
+ * If the {@link MinimatchOptions.magicalBraces} option is used,
90453
+ * then braces (`{` and `}`) will be escaped.
90144
90454
  */
90145
- const escape = (s, { windowsPathsNoEscape = false, } = {}) => {
90455
+ const escape = (s, { windowsPathsNoEscape = false, magicalBraces = false, } = {}) => {
90146
90456
  // don't need to escape +@! because we escape the parens
90147
90457
  // that make those magic, and escaping ! as [!] isn't valid,
90148
90458
  // because [!]] is a valid glob class meaning not ']'.
90149
- return windowsPathsNoEscape
90150
- ? s.replace(/[?*()[\]]/g, '[$&]')
90459
+ if (magicalBraces) {
90460
+ return windowsPathsNoEscape ?
90461
+ s.replace(/[?*()[\]{}]/g, '[$&]')
90462
+ : s.replace(/[?*()[\]\\{}]/g, '\\$&');
90463
+ }
90464
+ return windowsPathsNoEscape ?
90465
+ s.replace(/[?*()[\]]/g, '[$&]')
90151
90466
  : s.replace(/[?*()[\]\\]/g, '\\$&');
90152
90467
  };
90153
90468
  exports.escape = escape;
@@ -90165,7 +90480,7 @@ exports.escape = escape;
90165
90480
 
90166
90481
  Object.defineProperty(exports, "__esModule", ({ value: true }));
90167
90482
  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;
90168
- const brace_expansion_1 = __webpack_require__(/*! @isaacs/brace-expansion */ "./node_modules/@isaacs/brace-expansion/dist/commonjs/index.js");
90483
+ const brace_expansion_1 = __webpack_require__(/*! brace-expansion */ "./node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js");
90169
90484
  const assert_valid_pattern_js_1 = __webpack_require__(/*! ./assert-valid-pattern.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js");
90170
90485
  const ast_js_1 = __webpack_require__(/*! ./ast.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js");
90171
90486
  const escape_js_1 = __webpack_require__(/*! ./escape.js */ "./node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js");
@@ -90231,8 +90546,8 @@ const qmarksTestNoExtDot = ([$0]) => {
90231
90546
  return (f) => f.length === len && f !== '.' && f !== '..';
90232
90547
  };
90233
90548
  /* c8 ignore start */
90234
- const defaultPlatform = (typeof process === 'object' && process
90235
- ? (typeof process.env === 'object' &&
90549
+ const defaultPlatform = (typeof process === 'object' && process ?
90550
+ (typeof process.env === 'object' &&
90236
90551
  process.env &&
90237
90552
  process.env.__MINIMATCH_TESTING_PLATFORM__) ||
90238
90553
  process.platform
@@ -90318,7 +90633,7 @@ const braceExpand = (pattern, options = {}) => {
90318
90633
  // shortcut. no need to expand.
90319
90634
  return [pattern];
90320
90635
  }
90321
- return (0, brace_expansion_1.expand)(pattern);
90636
+ return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax });
90322
90637
  };
90323
90638
  exports.braceExpand = braceExpand;
90324
90639
  exports.minimatch.braceExpand = exports.braceExpand;
@@ -90366,16 +90681,20 @@ class Minimatch {
90366
90681
  isWindows;
90367
90682
  platform;
90368
90683
  windowsNoMagicRoot;
90684
+ maxGlobstarRecursion;
90369
90685
  regexp;
90370
90686
  constructor(pattern, options = {}) {
90371
90687
  (0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
90372
90688
  options = options || {};
90373
90689
  this.options = options;
90690
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
90374
90691
  this.pattern = pattern;
90375
90692
  this.platform = options.platform || defaultPlatform;
90376
90693
  this.isWindows = this.platform === 'win32';
90694
+ // avoid the annoying deprecation flag lol
90695
+ const awe = ('allowWindow' + 'sEscape');
90377
90696
  this.windowsPathsNoEscape =
90378
- !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
90697
+ !!options.windowsPathsNoEscape || options[awe] === false;
90379
90698
  if (this.windowsPathsNoEscape) {
90380
90699
  this.pattern = this.pattern.replace(/\\/g, '/');
90381
90700
  }
@@ -90388,8 +90707,8 @@ class Minimatch {
90388
90707
  this.partial = !!options.partial;
90389
90708
  this.nocase = !!this.options.nocase;
90390
90709
  this.windowsNoMagicRoot =
90391
- options.windowsNoMagicRoot !== undefined
90392
- ? options.windowsNoMagicRoot
90710
+ options.windowsNoMagicRoot !== undefined ?
90711
+ options.windowsNoMagicRoot
90393
90712
  : !!(this.isWindows && this.nocase);
90394
90713
  this.globSet = [];
90395
90714
  this.globParts = [];
@@ -90452,7 +90771,10 @@ class Minimatch {
90452
90771
  !globMagic.test(s[3]);
90453
90772
  const isDrive = /^[a-z]:/i.test(s[0]);
90454
90773
  if (isUNC) {
90455
- return [...s.slice(0, 4), ...s.slice(4).map(ss => this.parse(ss))];
90774
+ return [
90775
+ ...s.slice(0, 4),
90776
+ ...s.slice(4).map(ss => this.parse(ss)),
90777
+ ];
90456
90778
  }
90457
90779
  else if (isDrive) {
90458
90780
  return [s[0], ...s.slice(1).map(ss => this.parse(ss))];
@@ -90484,7 +90806,7 @@ class Minimatch {
90484
90806
  // to the right as possible, even if it increases the number
90485
90807
  // of patterns that we have to process.
90486
90808
  preprocess(globParts) {
90487
- // if we're not in globstar mode, then turn all ** into *
90809
+ // if we're not in globstar mode, then turn ** into *
90488
90810
  if (this.options.noglobstar) {
90489
90811
  for (let i = 0; i < globParts.length; i++) {
90490
90812
  for (let j = 0; j < globParts[i].length; j++) {
@@ -90770,7 +91092,8 @@ class Minimatch {
90770
91092
  // out of pattern, then that's fine, as long as all
90771
91093
  // the parts match.
90772
91094
  matchOne(file, pattern, partial = false) {
90773
- const options = this.options;
91095
+ let fileStartIndex = 0;
91096
+ let patternStartIndex = 0;
90774
91097
  // UNC paths like //?/X:/... can match X:/... and vice versa
90775
91098
  // Drive letters in absolute drive or unc paths are always compared
90776
91099
  // case-insensitively.
@@ -90788,120 +91111,210 @@ class Minimatch {
90788
91111
  pattern[2] === '?' &&
90789
91112
  typeof pattern[3] === 'string' &&
90790
91113
  /^[a-z]:$/i.test(pattern[3]);
90791
- const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined;
90792
- const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined;
91114
+ const fdi = fileUNC ? 3
91115
+ : fileDrive ? 0
91116
+ : undefined;
91117
+ const pdi = patternUNC ? 3
91118
+ : patternDrive ? 0
91119
+ : undefined;
90793
91120
  if (typeof fdi === 'number' && typeof pdi === 'number') {
90794
- const [fd, pd] = [file[fdi], pattern[pdi]];
91121
+ const [fd, pd] = [
91122
+ file[fdi],
91123
+ pattern[pdi],
91124
+ ];
91125
+ // start matching at the drive letter index of each
90795
91126
  if (fd.toLowerCase() === pd.toLowerCase()) {
90796
91127
  pattern[pdi] = fd;
90797
- if (pdi > fdi) {
90798
- pattern = pattern.slice(pdi);
90799
- }
90800
- else if (fdi > pdi) {
90801
- file = file.slice(fdi);
90802
- }
91128
+ patternStartIndex = pdi;
91129
+ fileStartIndex = fdi;
90803
91130
  }
90804
91131
  }
90805
91132
  }
90806
91133
  // resolve and reduce . and .. portions in the file as well.
90807
- // dont' need to do the second phase, because it's only one string[]
91134
+ // don't need to do the second phase, because it's only one string[]
90808
91135
  const { optimizationLevel = 1 } = this.options;
90809
91136
  if (optimizationLevel >= 2) {
90810
91137
  file = this.levelTwoFileOptimize(file);
90811
91138
  }
90812
- this.debug('matchOne', this, { file, pattern });
90813
- this.debug('matchOne', file.length, pattern.length);
90814
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
91139
+ if (pattern.includes(exports.GLOBSTAR)) {
91140
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
91141
+ }
91142
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
91143
+ }
91144
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
91145
+ // split the pattern into head, tail, and middle of ** delimited parts
91146
+ const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
91147
+ const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
91148
+ // split the pattern up into globstar-delimited sections
91149
+ // the tail has to be at the end, and the others just have
91150
+ // to be found in order from the head.
91151
+ const [head, body, tail] = partial ? [
91152
+ pattern.slice(patternIndex, firstgs),
91153
+ pattern.slice(firstgs + 1),
91154
+ [],
91155
+ ] : [
91156
+ pattern.slice(patternIndex, firstgs),
91157
+ pattern.slice(firstgs + 1, lastgs),
91158
+ pattern.slice(lastgs + 1),
91159
+ ];
91160
+ // check the head, from the current file/pattern index.
91161
+ if (head.length) {
91162
+ const fileHead = file.slice(fileIndex, fileIndex + head.length);
91163
+ if (!this.#matchOne(fileHead, head, partial, 0, 0)) {
91164
+ return false;
91165
+ }
91166
+ fileIndex += head.length;
91167
+ patternIndex += head.length;
91168
+ }
91169
+ // now we know the head matches!
91170
+ // if the last portion is not empty, it MUST match the end
91171
+ // check the tail
91172
+ let fileTailMatch = 0;
91173
+ if (tail.length) {
91174
+ // if head + tail > file, then we cannot possibly match
91175
+ if (tail.length + fileIndex > file.length)
91176
+ return false;
91177
+ // try to match the tail
91178
+ let tailStart = file.length - tail.length;
91179
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
91180
+ fileTailMatch = tail.length;
91181
+ }
91182
+ else {
91183
+ // affordance for stuff like a/**/* matching a/b/
91184
+ // if the last file portion is '', and there's more to the pattern
91185
+ // then try without the '' bit.
91186
+ if (file[file.length - 1] !== '' ||
91187
+ fileIndex + tail.length === file.length) {
91188
+ return false;
91189
+ }
91190
+ tailStart--;
91191
+ if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
91192
+ return false;
91193
+ }
91194
+ fileTailMatch = tail.length + 1;
91195
+ }
91196
+ }
91197
+ // now we know the tail matches!
91198
+ // the middle is zero or more portions wrapped in **, possibly
91199
+ // containing more ** sections.
91200
+ // so a/**/b/**/c/**/d has become **/b/**/c/**
91201
+ // if it's empty, it means a/**/b, just verify we have no bad dots
91202
+ // if there's no tail, so it ends on /**, then we must have *something*
91203
+ // after the head, or it's not a matc
91204
+ if (!body.length) {
91205
+ let sawSome = !!fileTailMatch;
91206
+ for (let i = fileIndex; i < file.length - fileTailMatch; i++) {
91207
+ const f = String(file[i]);
91208
+ sawSome = true;
91209
+ if (f === '.' ||
91210
+ f === '..' ||
91211
+ (!this.options.dot && f.startsWith('.'))) {
91212
+ return false;
91213
+ }
91214
+ }
91215
+ // in partial mode, we just need to get past all file parts
91216
+ return partial || sawSome;
91217
+ }
91218
+ // now we know that there's one or more body sections, which can
91219
+ // be matched anywhere from the 0 index (because the head was pruned)
91220
+ // through to the length-fileTailMatch index.
91221
+ // split the body up into sections, and note the minimum index it can
91222
+ // be found at (start with the length of all previous segments)
91223
+ // [section, before, after]
91224
+ const bodySegments = [[[], 0]];
91225
+ let currentBody = bodySegments[0];
91226
+ let nonGsParts = 0;
91227
+ const nonGsPartsSums = [0];
91228
+ for (const b of body) {
91229
+ if (b === exports.GLOBSTAR) {
91230
+ nonGsPartsSums.push(nonGsParts);
91231
+ currentBody = [[], 0];
91232
+ bodySegments.push(currentBody);
91233
+ }
91234
+ else {
91235
+ currentBody[0].push(b);
91236
+ nonGsParts++;
91237
+ }
91238
+ }
91239
+ let i = bodySegments.length - 1;
91240
+ const fileLength = file.length - fileTailMatch;
91241
+ for (const b of bodySegments) {
91242
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
91243
+ }
91244
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
91245
+ }
91246
+ // return false for "nope, not matching"
91247
+ // return null for "not matching, cannot keep trying"
91248
+ #matchGlobStarBodySections(file,
91249
+ // pattern section, last possible position for it
91250
+ bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
91251
+ // take the first body segment, and walk from fileIndex to its "after"
91252
+ // value at the end
91253
+ // If it doesn't match at that position, we increment, until we hit
91254
+ // that final possible position, and give up.
91255
+ // If it does match, then advance and try to rest.
91256
+ // If any of them fail we keep walking forward.
91257
+ // this is still a bit recursively painful, but it's more constrained
91258
+ // than previous implementations, because we never test something that
91259
+ // can't possibly be a valid matching condition.
91260
+ const bs = bodySegments[bodyIndex];
91261
+ if (!bs) {
91262
+ // just make sure that there's no bad dots
91263
+ for (let i = fileIndex; i < file.length; i++) {
91264
+ sawTail = true;
91265
+ const f = file[i];
91266
+ if (f === '.' ||
91267
+ f === '..' ||
91268
+ (!this.options.dot && f.startsWith('.'))) {
91269
+ return false;
91270
+ }
91271
+ }
91272
+ return sawTail;
91273
+ }
91274
+ // have a non-globstar body section to test
91275
+ const [body, after] = bs;
91276
+ while (fileIndex <= after) {
91277
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
91278
+ // if limit exceeded, no match. intentional false negative,
91279
+ // acceptable break in correctness for security.
91280
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
91281
+ // match! see if the rest match. if so, we're done!
91282
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
91283
+ if (sub !== false) {
91284
+ return sub;
91285
+ }
91286
+ }
91287
+ const f = file[fileIndex];
91288
+ if (f === '.' ||
91289
+ f === '..' ||
91290
+ (!this.options.dot && f.startsWith('.'))) {
91291
+ return false;
91292
+ }
91293
+ fileIndex++;
91294
+ }
91295
+ // walked off. no point continuing
91296
+ return partial || null;
91297
+ }
91298
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
91299
+ let fi;
91300
+ let pi;
91301
+ let pl;
91302
+ let fl;
91303
+ for (fi = fileIndex,
91304
+ pi = patternIndex,
91305
+ fl = file.length,
91306
+ pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
90815
91307
  this.debug('matchOne loop');
90816
- var p = pattern[pi];
90817
- var f = file[fi];
91308
+ let p = pattern[pi];
91309
+ let f = file[fi];
90818
91310
  this.debug(pattern, p, f);
90819
91311
  // should be impossible.
90820
91312
  // some invalid regexp stuff in the set.
90821
91313
  /* c8 ignore start */
90822
- if (p === false) {
91314
+ if (p === false || p === exports.GLOBSTAR) {
90823
91315
  return false;
90824
91316
  }
90825
91317
  /* c8 ignore stop */
90826
- if (p === exports.GLOBSTAR) {
90827
- this.debug('GLOBSTAR', [pattern, p, f]);
90828
- // "**"
90829
- // a/**/b/**/c would match the following:
90830
- // a/b/x/y/z/c
90831
- // a/x/y/z/b/c
90832
- // a/b/x/b/x/c
90833
- // a/b/c
90834
- // To do this, take the rest of the pattern after
90835
- // the **, and see if it would match the file remainder.
90836
- // If so, return success.
90837
- // If not, the ** "swallows" a segment, and try again.
90838
- // This is recursively awful.
90839
- //
90840
- // a/**/b/**/c matching a/b/x/y/z/c
90841
- // - a matches a
90842
- // - doublestar
90843
- // - matchOne(b/x/y/z/c, b/**/c)
90844
- // - b matches b
90845
- // - doublestar
90846
- // - matchOne(x/y/z/c, c) -> no
90847
- // - matchOne(y/z/c, c) -> no
90848
- // - matchOne(z/c, c) -> no
90849
- // - matchOne(c, c) yes, hit
90850
- var fr = fi;
90851
- var pr = pi + 1;
90852
- if (pr === pl) {
90853
- this.debug('** at the end');
90854
- // a ** at the end will just swallow the rest.
90855
- // We have found a match.
90856
- // however, it will not swallow /.x, unless
90857
- // options.dot is set.
90858
- // . and .. are *never* matched by **, for explosively
90859
- // exponential reasons.
90860
- for (; fi < fl; fi++) {
90861
- if (file[fi] === '.' ||
90862
- file[fi] === '..' ||
90863
- (!options.dot && file[fi].charAt(0) === '.'))
90864
- return false;
90865
- }
90866
- return true;
90867
- }
90868
- // ok, let's see if we can swallow whatever we can.
90869
- while (fr < fl) {
90870
- var swallowee = file[fr];
90871
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee);
90872
- // XXX remove this slice. Just pass the start index.
90873
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
90874
- this.debug('globstar found match!', fr, fl, swallowee);
90875
- // found a match.
90876
- return true;
90877
- }
90878
- else {
90879
- // can't swallow "." or ".." ever.
90880
- // can only swallow ".foo" when explicitly asked.
90881
- if (swallowee === '.' ||
90882
- swallowee === '..' ||
90883
- (!options.dot && swallowee.charAt(0) === '.')) {
90884
- this.debug('dot detected!', file, fr, pattern, pr);
90885
- break;
90886
- }
90887
- // ** swallows a segment, and continue.
90888
- this.debug('globstar swallow a segment, and continue');
90889
- fr++;
90890
- }
90891
- }
90892
- // no match was found.
90893
- // However, in partial mode, we can't say this is necessarily over.
90894
- /* c8 ignore start */
90895
- if (partial) {
90896
- // ran out of file
90897
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr);
90898
- if (fr === fl) {
90899
- return true;
90900
- }
90901
- }
90902
- /* c8 ignore stop */
90903
- return false;
90904
- }
90905
91318
  // something other than **
90906
91319
  // non-magic patterns just have to match exactly
90907
91320
  // patterns with magic have been turned into regexps.
@@ -90972,21 +91385,19 @@ class Minimatch {
90972
91385
  fastTest = options.dot ? starTestDot : starTest;
90973
91386
  }
90974
91387
  else if ((m = pattern.match(starDotExtRE))) {
90975
- fastTest = (options.nocase
90976
- ? options.dot
90977
- ? starDotExtTestNocaseDot
91388
+ fastTest = (options.nocase ?
91389
+ options.dot ?
91390
+ starDotExtTestNocaseDot
90978
91391
  : starDotExtTestNocase
90979
- : options.dot
90980
- ? starDotExtTestDot
91392
+ : options.dot ? starDotExtTestDot
90981
91393
  : starDotExtTest)(m[1]);
90982
91394
  }
90983
91395
  else if ((m = pattern.match(qmarksRE))) {
90984
- fastTest = (options.nocase
90985
- ? options.dot
90986
- ? qmarksTestNocaseDot
91396
+ fastTest = (options.nocase ?
91397
+ options.dot ?
91398
+ qmarksTestNocaseDot
90987
91399
  : qmarksTestNocase
90988
- : options.dot
90989
- ? qmarksTestDot
91400
+ : options.dot ? qmarksTestDot
90990
91401
  : qmarksTest)(m);
90991
91402
  }
90992
91403
  else if ((m = pattern.match(starDotStarRE))) {
@@ -91017,10 +91428,8 @@ class Minimatch {
91017
91428
  return this.regexp;
91018
91429
  }
91019
91430
  const options = this.options;
91020
- const twoStar = options.noglobstar
91021
- ? star
91022
- : options.dot
91023
- ? twoStarDot
91431
+ const twoStar = options.noglobstar ? star
91432
+ : options.dot ? twoStarDot
91024
91433
  : twoStarNoDot;
91025
91434
  const flags = new Set(options.nocase ? ['i'] : []);
91026
91435
  // regexpify non-globstar patterns
@@ -91036,11 +91445,9 @@ class Minimatch {
91036
91445
  for (const f of p.flags.split(''))
91037
91446
  flags.add(f);
91038
91447
  }
91039
- return typeof p === 'string'
91040
- ? regExpEscape(p)
91041
- : p === exports.GLOBSTAR
91042
- ? exports.GLOBSTAR
91043
- : p._src;
91448
+ return (typeof p === 'string' ? regExpEscape(p)
91449
+ : p === exports.GLOBSTAR ? exports.GLOBSTAR
91450
+ : p._src);
91044
91451
  });
91045
91452
  pp.forEach((p, i) => {
91046
91453
  const next = pp[i + 1];
@@ -91057,14 +91464,25 @@ class Minimatch {
91057
91464
  }
91058
91465
  }
91059
91466
  else if (next === undefined) {
91060
- pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?';
91467
+ pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + ')?';
91061
91468
  }
91062
91469
  else if (next !== exports.GLOBSTAR) {
91063
91470
  pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next;
91064
91471
  pp[i + 1] = exports.GLOBSTAR;
91065
91472
  }
91066
91473
  });
91067
- return pp.filter(p => p !== exports.GLOBSTAR).join('/');
91474
+ const filtered = pp.filter(p => p !== exports.GLOBSTAR);
91475
+ // For partial matches, we need to make the pattern match
91476
+ // any prefix of the full path. We do this by generating
91477
+ // alternative patterns that match progressively longer prefixes.
91478
+ if (this.partial && filtered.length >= 1) {
91479
+ const prefixes = [];
91480
+ for (let i = 1; i <= filtered.length; i++) {
91481
+ prefixes.push(filtered.slice(0, i).join('/'));
91482
+ }
91483
+ return '(?:' + prefixes.join('|') + ')';
91484
+ }
91485
+ return filtered.join('/');
91068
91486
  })
91069
91487
  .join('|');
91070
91488
  // need to wrap in parens if we had more than one thing with |,
@@ -91073,6 +91491,10 @@ class Minimatch {
91073
91491
  // must match entire pattern
91074
91492
  // ending in a * or ** will make it less strict.
91075
91493
  re = '^' + open + re + close + '$';
91494
+ // In partial mode, '/' should always match as it's a valid prefix for any pattern
91495
+ if (this.partial) {
91496
+ re = '^(?:\\/|' + open + re.slice(1, -1) + close + ')$';
91497
+ }
91076
91498
  // can match anything, as long as it's not this.
91077
91499
  if (this.negate)
91078
91500
  re = '^(?!' + re + ').+$';
@@ -91192,21 +91614,35 @@ exports.unescape = void 0;
91192
91614
  /**
91193
91615
  * Un-escape a string that has been escaped with {@link escape}.
91194
91616
  *
91195
- * If the {@link windowsPathsNoEscape} option is used, then square-brace
91196
- * escapes are removed, but not backslash escapes. For example, it will turn
91197
- * the string `'[*]'` into `*`, but it will not turn `'\\*'` into `'*'`,
91198
- * becuase `\` is a path separator in `windowsPathsNoEscape` mode.
91617
+ * If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
91618
+ * square-bracket escapes are removed, but not backslash escapes.
91199
91619
  *
91200
- * When `windowsPathsNoEscape` is not set, then both brace escapes and
91620
+ * For example, it will turn the string `'[*]'` into `*`, but it will not
91621
+ * turn `'\\*'` into `'*'`, because `\` is a path separator in
91622
+ * `windowsPathsNoEscape` mode.
91623
+ *
91624
+ * When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
91201
91625
  * backslash escapes are removed.
91202
91626
  *
91203
91627
  * Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
91204
91628
  * or unescaped.
91629
+ *
91630
+ * When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
91631
+ * unescaped.
91205
91632
  */
91206
- const unescape = (s, { windowsPathsNoEscape = false, } = {}) => {
91207
- return windowsPathsNoEscape
91208
- ? s.replace(/\[([^\/\\])\]/g, '$1')
91209
- : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2').replace(/\\([^\/])/g, '$1');
91633
+ const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true, } = {}) => {
91634
+ if (magicalBraces) {
91635
+ return windowsPathsNoEscape ?
91636
+ s.replace(/\[([^\/\\])\]/g, '$1')
91637
+ : s
91638
+ .replace(/((?!\\).|^)\[([^\/\\])\]/g, '$1$2')
91639
+ .replace(/\\([^\/])/g, '$1');
91640
+ }
91641
+ return windowsPathsNoEscape ?
91642
+ s.replace(/\[([^\/\\{}])\]/g, '$1')
91643
+ : s
91644
+ .replace(/((?!\\).|^)\[([^\/\\{}])\]/g, '$1$2')
91645
+ .replace(/\\([^\/{}])/g, '$1');
91210
91646
  };
91211
91647
  exports.unescape = unescape;
91212
91648
  //# sourceMappingURL=unescape.js.map