@sentry/craft 2.24.2 → 2.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/craft +2087 -791
  2. package/package.json +6 -4
package/dist/craft CHANGED
@@ -104254,7 +104254,7 @@ var init_storage = __esm({
104254
104254
  }
104255
104255
  });
104256
104256
 
104257
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/util.js
104257
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/util.js
104258
104258
  function getAllMatches(string, regex2) {
104259
104259
  const matches = [];
104260
104260
  let match2 = regex2.exec(string);
@@ -104273,9 +104273,9 @@ function getAllMatches(string, regex2) {
104273
104273
  function isExist(v9) {
104274
104274
  return typeof v9 !== "undefined";
104275
104275
  }
104276
- var nameStartChar, nameChar, nameRegexp, regexName, isName;
104276
+ var nameStartChar, nameChar, nameRegexp, regexName, isName, DANGEROUS_PROPERTY_NAMES, criticalProperties;
104277
104277
  var init_util5 = __esm({
104278
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/util.js"() {
104278
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/util.js"() {
104279
104279
  "use strict";
104280
104280
  init_import_meta_url();
104281
104281
  nameStartChar = ":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";
@@ -104286,10 +104286,23 @@ var init_util5 = __esm({
104286
104286
  const match2 = regexName.exec(string);
104287
104287
  return !(match2 === null || typeof match2 === "undefined");
104288
104288
  };
104289
+ DANGEROUS_PROPERTY_NAMES = [
104290
+ // '__proto__',
104291
+ // 'constructor',
104292
+ // 'prototype',
104293
+ "hasOwnProperty",
104294
+ "toString",
104295
+ "valueOf",
104296
+ "__defineGetter__",
104297
+ "__defineSetter__",
104298
+ "__lookupGetter__",
104299
+ "__lookupSetter__"
104300
+ ];
104301
+ criticalProperties = ["__proto__", "constructor", "prototype"];
104289
104302
  }
104290
104303
  });
104291
104304
 
104292
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/validator.js
104305
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/validator.js
104293
104306
  function validate3(xmlData, options) {
104294
104307
  options = Object.assign({}, defaultOptions2, options);
104295
104308
  const tags = [];
@@ -104588,7 +104601,7 @@ function getPositionFromMatch(match2) {
104588
104601
  }
104589
104602
  var defaultOptions2, doubleQuote, singleQuote, validAttrStrRegxp;
104590
104603
  var init_validator = __esm({
104591
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/validator.js"() {
104604
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/validator.js"() {
104592
104605
  "use strict";
104593
104606
  init_import_meta_url();
104594
104607
  init_util5();
@@ -104603,7 +104616,23 @@ var init_validator = __esm({
104603
104616
  }
104604
104617
  });
104605
104618
 
104606
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
104619
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
104620
+ function validatePropertyName(propertyName, optionName) {
104621
+ if (typeof propertyName !== "string") {
104622
+ return;
104623
+ }
104624
+ const normalized = propertyName.toLowerCase();
104625
+ if (DANGEROUS_PROPERTY_NAMES.some((dangerous) => normalized === dangerous.toLowerCase())) {
104626
+ throw new Error(
104627
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
104628
+ );
104629
+ }
104630
+ if (criticalProperties.some((dangerous) => normalized === dangerous.toLowerCase())) {
104631
+ throw new Error(
104632
+ `[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`
104633
+ );
104634
+ }
104635
+ }
104607
104636
  function normalizeProcessEntities(value) {
104608
104637
  if (typeof value === "boolean") {
104609
104638
  return {
@@ -104613,6 +104642,7 @@ function normalizeProcessEntities(value) {
104613
104642
  maxExpansionDepth: 10,
104614
104643
  maxTotalExpansions: 1e3,
104615
104644
  maxExpandedLength: 1e5,
104645
+ maxEntityCount: 100,
104616
104646
  allowedTags: null,
104617
104647
  tagFilter: null
104618
104648
  };
@@ -104620,21 +104650,28 @@ function normalizeProcessEntities(value) {
104620
104650
  if (typeof value === "object" && value !== null) {
104621
104651
  return {
104622
104652
  enabled: value.enabled !== false,
104623
- // default true if not specified
104624
- maxEntitySize: value.maxEntitySize ?? 1e4,
104625
- maxExpansionDepth: value.maxExpansionDepth ?? 10,
104626
- maxTotalExpansions: value.maxTotalExpansions ?? 1e3,
104627
- maxExpandedLength: value.maxExpandedLength ?? 1e5,
104653
+ maxEntitySize: Math.max(1, value.maxEntitySize ?? 1e4),
104654
+ maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10),
104655
+ maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? 1e3),
104656
+ maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
104657
+ maxEntityCount: Math.max(1, value.maxEntityCount ?? 100),
104628
104658
  allowedTags: value.allowedTags ?? null,
104629
104659
  tagFilter: value.tagFilter ?? null
104630
104660
  };
104631
104661
  }
104632
104662
  return normalizeProcessEntities(true);
104633
104663
  }
104634
- var defaultOptions3, buildOptions;
104664
+ var defaultOnDangerousProperty, defaultOptions3, buildOptions;
104635
104665
  var init_OptionsBuilder = __esm({
104636
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"() {
104666
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js"() {
104637
104667
  init_import_meta_url();
104668
+ init_util5();
104669
+ defaultOnDangerousProperty = (name) => {
104670
+ if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
104671
+ return "__" + name;
104672
+ }
104673
+ return name;
104674
+ };
104638
104675
  defaultOptions3 = {
104639
104676
  preserveOrder: false,
104640
104677
  attributeNamePrefix: "@_",
@@ -104679,20 +104716,47 @@ var init_OptionsBuilder = __esm({
104679
104716
  },
104680
104717
  // skipEmptyListItem: false
104681
104718
  captureMetaData: false,
104682
- maxNestedTags: 100
104719
+ maxNestedTags: 100,
104720
+ strictReservedNames: true,
104721
+ jPath: true,
104722
+ // if true, pass jPath string to callbacks; if false, pass matcher instance
104723
+ onDangerousProperty: defaultOnDangerousProperty
104683
104724
  };
104684
104725
  buildOptions = function(options) {
104685
104726
  const built = Object.assign({}, defaultOptions3, options);
104727
+ const propertyNameOptions = [
104728
+ { value: built.attributeNamePrefix, name: "attributeNamePrefix" },
104729
+ { value: built.attributesGroupName, name: "attributesGroupName" },
104730
+ { value: built.textNodeName, name: "textNodeName" },
104731
+ { value: built.cdataPropName, name: "cdataPropName" },
104732
+ { value: built.commentPropName, name: "commentPropName" }
104733
+ ];
104734
+ for (const { value, name } of propertyNameOptions) {
104735
+ if (value) {
104736
+ validatePropertyName(value, name);
104737
+ }
104738
+ }
104739
+ if (built.onDangerousProperty === null) {
104740
+ built.onDangerousProperty = defaultOnDangerousProperty;
104741
+ }
104686
104742
  built.processEntities = normalizeProcessEntities(built.processEntities);
104743
+ if (built.stopNodes && Array.isArray(built.stopNodes)) {
104744
+ built.stopNodes = built.stopNodes.map((node2) => {
104745
+ if (typeof node2 === "string" && node2.startsWith("*.")) {
104746
+ return ".." + node2.substring(2);
104747
+ }
104748
+ return node2;
104749
+ });
104750
+ }
104687
104751
  return built;
104688
104752
  };
104689
104753
  }
104690
104754
  });
104691
104755
 
104692
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
104756
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
104693
104757
  var METADATA_SYMBOL, XmlNode;
104694
104758
  var init_xmlNode = __esm({
104695
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"() {
104759
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js"() {
104696
104760
  "use strict";
104697
104761
  init_import_meta_url();
104698
104762
  if (typeof Symbol !== "function") {
@@ -104729,7 +104793,7 @@ var init_xmlNode = __esm({
104729
104793
  }
104730
104794
  });
104731
104795
 
104732
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
104796
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
104733
104797
  function hasSeq(data2, seq2, i4) {
104734
104798
  for (let j6 = 0; j6 < seq2.length; j6++) {
104735
104799
  if (seq2[j6] !== data2[i4 + j6 + 1]) return false;
@@ -104744,7 +104808,7 @@ function validateEntityName(name) {
104744
104808
  }
104745
104809
  var DocTypeReader, skipWhitespace;
104746
104810
  var init_DocTypeReader = __esm({
104747
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"() {
104811
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js"() {
104748
104812
  init_import_meta_url();
104749
104813
  init_util5();
104750
104814
  DocTypeReader = class {
@@ -104754,6 +104818,7 @@ var init_DocTypeReader = __esm({
104754
104818
  }
104755
104819
  readDocType(xmlData, i4) {
104756
104820
  const entities = /* @__PURE__ */ Object.create(null);
104821
+ let entityCount = 0;
104757
104822
  if (xmlData[i4 + 3] === "O" && xmlData[i4 + 4] === "C" && xmlData[i4 + 5] === "T" && xmlData[i4 + 6] === "Y" && xmlData[i4 + 7] === "P" && xmlData[i4 + 8] === "E") {
104758
104823
  i4 = i4 + 9;
104759
104824
  let angleBracketsCount = 1;
@@ -104766,11 +104831,17 @@ var init_DocTypeReader = __esm({
104766
104831
  let entityName, val;
104767
104832
  [entityName, val, i4] = this.readEntityExp(xmlData, i4 + 1, this.suppressValidationErr);
104768
104833
  if (val.indexOf("&") === -1) {
104769
- const escaped = entityName.replace(/[.\-+*:]/g, "\\.");
104834
+ if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
104835
+ throw new Error(
104836
+ `Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
104837
+ );
104838
+ }
104839
+ const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
104770
104840
  entities[entityName] = {
104771
104841
  regx: RegExp(`&${escaped};`, "g"),
104772
104842
  val
104773
104843
  };
104844
+ entityCount++;
104774
104845
  }
104775
104846
  } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i4)) {
104776
104847
  i4 += 8;
@@ -104814,11 +104885,11 @@ var init_DocTypeReader = __esm({
104814
104885
  }
104815
104886
  readEntityExp(xmlData, i4) {
104816
104887
  i4 = skipWhitespace(xmlData, i4);
104817
- let entityName = "";
104888
+ const startIndex = i4;
104818
104889
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4]) && xmlData[i4] !== '"' && xmlData[i4] !== "'") {
104819
- entityName += xmlData[i4];
104820
104890
  i4++;
104821
104891
  }
104892
+ let entityName = xmlData.substring(startIndex, i4);
104822
104893
  validateEntityName(entityName);
104823
104894
  i4 = skipWhitespace(xmlData, i4);
104824
104895
  if (!this.suppressValidationErr) {
@@ -104830,7 +104901,7 @@ var init_DocTypeReader = __esm({
104830
104901
  }
104831
104902
  let entityValue = "";
104832
104903
  [i4, entityValue] = this.readIdentifierVal(xmlData, i4, "entity");
104833
- if (this.options.enabled !== false && this.options.maxEntitySize && entityValue.length > this.options.maxEntitySize) {
104904
+ if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
104834
104905
  throw new Error(
104835
104906
  `Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
104836
104907
  );
@@ -104840,11 +104911,11 @@ var init_DocTypeReader = __esm({
104840
104911
  }
104841
104912
  readNotationExp(xmlData, i4) {
104842
104913
  i4 = skipWhitespace(xmlData, i4);
104843
- let notationName = "";
104914
+ const startIndex = i4;
104844
104915
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104845
- notationName += xmlData[i4];
104846
104916
  i4++;
104847
104917
  }
104918
+ let notationName = xmlData.substring(startIndex, i4);
104848
104919
  !this.suppressValidationErr && validateEntityName(notationName);
104849
104920
  i4 = skipWhitespace(xmlData, i4);
104850
104921
  const identifierType = xmlData.substring(i4, i4 + 6).toUpperCase();
@@ -104876,10 +104947,11 @@ var init_DocTypeReader = __esm({
104876
104947
  throw new Error(`Expected quoted string, found "${startChar}"`);
104877
104948
  }
104878
104949
  i4++;
104950
+ const startIndex = i4;
104879
104951
  while (i4 < xmlData.length && xmlData[i4] !== startChar) {
104880
- identifierVal += xmlData[i4];
104881
104952
  i4++;
104882
104953
  }
104954
+ identifierVal = xmlData.substring(startIndex, i4);
104883
104955
  if (xmlData[i4] !== startChar) {
104884
104956
  throw new Error(`Unterminated ${type2} value`);
104885
104957
  }
@@ -104888,11 +104960,11 @@ var init_DocTypeReader = __esm({
104888
104960
  }
104889
104961
  readElementExp(xmlData, i4) {
104890
104962
  i4 = skipWhitespace(xmlData, i4);
104891
- let elementName = "";
104963
+ const startIndex = i4;
104892
104964
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104893
- elementName += xmlData[i4];
104894
104965
  i4++;
104895
104966
  }
104967
+ let elementName = xmlData.substring(startIndex, i4);
104896
104968
  if (!this.suppressValidationErr && !isName(elementName)) {
104897
104969
  throw new Error(`Invalid element name: "${elementName}"`);
104898
104970
  }
@@ -104902,10 +104974,11 @@ var init_DocTypeReader = __esm({
104902
104974
  else if (xmlData[i4] === "A" && hasSeq(xmlData, "NY", i4)) i4 += 2;
104903
104975
  else if (xmlData[i4] === "(") {
104904
104976
  i4++;
104977
+ const startIndex2 = i4;
104905
104978
  while (i4 < xmlData.length && xmlData[i4] !== ")") {
104906
- contentModel += xmlData[i4];
104907
104979
  i4++;
104908
104980
  }
104981
+ contentModel = xmlData.substring(startIndex2, i4);
104909
104982
  if (xmlData[i4] !== ")") {
104910
104983
  throw new Error("Unterminated content model");
104911
104984
  }
@@ -104920,18 +104993,18 @@ var init_DocTypeReader = __esm({
104920
104993
  }
104921
104994
  readAttlistExp(xmlData, i4) {
104922
104995
  i4 = skipWhitespace(xmlData, i4);
104923
- let elementName = "";
104996
+ let startIndex = i4;
104924
104997
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104925
- elementName += xmlData[i4];
104926
104998
  i4++;
104927
104999
  }
105000
+ let elementName = xmlData.substring(startIndex, i4);
104928
105001
  validateEntityName(elementName);
104929
105002
  i4 = skipWhitespace(xmlData, i4);
104930
- let attributeName = "";
105003
+ startIndex = i4;
104931
105004
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104932
- attributeName += xmlData[i4];
104933
105005
  i4++;
104934
105006
  }
105007
+ let attributeName = xmlData.substring(startIndex, i4);
104935
105008
  if (!validateEntityName(attributeName)) {
104936
105009
  throw new Error(`Invalid attribute name: "${attributeName}"`);
104937
105010
  }
@@ -104947,11 +105020,11 @@ var init_DocTypeReader = __esm({
104947
105020
  i4++;
104948
105021
  let allowedNotations = [];
104949
105022
  while (i4 < xmlData.length && xmlData[i4] !== ")") {
104950
- let notation = "";
105023
+ const startIndex2 = i4;
104951
105024
  while (i4 < xmlData.length && xmlData[i4] !== "|" && xmlData[i4] !== ")") {
104952
- notation += xmlData[i4];
104953
105025
  i4++;
104954
105026
  }
105027
+ let notation = xmlData.substring(startIndex2, i4);
104955
105028
  notation = notation.trim();
104956
105029
  if (!validateEntityName(notation)) {
104957
105030
  throw new Error(`Invalid notation name: "${notation}"`);
@@ -104968,10 +105041,11 @@ var init_DocTypeReader = __esm({
104968
105041
  i4++;
104969
105042
  attributeType += " (" + allowedNotations.join("|") + ")";
104970
105043
  } else {
105044
+ const startIndex2 = i4;
104971
105045
  while (i4 < xmlData.length && !/\s/.test(xmlData[i4])) {
104972
- attributeType += xmlData[i4];
104973
105046
  i4++;
104974
105047
  }
105048
+ attributeType += xmlData.substring(startIndex2, i4);
104975
105049
  const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
104976
105050
  if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
104977
105051
  throw new Error(`Invalid attribute type: "${attributeType}"`);
@@ -105006,7 +105080,7 @@ var init_DocTypeReader = __esm({
105006
105080
  }
105007
105081
  });
105008
105082
 
105009
- // node_modules/.pnpm/strnum@2.1.2/node_modules/strnum/strnum.js
105083
+ // node_modules/.pnpm/strnum@2.2.1/node_modules/strnum/strnum.js
105010
105084
  function toNumber2(str2, options = {}) {
105011
105085
  options = Object.assign({}, consider, options);
105012
105086
  if (!str2 || typeof str2 !== "string") return str2;
@@ -105015,6 +105089,8 @@ function toNumber2(str2, options = {}) {
105015
105089
  else if (str2 === "0") return 0;
105016
105090
  else if (options.hex && hexRegex.test(trimmedStr)) {
105017
105091
  return parse_int(trimmedStr, 16);
105092
+ } else if (!isFinite(trimmedStr)) {
105093
+ return handleInfinity(str2, Number(trimmedStr), options);
105018
105094
  } else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
105019
105095
  return resolveEnotation(str2, trimmedStr, options);
105020
105096
  } else {
@@ -105068,10 +105144,14 @@ function resolveEnotation(str2, trimmedStr, options) {
105068
105144
  if (leadingZeros.length > 1 && eAdjacentToLeadingZeros) return str2;
105069
105145
  else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) {
105070
105146
  return Number(trimmedStr);
105071
- } else if (options.leadingZeros && !eAdjacentToLeadingZeros) {
105072
- trimmedStr = (notation[1] || "") + notation[3];
105147
+ } else if (leadingZeros.length > 0) {
105148
+ if (options.leadingZeros && !eAdjacentToLeadingZeros) {
105149
+ trimmedStr = (notation[1] || "") + notation[3];
105150
+ return Number(trimmedStr);
105151
+ } else return str2;
105152
+ } else {
105073
105153
  return Number(trimmedStr);
105074
- } else return str2;
105154
+ }
105075
105155
  } else {
105076
105156
  return str2;
105077
105157
  }
@@ -105092,9 +105172,24 @@ function parse_int(numStr, base) {
105092
105172
  else if (window && window.parseInt) return window.parseInt(numStr, base);
105093
105173
  else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
105094
105174
  }
105175
+ function handleInfinity(str2, num, options) {
105176
+ const isPositive = num === Infinity;
105177
+ switch (options.infinity.toLowerCase()) {
105178
+ case "null":
105179
+ return null;
105180
+ case "infinity":
105181
+ return num;
105182
+ // Return Infinity or -Infinity
105183
+ case "string":
105184
+ return isPositive ? "Infinity" : "-Infinity";
105185
+ case "original":
105186
+ default:
105187
+ return str2;
105188
+ }
105189
+ }
105095
105190
  var hexRegex, numRegex, consider, eNotationRegx;
105096
105191
  var init_strnum = __esm({
105097
- "node_modules/.pnpm/strnum@2.1.2/node_modules/strnum/strnum.js"() {
105192
+ "node_modules/.pnpm/strnum@2.2.1/node_modules/strnum/strnum.js"() {
105098
105193
  init_import_meta_url();
105099
105194
  hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
105100
105195
  numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
@@ -105103,14 +105198,16 @@ var init_strnum = __esm({
105103
105198
  // oct: false,
105104
105199
  leadingZeros: true,
105105
105200
  decimalPoint: ".",
105106
- eNotation: true
105107
- //skipLike: /regex/
105201
+ eNotation: true,
105202
+ //skipLike: /regex/,
105203
+ infinity: "original"
105204
+ // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
105108
105205
  };
105109
105206
  eNotationRegx = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
105110
105207
  }
105111
105208
  });
105112
105209
 
105113
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/ignoreAttributes.js
105210
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/ignoreAttributes.js
105114
105211
  function getIgnoreAttributesFn(ignoreAttributes) {
105115
105212
  if (typeof ignoreAttributes === "function") {
105116
105213
  return ignoreAttributes;
@@ -105130,12 +105227,532 @@ function getIgnoreAttributesFn(ignoreAttributes) {
105130
105227
  return () => false;
105131
105228
  }
105132
105229
  var init_ignoreAttributes = __esm({
105133
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/ignoreAttributes.js"() {
105230
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/ignoreAttributes.js"() {
105231
+ init_import_meta_url();
105232
+ }
105233
+ });
105234
+
105235
+ // node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Expression.js
105236
+ var Expression;
105237
+ var init_Expression = __esm({
105238
+ "node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Expression.js"() {
105239
+ init_import_meta_url();
105240
+ Expression = class {
105241
+ /**
105242
+ * Create a new Expression
105243
+ * @param {string} pattern - Pattern string (e.g., "root.users.user", "..user[id]")
105244
+ * @param {Object} options - Configuration options
105245
+ * @param {string} options.separator - Path separator (default: '.')
105246
+ */
105247
+ constructor(pattern, options = {}) {
105248
+ this.pattern = pattern;
105249
+ this.separator = options.separator || ".";
105250
+ this.segments = this._parse(pattern);
105251
+ this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
105252
+ this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
105253
+ this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
105254
+ }
105255
+ /**
105256
+ * Parse pattern string into segments
105257
+ * @private
105258
+ * @param {string} pattern - Pattern to parse
105259
+ * @returns {Array} Array of segment objects
105260
+ */
105261
+ _parse(pattern) {
105262
+ const segments = [];
105263
+ let i4 = 0;
105264
+ let currentPart = "";
105265
+ while (i4 < pattern.length) {
105266
+ if (pattern[i4] === this.separator) {
105267
+ if (i4 + 1 < pattern.length && pattern[i4 + 1] === this.separator) {
105268
+ if (currentPart.trim()) {
105269
+ segments.push(this._parseSegment(currentPart.trim()));
105270
+ currentPart = "";
105271
+ }
105272
+ segments.push({ type: "deep-wildcard" });
105273
+ i4 += 2;
105274
+ } else {
105275
+ if (currentPart.trim()) {
105276
+ segments.push(this._parseSegment(currentPart.trim()));
105277
+ }
105278
+ currentPart = "";
105279
+ i4++;
105280
+ }
105281
+ } else {
105282
+ currentPart += pattern[i4];
105283
+ i4++;
105284
+ }
105285
+ }
105286
+ if (currentPart.trim()) {
105287
+ segments.push(this._parseSegment(currentPart.trim()));
105288
+ }
105289
+ return segments;
105290
+ }
105291
+ /**
105292
+ * Parse a single segment
105293
+ * @private
105294
+ * @param {string} part - Segment string (e.g., "user", "ns::user", "user[id]", "ns::user:first")
105295
+ * @returns {Object} Segment object
105296
+ */
105297
+ _parseSegment(part) {
105298
+ const segment = { type: "tag" };
105299
+ let bracketContent = null;
105300
+ let withoutBrackets = part;
105301
+ const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
105302
+ if (bracketMatch) {
105303
+ withoutBrackets = bracketMatch[1] + bracketMatch[3];
105304
+ if (bracketMatch[2]) {
105305
+ const content = bracketMatch[2].slice(1, -1);
105306
+ if (content) {
105307
+ bracketContent = content;
105308
+ }
105309
+ }
105310
+ }
105311
+ let namespace = void 0;
105312
+ let tagAndPosition = withoutBrackets;
105313
+ if (withoutBrackets.includes("::")) {
105314
+ const nsIndex = withoutBrackets.indexOf("::");
105315
+ namespace = withoutBrackets.substring(0, nsIndex).trim();
105316
+ tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
105317
+ if (!namespace) {
105318
+ throw new Error(`Invalid namespace in pattern: ${part}`);
105319
+ }
105320
+ }
105321
+ let tag2 = void 0;
105322
+ let positionMatch = null;
105323
+ if (tagAndPosition.includes(":")) {
105324
+ const colonIndex = tagAndPosition.lastIndexOf(":");
105325
+ const tagPart = tagAndPosition.substring(0, colonIndex).trim();
105326
+ const posPart = tagAndPosition.substring(colonIndex + 1).trim();
105327
+ const isPositionKeyword = ["first", "last", "odd", "even"].includes(posPart) || /^nth\(\d+\)$/.test(posPart);
105328
+ if (isPositionKeyword) {
105329
+ tag2 = tagPart;
105330
+ positionMatch = posPart;
105331
+ } else {
105332
+ tag2 = tagAndPosition;
105333
+ }
105334
+ } else {
105335
+ tag2 = tagAndPosition;
105336
+ }
105337
+ if (!tag2) {
105338
+ throw new Error(`Invalid segment pattern: ${part}`);
105339
+ }
105340
+ segment.tag = tag2;
105341
+ if (namespace) {
105342
+ segment.namespace = namespace;
105343
+ }
105344
+ if (bracketContent) {
105345
+ if (bracketContent.includes("=")) {
105346
+ const eqIndex = bracketContent.indexOf("=");
105347
+ segment.attrName = bracketContent.substring(0, eqIndex).trim();
105348
+ segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
105349
+ } else {
105350
+ segment.attrName = bracketContent.trim();
105351
+ }
105352
+ }
105353
+ if (positionMatch) {
105354
+ const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
105355
+ if (nthMatch) {
105356
+ segment.position = "nth";
105357
+ segment.positionValue = parseInt(nthMatch[1], 10);
105358
+ } else {
105359
+ segment.position = positionMatch;
105360
+ }
105361
+ }
105362
+ return segment;
105363
+ }
105364
+ /**
105365
+ * Get the number of segments
105366
+ * @returns {number}
105367
+ */
105368
+ get length() {
105369
+ return this.segments.length;
105370
+ }
105371
+ /**
105372
+ * Check if expression contains deep wildcard
105373
+ * @returns {boolean}
105374
+ */
105375
+ hasDeepWildcard() {
105376
+ return this._hasDeepWildcard;
105377
+ }
105378
+ /**
105379
+ * Check if expression has attribute conditions
105380
+ * @returns {boolean}
105381
+ */
105382
+ hasAttributeCondition() {
105383
+ return this._hasAttributeCondition;
105384
+ }
105385
+ /**
105386
+ * Check if expression has position selectors
105387
+ * @returns {boolean}
105388
+ */
105389
+ hasPositionSelector() {
105390
+ return this._hasPositionSelector;
105391
+ }
105392
+ /**
105393
+ * Get string representation
105394
+ * @returns {string}
105395
+ */
105396
+ toString() {
105397
+ return this.pattern;
105398
+ }
105399
+ };
105400
+ }
105401
+ });
105402
+
105403
+ // node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Matcher.js
105404
+ var Matcher;
105405
+ var init_Matcher = __esm({
105406
+ "node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/Matcher.js"() {
105407
+ init_import_meta_url();
105408
+ Matcher = class {
105409
+ /**
105410
+ * Create a new Matcher
105411
+ * @param {Object} options - Configuration options
105412
+ * @param {string} options.separator - Default path separator (default: '.')
105413
+ */
105414
+ constructor(options = {}) {
105415
+ this.separator = options.separator || ".";
105416
+ this.path = [];
105417
+ this.siblingStacks = [];
105418
+ }
105419
+ /**
105420
+ * Push a new tag onto the path
105421
+ * @param {string} tagName - Name of the tag
105422
+ * @param {Object} attrValues - Attribute key-value pairs for current node (optional)
105423
+ * @param {string} namespace - Namespace for the tag (optional)
105424
+ */
105425
+ push(tagName, attrValues = null, namespace = null) {
105426
+ if (this.path.length > 0) {
105427
+ const prev = this.path[this.path.length - 1];
105428
+ prev.values = void 0;
105429
+ }
105430
+ const currentLevel = this.path.length;
105431
+ if (!this.siblingStacks[currentLevel]) {
105432
+ this.siblingStacks[currentLevel] = /* @__PURE__ */ new Map();
105433
+ }
105434
+ const siblings = this.siblingStacks[currentLevel];
105435
+ const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
105436
+ const counter = siblings.get(siblingKey) || 0;
105437
+ let position = 0;
105438
+ for (const count of siblings.values()) {
105439
+ position += count;
105440
+ }
105441
+ siblings.set(siblingKey, counter + 1);
105442
+ const node2 = {
105443
+ tag: tagName,
105444
+ position,
105445
+ counter
105446
+ };
105447
+ if (namespace !== null && namespace !== void 0) {
105448
+ node2.namespace = namespace;
105449
+ }
105450
+ if (attrValues !== null && attrValues !== void 0) {
105451
+ node2.values = attrValues;
105452
+ }
105453
+ this.path.push(node2);
105454
+ }
105455
+ /**
105456
+ * Pop the last tag from the path
105457
+ * @returns {Object|undefined} The popped node
105458
+ */
105459
+ pop() {
105460
+ if (this.path.length === 0) {
105461
+ return void 0;
105462
+ }
105463
+ const node2 = this.path.pop();
105464
+ if (this.siblingStacks.length > this.path.length + 1) {
105465
+ this.siblingStacks.length = this.path.length + 1;
105466
+ }
105467
+ return node2;
105468
+ }
105469
+ /**
105470
+ * Update current node's attribute values
105471
+ * Useful when attributes are parsed after push
105472
+ * @param {Object} attrValues - Attribute values
105473
+ */
105474
+ updateCurrent(attrValues) {
105475
+ if (this.path.length > 0) {
105476
+ const current = this.path[this.path.length - 1];
105477
+ if (attrValues !== null && attrValues !== void 0) {
105478
+ current.values = attrValues;
105479
+ }
105480
+ }
105481
+ }
105482
+ /**
105483
+ * Get current tag name
105484
+ * @returns {string|undefined}
105485
+ */
105486
+ getCurrentTag() {
105487
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
105488
+ }
105489
+ /**
105490
+ * Get current namespace
105491
+ * @returns {string|undefined}
105492
+ */
105493
+ getCurrentNamespace() {
105494
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
105495
+ }
105496
+ /**
105497
+ * Get current node's attribute value
105498
+ * @param {string} attrName - Attribute name
105499
+ * @returns {*} Attribute value or undefined
105500
+ */
105501
+ getAttrValue(attrName) {
105502
+ if (this.path.length === 0) return void 0;
105503
+ const current = this.path[this.path.length - 1];
105504
+ return current.values?.[attrName];
105505
+ }
105506
+ /**
105507
+ * Check if current node has an attribute
105508
+ * @param {string} attrName - Attribute name
105509
+ * @returns {boolean}
105510
+ */
105511
+ hasAttr(attrName) {
105512
+ if (this.path.length === 0) return false;
105513
+ const current = this.path[this.path.length - 1];
105514
+ return current.values !== void 0 && attrName in current.values;
105515
+ }
105516
+ /**
105517
+ * Get current node's sibling position (child index in parent)
105518
+ * @returns {number}
105519
+ */
105520
+ getPosition() {
105521
+ if (this.path.length === 0) return -1;
105522
+ return this.path[this.path.length - 1].position ?? 0;
105523
+ }
105524
+ /**
105525
+ * Get current node's repeat counter (occurrence count of this tag name)
105526
+ * @returns {number}
105527
+ */
105528
+ getCounter() {
105529
+ if (this.path.length === 0) return -1;
105530
+ return this.path[this.path.length - 1].counter ?? 0;
105531
+ }
105532
+ /**
105533
+ * Get current node's sibling index (alias for getPosition for backward compatibility)
105534
+ * @returns {number}
105535
+ * @deprecated Use getPosition() or getCounter() instead
105536
+ */
105537
+ getIndex() {
105538
+ return this.getPosition();
105539
+ }
105540
+ /**
105541
+ * Get current path depth
105542
+ * @returns {number}
105543
+ */
105544
+ getDepth() {
105545
+ return this.path.length;
105546
+ }
105547
+ /**
105548
+ * Get path as string
105549
+ * @param {string} separator - Optional separator (uses default if not provided)
105550
+ * @param {boolean} includeNamespace - Whether to include namespace in output (default: true)
105551
+ * @returns {string}
105552
+ */
105553
+ toString(separator, includeNamespace = true) {
105554
+ const sep4 = separator || this.separator;
105555
+ return this.path.map((n4) => {
105556
+ if (includeNamespace && n4.namespace) {
105557
+ return `${n4.namespace}:${n4.tag}`;
105558
+ }
105559
+ return n4.tag;
105560
+ }).join(sep4);
105561
+ }
105562
+ /**
105563
+ * Get path as array of tag names
105564
+ * @returns {string[]}
105565
+ */
105566
+ toArray() {
105567
+ return this.path.map((n4) => n4.tag);
105568
+ }
105569
+ /**
105570
+ * Reset the path to empty
105571
+ */
105572
+ reset() {
105573
+ this.path = [];
105574
+ this.siblingStacks = [];
105575
+ }
105576
+ /**
105577
+ * Match current path against an Expression
105578
+ * @param {Expression} expression - The expression to match against
105579
+ * @returns {boolean} True if current path matches the expression
105580
+ */
105581
+ matches(expression) {
105582
+ const segments = expression.segments;
105583
+ if (segments.length === 0) {
105584
+ return false;
105585
+ }
105586
+ if (expression.hasDeepWildcard()) {
105587
+ return this._matchWithDeepWildcard(segments);
105588
+ }
105589
+ return this._matchSimple(segments);
105590
+ }
105591
+ /**
105592
+ * Match simple path (no deep wildcards)
105593
+ * @private
105594
+ */
105595
+ _matchSimple(segments) {
105596
+ if (this.path.length !== segments.length) {
105597
+ return false;
105598
+ }
105599
+ for (let i4 = 0; i4 < segments.length; i4++) {
105600
+ const segment = segments[i4];
105601
+ const node2 = this.path[i4];
105602
+ const isCurrentNode = i4 === this.path.length - 1;
105603
+ if (!this._matchSegment(segment, node2, isCurrentNode)) {
105604
+ return false;
105605
+ }
105606
+ }
105607
+ return true;
105608
+ }
105609
+ /**
105610
+ * Match path with deep wildcards
105611
+ * @private
105612
+ */
105613
+ _matchWithDeepWildcard(segments) {
105614
+ let pathIdx = this.path.length - 1;
105615
+ let segIdx = segments.length - 1;
105616
+ while (segIdx >= 0 && pathIdx >= 0) {
105617
+ const segment = segments[segIdx];
105618
+ if (segment.type === "deep-wildcard") {
105619
+ segIdx--;
105620
+ if (segIdx < 0) {
105621
+ return true;
105622
+ }
105623
+ const nextSeg = segments[segIdx];
105624
+ let found = false;
105625
+ for (let i4 = pathIdx; i4 >= 0; i4--) {
105626
+ const isCurrentNode = i4 === this.path.length - 1;
105627
+ if (this._matchSegment(nextSeg, this.path[i4], isCurrentNode)) {
105628
+ pathIdx = i4 - 1;
105629
+ segIdx--;
105630
+ found = true;
105631
+ break;
105632
+ }
105633
+ }
105634
+ if (!found) {
105635
+ return false;
105636
+ }
105637
+ } else {
105638
+ const isCurrentNode = pathIdx === this.path.length - 1;
105639
+ if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
105640
+ return false;
105641
+ }
105642
+ pathIdx--;
105643
+ segIdx--;
105644
+ }
105645
+ }
105646
+ return segIdx < 0;
105647
+ }
105648
+ /**
105649
+ * Match a single segment against a node
105650
+ * @private
105651
+ * @param {Object} segment - Segment from Expression
105652
+ * @param {Object} node - Node from path
105653
+ * @param {boolean} isCurrentNode - Whether this is the current (last) node
105654
+ * @returns {boolean}
105655
+ */
105656
+ _matchSegment(segment, node2, isCurrentNode) {
105657
+ if (segment.tag !== "*" && segment.tag !== node2.tag) {
105658
+ return false;
105659
+ }
105660
+ if (segment.namespace !== void 0) {
105661
+ if (segment.namespace !== "*" && segment.namespace !== node2.namespace) {
105662
+ return false;
105663
+ }
105664
+ }
105665
+ if (segment.attrName !== void 0) {
105666
+ if (!isCurrentNode) {
105667
+ return false;
105668
+ }
105669
+ if (!node2.values || !(segment.attrName in node2.values)) {
105670
+ return false;
105671
+ }
105672
+ if (segment.attrValue !== void 0) {
105673
+ const actualValue = node2.values[segment.attrName];
105674
+ if (String(actualValue) !== String(segment.attrValue)) {
105675
+ return false;
105676
+ }
105677
+ }
105678
+ }
105679
+ if (segment.position !== void 0) {
105680
+ if (!isCurrentNode) {
105681
+ return false;
105682
+ }
105683
+ const counter = node2.counter ?? 0;
105684
+ if (segment.position === "first" && counter !== 0) {
105685
+ return false;
105686
+ } else if (segment.position === "odd" && counter % 2 !== 1) {
105687
+ return false;
105688
+ } else if (segment.position === "even" && counter % 2 !== 0) {
105689
+ return false;
105690
+ } else if (segment.position === "nth") {
105691
+ if (counter !== segment.positionValue) {
105692
+ return false;
105693
+ }
105694
+ }
105695
+ }
105696
+ return true;
105697
+ }
105698
+ /**
105699
+ * Create a snapshot of current state
105700
+ * @returns {Object} State snapshot
105701
+ */
105702
+ snapshot() {
105703
+ return {
105704
+ path: this.path.map((node2) => ({ ...node2 })),
105705
+ siblingStacks: this.siblingStacks.map((map3) => new Map(map3))
105706
+ };
105707
+ }
105708
+ /**
105709
+ * Restore state from snapshot
105710
+ * @param {Object} snapshot - State snapshot
105711
+ */
105712
+ restore(snapshot) {
105713
+ this.path = snapshot.path.map((node2) => ({ ...node2 }));
105714
+ this.siblingStacks = snapshot.siblingStacks.map((map3) => new Map(map3));
105715
+ }
105716
+ };
105717
+ }
105718
+ });
105719
+
105720
+ // node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/index.js
105721
+ var init_src = __esm({
105722
+ "node_modules/.pnpm/path-expression-matcher@1.1.3/node_modules/path-expression-matcher/src/index.js"() {
105134
105723
  init_import_meta_url();
105724
+ init_Expression();
105725
+ init_Matcher();
105135
105726
  }
105136
105727
  });
105137
105728
 
105138
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
105729
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
105730
+ function extractRawAttributes(prefixedAttrs, options) {
105731
+ if (!prefixedAttrs) return {};
105732
+ const attrs = options.attributesGroupName ? prefixedAttrs[options.attributesGroupName] : prefixedAttrs;
105733
+ if (!attrs) return {};
105734
+ const rawAttrs = {};
105735
+ for (const key in attrs) {
105736
+ if (key.startsWith(options.attributeNamePrefix)) {
105737
+ const rawName = key.substring(options.attributeNamePrefix.length);
105738
+ rawAttrs[rawName] = attrs[key];
105739
+ } else {
105740
+ rawAttrs[key] = attrs[key];
105741
+ }
105742
+ }
105743
+ return rawAttrs;
105744
+ }
105745
+ function extractNamespace(rawTagName) {
105746
+ if (!rawTagName || typeof rawTagName !== "string") return void 0;
105747
+ const colonIndex = rawTagName.indexOf(":");
105748
+ if (colonIndex !== -1 && colonIndex > 0) {
105749
+ const ns2 = rawTagName.substring(0, colonIndex);
105750
+ if (ns2 !== "xmlns") {
105751
+ return ns2;
105752
+ }
105753
+ }
105754
+ return void 0;
105755
+ }
105139
105756
  function addExternalEntities(externalEntities) {
105140
105757
  const entKeys = Object.keys(externalEntities);
105141
105758
  for (let i4 = 0; i4 < entKeys.length; i4++) {
@@ -105154,7 +105771,8 @@ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode,
105154
105771
  }
105155
105772
  if (val.length > 0) {
105156
105773
  if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
105157
- const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
105774
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105775
+ const newval = this.options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
105158
105776
  if (newval === null || newval === void 0) {
105159
105777
  return val;
105160
105778
  } else if (typeof newval !== typeof val || newval !== val) {
@@ -105190,9 +105808,26 @@ function buildAttributesMap(attrStr, jPath, tagName) {
105190
105808
  const matches = getAllMatches(attrStr, attrsRegx);
105191
105809
  const len = matches.length;
105192
105810
  const attrs = {};
105811
+ const rawAttrsForMatcher = {};
105193
105812
  for (let i4 = 0; i4 < len; i4++) {
105194
105813
  const attrName = this.resolveNameSpace(matches[i4][1]);
105195
- if (this.ignoreAttributesFn(attrName, jPath)) {
105814
+ const oldVal = matches[i4][4];
105815
+ if (attrName.length && oldVal !== void 0) {
105816
+ let parsedVal = oldVal;
105817
+ if (this.options.trimValues) {
105818
+ parsedVal = parsedVal.trim();
105819
+ }
105820
+ parsedVal = this.replaceEntitiesValue(parsedVal, tagName, jPath);
105821
+ rawAttrsForMatcher[attrName] = parsedVal;
105822
+ }
105823
+ }
105824
+ if (Object.keys(rawAttrsForMatcher).length > 0 && typeof jPath === "object" && jPath.updateCurrent) {
105825
+ jPath.updateCurrent(rawAttrsForMatcher);
105826
+ }
105827
+ for (let i4 = 0; i4 < len; i4++) {
105828
+ const attrName = this.resolveNameSpace(matches[i4][1]);
105829
+ const jPathStr = this.options.jPath ? jPath.toString() : jPath;
105830
+ if (this.ignoreAttributesFn(attrName, jPathStr)) {
105196
105831
  continue;
105197
105832
  }
105198
105833
  let oldVal = matches[i4][4];
@@ -105201,13 +105836,14 @@ function buildAttributesMap(attrStr, jPath, tagName) {
105201
105836
  if (this.options.transformAttributeName) {
105202
105837
  aName = this.options.transformAttributeName(aName);
105203
105838
  }
105204
- if (aName === "__proto__") aName = "#__proto__";
105839
+ aName = sanitizeName(aName, this.options);
105205
105840
  if (oldVal !== void 0) {
105206
105841
  if (this.options.trimValues) {
105207
105842
  oldVal = oldVal.trim();
105208
105843
  }
105209
105844
  oldVal = this.replaceEntitiesValue(oldVal, tagName, jPath);
105210
- const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
105845
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105846
+ const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPathOrMatcher);
105211
105847
  if (newVal === null || newVal === void 0) {
105212
105848
  attrs[aName] = oldVal;
105213
105849
  } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
@@ -105235,9 +105871,10 @@ function buildAttributesMap(attrStr, jPath, tagName) {
105235
105871
  return attrs;
105236
105872
  }
105237
105873
  }
105238
- function addChild(currentNode, childNode, jPath, startIndex) {
105874
+ function addChild(currentNode, childNode, matcher, startIndex) {
105239
105875
  if (!this.options.captureMetaData) startIndex = void 0;
105240
- const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
105876
+ const jPathOrMatcher = this.options.jPath ? matcher.toString() : matcher;
105877
+ const result = this.options.updateTag(childNode.tagname, jPathOrMatcher, childNode[":@"]);
105241
105878
  if (result === false) {
105242
105879
  } else if (typeof result === "string") {
105243
105880
  childNode.tagname = result;
@@ -105246,26 +105883,102 @@ function addChild(currentNode, childNode, jPath, startIndex) {
105246
105883
  currentNode.addChild(childNode, startIndex);
105247
105884
  }
105248
105885
  }
105249
- function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
105886
+ function replaceEntitiesValue(val, tagName, jPath) {
105887
+ const entityConfig = this.options.processEntities;
105888
+ if (!entityConfig || !entityConfig.enabled) {
105889
+ return val;
105890
+ }
105891
+ if (entityConfig.allowedTags) {
105892
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105893
+ const allowed = Array.isArray(entityConfig.allowedTags) ? entityConfig.allowedTags.includes(tagName) : entityConfig.allowedTags(tagName, jPathOrMatcher);
105894
+ if (!allowed) {
105895
+ return val;
105896
+ }
105897
+ }
105898
+ if (entityConfig.tagFilter) {
105899
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
105900
+ if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) {
105901
+ return val;
105902
+ }
105903
+ }
105904
+ for (const entityName of Object.keys(this.docTypeEntities)) {
105905
+ const entity = this.docTypeEntities[entityName];
105906
+ const matches = val.match(entity.regx);
105907
+ if (matches) {
105908
+ this.entityExpansionCount += matches.length;
105909
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105910
+ throw new Error(
105911
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105912
+ );
105913
+ }
105914
+ const lengthBefore = val.length;
105915
+ val = val.replace(entity.regx, entity.val);
105916
+ if (entityConfig.maxExpandedLength) {
105917
+ this.currentExpandedLength += val.length - lengthBefore;
105918
+ if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
105919
+ throw new Error(
105920
+ `Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
105921
+ );
105922
+ }
105923
+ }
105924
+ }
105925
+ }
105926
+ for (const entityName of Object.keys(this.lastEntities)) {
105927
+ const entity = this.lastEntities[entityName];
105928
+ const matches = val.match(entity.regex);
105929
+ if (matches) {
105930
+ this.entityExpansionCount += matches.length;
105931
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105932
+ throw new Error(
105933
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105934
+ );
105935
+ }
105936
+ }
105937
+ val = val.replace(entity.regex, entity.val);
105938
+ }
105939
+ if (val.indexOf("&") === -1) return val;
105940
+ if (this.options.htmlEntities) {
105941
+ for (const entityName of Object.keys(this.htmlEntities)) {
105942
+ const entity = this.htmlEntities[entityName];
105943
+ const matches = val.match(entity.regex);
105944
+ if (matches) {
105945
+ this.entityExpansionCount += matches.length;
105946
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105947
+ throw new Error(
105948
+ `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105949
+ );
105950
+ }
105951
+ }
105952
+ val = val.replace(entity.regex, entity.val);
105953
+ }
105954
+ }
105955
+ val = val.replace(this.ampEntity.regex, this.ampEntity.val);
105956
+ return val;
105957
+ }
105958
+ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
105250
105959
  if (textData) {
105251
- if (isLeafNode === void 0) isLeafNode = currentNode.child.length === 0;
105960
+ if (isLeafNode === void 0) isLeafNode = parentNode.child.length === 0;
105252
105961
  textData = this.parseTextData(
105253
105962
  textData,
105254
- currentNode.tagname,
105255
- jPath,
105963
+ parentNode.tagname,
105964
+ matcher,
105256
105965
  false,
105257
- currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
105966
+ parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false,
105258
105967
  isLeafNode
105259
105968
  );
105260
105969
  if (textData !== void 0 && textData !== "")
105261
- currentNode.add(this.options.textNodeName, textData);
105970
+ parentNode.add(this.options.textNodeName, textData);
105262
105971
  textData = "";
105263
105972
  }
105264
105973
  return textData;
105265
105974
  }
105266
- function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
105267
- if (stopNodesWildcard && stopNodesWildcard.has(currentTagName)) return true;
105268
- if (stopNodesExact && stopNodesExact.has(jPath)) return true;
105975
+ function isItStopNode(stopNodeExpressions, matcher) {
105976
+ if (!stopNodeExpressions || stopNodeExpressions.length === 0) return false;
105977
+ for (let i4 = 0; i4 < stopNodeExpressions.length; i4++) {
105978
+ if (matcher.matches(stopNodeExpressions[i4])) {
105979
+ return true;
105980
+ }
105981
+ }
105269
105982
  return false;
105270
105983
  }
105271
105984
  function tagExpWithClosingIndex(xmlData, i4, closingChar = ">") {
@@ -105395,9 +106108,28 @@ function fromCodePoint2(str2, base, prefix) {
105395
106108
  return prefix + str2 + ";";
105396
106109
  }
105397
106110
  }
105398
- var OrderedObjParser, attrsRegx, parseXml, replaceEntitiesValue;
106111
+ function transformTagName(fn2, tagName, tagExp, options) {
106112
+ if (fn2) {
106113
+ const newTagName = fn2(tagName);
106114
+ if (tagExp === tagName) {
106115
+ tagExp = newTagName;
106116
+ }
106117
+ tagName = newTagName;
106118
+ }
106119
+ tagName = sanitizeName(tagName, options);
106120
+ return { tagName, tagExp };
106121
+ }
106122
+ function sanitizeName(name, options) {
106123
+ if (criticalProperties.includes(name)) {
106124
+ throw new Error(`[SECURITY] Invalid name: "${name}" is a reserved JavaScript keyword that could cause prototype pollution`);
106125
+ } else if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
106126
+ return options.onDangerousProperty(name);
106127
+ }
106128
+ return name;
106129
+ }
106130
+ var OrderedObjParser, attrsRegx, parseXml;
105399
106131
  var init_OrderedObjParser = __esm({
105400
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"() {
106132
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js"() {
105401
106133
  "use strict";
105402
106134
  init_import_meta_url();
105403
106135
  init_util5();
@@ -105405,6 +106137,7 @@ var init_OrderedObjParser = __esm({
105405
106137
  init_DocTypeReader();
105406
106138
  init_strnum();
105407
106139
  init_ignoreAttributes();
106140
+ init_src();
105408
106141
  OrderedObjParser = class {
105409
106142
  constructor(options) {
105410
106143
  this.options = options;
@@ -105448,16 +106181,16 @@ var init_OrderedObjParser = __esm({
105448
106181
  this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
105449
106182
  this.entityExpansionCount = 0;
105450
106183
  this.currentExpandedLength = 0;
106184
+ this.matcher = new Matcher();
106185
+ this.isCurrentNodeStopNode = false;
105451
106186
  if (this.options.stopNodes && this.options.stopNodes.length > 0) {
105452
- this.stopNodesExact = /* @__PURE__ */ new Set();
105453
- this.stopNodesWildcard = /* @__PURE__ */ new Set();
106187
+ this.stopNodeExpressions = [];
105454
106188
  for (let i4 = 0; i4 < this.options.stopNodes.length; i4++) {
105455
106189
  const stopNodeExp = this.options.stopNodes[i4];
105456
- if (typeof stopNodeExp !== "string") continue;
105457
- if (stopNodeExp.startsWith("*.")) {
105458
- this.stopNodesWildcard.add(stopNodeExp.substring(2));
105459
- } else {
105460
- this.stopNodesExact.add(stopNodeExp);
106190
+ if (typeof stopNodeExp === "string") {
106191
+ this.stopNodeExpressions.push(new Expression(stopNodeExp));
106192
+ } else if (stopNodeExp instanceof Expression) {
106193
+ this.stopNodeExpressions.push(stopNodeExp);
105461
106194
  }
105462
106195
  }
105463
106196
  }
@@ -105469,7 +106202,7 @@ var init_OrderedObjParser = __esm({
105469
106202
  const xmlObj = new XmlNode("!xml");
105470
106203
  let currentNode = xmlObj;
105471
106204
  let textData = "";
105472
- let jPath = "";
106205
+ this.matcher.reset();
105473
106206
  this.entityExpansionCount = 0;
105474
106207
  this.currentExpandedLength = 0;
105475
106208
  const docTypeReader = new DocTypeReader(this.options.processEntities);
@@ -105485,46 +106218,42 @@ var init_OrderedObjParser = __esm({
105485
106218
  tagName = tagName.substr(colonIndex + 1);
105486
106219
  }
105487
106220
  }
105488
- if (this.options.transformTagName) {
105489
- tagName = this.options.transformTagName(tagName);
105490
- }
106221
+ tagName = transformTagName(this.options.transformTagName, tagName, "", this.options).tagName;
105491
106222
  if (currentNode) {
105492
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
106223
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
105493
106224
  }
105494
- const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
106225
+ const lastTagName = this.matcher.getCurrentTag();
105495
106226
  if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
105496
106227
  throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
105497
106228
  }
105498
- let propIndex = 0;
105499
106229
  if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
105500
- propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
106230
+ this.matcher.pop();
105501
106231
  this.tagsNodeStack.pop();
105502
- } else {
105503
- propIndex = jPath.lastIndexOf(".");
105504
106232
  }
105505
- jPath = jPath.substring(0, propIndex);
106233
+ this.matcher.pop();
106234
+ this.isCurrentNodeStopNode = false;
105506
106235
  currentNode = this.tagsNodeStack.pop();
105507
106236
  textData = "";
105508
106237
  i4 = closeIndex;
105509
106238
  } else if (xmlData[i4 + 1] === "?") {
105510
106239
  let tagData = readTagExp(xmlData, i4, false, "?>");
105511
106240
  if (!tagData) throw new Error("Pi Tag is not closed.");
105512
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
106241
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
105513
106242
  if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {
105514
106243
  } else {
105515
106244
  const childNode = new XmlNode(tagData.tagName);
105516
106245
  childNode.add(this.options.textNodeName, "");
105517
106246
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
105518
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
106247
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
105519
106248
  }
105520
- this.addChild(currentNode, childNode, jPath, i4);
106249
+ this.addChild(currentNode, childNode, this.matcher, i4);
105521
106250
  }
105522
106251
  i4 = tagData.closeIndex + 1;
105523
106252
  } else if (xmlData.substr(i4 + 1, 3) === "!--") {
105524
106253
  const endIndex = findClosingIndex(xmlData, "-->", i4 + 4, "Comment is not closed.");
105525
106254
  if (this.options.commentPropName) {
105526
106255
  const comment = xmlData.substring(i4 + 4, endIndex - 2);
105527
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
106256
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
105528
106257
  currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
105529
106258
  }
105530
106259
  i4 = endIndex;
@@ -105535,8 +106264,8 @@ var init_OrderedObjParser = __esm({
105535
106264
  } else if (xmlData.substr(i4 + 1, 2) === "![") {
105536
106265
  const closeIndex = findClosingIndex(xmlData, "]]>", i4, "CDATA is not closed.") - 2;
105537
106266
  const tagExp = xmlData.substring(i4 + 9, closeIndex);
105538
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
105539
- let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
106267
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher);
106268
+ let val = this.parseTextData(tagExp, currentNode.tagname, this.matcher, true, false, true, true);
105540
106269
  if (val == void 0) val = "";
105541
106270
  if (this.options.cdataPropName) {
105542
106271
  currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
@@ -105546,42 +106275,60 @@ var init_OrderedObjParser = __esm({
105546
106275
  i4 = closeIndex + 2;
105547
106276
  } else {
105548
106277
  let result = readTagExp(xmlData, i4, this.options.removeNSPrefix);
106278
+ if (!result) {
106279
+ const context2 = xmlData.substring(Math.max(0, i4 - 50), Math.min(xmlData.length, i4 + 50));
106280
+ throw new Error(`readTagExp returned undefined at position ${i4}. Context: "${context2}"`);
106281
+ }
105549
106282
  let tagName = result.tagName;
105550
106283
  const rawTagName = result.rawTagName;
105551
106284
  let tagExp = result.tagExp;
105552
106285
  let attrExpPresent = result.attrExpPresent;
105553
106286
  let closeIndex = result.closeIndex;
105554
- if (this.options.transformTagName) {
105555
- const newTagName = this.options.transformTagName(tagName);
105556
- if (tagExp === tagName) {
105557
- tagExp = newTagName;
105558
- }
105559
- tagName = newTagName;
106287
+ ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
106288
+ if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName || tagName === this.options.textNodeName || tagName === this.options.attributesGroupName)) {
106289
+ throw new Error(`Invalid tag name: ${tagName}`);
105560
106290
  }
105561
106291
  if (currentNode && textData) {
105562
106292
  if (currentNode.tagname !== "!xml") {
105563
- textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
106293
+ textData = this.saveTextToParentTag(textData, currentNode, this.matcher, false);
105564
106294
  }
105565
106295
  }
105566
106296
  const lastTag = currentNode;
105567
106297
  if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
105568
106298
  currentNode = this.tagsNodeStack.pop();
105569
- jPath = jPath.substring(0, jPath.lastIndexOf("."));
106299
+ this.matcher.pop();
106300
+ }
106301
+ let isSelfClosing = false;
106302
+ if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
106303
+ isSelfClosing = true;
106304
+ if (tagName[tagName.length - 1] === "/") {
106305
+ tagName = tagName.substr(0, tagName.length - 1);
106306
+ tagExp = tagName;
106307
+ } else {
106308
+ tagExp = tagExp.substr(0, tagExp.length - 1);
106309
+ }
106310
+ attrExpPresent = tagName !== tagExp;
106311
+ }
106312
+ let prefixedAttrs = null;
106313
+ let rawAttrs = {};
106314
+ let namespace = void 0;
106315
+ namespace = extractNamespace(rawTagName);
106316
+ if (tagName !== xmlObj.tagname) {
106317
+ this.matcher.push(tagName, {}, namespace);
106318
+ }
106319
+ if (tagName !== tagExp && attrExpPresent) {
106320
+ prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
106321
+ if (prefixedAttrs) {
106322
+ rawAttrs = extractRawAttributes(prefixedAttrs, this.options);
106323
+ }
105570
106324
  }
105571
106325
  if (tagName !== xmlObj.tagname) {
105572
- jPath += jPath ? "." + tagName : tagName;
106326
+ this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher);
105573
106327
  }
105574
106328
  const startIndex = i4;
105575
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
106329
+ if (this.isCurrentNodeStopNode) {
105576
106330
  let tagContent = "";
105577
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
105578
- if (tagName[tagName.length - 1] === "/") {
105579
- tagName = tagName.substr(0, tagName.length - 1);
105580
- jPath = jPath.substr(0, jPath.length - 1);
105581
- tagExp = tagName;
105582
- } else {
105583
- tagExp = tagExp.substr(0, tagExp.length - 1);
105584
- }
106331
+ if (isSelfClosing) {
105585
106332
  i4 = result.closeIndex;
105586
106333
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
105587
106334
  i4 = result.closeIndex;
@@ -105592,47 +106339,43 @@ var init_OrderedObjParser = __esm({
105592
106339
  tagContent = result2.tagContent;
105593
106340
  }
105594
106341
  const childNode = new XmlNode(tagName);
105595
- if (tagName !== tagExp && attrExpPresent) {
105596
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
106342
+ if (prefixedAttrs) {
106343
+ childNode[":@"] = prefixedAttrs;
105597
106344
  }
105598
- if (tagContent) {
105599
- tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
105600
- }
105601
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
105602
106345
  childNode.add(this.options.textNodeName, tagContent);
105603
- this.addChild(currentNode, childNode, jPath, startIndex);
106346
+ this.matcher.pop();
106347
+ this.isCurrentNodeStopNode = false;
106348
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
105604
106349
  } else {
105605
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
105606
- if (tagName[tagName.length - 1] === "/") {
105607
- tagName = tagName.substr(0, tagName.length - 1);
105608
- jPath = jPath.substr(0, jPath.length - 1);
105609
- tagExp = tagName;
105610
- } else {
105611
- tagExp = tagExp.substr(0, tagExp.length - 1);
105612
- }
105613
- if (this.options.transformTagName) {
105614
- const newTagName = this.options.transformTagName(tagName);
105615
- if (tagExp === tagName) {
105616
- tagExp = newTagName;
105617
- }
105618
- tagName = newTagName;
106350
+ if (isSelfClosing) {
106351
+ ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
106352
+ const childNode = new XmlNode(tagName);
106353
+ if (prefixedAttrs) {
106354
+ childNode[":@"] = prefixedAttrs;
105619
106355
  }
106356
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
106357
+ this.matcher.pop();
106358
+ this.isCurrentNodeStopNode = false;
106359
+ } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
105620
106360
  const childNode = new XmlNode(tagName);
105621
- if (tagName !== tagExp && attrExpPresent) {
105622
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
106361
+ if (prefixedAttrs) {
106362
+ childNode[":@"] = prefixedAttrs;
105623
106363
  }
105624
- this.addChild(currentNode, childNode, jPath, startIndex);
105625
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
106364
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
106365
+ this.matcher.pop();
106366
+ this.isCurrentNodeStopNode = false;
106367
+ i4 = result.closeIndex;
106368
+ continue;
105626
106369
  } else {
105627
106370
  const childNode = new XmlNode(tagName);
105628
106371
  if (this.tagsNodeStack.length > this.options.maxNestedTags) {
105629
106372
  throw new Error("Maximum nested tags exceeded");
105630
106373
  }
105631
106374
  this.tagsNodeStack.push(currentNode);
105632
- if (tagName !== tagExp && attrExpPresent) {
105633
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
106375
+ if (prefixedAttrs) {
106376
+ childNode[":@"] = prefixedAttrs;
105634
106377
  }
105635
- this.addChild(currentNode, childNode, jPath, startIndex);
106378
+ this.addChild(currentNode, childNode, this.matcher, startIndex);
105636
106379
  currentNode = childNode;
105637
106380
  }
105638
106381
  textData = "";
@@ -105645,87 +106388,50 @@ var init_OrderedObjParser = __esm({
105645
106388
  }
105646
106389
  return xmlObj.child;
105647
106390
  };
105648
- replaceEntitiesValue = function(val, tagName, jPath) {
105649
- if (val.indexOf("&") === -1) {
105650
- return val;
105651
- }
105652
- const entityConfig = this.options.processEntities;
105653
- if (!entityConfig.enabled) {
105654
- return val;
105655
- }
105656
- if (entityConfig.allowedTags) {
105657
- if (!entityConfig.allowedTags.includes(tagName)) {
105658
- return val;
105659
- }
105660
- }
105661
- if (entityConfig.tagFilter) {
105662
- if (!entityConfig.tagFilter(tagName, jPath)) {
105663
- return val;
105664
- }
105665
- }
105666
- for (let entityName in this.docTypeEntities) {
105667
- const entity = this.docTypeEntities[entityName];
105668
- const matches = val.match(entity.regx);
105669
- if (matches) {
105670
- this.entityExpansionCount += matches.length;
105671
- if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
105672
- throw new Error(
105673
- `Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
105674
- );
105675
- }
105676
- const lengthBefore = val.length;
105677
- val = val.replace(entity.regx, entity.val);
105678
- if (entityConfig.maxExpandedLength) {
105679
- this.currentExpandedLength += val.length - lengthBefore;
105680
- if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
105681
- throw new Error(
105682
- `Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
105683
- );
105684
- }
105685
- }
105686
- }
105687
- }
105688
- if (val.indexOf("&") === -1) return val;
105689
- for (let entityName in this.lastEntities) {
105690
- const entity = this.lastEntities[entityName];
105691
- val = val.replace(entity.regex, entity.val);
105692
- }
105693
- if (val.indexOf("&") === -1) return val;
105694
- if (this.options.htmlEntities) {
105695
- for (let entityName in this.htmlEntities) {
105696
- const entity = this.htmlEntities[entityName];
105697
- val = val.replace(entity.regex, entity.val);
105698
- }
105699
- }
105700
- val = val.replace(this.ampEntity.regex, this.ampEntity.val);
105701
- return val;
105702
- };
105703
106391
  }
105704
106392
  });
105705
106393
 
105706
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/node2json.js
105707
- function prettify(node2, options) {
105708
- return compress(node2, options);
106394
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/node2json.js
106395
+ function stripAttributePrefix(attrs, prefix) {
106396
+ if (!attrs || typeof attrs !== "object") return {};
106397
+ if (!prefix) return attrs;
106398
+ const rawAttrs = {};
106399
+ for (const key in attrs) {
106400
+ if (key.startsWith(prefix)) {
106401
+ const rawName = key.substring(prefix.length);
106402
+ rawAttrs[rawName] = attrs[key];
106403
+ } else {
106404
+ rawAttrs[key] = attrs[key];
106405
+ }
106406
+ }
106407
+ return rawAttrs;
105709
106408
  }
105710
- function compress(arr, options, jPath) {
106409
+ function prettify(node2, options, matcher) {
106410
+ return compress(node2, options, matcher);
106411
+ }
106412
+ function compress(arr, options, matcher) {
105711
106413
  let text;
105712
106414
  const compressedObj = {};
105713
106415
  for (let i4 = 0; i4 < arr.length; i4++) {
105714
106416
  const tagObj = arr[i4];
105715
106417
  const property = propName(tagObj);
105716
- let newJpath = "";
105717
- if (jPath === void 0) newJpath = property;
105718
- else newJpath = jPath + "." + property;
106418
+ if (property !== void 0 && property !== options.textNodeName) {
106419
+ const rawAttrs = stripAttributePrefix(
106420
+ tagObj[":@"] || {},
106421
+ options.attributeNamePrefix
106422
+ );
106423
+ matcher.push(property, rawAttrs);
106424
+ }
105719
106425
  if (property === options.textNodeName) {
105720
106426
  if (text === void 0) text = tagObj[property];
105721
106427
  else text += "" + tagObj[property];
105722
106428
  } else if (property === void 0) {
105723
106429
  continue;
105724
106430
  } else if (tagObj[property]) {
105725
- let val = compress(tagObj[property], options, newJpath);
106431
+ let val = compress(tagObj[property], options, matcher);
105726
106432
  const isLeaf = isLeafTag(val, options);
105727
106433
  if (tagObj[":@"]) {
105728
- assignAttributes(val, tagObj[":@"], newJpath, options);
106434
+ assignAttributes(val, tagObj[":@"], matcher, options);
105729
106435
  } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== void 0 && !options.alwaysCreateTextNode) {
105730
106436
  val = val[options.textNodeName];
105731
106437
  } else if (Object.keys(val).length === 0) {
@@ -105741,12 +106447,16 @@ function compress(arr, options, jPath) {
105741
106447
  }
105742
106448
  compressedObj[property].push(val);
105743
106449
  } else {
105744
- if (options.isArray(property, newJpath, isLeaf)) {
106450
+ const jPathOrMatcher = options.jPath ? matcher.toString() : matcher;
106451
+ if (options.isArray(property, jPathOrMatcher, isLeaf)) {
105745
106452
  compressedObj[property] = [val];
105746
106453
  } else {
105747
106454
  compressedObj[property] = val;
105748
106455
  }
105749
106456
  }
106457
+ if (property !== void 0 && property !== options.textNodeName) {
106458
+ matcher.pop();
106459
+ }
105750
106460
  }
105751
106461
  }
105752
106462
  if (typeof text === "string") {
@@ -105761,13 +106471,15 @@ function propName(obj) {
105761
106471
  if (key !== ":@") return key;
105762
106472
  }
105763
106473
  }
105764
- function assignAttributes(obj, attrMap, jpath, options) {
106474
+ function assignAttributes(obj, attrMap, matcher, options) {
105765
106475
  if (attrMap) {
105766
106476
  const keys = Object.keys(attrMap);
105767
106477
  const len = keys.length;
105768
106478
  for (let i4 = 0; i4 < len; i4++) {
105769
106479
  const atrrName = keys[i4];
105770
- if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
106480
+ const rawAttrName = atrrName.startsWith(options.attributeNamePrefix) ? atrrName.substring(options.attributeNamePrefix.length) : atrrName;
106481
+ const jPathOrMatcher = options.jPath ? matcher.toString() + "." + rawAttrName : matcher;
106482
+ if (options.isArray(atrrName, jPathOrMatcher, true, true)) {
105771
106483
  obj[atrrName] = [attrMap[atrrName]];
105772
106484
  } else {
105773
106485
  obj[atrrName] = attrMap[atrrName];
@@ -105788,7 +106500,7 @@ function isLeafTag(obj, options) {
105788
106500
  }
105789
106501
  var METADATA_SYMBOL2;
105790
106502
  var init_node2json = __esm({
105791
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/node2json.js"() {
106503
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/node2json.js"() {
105792
106504
  "use strict";
105793
106505
  init_import_meta_url();
105794
106506
  init_xmlNode();
@@ -105796,10 +106508,10 @@ var init_node2json = __esm({
105796
106508
  }
105797
106509
  });
105798
106510
 
105799
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
106511
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
105800
106512
  var XMLParser;
105801
106513
  var init_XMLParser = __esm({
105802
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"() {
106514
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js"() {
105803
106515
  init_import_meta_url();
105804
106516
  init_OptionsBuilder();
105805
106517
  init_OrderedObjParser();
@@ -105833,7 +106545,7 @@ var init_XMLParser = __esm({
105833
106545
  orderedObjParser.addExternalEntities(this.externalEntities);
105834
106546
  const orderedResult = orderedObjParser.parseXml(xmlData);
105835
106547
  if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
105836
- else return prettify(orderedResult, this.options);
106548
+ else return prettify(orderedResult, this.options, orderedObjParser.matcher);
105837
106549
  }
105838
106550
  /**
105839
106551
  * Add Entity which is not by default supported by this library
@@ -105868,9 +106580,9 @@ var init_XMLParser = __esm({
105868
106580
  }
105869
106581
  });
105870
106582
 
105871
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/fxp.js
106583
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/fxp.js
105872
106584
  var init_fxp = __esm({
105873
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/src/fxp.js"() {
106585
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/src/fxp.js"() {
105874
106586
  "use strict";
105875
106587
  init_import_meta_url();
105876
106588
  init_XMLParser();
@@ -105931,7 +106643,7 @@ var init_transfer_manager = __esm({
105931
106643
  });
105932
106644
 
105933
106645
  // node_modules/.pnpm/@google-cloud+storage@7.18.0/node_modules/@google-cloud/storage/build/esm/src/index.js
105934
- var init_src = __esm({
106646
+ var init_src2 = __esm({
105935
106647
  "node_modules/.pnpm/@google-cloud+storage@7.18.0/node_modules/@google-cloud/storage/build/esm/src/index.js"() {
105936
106648
  init_import_meta_url();
105937
106649
  init_nodejs_common();
@@ -105993,7 +106705,7 @@ var init_gcsApi = __esm({
105993
106705
  init_import_meta_url();
105994
106706
  fs8 = __toESM(require("fs"));
105995
106707
  path8 = __toESM(require("path"));
105996
- init_src();
106708
+ init_src2();
105997
106709
  init_logger2();
105998
106710
  init_errors2();
105999
106711
  init_dryRun();
@@ -113258,20 +113970,20 @@ ${data2}`);
113258
113970
  });
113259
113971
 
113260
113972
  // src/targets/cocoapods.ts
113261
- var fs9, import_path8, import_util23, writeFile2, DEFAULT_COCOAPODS_BIN, COCOAPODS_BIN, CocoapodsTarget;
113973
+ var fs9, import_path8, import_util24, writeFile2, DEFAULT_COCOAPODS_BIN, COCOAPODS_BIN, CocoapodsTarget;
113262
113974
  var init_cocoapods = __esm({
113263
113975
  "src/targets/cocoapods.ts"() {
113264
113976
  "use strict";
113265
113977
  init_import_meta_url();
113266
113978
  fs9 = __toESM(require("fs"));
113267
113979
  import_path8 = require("path");
113268
- import_util23 = require("util");
113980
+ import_util24 = require("util");
113269
113981
  init_errors2();
113270
113982
  init_files();
113271
113983
  init_githubApi();
113272
113984
  init_system();
113273
113985
  init_base5();
113274
- writeFile2 = (0, import_util23.promisify)(fs9.writeFile);
113986
+ writeFile2 = (0, import_util24.promisify)(fs9.writeFile);
113275
113987
  DEFAULT_COCOAPODS_BIN = "pod";
113276
113988
  COCOAPODS_BIN = process.env.COCOAPODS_BIN || DEFAULT_COCOAPODS_BIN;
113277
113989
  CocoapodsTarget = class extends BaseTarget {
@@ -113711,7 +114423,11 @@ var init_docker = __esm({
113711
114423
  init_base5();
113712
114424
  DEFAULT_DOCKER_BIN = "docker";
113713
114425
  DOCKER_BIN = process.env.DOCKER_BIN || DEFAULT_DOCKER_BIN;
113714
- DOCKER_HUB_REGISTRIES = ["docker.io", "index.docker.io", "registry-1.docker.io"];
114426
+ DOCKER_HUB_REGISTRIES = [
114427
+ "docker.io",
114428
+ "index.docker.io",
114429
+ "registry-1.docker.io"
114430
+ ];
113715
114431
  GCR_REGISTRY_PATTERNS = [
113716
114432
  /^gcr\.io$/,
113717
114433
  /^[a-z]+-gcr\.io$/,
@@ -113902,17 +114618,28 @@ Please use ${registryHint}DOCKER_USERNAME and DOCKER_PASSWORD environment variab
113902
114618
  return false;
113903
114619
  }
113904
114620
  if (!hasGcloudCredentials()) {
113905
- this.logger.debug("No gcloud credentials detected, skipping gcloud auth configure-docker");
114621
+ this.logger.debug(
114622
+ "No gcloud credentials detected, skipping gcloud auth configure-docker"
114623
+ );
113906
114624
  return false;
113907
114625
  }
113908
114626
  if (!await isGcloudAvailable()) {
113909
- this.logger.debug("gcloud CLI not available, skipping gcloud auth configure-docker");
114627
+ this.logger.debug(
114628
+ "gcloud CLI not available, skipping gcloud auth configure-docker"
114629
+ );
113910
114630
  return false;
113911
114631
  }
113912
114632
  const registryList = registries.join(",");
113913
- this.logger.debug(`Configuring Docker for Google Cloud registries: ${registryList}`);
114633
+ this.logger.debug(
114634
+ `Configuring Docker for Google Cloud registries: ${registryList}`
114635
+ );
113914
114636
  try {
113915
- await spawnProcess("gcloud", ["auth", "configure-docker", registryList, "--quiet"], {}, {});
114637
+ await spawnProcess(
114638
+ "gcloud",
114639
+ ["auth", "configure-docker", registryList, "--quiet"],
114640
+ {},
114641
+ {}
114642
+ );
113916
114643
  this.logger.info(`Configured Docker authentication for: ${registryList}`);
113917
114644
  return true;
113918
114645
  } catch (error3) {
@@ -113953,7 +114680,9 @@ Please use ${registryHint}DOCKER_USERNAME and DOCKER_PASSWORD environment variab
113953
114680
  await this.loginToRegistry(source.credentials);
113954
114681
  } else if (sourceRegistry && !source.skipLogin && !gcrConfiguredRegistries.has(sourceRegistry) && // Don't warn if source and target share the same registry - target login will cover it
113955
114682
  sourceRegistry !== targetRegistry) {
113956
- this.logger.debug(`No credentials for source registry ${sourceRegistry}, assuming public`);
114683
+ this.logger.debug(
114684
+ `No credentials for source registry ${sourceRegistry}, assuming public`
114685
+ );
113957
114686
  }
113958
114687
  if (target.credentials) {
113959
114688
  await this.loginToRegistry(target.credentials);
@@ -124498,24 +125227,22 @@ function castChecksums(checksums) {
124498
125227
  'Invalid type of "checksums": should be an array'
124499
125228
  );
124500
125229
  }
124501
- return checksums.map(
124502
- (item) => {
124503
- if (typeof item !== "object" || !item.algorithm || !item.format) {
124504
- throw new ConfigurationError(
124505
- `Invalid checksum type: ${JSON.stringify(item)}`
124506
- );
124507
- }
124508
- if (!Object.values(HashAlgorithm).includes(item.algorithm) || !Object.values(HashOutputFormat).includes(item.format)) {
124509
- throw new ConfigurationError(
124510
- `Invalid checksum type: ${JSON.stringify(item)}`
124511
- );
124512
- }
124513
- return {
124514
- algorithm: item.algorithm,
124515
- format: item.format
124516
- };
125230
+ return checksums.map((item) => {
125231
+ if (typeof item !== "object" || !item.algorithm || !item.format) {
125232
+ throw new ConfigurationError(
125233
+ `Invalid checksum type: ${JSON.stringify(item)}`
125234
+ );
124517
125235
  }
124518
- );
125236
+ if (!Object.values(HashAlgorithm).includes(item.algorithm) || !Object.values(HashOutputFormat).includes(item.format)) {
125237
+ throw new ConfigurationError(
125238
+ `Invalid checksum type: ${JSON.stringify(item)}`
125239
+ );
125240
+ }
125241
+ return {
125242
+ algorithm: item.algorithm,
125243
+ format: item.format
125244
+ };
125245
+ });
124519
125246
  }
124520
125247
  async function getArtifactChecksums(checksums, artifact, artifactProvider) {
124521
125248
  const fileChecksums = {};
@@ -124698,18 +125425,44 @@ async function getPackageManifest(baseDir, type2, canonicalName, version2, initi
124698
125425
  );
124699
125426
  throw new Error("Unreachable");
124700
125427
  }
125428
+ let effectiveManifestData = initialManifestData;
125429
+ if (!initialManifestData.name) {
125430
+ reportError(
125431
+ `"name" is required for new package "${canonicalName}". Add \`name\` to the registry target config in your .craft.yml.`
125432
+ );
125433
+ throw new Error("Unreachable");
125434
+ }
125435
+ if (!initialManifestData.mainDocsUrl) {
125436
+ logger.warn(
125437
+ `"mainDocsUrl" is not set for "${canonicalName}". Falling back to repo_url ("${initialManifestData.repoUrl}"). Set \`mainDocsUrl\` in the registry target config in .craft.yml to avoid this warning.`
125438
+ );
125439
+ effectiveManifestData = {
125440
+ ...initialManifestData,
125441
+ mainDocsUrl: initialManifestData.repoUrl
125442
+ };
125443
+ }
125444
+ if (initialManifestData.sdkName && !initialManifestData.packageUrl) {
125445
+ reportError(
125446
+ `"packageUrl" is required for new SDK "${canonicalName}". Add \`packageUrl\` to the registry target config in your .craft.yml.`
125447
+ );
125448
+ throw new Error("Unreachable");
125449
+ }
124701
125450
  if (!(0, import_fs18.existsSync)(fullPackageDir)) {
124702
125451
  logger.info(
124703
125452
  `Creating new package directory for "${canonicalName}" at "${packageDirPath}"...`
124704
125453
  );
124705
125454
  (0, import_fs18.mkdirSync)(fullPackageDir, { recursive: true });
124706
125455
  }
124707
- if (initialManifestData.sdkName) {
124708
- const sdkSymlinkPath = path15.join(baseDir, "sdks", initialManifestData.sdkName);
125456
+ if (effectiveManifestData.sdkName) {
125457
+ const sdkSymlinkPath = path15.join(
125458
+ baseDir,
125459
+ "sdks",
125460
+ effectiveManifestData.sdkName
125461
+ );
124709
125462
  if (!(0, import_fs18.existsSync)(sdkSymlinkPath)) {
124710
125463
  const relativeTarget = path15.join("..", packageDirPath);
124711
125464
  logger.info(
124712
- `Creating sdks symlink "${initialManifestData.sdkName}" -> "${relativeTarget}"...`
125465
+ `Creating sdks symlink "${effectiveManifestData.sdkName}" -> "${relativeTarget}"...`
124713
125466
  );
124714
125467
  (0, import_fs18.symlinkSync)(relativeTarget, sdkSymlinkPath);
124715
125468
  }
@@ -124719,10 +125472,13 @@ async function getPackageManifest(baseDir, type2, canonicalName, version2, initi
124719
125472
  );
124720
125473
  return {
124721
125474
  versionFilePath,
124722
- packageManifest: createInitialManifest(initialManifestData)
125475
+ packageManifest: createInitialManifest(effectiveManifestData)
124723
125476
  };
124724
125477
  }
124725
- logger.debug("Reading the current configuration from", packageManifestPath);
125478
+ logger.debug(
125479
+ "Reading the already existing configuration from",
125480
+ packageManifestPath
125481
+ );
124726
125482
  return {
124727
125483
  versionFilePath,
124728
125484
  packageManifest: JSON.parse(
@@ -136961,50 +137717,50 @@ var init_awsExpectUnion = __esm({
136961
137717
  }
136962
137718
  });
136963
137719
 
136964
- // node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/lib/fxp.cjs
137720
+ // node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/lib/fxp.cjs
136965
137721
  var require_fxp = __commonJS({
136966
- "node_modules/.pnpm/fast-xml-parser@5.3.8/node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
137722
+ "node_modules/.pnpm/fast-xml-parser@5.5.7/node_modules/fast-xml-parser/lib/fxp.cjs"(exports2, module2) {
136967
137723
  init_import_meta_url();
136968
137724
  (() => {
136969
137725
  "use strict";
136970
- var t4 = { d: (e5, n5) => {
136971
- for (var i5 in n5) t4.o(n5, i5) && !t4.o(e5, i5) && Object.defineProperty(e5, i5, { enumerable: true, get: n5[i5] });
137726
+ var t4 = { d: (e5, i5) => {
137727
+ for (var n5 in i5) t4.o(i5, n5) && !t4.o(e5, n5) && Object.defineProperty(e5, n5, { enumerable: true, get: i5[n5] });
136972
137728
  }, o: (t5, e5) => Object.prototype.hasOwnProperty.call(t5, e5), r: (t5) => {
136973
137729
  "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t5, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t5, "__esModule", { value: true });
136974
137730
  } }, e4 = {};
136975
- t4.r(e4), t4.d(e4, { XMLBuilder: () => pt2, XMLParser: () => st2, XMLValidator: () => xt2 });
136976
- const n4 = ":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", i4 = new RegExp("^[" + n4 + "][" + n4 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
137731
+ t4.r(e4), t4.d(e4, { XMLBuilder: () => Ot2, XMLParser: () => ft2, XMLValidator: () => $t2 });
137732
+ const i4 = ":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", n4 = new RegExp("^[" + i4 + "][" + i4 + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
136977
137733
  function s6(t5, e5) {
136978
- const n5 = [];
136979
- let i5 = e5.exec(t5);
136980
- for (; i5; ) {
137734
+ const i5 = [];
137735
+ let n5 = e5.exec(t5);
137736
+ for (; n5; ) {
136981
137737
  const s7 = [];
136982
- s7.startIndex = e5.lastIndex - i5[0].length;
136983
- const r5 = i5.length;
136984
- for (let t6 = 0; t6 < r5; t6++) s7.push(i5[t6]);
136985
- n5.push(s7), i5 = e5.exec(t5);
137738
+ s7.startIndex = e5.lastIndex - n5[0].length;
137739
+ const r5 = n5.length;
137740
+ for (let t6 = 0; t6 < r5; t6++) s7.push(n5[t6]);
137741
+ i5.push(s7), n5 = e5.exec(t5);
136986
137742
  }
136987
- return n5;
137743
+ return i5;
136988
137744
  }
136989
137745
  const r4 = function(t5) {
136990
- return !(null == i4.exec(t5));
136991
- }, o4 = { allowBooleanAttributes: false, unpairedTags: [] };
136992
- function a4(t5, e5) {
136993
- e5 = Object.assign({}, o4, e5);
136994
- const n5 = [];
136995
- let i5 = false, s7 = false;
137746
+ return !(null == n4.exec(t5));
137747
+ }, o4 = ["hasOwnProperty", "toString", "valueOf", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"], a4 = ["__proto__", "constructor", "prototype"], h4 = { allowBooleanAttributes: false, unpairedTags: [] };
137748
+ function l4(t5, e5) {
137749
+ e5 = Object.assign({}, h4, e5);
137750
+ const i5 = [];
137751
+ let n5 = false, s7 = false;
136996
137752
  "\uFEFF" === t5[0] && (t5 = t5.substr(1));
136997
137753
  for (let r5 = 0; r5 < t5.length; r5++) if ("<" === t5[r5] && "?" === t5[r5 + 1]) {
136998
137754
  if (r5 += 2, r5 = u7(t5, r5), r5.err) return r5;
136999
137755
  } else {
137000
137756
  if ("<" !== t5[r5]) {
137001
- if (l4(t5[r5])) continue;
137002
- return m6("InvalidChar", "char '" + t5[r5] + "' is not expected.", N2(t5, r5));
137757
+ if (p5(t5[r5])) continue;
137758
+ return b6("InvalidChar", "char '" + t5[r5] + "' is not expected.", w6(t5, r5));
137003
137759
  }
137004
137760
  {
137005
137761
  let o5 = r5;
137006
137762
  if (r5++, "!" === t5[r5]) {
137007
- r5 = d5(t5, r5);
137763
+ r5 = c4(t5, r5);
137008
137764
  continue;
137009
137765
  }
137010
137766
  {
@@ -137012,63 +137768,63 @@ var require_fxp = __commonJS({
137012
137768
  "/" === t5[r5] && (a5 = true, r5++);
137013
137769
  let h5 = "";
137014
137770
  for (; r5 < t5.length && ">" !== t5[r5] && " " !== t5[r5] && " " !== t5[r5] && "\n" !== t5[r5] && "\r" !== t5[r5]; r5++) h5 += t5[r5];
137015
- if (h5 = h5.trim(), "/" === h5[h5.length - 1] && (h5 = h5.substring(0, h5.length - 1), r5--), !b6(h5)) {
137771
+ if (h5 = h5.trim(), "/" === h5[h5.length - 1] && (h5 = h5.substring(0, h5.length - 1), r5--), !y4(h5)) {
137016
137772
  let e6;
137017
- return e6 = 0 === h5.trim().length ? "Invalid space after '<'." : "Tag '" + h5 + "' is an invalid name.", m6("InvalidTag", e6, N2(t5, r5));
137773
+ return e6 = 0 === h5.trim().length ? "Invalid space after '<'." : "Tag '" + h5 + "' is an invalid name.", b6("InvalidTag", e6, w6(t5, r5));
137018
137774
  }
137019
- const p6 = c4(t5, r5);
137020
- if (false === p6) return m6("InvalidAttr", "Attributes for '" + h5 + "' have open quote.", N2(t5, r5));
137021
- let f6 = p6.value;
137022
- if (r5 = p6.index, "/" === f6[f6.length - 1]) {
137023
- const n6 = r5 - f6.length;
137024
- f6 = f6.substring(0, f6.length - 1);
137025
- const s8 = g5(f6, e5);
137026
- if (true !== s8) return m6(s8.err.code, s8.err.msg, N2(t5, n6 + s8.err.line));
137027
- i5 = true;
137775
+ const l5 = g5(t5, r5);
137776
+ if (false === l5) return b6("InvalidAttr", "Attributes for '" + h5 + "' have open quote.", w6(t5, r5));
137777
+ let d6 = l5.value;
137778
+ if (r5 = l5.index, "/" === d6[d6.length - 1]) {
137779
+ const i6 = r5 - d6.length;
137780
+ d6 = d6.substring(0, d6.length - 1);
137781
+ const s8 = x5(d6, e5);
137782
+ if (true !== s8) return b6(s8.err.code, s8.err.msg, w6(t5, i6 + s8.err.line));
137783
+ n5 = true;
137028
137784
  } else if (a5) {
137029
- if (!p6.tagClosed) return m6("InvalidTag", "Closing tag '" + h5 + "' doesn't have proper closing.", N2(t5, r5));
137030
- if (f6.trim().length > 0) return m6("InvalidTag", "Closing tag '" + h5 + "' can't have attributes or invalid starting.", N2(t5, o5));
137031
- if (0 === n5.length) return m6("InvalidTag", "Closing tag '" + h5 + "' has not been opened.", N2(t5, o5));
137785
+ if (!l5.tagClosed) return b6("InvalidTag", "Closing tag '" + h5 + "' doesn't have proper closing.", w6(t5, r5));
137786
+ if (d6.trim().length > 0) return b6("InvalidTag", "Closing tag '" + h5 + "' can't have attributes or invalid starting.", w6(t5, o5));
137787
+ if (0 === i5.length) return b6("InvalidTag", "Closing tag '" + h5 + "' has not been opened.", w6(t5, o5));
137032
137788
  {
137033
- const e6 = n5.pop();
137789
+ const e6 = i5.pop();
137034
137790
  if (h5 !== e6.tagName) {
137035
- let n6 = N2(t5, e6.tagStartPos);
137036
- return m6("InvalidTag", "Expected closing tag '" + e6.tagName + "' (opened in line " + n6.line + ", col " + n6.col + ") instead of closing tag '" + h5 + "'.", N2(t5, o5));
137791
+ let i6 = w6(t5, e6.tagStartPos);
137792
+ return b6("InvalidTag", "Expected closing tag '" + e6.tagName + "' (opened in line " + i6.line + ", col " + i6.col + ") instead of closing tag '" + h5 + "'.", w6(t5, o5));
137037
137793
  }
137038
- 0 == n5.length && (s7 = true);
137794
+ 0 == i5.length && (s7 = true);
137039
137795
  }
137040
137796
  } else {
137041
- const a6 = g5(f6, e5);
137042
- if (true !== a6) return m6(a6.err.code, a6.err.msg, N2(t5, r5 - f6.length + a6.err.line));
137043
- if (true === s7) return m6("InvalidXml", "Multiple possible root nodes found.", N2(t5, r5));
137044
- -1 !== e5.unpairedTags.indexOf(h5) || n5.push({ tagName: h5, tagStartPos: o5 }), i5 = true;
137797
+ const a6 = x5(d6, e5);
137798
+ if (true !== a6) return b6(a6.err.code, a6.err.msg, w6(t5, r5 - d6.length + a6.err.line));
137799
+ if (true === s7) return b6("InvalidXml", "Multiple possible root nodes found.", w6(t5, r5));
137800
+ -1 !== e5.unpairedTags.indexOf(h5) || i5.push({ tagName: h5, tagStartPos: o5 }), n5 = true;
137045
137801
  }
137046
137802
  for (r5++; r5 < t5.length; r5++) if ("<" === t5[r5]) {
137047
137803
  if ("!" === t5[r5 + 1]) {
137048
- r5++, r5 = d5(t5, r5);
137804
+ r5++, r5 = c4(t5, r5);
137049
137805
  continue;
137050
137806
  }
137051
137807
  if ("?" !== t5[r5 + 1]) break;
137052
137808
  if (r5 = u7(t5, ++r5), r5.err) return r5;
137053
137809
  } else if ("&" === t5[r5]) {
137054
- const e6 = x5(t5, r5);
137055
- if (-1 == e6) return m6("InvalidChar", "char '&' is not expected.", N2(t5, r5));
137810
+ const e6 = N2(t5, r5);
137811
+ if (-1 == e6) return b6("InvalidChar", "char '&' is not expected.", w6(t5, r5));
137056
137812
  r5 = e6;
137057
- } else if (true === s7 && !l4(t5[r5])) return m6("InvalidXml", "Extra text at the end", N2(t5, r5));
137813
+ } else if (true === s7 && !p5(t5[r5])) return b6("InvalidXml", "Extra text at the end", w6(t5, r5));
137058
137814
  "<" === t5[r5] && r5--;
137059
137815
  }
137060
137816
  }
137061
137817
  }
137062
- return i5 ? 1 == n5.length ? m6("InvalidTag", "Unclosed tag '" + n5[0].tagName + "'.", N2(t5, n5[0].tagStartPos)) : !(n5.length > 0) || m6("InvalidXml", "Invalid '" + JSON.stringify(n5.map((t6) => t6.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : m6("InvalidXml", "Start tag expected.", 1);
137818
+ return n5 ? 1 == i5.length ? b6("InvalidTag", "Unclosed tag '" + i5[0].tagName + "'.", w6(t5, i5[0].tagStartPos)) : !(i5.length > 0) || b6("InvalidXml", "Invalid '" + JSON.stringify(i5.map((t6) => t6.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : b6("InvalidXml", "Start tag expected.", 1);
137063
137819
  }
137064
- function l4(t5) {
137820
+ function p5(t5) {
137065
137821
  return " " === t5 || " " === t5 || "\n" === t5 || "\r" === t5;
137066
137822
  }
137067
137823
  function u7(t5, e5) {
137068
- const n5 = e5;
137824
+ const i5 = e5;
137069
137825
  for (; e5 < t5.length; e5++) if ("?" == t5[e5] || " " == t5[e5]) {
137070
- const i5 = t5.substr(n5, e5 - n5);
137071
- if (e5 > 5 && "xml" === i5) return m6("InvalidXml", "XML declaration allowed only at the start of the document.", N2(t5, e5));
137826
+ const n5 = t5.substr(i5, e5 - i5);
137827
+ if (e5 > 5 && "xml" === n5) return b6("InvalidXml", "XML declaration allowed only at the start of the document.", w6(t5, e5));
137072
137828
  if ("?" == t5[e5] && ">" == t5[e5 + 1]) {
137073
137829
  e5++;
137074
137830
  break;
@@ -137077,16 +137833,16 @@ var require_fxp = __commonJS({
137077
137833
  }
137078
137834
  return e5;
137079
137835
  }
137080
- function d5(t5, e5) {
137836
+ function c4(t5, e5) {
137081
137837
  if (t5.length > e5 + 5 && "-" === t5[e5 + 1] && "-" === t5[e5 + 2]) {
137082
137838
  for (e5 += 3; e5 < t5.length; e5++) if ("-" === t5[e5] && "-" === t5[e5 + 1] && ">" === t5[e5 + 2]) {
137083
137839
  e5 += 2;
137084
137840
  break;
137085
137841
  }
137086
137842
  } else if (t5.length > e5 + 8 && "D" === t5[e5 + 1] && "O" === t5[e5 + 2] && "C" === t5[e5 + 3] && "T" === t5[e5 + 4] && "Y" === t5[e5 + 5] && "P" === t5[e5 + 6] && "E" === t5[e5 + 7]) {
137087
- let n5 = 1;
137088
- for (e5 += 8; e5 < t5.length; e5++) if ("<" === t5[e5]) n5++;
137089
- else if (">" === t5[e5] && (n5--, 0 === n5)) break;
137843
+ let i5 = 1;
137844
+ for (e5 += 8; e5 < t5.length; e5++) if ("<" === t5[e5]) i5++;
137845
+ else if (">" === t5[e5] && (i5--, 0 === i5)) break;
137090
137846
  } else if (t5.length > e5 + 9 && "[" === t5[e5 + 1] && "C" === t5[e5 + 2] && "D" === t5[e5 + 3] && "A" === t5[e5 + 4] && "T" === t5[e5 + 5] && "A" === t5[e5 + 6] && "[" === t5[e5 + 7]) {
137091
137847
  for (e5 += 8; e5 < t5.length; e5++) if ("]" === t5[e5] && "]" === t5[e5 + 1] && ">" === t5[e5 + 2]) {
137092
137848
  e5 += 2;
@@ -137095,83 +137851,90 @@ var require_fxp = __commonJS({
137095
137851
  }
137096
137852
  return e5;
137097
137853
  }
137098
- const h4 = '"', p5 = "'";
137099
- function c4(t5, e5) {
137100
- let n5 = "", i5 = "", s7 = false;
137854
+ const d5 = '"', f5 = "'";
137855
+ function g5(t5, e5) {
137856
+ let i5 = "", n5 = "", s7 = false;
137101
137857
  for (; e5 < t5.length; e5++) {
137102
- if (t5[e5] === h4 || t5[e5] === p5) "" === i5 ? i5 = t5[e5] : i5 !== t5[e5] || (i5 = "");
137103
- else if (">" === t5[e5] && "" === i5) {
137858
+ if (t5[e5] === d5 || t5[e5] === f5) "" === n5 ? n5 = t5[e5] : n5 !== t5[e5] || (n5 = "");
137859
+ else if (">" === t5[e5] && "" === n5) {
137104
137860
  s7 = true;
137105
137861
  break;
137106
137862
  }
137107
- n5 += t5[e5];
137863
+ i5 += t5[e5];
137108
137864
  }
137109
- return "" === i5 && { value: n5, index: e5, tagClosed: s7 };
137865
+ return "" === n5 && { value: i5, index: e5, tagClosed: s7 };
137110
137866
  }
137111
- const f5 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
137112
- function g5(t5, e5) {
137113
- const n5 = s6(t5, f5), i5 = {};
137114
- for (let t6 = 0; t6 < n5.length; t6++) {
137115
- if (0 === n5[t6][1].length) return m6("InvalidAttr", "Attribute '" + n5[t6][2] + "' has no space in starting.", y4(n5[t6]));
137116
- if (void 0 !== n5[t6][3] && void 0 === n5[t6][4]) return m6("InvalidAttr", "Attribute '" + n5[t6][2] + "' is without value.", y4(n5[t6]));
137117
- if (void 0 === n5[t6][3] && !e5.allowBooleanAttributes) return m6("InvalidAttr", "boolean attribute '" + n5[t6][2] + "' is not allowed.", y4(n5[t6]));
137118
- const s7 = n5[t6][2];
137119
- if (!E3(s7)) return m6("InvalidAttr", "Attribute '" + s7 + "' is an invalid name.", y4(n5[t6]));
137120
- if (Object.prototype.hasOwnProperty.call(i5, s7)) return m6("InvalidAttr", "Attribute '" + s7 + "' is repeated.", y4(n5[t6]));
137121
- i5[s7] = 1;
137867
+ const m6 = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
137868
+ function x5(t5, e5) {
137869
+ const i5 = s6(t5, m6), n5 = {};
137870
+ for (let t6 = 0; t6 < i5.length; t6++) {
137871
+ if (0 === i5[t6][1].length) return b6("InvalidAttr", "Attribute '" + i5[t6][2] + "' has no space in starting.", v9(i5[t6]));
137872
+ if (void 0 !== i5[t6][3] && void 0 === i5[t6][4]) return b6("InvalidAttr", "Attribute '" + i5[t6][2] + "' is without value.", v9(i5[t6]));
137873
+ if (void 0 === i5[t6][3] && !e5.allowBooleanAttributes) return b6("InvalidAttr", "boolean attribute '" + i5[t6][2] + "' is not allowed.", v9(i5[t6]));
137874
+ const s7 = i5[t6][2];
137875
+ if (!E3(s7)) return b6("InvalidAttr", "Attribute '" + s7 + "' is an invalid name.", v9(i5[t6]));
137876
+ if (Object.prototype.hasOwnProperty.call(n5, s7)) return b6("InvalidAttr", "Attribute '" + s7 + "' is repeated.", v9(i5[t6]));
137877
+ n5[s7] = 1;
137122
137878
  }
137123
137879
  return true;
137124
137880
  }
137125
- function x5(t5, e5) {
137881
+ function N2(t5, e5) {
137126
137882
  if (";" === t5[++e5]) return -1;
137127
137883
  if ("#" === t5[e5]) return (function(t6, e6) {
137128
- let n6 = /\d/;
137129
- for ("x" === t6[e6] && (e6++, n6 = /[\da-fA-F]/); e6 < t6.length; e6++) {
137884
+ let i6 = /\d/;
137885
+ for ("x" === t6[e6] && (e6++, i6 = /[\da-fA-F]/); e6 < t6.length; e6++) {
137130
137886
  if (";" === t6[e6]) return e6;
137131
- if (!t6[e6].match(n6)) break;
137887
+ if (!t6[e6].match(i6)) break;
137132
137888
  }
137133
137889
  return -1;
137134
137890
  })(t5, ++e5);
137135
- let n5 = 0;
137136
- for (; e5 < t5.length; e5++, n5++) if (!(t5[e5].match(/\w/) && n5 < 20)) {
137891
+ let i5 = 0;
137892
+ for (; e5 < t5.length; e5++, i5++) if (!(t5[e5].match(/\w/) && i5 < 20)) {
137137
137893
  if (";" === t5[e5]) break;
137138
137894
  return -1;
137139
137895
  }
137140
137896
  return e5;
137141
137897
  }
137142
- function m6(t5, e5, n5) {
137143
- return { err: { code: t5, msg: e5, line: n5.line || n5, col: n5.col } };
137898
+ function b6(t5, e5, i5) {
137899
+ return { err: { code: t5, msg: e5, line: i5.line || i5, col: i5.col } };
137144
137900
  }
137145
137901
  function E3(t5) {
137146
137902
  return r4(t5);
137147
137903
  }
137148
- function b6(t5) {
137904
+ function y4(t5) {
137149
137905
  return r4(t5);
137150
137906
  }
137151
- function N2(t5, e5) {
137152
- const n5 = t5.substring(0, e5).split(/\r?\n/);
137153
- return { line: n5.length, col: n5[n5.length - 1].length + 1 };
137907
+ function w6(t5, e5) {
137908
+ const i5 = t5.substring(0, e5).split(/\r?\n/);
137909
+ return { line: i5.length, col: i5[i5.length - 1].length + 1 };
137154
137910
  }
137155
- function y4(t5) {
137911
+ function v9(t5) {
137156
137912
  return t5.startIndex + t5[1].length;
137157
137913
  }
137158
- const T2 = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t5, e5) {
137914
+ const T2 = (t5) => o4.includes(t5) ? "__" + t5 : t5, P3 = { preserveOrder: false, attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, removeNSPrefix: false, allowBooleanAttributes: false, parseTagValue: true, parseAttributeValue: false, trimValues: true, cdataPropName: false, numberParseOptions: { hex: true, leadingZeros: true, eNotation: true }, tagValueProcessor: function(t5, e5) {
137159
137915
  return e5;
137160
137916
  }, attributeValueProcessor: function(t5, e5) {
137161
137917
  return e5;
137162
- }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t5, e5, n5) {
137918
+ }, stopNodes: [], alwaysCreateTextNode: false, isArray: () => false, commentPropName: false, unpairedTags: [], processEntities: true, htmlEntities: false, ignoreDeclaration: false, ignorePiTags: false, transformTagName: false, transformAttributeName: false, updateTag: function(t5, e5, i5) {
137163
137919
  return t5;
137164
- }, captureMetaData: false, maxNestedTags: 100 };
137165
- function w6(t5) {
137166
- return "boolean" == typeof t5 ? { enabled: t5, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, allowedTags: null, tagFilter: null } : "object" == typeof t5 && null !== t5 ? { enabled: false !== t5.enabled, maxEntitySize: t5.maxEntitySize ?? 1e4, maxExpansionDepth: t5.maxExpansionDepth ?? 10, maxTotalExpansions: t5.maxTotalExpansions ?? 1e3, maxExpandedLength: t5.maxExpandedLength ?? 1e5, allowedTags: t5.allowedTags ?? null, tagFilter: t5.tagFilter ?? null } : w6(true);
137920
+ }, captureMetaData: false, maxNestedTags: 100, strictReservedNames: true, jPath: true, onDangerousProperty: T2 };
137921
+ function S2(t5, e5) {
137922
+ if ("string" != typeof t5) return;
137923
+ const i5 = t5.toLowerCase();
137924
+ if (o4.some((t6) => i5 === t6.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e5}: "${t5}" is a reserved JavaScript keyword that could cause prototype pollution`);
137925
+ if (a4.some((t6) => i5 === t6.toLowerCase())) throw new Error(`[SECURITY] Invalid ${e5}: "${t5}" is a reserved JavaScript keyword that could cause prototype pollution`);
137926
+ }
137927
+ function A3(t5) {
137928
+ return "boolean" == typeof t5 ? { enabled: t5, maxEntitySize: 1e4, maxExpansionDepth: 10, maxTotalExpansions: 1e3, maxExpandedLength: 1e5, maxEntityCount: 100, allowedTags: null, tagFilter: null } : "object" == typeof t5 && null !== t5 ? { enabled: false !== t5.enabled, maxEntitySize: Math.max(1, t5.maxEntitySize ?? 1e4), maxExpansionDepth: Math.max(1, t5.maxExpansionDepth ?? 10), maxTotalExpansions: Math.max(1, t5.maxTotalExpansions ?? 1e3), maxExpandedLength: Math.max(1, t5.maxExpandedLength ?? 1e5), maxEntityCount: Math.max(1, t5.maxEntityCount ?? 100), allowedTags: t5.allowedTags ?? null, tagFilter: t5.tagFilter ?? null } : A3(true);
137167
137929
  }
137168
- const v9 = function(t5) {
137169
- const e5 = Object.assign({}, T2, t5);
137170
- return e5.processEntities = w6(e5.processEntities), e5;
137930
+ const C4 = function(t5) {
137931
+ const e5 = Object.assign({}, P3, t5), i5 = [{ value: e5.attributeNamePrefix, name: "attributeNamePrefix" }, { value: e5.attributesGroupName, name: "attributesGroupName" }, { value: e5.textNodeName, name: "textNodeName" }, { value: e5.cdataPropName, name: "cdataPropName" }, { value: e5.commentPropName, name: "commentPropName" }];
137932
+ for (const { value: t6, name: e6 } of i5) t6 && S2(t6, e6);
137933
+ return null === e5.onDangerousProperty && (e5.onDangerousProperty = T2), e5.processEntities = A3(e5.processEntities), e5.stopNodes && Array.isArray(e5.stopNodes) && (e5.stopNodes = e5.stopNodes.map((t6) => "string" == typeof t6 && t6.startsWith("*.") ? ".." + t6.substring(2) : t6)), e5;
137171
137934
  };
137172
137935
  let O2;
137173
137936
  O2 = "function" != typeof Symbol ? "@@xmlMetadata" : Symbol("XML Node Metadata");
137174
- class I4 {
137937
+ class $3 {
137175
137938
  constructor(t5) {
137176
137939
  this.tagname = t5, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
137177
137940
  }
@@ -137185,192 +137948,403 @@ var require_fxp = __commonJS({
137185
137948
  return O2;
137186
137949
  }
137187
137950
  }
137188
- class P3 {
137951
+ class I4 {
137189
137952
  constructor(t5) {
137190
137953
  this.suppressValidationErr = !t5, this.options = t5;
137191
137954
  }
137192
137955
  readDocType(t5, e5) {
137193
- const n5 = /* @__PURE__ */ Object.create(null);
137956
+ const i5 = /* @__PURE__ */ Object.create(null);
137957
+ let n5 = 0;
137194
137958
  if ("O" !== t5[e5 + 3] || "C" !== t5[e5 + 4] || "T" !== t5[e5 + 5] || "Y" !== t5[e5 + 6] || "P" !== t5[e5 + 7] || "E" !== t5[e5 + 8]) throw new Error("Invalid Tag instead of DOCTYPE");
137195
137959
  {
137196
137960
  e5 += 9;
137197
- let i5 = 1, s7 = false, r5 = false, o5 = "";
137198
- for (; e5 < t5.length; e5++) if ("<" !== t5[e5] || r5) if (">" === t5[e5]) {
137199
- if (r5 ? "-" === t5[e5 - 1] && "-" === t5[e5 - 2] && (r5 = false, i5--) : i5--, 0 === i5) break;
137200
- } else "[" === t5[e5] ? s7 = true : o5 += t5[e5];
137961
+ let s7 = 1, r5 = false, o5 = false, a5 = "";
137962
+ for (; e5 < t5.length; e5++) if ("<" !== t5[e5] || o5) if (">" === t5[e5]) {
137963
+ if (o5 ? "-" === t5[e5 - 1] && "-" === t5[e5 - 2] && (o5 = false, s7--) : s7--, 0 === s7) break;
137964
+ } else "[" === t5[e5] ? r5 = true : a5 += t5[e5];
137201
137965
  else {
137202
- if (s7 && S2(t5, "!ENTITY", e5)) {
137203
- let i6, s8;
137204
- if (e5 += 7, [i6, s8, e5] = this.readEntityExp(t5, e5 + 1, this.suppressValidationErr), -1 === s8.indexOf("&")) {
137205
- const t6 = i6.replace(/[.\-+*:]/g, "\\.");
137206
- n5[i6] = { regx: RegExp(`&${t6};`, "g"), val: s8 };
137966
+ if (r5 && _3(t5, "!ENTITY", e5)) {
137967
+ let s8, r6;
137968
+ if (e5 += 7, [s8, r6, e5] = this.readEntityExp(t5, e5 + 1, this.suppressValidationErr), -1 === r6.indexOf("&")) {
137969
+ if (false !== this.options.enabled && null != this.options.maxEntityCount && n5 >= this.options.maxEntityCount) throw new Error(`Entity count (${n5 + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
137970
+ const t6 = s8.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
137971
+ i5[s8] = { regx: RegExp(`&${t6};`, "g"), val: r6 }, n5++;
137207
137972
  }
137208
- } else if (s7 && S2(t5, "!ELEMENT", e5)) {
137973
+ } else if (r5 && _3(t5, "!ELEMENT", e5)) {
137209
137974
  e5 += 8;
137210
- const { index: n6 } = this.readElementExp(t5, e5 + 1);
137211
- e5 = n6;
137212
- } else if (s7 && S2(t5, "!ATTLIST", e5)) e5 += 8;
137213
- else if (s7 && S2(t5, "!NOTATION", e5)) {
137975
+ const { index: i6 } = this.readElementExp(t5, e5 + 1);
137976
+ e5 = i6;
137977
+ } else if (r5 && _3(t5, "!ATTLIST", e5)) e5 += 8;
137978
+ else if (r5 && _3(t5, "!NOTATION", e5)) {
137214
137979
  e5 += 9;
137215
- const { index: n6 } = this.readNotationExp(t5, e5 + 1, this.suppressValidationErr);
137216
- e5 = n6;
137980
+ const { index: i6 } = this.readNotationExp(t5, e5 + 1, this.suppressValidationErr);
137981
+ e5 = i6;
137217
137982
  } else {
137218
- if (!S2(t5, "!--", e5)) throw new Error("Invalid DOCTYPE");
137219
- r5 = true;
137983
+ if (!_3(t5, "!--", e5)) throw new Error("Invalid DOCTYPE");
137984
+ o5 = true;
137220
137985
  }
137221
- i5++, o5 = "";
137986
+ s7++, a5 = "";
137222
137987
  }
137223
- if (0 !== i5) throw new Error("Unclosed DOCTYPE");
137988
+ if (0 !== s7) throw new Error("Unclosed DOCTYPE");
137224
137989
  }
137225
- return { entities: n5, i: e5 };
137990
+ return { entities: i5, i: e5 };
137226
137991
  }
137227
137992
  readEntityExp(t5, e5) {
137228
- e5 = A3(t5, e5);
137229
- let n5 = "";
137230
- for (; e5 < t5.length && !/\s/.test(t5[e5]) && '"' !== t5[e5] && "'" !== t5[e5]; ) n5 += t5[e5], e5++;
137231
- if (C4(n5), e5 = A3(t5, e5), !this.suppressValidationErr) {
137993
+ const i5 = e5 = j6(t5, e5);
137994
+ for (; e5 < t5.length && !/\s/.test(t5[e5]) && '"' !== t5[e5] && "'" !== t5[e5]; ) e5++;
137995
+ let n5 = t5.substring(i5, e5);
137996
+ if (D4(n5), e5 = j6(t5, e5), !this.suppressValidationErr) {
137232
137997
  if ("SYSTEM" === t5.substring(e5, e5 + 6).toUpperCase()) throw new Error("External entities are not supported");
137233
137998
  if ("%" === t5[e5]) throw new Error("Parameter entities are not supported");
137234
137999
  }
137235
- let i5 = "";
137236
- if ([e5, i5] = this.readIdentifierVal(t5, e5, "entity"), false !== this.options.enabled && this.options.maxEntitySize && i5.length > this.options.maxEntitySize) throw new Error(`Entity "${n5}" size (${i5.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
137237
- return [n5, i5, --e5];
138000
+ let s7 = "";
138001
+ if ([e5, s7] = this.readIdentifierVal(t5, e5, "entity"), false !== this.options.enabled && null != this.options.maxEntitySize && s7.length > this.options.maxEntitySize) throw new Error(`Entity "${n5}" size (${s7.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
138002
+ return [n5, s7, --e5];
137238
138003
  }
137239
138004
  readNotationExp(t5, e5) {
137240
- e5 = A3(t5, e5);
138005
+ const i5 = e5 = j6(t5, e5);
138006
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138007
+ let n5 = t5.substring(i5, e5);
138008
+ !this.suppressValidationErr && D4(n5), e5 = j6(t5, e5);
138009
+ const s7 = t5.substring(e5, e5 + 6).toUpperCase();
138010
+ if (!this.suppressValidationErr && "SYSTEM" !== s7 && "PUBLIC" !== s7) throw new Error(`Expected SYSTEM or PUBLIC, found "${s7}"`);
138011
+ e5 += s7.length, e5 = j6(t5, e5);
138012
+ let r5 = null, o5 = null;
138013
+ if ("PUBLIC" === s7) [e5, r5] = this.readIdentifierVal(t5, e5, "publicIdentifier"), '"' !== t5[e5 = j6(t5, e5)] && "'" !== t5[e5] || ([e5, o5] = this.readIdentifierVal(t5, e5, "systemIdentifier"));
138014
+ else if ("SYSTEM" === s7 && ([e5, o5] = this.readIdentifierVal(t5, e5, "systemIdentifier"), !this.suppressValidationErr && !o5)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
138015
+ return { notationName: n5, publicIdentifier: r5, systemIdentifier: o5, index: --e5 };
138016
+ }
138017
+ readIdentifierVal(t5, e5, i5) {
137241
138018
  let n5 = "";
137242
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) n5 += t5[e5], e5++;
137243
- !this.suppressValidationErr && C4(n5), e5 = A3(t5, e5);
137244
- const i5 = t5.substring(e5, e5 + 6).toUpperCase();
137245
- if (!this.suppressValidationErr && "SYSTEM" !== i5 && "PUBLIC" !== i5) throw new Error(`Expected SYSTEM or PUBLIC, found "${i5}"`);
137246
- e5 += i5.length, e5 = A3(t5, e5);
137247
- let s7 = null, r5 = null;
137248
- if ("PUBLIC" === i5) [e5, s7] = this.readIdentifierVal(t5, e5, "publicIdentifier"), '"' !== t5[e5 = A3(t5, e5)] && "'" !== t5[e5] || ([e5, r5] = this.readIdentifierVal(t5, e5, "systemIdentifier"));
137249
- else if ("SYSTEM" === i5 && ([e5, r5] = this.readIdentifierVal(t5, e5, "systemIdentifier"), !this.suppressValidationErr && !r5)) throw new Error("Missing mandatory system identifier for SYSTEM notation");
137250
- return { notationName: n5, publicIdentifier: s7, systemIdentifier: r5, index: --e5 };
137251
- }
137252
- readIdentifierVal(t5, e5, n5) {
137253
- let i5 = "";
137254
138019
  const s7 = t5[e5];
137255
138020
  if ('"' !== s7 && "'" !== s7) throw new Error(`Expected quoted string, found "${s7}"`);
137256
- for (e5++; e5 < t5.length && t5[e5] !== s7; ) i5 += t5[e5], e5++;
137257
- if (t5[e5] !== s7) throw new Error(`Unterminated ${n5} value`);
137258
- return [++e5, i5];
138021
+ const r5 = ++e5;
138022
+ for (; e5 < t5.length && t5[e5] !== s7; ) e5++;
138023
+ if (n5 = t5.substring(r5, e5), t5[e5] !== s7) throw new Error(`Unterminated ${i5} value`);
138024
+ return [++e5, n5];
137259
138025
  }
137260
138026
  readElementExp(t5, e5) {
137261
- e5 = A3(t5, e5);
137262
- let n5 = "";
137263
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) n5 += t5[e5], e5++;
138027
+ const i5 = e5 = j6(t5, e5);
138028
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138029
+ let n5 = t5.substring(i5, e5);
137264
138030
  if (!this.suppressValidationErr && !r4(n5)) throw new Error(`Invalid element name: "${n5}"`);
137265
- let i5 = "";
137266
- if ("E" === t5[e5 = A3(t5, e5)] && S2(t5, "MPTY", e5)) e5 += 4;
137267
- else if ("A" === t5[e5] && S2(t5, "NY", e5)) e5 += 2;
138031
+ let s7 = "";
138032
+ if ("E" === t5[e5 = j6(t5, e5)] && _3(t5, "MPTY", e5)) e5 += 4;
138033
+ else if ("A" === t5[e5] && _3(t5, "NY", e5)) e5 += 2;
137268
138034
  else if ("(" === t5[e5]) {
137269
- for (e5++; e5 < t5.length && ")" !== t5[e5]; ) i5 += t5[e5], e5++;
137270
- if (")" !== t5[e5]) throw new Error("Unterminated content model");
138035
+ const i6 = ++e5;
138036
+ for (; e5 < t5.length && ")" !== t5[e5]; ) e5++;
138037
+ if (s7 = t5.substring(i6, e5), ")" !== t5[e5]) throw new Error("Unterminated content model");
137271
138038
  } else if (!this.suppressValidationErr) throw new Error(`Invalid Element Expression, found "${t5[e5]}"`);
137272
- return { elementName: n5, contentModel: i5.trim(), index: e5 };
138039
+ return { elementName: n5, contentModel: s7.trim(), index: e5 };
137273
138040
  }
137274
138041
  readAttlistExp(t5, e5) {
137275
- e5 = A3(t5, e5);
137276
- let n5 = "";
137277
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) n5 += t5[e5], e5++;
137278
- C4(n5), e5 = A3(t5, e5);
137279
- let i5 = "";
137280
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) i5 += t5[e5], e5++;
137281
- if (!C4(i5)) throw new Error(`Invalid attribute name: "${i5}"`);
137282
- e5 = A3(t5, e5);
137283
- let s7 = "";
138042
+ let i5 = e5 = j6(t5, e5);
138043
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138044
+ let n5 = t5.substring(i5, e5);
138045
+ for (D4(n5), i5 = e5 = j6(t5, e5); e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138046
+ let s7 = t5.substring(i5, e5);
138047
+ if (!D4(s7)) throw new Error(`Invalid attribute name: "${s7}"`);
138048
+ e5 = j6(t5, e5);
138049
+ let r5 = "";
137284
138050
  if ("NOTATION" === t5.substring(e5, e5 + 8).toUpperCase()) {
137285
- if (s7 = "NOTATION", "(" !== t5[e5 = A3(t5, e5 += 8)]) throw new Error(`Expected '(', found "${t5[e5]}"`);
138051
+ if (r5 = "NOTATION", "(" !== t5[e5 = j6(t5, e5 += 8)]) throw new Error(`Expected '(', found "${t5[e5]}"`);
137286
138052
  e5++;
137287
- let n6 = [];
138053
+ let i6 = [];
137288
138054
  for (; e5 < t5.length && ")" !== t5[e5]; ) {
137289
- let i6 = "";
137290
- for (; e5 < t5.length && "|" !== t5[e5] && ")" !== t5[e5]; ) i6 += t5[e5], e5++;
137291
- if (i6 = i6.trim(), !C4(i6)) throw new Error(`Invalid notation name: "${i6}"`);
137292
- n6.push(i6), "|" === t5[e5] && (e5++, e5 = A3(t5, e5));
138055
+ const n6 = e5;
138056
+ for (; e5 < t5.length && "|" !== t5[e5] && ")" !== t5[e5]; ) e5++;
138057
+ let s8 = t5.substring(n6, e5);
138058
+ if (s8 = s8.trim(), !D4(s8)) throw new Error(`Invalid notation name: "${s8}"`);
138059
+ i6.push(s8), "|" === t5[e5] && (e5++, e5 = j6(t5, e5));
137293
138060
  }
137294
138061
  if (")" !== t5[e5]) throw new Error("Unterminated list of notations");
137295
- e5++, s7 += " (" + n6.join("|") + ")";
138062
+ e5++, r5 += " (" + i6.join("|") + ")";
137296
138063
  } else {
137297
- for (; e5 < t5.length && !/\s/.test(t5[e5]); ) s7 += t5[e5], e5++;
138064
+ const i6 = e5;
138065
+ for (; e5 < t5.length && !/\s/.test(t5[e5]); ) e5++;
138066
+ r5 += t5.substring(i6, e5);
137298
138067
  const n6 = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
137299
- if (!this.suppressValidationErr && !n6.includes(s7.toUpperCase())) throw new Error(`Invalid attribute type: "${s7}"`);
138068
+ if (!this.suppressValidationErr && !n6.includes(r5.toUpperCase())) throw new Error(`Invalid attribute type: "${r5}"`);
137300
138069
  }
137301
- e5 = A3(t5, e5);
137302
- let r5 = "";
137303
- return "#REQUIRED" === t5.substring(e5, e5 + 8).toUpperCase() ? (r5 = "#REQUIRED", e5 += 8) : "#IMPLIED" === t5.substring(e5, e5 + 7).toUpperCase() ? (r5 = "#IMPLIED", e5 += 7) : [e5, r5] = this.readIdentifierVal(t5, e5, "ATTLIST"), { elementName: n5, attributeName: i5, attributeType: s7, defaultValue: r5, index: e5 };
138070
+ e5 = j6(t5, e5);
138071
+ let o5 = "";
138072
+ return "#REQUIRED" === t5.substring(e5, e5 + 8).toUpperCase() ? (o5 = "#REQUIRED", e5 += 8) : "#IMPLIED" === t5.substring(e5, e5 + 7).toUpperCase() ? (o5 = "#IMPLIED", e5 += 7) : [e5, o5] = this.readIdentifierVal(t5, e5, "ATTLIST"), { elementName: n5, attributeName: s7, attributeType: r5, defaultValue: o5, index: e5 };
137304
138073
  }
137305
138074
  }
137306
- const A3 = (t5, e5) => {
138075
+ const j6 = (t5, e5) => {
137307
138076
  for (; e5 < t5.length && /\s/.test(t5[e5]); ) e5++;
137308
138077
  return e5;
137309
138078
  };
137310
- function S2(t5, e5, n5) {
137311
- for (let i5 = 0; i5 < e5.length; i5++) if (e5[i5] !== t5[n5 + i5 + 1]) return false;
138079
+ function _3(t5, e5, i5) {
138080
+ for (let n5 = 0; n5 < e5.length; n5++) if (e5[n5] !== t5[i5 + n5 + 1]) return false;
137312
138081
  return true;
137313
138082
  }
137314
- function C4(t5) {
138083
+ function D4(t5) {
137315
138084
  if (r4(t5)) return t5;
137316
138085
  throw new Error(`Invalid entity name ${t5}`);
137317
138086
  }
137318
- const $3 = /^[-+]?0x[a-fA-F0-9]+$/, V2 = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, D4 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true };
137319
- const j6 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
137320
- function L3(t5) {
137321
- return "function" == typeof t5 ? t5 : Array.isArray(t5) ? (e5) => {
137322
- for (const n5 of t5) {
137323
- if ("string" == typeof n5 && e5 === n5) return true;
137324
- if (n5 instanceof RegExp && n5.test(e5)) return true;
138087
+ const V2 = /^[-+]?0x[a-fA-F0-9]+$/, k6 = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, M3 = { hex: true, leadingZeros: true, decimalPoint: ".", eNotation: true, infinity: "original" };
138088
+ const F4 = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
138089
+ class L3 {
138090
+ constructor(t5 = {}) {
138091
+ this.separator = t5.separator || ".", this.path = [], this.siblingStacks = [];
138092
+ }
138093
+ push(t5, e5 = null, i5 = null) {
138094
+ this.path.length > 0 && (this.path[this.path.length - 1].values = void 0);
138095
+ const n5 = this.path.length;
138096
+ this.siblingStacks[n5] || (this.siblingStacks[n5] = /* @__PURE__ */ new Map());
138097
+ const s7 = this.siblingStacks[n5], r5 = i5 ? `${i5}:${t5}` : t5, o5 = s7.get(r5) || 0;
138098
+ let a5 = 0;
138099
+ for (const t6 of s7.values()) a5 += t6;
138100
+ s7.set(r5, o5 + 1);
138101
+ const h5 = { tag: t5, position: a5, counter: o5 };
138102
+ null != i5 && (h5.namespace = i5), null != e5 && (h5.values = e5), this.path.push(h5);
138103
+ }
138104
+ pop() {
138105
+ if (0 === this.path.length) return;
138106
+ const t5 = this.path.pop();
138107
+ return this.siblingStacks.length > this.path.length + 1 && (this.siblingStacks.length = this.path.length + 1), t5;
138108
+ }
138109
+ updateCurrent(t5) {
138110
+ if (this.path.length > 0) {
138111
+ const e5 = this.path[this.path.length - 1];
138112
+ null != t5 && (e5.values = t5);
138113
+ }
138114
+ }
138115
+ getCurrentTag() {
138116
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
138117
+ }
138118
+ getCurrentNamespace() {
138119
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
138120
+ }
138121
+ getAttrValue(t5) {
138122
+ if (0 === this.path.length) return;
138123
+ const e5 = this.path[this.path.length - 1];
138124
+ return e5.values?.[t5];
138125
+ }
138126
+ hasAttr(t5) {
138127
+ if (0 === this.path.length) return false;
138128
+ const e5 = this.path[this.path.length - 1];
138129
+ return void 0 !== e5.values && t5 in e5.values;
138130
+ }
138131
+ getPosition() {
138132
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].position ?? 0;
138133
+ }
138134
+ getCounter() {
138135
+ return 0 === this.path.length ? -1 : this.path[this.path.length - 1].counter ?? 0;
138136
+ }
138137
+ getIndex() {
138138
+ return this.getPosition();
138139
+ }
138140
+ getDepth() {
138141
+ return this.path.length;
138142
+ }
138143
+ toString(t5, e5 = true) {
138144
+ const i5 = t5 || this.separator;
138145
+ return this.path.map((t6) => e5 && t6.namespace ? `${t6.namespace}:${t6.tag}` : t6.tag).join(i5);
138146
+ }
138147
+ toArray() {
138148
+ return this.path.map((t5) => t5.tag);
138149
+ }
138150
+ reset() {
138151
+ this.path = [], this.siblingStacks = [];
138152
+ }
138153
+ matches(t5) {
138154
+ const e5 = t5.segments;
138155
+ return 0 !== e5.length && (t5.hasDeepWildcard() ? this._matchWithDeepWildcard(e5) : this._matchSimple(e5));
138156
+ }
138157
+ _matchSimple(t5) {
138158
+ if (this.path.length !== t5.length) return false;
138159
+ for (let e5 = 0; e5 < t5.length; e5++) {
138160
+ const i5 = t5[e5], n5 = this.path[e5], s7 = e5 === this.path.length - 1;
138161
+ if (!this._matchSegment(i5, n5, s7)) return false;
138162
+ }
138163
+ return true;
138164
+ }
138165
+ _matchWithDeepWildcard(t5) {
138166
+ let e5 = this.path.length - 1, i5 = t5.length - 1;
138167
+ for (; i5 >= 0 && e5 >= 0; ) {
138168
+ const n5 = t5[i5];
138169
+ if ("deep-wildcard" === n5.type) {
138170
+ if (i5--, i5 < 0) return true;
138171
+ const n6 = t5[i5];
138172
+ let s7 = false;
138173
+ for (let t6 = e5; t6 >= 0; t6--) {
138174
+ const r5 = t6 === this.path.length - 1;
138175
+ if (this._matchSegment(n6, this.path[t6], r5)) {
138176
+ e5 = t6 - 1, i5--, s7 = true;
138177
+ break;
138178
+ }
138179
+ }
138180
+ if (!s7) return false;
138181
+ } else {
138182
+ const t6 = e5 === this.path.length - 1;
138183
+ if (!this._matchSegment(n5, this.path[e5], t6)) return false;
138184
+ e5--, i5--;
138185
+ }
138186
+ }
138187
+ return i5 < 0;
138188
+ }
138189
+ _matchSegment(t5, e5, i5) {
138190
+ if ("*" !== t5.tag && t5.tag !== e5.tag) return false;
138191
+ if (void 0 !== t5.namespace && "*" !== t5.namespace && t5.namespace !== e5.namespace) return false;
138192
+ if (void 0 !== t5.attrName) {
138193
+ if (!i5) return false;
138194
+ if (!e5.values || !(t5.attrName in e5.values)) return false;
138195
+ if (void 0 !== t5.attrValue) {
138196
+ const i6 = e5.values[t5.attrName];
138197
+ if (String(i6) !== String(t5.attrValue)) return false;
138198
+ }
138199
+ }
138200
+ if (void 0 !== t5.position) {
138201
+ if (!i5) return false;
138202
+ const n5 = e5.counter ?? 0;
138203
+ if ("first" === t5.position && 0 !== n5) return false;
138204
+ if ("odd" === t5.position && n5 % 2 != 1) return false;
138205
+ if ("even" === t5.position && n5 % 2 != 0) return false;
138206
+ if ("nth" === t5.position && n5 !== t5.positionValue) return false;
137325
138207
  }
137326
- } : () => false;
138208
+ return true;
138209
+ }
138210
+ snapshot() {
138211
+ return { path: this.path.map((t5) => ({ ...t5 })), siblingStacks: this.siblingStacks.map((t5) => new Map(t5)) };
138212
+ }
138213
+ restore(t5) {
138214
+ this.path = t5.path.map((t6) => ({ ...t6 })), this.siblingStacks = t5.siblingStacks.map((t6) => new Map(t6));
138215
+ }
138216
+ }
138217
+ class G4 {
138218
+ constructor(t5, e5 = {}) {
138219
+ this.pattern = t5, this.separator = e5.separator || ".", this.segments = this._parse(t5), this._hasDeepWildcard = this.segments.some((t6) => "deep-wildcard" === t6.type), this._hasAttributeCondition = this.segments.some((t6) => void 0 !== t6.attrName), this._hasPositionSelector = this.segments.some((t6) => void 0 !== t6.position);
138220
+ }
138221
+ _parse(t5) {
138222
+ const e5 = [];
138223
+ let i5 = 0, n5 = "";
138224
+ for (; i5 < t5.length; ) t5[i5] === this.separator ? i5 + 1 < t5.length && t5[i5 + 1] === this.separator ? (n5.trim() && (e5.push(this._parseSegment(n5.trim())), n5 = ""), e5.push({ type: "deep-wildcard" }), i5 += 2) : (n5.trim() && e5.push(this._parseSegment(n5.trim())), n5 = "", i5++) : (n5 += t5[i5], i5++);
138225
+ return n5.trim() && e5.push(this._parseSegment(n5.trim())), e5;
138226
+ }
138227
+ _parseSegment(t5) {
138228
+ const e5 = { type: "tag" };
138229
+ let i5 = null, n5 = t5;
138230
+ const s7 = t5.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
138231
+ if (s7 && (n5 = s7[1] + s7[3], s7[2])) {
138232
+ const t6 = s7[2].slice(1, -1);
138233
+ t6 && (i5 = t6);
138234
+ }
138235
+ let r5, o5, a5 = n5;
138236
+ if (n5.includes("::")) {
138237
+ const e6 = n5.indexOf("::");
138238
+ if (r5 = n5.substring(0, e6).trim(), a5 = n5.substring(e6 + 2).trim(), !r5) throw new Error(`Invalid namespace in pattern: ${t5}`);
138239
+ }
138240
+ let h5 = null;
138241
+ if (a5.includes(":")) {
138242
+ const t6 = a5.lastIndexOf(":"), e6 = a5.substring(0, t6).trim(), i6 = a5.substring(t6 + 1).trim();
138243
+ ["first", "last", "odd", "even"].includes(i6) || /^nth\(\d+\)$/.test(i6) ? (o5 = e6, h5 = i6) : o5 = a5;
138244
+ } else o5 = a5;
138245
+ if (!o5) throw new Error(`Invalid segment pattern: ${t5}`);
138246
+ if (e5.tag = o5, r5 && (e5.namespace = r5), i5) if (i5.includes("=")) {
138247
+ const t6 = i5.indexOf("=");
138248
+ e5.attrName = i5.substring(0, t6).trim(), e5.attrValue = i5.substring(t6 + 1).trim();
138249
+ } else e5.attrName = i5.trim();
138250
+ if (h5) {
138251
+ const t6 = h5.match(/^nth\((\d+)\)$/);
138252
+ t6 ? (e5.position = "nth", e5.positionValue = parseInt(t6[1], 10)) : e5.position = h5;
138253
+ }
138254
+ return e5;
138255
+ }
138256
+ get length() {
138257
+ return this.segments.length;
138258
+ }
138259
+ hasDeepWildcard() {
138260
+ return this._hasDeepWildcard;
138261
+ }
138262
+ hasAttributeCondition() {
138263
+ return this._hasAttributeCondition;
138264
+ }
138265
+ hasPositionSelector() {
138266
+ return this._hasPositionSelector;
138267
+ }
138268
+ toString() {
138269
+ return this.pattern;
138270
+ }
138271
+ }
138272
+ function R2(t5, e5) {
138273
+ if (!t5) return {};
138274
+ const i5 = e5.attributesGroupName ? t5[e5.attributesGroupName] : t5;
138275
+ if (!i5) return {};
138276
+ const n5 = {};
138277
+ for (const t6 in i5) t6.startsWith(e5.attributeNamePrefix) ? n5[t6.substring(e5.attributeNamePrefix.length)] = i5[t6] : n5[t6] = i5[t6];
138278
+ return n5;
137327
138279
  }
137328
- class F4 {
138280
+ function U3(t5) {
138281
+ if (!t5 || "string" != typeof t5) return;
138282
+ const e5 = t5.indexOf(":");
138283
+ if (-1 !== e5 && e5 > 0) {
138284
+ const i5 = t5.substring(0, e5);
138285
+ if ("xmlns" !== i5) return i5;
138286
+ }
138287
+ }
138288
+ class B4 {
137329
138289
  constructor(t5) {
137330
- if (this.options = t5, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t6, e5) => Q3(e5, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t6, e5) => Q3(e5, 16, "&#x") } }, this.addExternalEntities = M3, this.parseXml = R2, this.parseTextData = k6, this.resolveNameSpace = _3, this.buildAttributesMap = B4, this.isItStopNode = z4, this.replaceEntitiesValue = G4, this.readStopNodeData = Z3, this.saveTextToParentTag = X3, this.addChild = Y2, this.ignoreAttributesFn = L3(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
137331
- this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
138290
+ var e5;
138291
+ if (this.options = t5, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "\xA2" }, pound: { regex: /&(pound|#163);/g, val: "\xA3" }, yen: { regex: /&(yen|#165);/g, val: "\xA5" }, euro: { regex: /&(euro|#8364);/g, val: "\u20AC" }, copyright: { regex: /&(copy|#169);/g, val: "\xA9" }, reg: { regex: /&(reg|#174);/g, val: "\xAE" }, inr: { regex: /&(inr|#8377);/g, val: "\u20B9" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (t6, e6) => st2(e6, 10, "&#") }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t6, e6) => st2(e6, 16, "&#x") } }, this.addExternalEntities = W3, this.parseXml = Z3, this.parseTextData = Y2, this.resolveNameSpace = X3, this.buildAttributesMap = q6, this.isItStopNode = H3, this.replaceEntitiesValue = K3, this.readStopNodeData = it2, this.saveTextToParentTag = Q3, this.addChild = J4, this.ignoreAttributesFn = "function" == typeof (e5 = this.options.ignoreAttributes) ? e5 : Array.isArray(e5) ? (t6) => {
138292
+ for (const i5 of e5) {
138293
+ if ("string" == typeof i5 && t6 === i5) return true;
138294
+ if (i5 instanceof RegExp && i5.test(t6)) return true;
138295
+ }
138296
+ } : () => false, this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.matcher = new L3(), this.isCurrentNodeStopNode = false, this.options.stopNodes && this.options.stopNodes.length > 0) {
138297
+ this.stopNodeExpressions = [];
137332
138298
  for (let t6 = 0; t6 < this.options.stopNodes.length; t6++) {
137333
- const e5 = this.options.stopNodes[t6];
137334
- "string" == typeof e5 && (e5.startsWith("*.") ? this.stopNodesWildcard.add(e5.substring(2)) : this.stopNodesExact.add(e5));
138299
+ const e6 = this.options.stopNodes[t6];
138300
+ "string" == typeof e6 ? this.stopNodeExpressions.push(new G4(e6)) : e6 instanceof G4 && this.stopNodeExpressions.push(e6);
137335
138301
  }
137336
138302
  }
137337
138303
  }
137338
138304
  }
137339
- function M3(t5) {
138305
+ function W3(t5) {
137340
138306
  const e5 = Object.keys(t5);
137341
- for (let n5 = 0; n5 < e5.length; n5++) {
137342
- const i5 = e5[n5], s7 = i5.replace(/[.\-+*:]/g, "\\.");
137343
- this.lastEntities[i5] = { regex: new RegExp("&" + s7 + ";", "g"), val: t5[i5] };
138307
+ for (let i5 = 0; i5 < e5.length; i5++) {
138308
+ const n5 = e5[i5], s7 = n5.replace(/[.\-+*:]/g, "\\.");
138309
+ this.lastEntities[n5] = { regex: new RegExp("&" + s7 + ";", "g"), val: t5[n5] };
137344
138310
  }
137345
138311
  }
137346
- function k6(t5, e5, n5, i5, s7, r5, o5) {
137347
- if (void 0 !== t5 && (this.options.trimValues && !i5 && (t5 = t5.trim()), t5.length > 0)) {
137348
- o5 || (t5 = this.replaceEntitiesValue(t5, e5, n5));
137349
- const i6 = this.options.tagValueProcessor(e5, t5, n5, s7, r5);
137350
- return null == i6 ? t5 : typeof i6 != typeof t5 || i6 !== t5 ? i6 : this.options.trimValues || t5.trim() === t5 ? K3(t5, this.options.parseTagValue, this.options.numberParseOptions) : t5;
138312
+ function Y2(t5, e5, i5, n5, s7, r5, o5) {
138313
+ if (void 0 !== t5 && (this.options.trimValues && !n5 && (t5 = t5.trim()), t5.length > 0)) {
138314
+ o5 || (t5 = this.replaceEntitiesValue(t5, e5, i5));
138315
+ const n6 = this.options.jPath ? i5.toString() : i5, a5 = this.options.tagValueProcessor(e5, t5, n6, s7, r5);
138316
+ return null == a5 ? t5 : typeof a5 != typeof t5 || a5 !== t5 ? a5 : this.options.trimValues || t5.trim() === t5 ? nt2(t5, this.options.parseTagValue, this.options.numberParseOptions) : t5;
137351
138317
  }
137352
138318
  }
137353
- function _3(t5) {
138319
+ function X3(t5) {
137354
138320
  if (this.options.removeNSPrefix) {
137355
- const e5 = t5.split(":"), n5 = "/" === t5.charAt(0) ? "/" : "";
138321
+ const e5 = t5.split(":"), i5 = "/" === t5.charAt(0) ? "/" : "";
137356
138322
  if ("xmlns" === e5[0]) return "";
137357
- 2 === e5.length && (t5 = n5 + e5[1]);
138323
+ 2 === e5.length && (t5 = i5 + e5[1]);
137358
138324
  }
137359
138325
  return t5;
137360
138326
  }
137361
- const U3 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
137362
- function B4(t5, e5, n5) {
138327
+ const z4 = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
138328
+ function q6(t5, e5, i5) {
137363
138329
  if (true !== this.options.ignoreAttributes && "string" == typeof t5) {
137364
- const i5 = s6(t5, U3), r5 = i5.length, o5 = {};
138330
+ const n5 = s6(t5, z4), r5 = n5.length, o5 = {}, a5 = {};
138331
+ for (let t6 = 0; t6 < r5; t6++) {
138332
+ const s7 = this.resolveNameSpace(n5[t6][1]), r6 = n5[t6][4];
138333
+ if (s7.length && void 0 !== r6) {
138334
+ let t7 = r6;
138335
+ this.options.trimValues && (t7 = t7.trim()), t7 = this.replaceEntitiesValue(t7, i5, e5), a5[s7] = t7;
138336
+ }
138337
+ }
138338
+ Object.keys(a5).length > 0 && "object" == typeof e5 && e5.updateCurrent && e5.updateCurrent(a5);
137365
138339
  for (let t6 = 0; t6 < r5; t6++) {
137366
- const s7 = this.resolveNameSpace(i5[t6][1]);
137367
- if (this.ignoreAttributesFn(s7, e5)) continue;
137368
- let r6 = i5[t6][4], a5 = this.options.attributeNamePrefix + s7;
137369
- if (s7.length) if (this.options.transformAttributeName && (a5 = this.options.transformAttributeName(a5)), "__proto__" === a5 && (a5 = "#__proto__"), void 0 !== r6) {
137370
- this.options.trimValues && (r6 = r6.trim()), r6 = this.replaceEntitiesValue(r6, n5, e5);
137371
- const t7 = this.options.attributeValueProcessor(s7, r6, e5);
137372
- o5[a5] = null == t7 ? r6 : typeof t7 != typeof r6 || t7 !== r6 ? t7 : K3(r6, this.options.parseAttributeValue, this.options.numberParseOptions);
137373
- } else this.options.allowBooleanAttributes && (o5[a5] = true);
138340
+ const s7 = this.resolveNameSpace(n5[t6][1]), r6 = this.options.jPath ? e5.toString() : e5;
138341
+ if (this.ignoreAttributesFn(s7, r6)) continue;
138342
+ let a6 = n5[t6][4], h5 = this.options.attributeNamePrefix + s7;
138343
+ if (s7.length) if (this.options.transformAttributeName && (h5 = this.options.transformAttributeName(h5)), h5 = ot2(h5, this.options), void 0 !== a6) {
138344
+ this.options.trimValues && (a6 = a6.trim()), a6 = this.replaceEntitiesValue(a6, i5, e5);
138345
+ const t7 = this.options.jPath ? e5.toString() : e5, n6 = this.options.attributeValueProcessor(s7, a6, t7);
138346
+ o5[h5] = null == n6 ? a6 : typeof n6 != typeof a6 || n6 !== a6 ? n6 : nt2(a6, this.options.parseAttributeValue, this.options.numberParseOptions);
138347
+ } else this.options.allowBooleanAttributes && (o5[h5] = true);
137374
138348
  }
137375
138349
  if (!Object.keys(o5).length) return;
137376
138350
  if (this.options.attributesGroupName) {
@@ -137380,282 +138354,340 @@ var require_fxp = __commonJS({
137380
138354
  return o5;
137381
138355
  }
137382
138356
  }
137383
- const R2 = function(t5) {
138357
+ const Z3 = function(t5) {
137384
138358
  t5 = t5.replace(/\r\n?/g, "\n");
137385
- const e5 = new I4("!xml");
137386
- let n5 = e5, i5 = "", s7 = "";
137387
- this.entityExpansionCount = 0, this.currentExpandedLength = 0;
137388
- const r5 = new P3(this.options.processEntities);
137389
- for (let o5 = 0; o5 < t5.length; o5++) if ("<" === t5[o5]) if ("/" === t5[o5 + 1]) {
137390
- const e6 = W3(t5, ">", o5, "Closing Tag is not closed.");
137391
- let r6 = t5.substring(o5 + 2, e6).trim();
138359
+ const e5 = new $3("!xml");
138360
+ let i5 = e5, n5 = "";
138361
+ this.matcher.reset(), this.entityExpansionCount = 0, this.currentExpandedLength = 0;
138362
+ const s7 = new I4(this.options.processEntities);
138363
+ for (let r5 = 0; r5 < t5.length; r5++) if ("<" === t5[r5]) if ("/" === t5[r5 + 1]) {
138364
+ const e6 = tt2(t5, ">", r5, "Closing Tag is not closed.");
138365
+ let s8 = t5.substring(r5 + 2, e6).trim();
137392
138366
  if (this.options.removeNSPrefix) {
137393
- const t6 = r6.indexOf(":");
137394
- -1 !== t6 && (r6 = r6.substr(t6 + 1));
137395
- }
137396
- this.options.transformTagName && (r6 = this.options.transformTagName(r6)), n5 && (i5 = this.saveTextToParentTag(i5, n5, s7));
137397
- const a5 = s7.substring(s7.lastIndexOf(".") + 1);
137398
- if (r6 && -1 !== this.options.unpairedTags.indexOf(r6)) throw new Error(`Unpaired tag can not be used as closing tag: </${r6}>`);
137399
- let l5 = 0;
137400
- a5 && -1 !== this.options.unpairedTags.indexOf(a5) ? (l5 = s7.lastIndexOf(".", s7.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l5 = s7.lastIndexOf("."), s7 = s7.substring(0, l5), n5 = this.tagsNodeStack.pop(), i5 = "", o5 = e6;
137401
- } else if ("?" === t5[o5 + 1]) {
137402
- let e6 = q6(t5, o5, false, "?>");
138367
+ const t6 = s8.indexOf(":");
138368
+ -1 !== t6 && (s8 = s8.substr(t6 + 1));
138369
+ }
138370
+ s8 = rt2(this.options.transformTagName, s8, "", this.options).tagName, i5 && (n5 = this.saveTextToParentTag(n5, i5, this.matcher));
138371
+ const o5 = this.matcher.getCurrentTag();
138372
+ if (s8 && -1 !== this.options.unpairedTags.indexOf(s8)) throw new Error(`Unpaired tag can not be used as closing tag: </${s8}>`);
138373
+ o5 && -1 !== this.options.unpairedTags.indexOf(o5) && (this.matcher.pop(), this.tagsNodeStack.pop()), this.matcher.pop(), this.isCurrentNodeStopNode = false, i5 = this.tagsNodeStack.pop(), n5 = "", r5 = e6;
138374
+ } else if ("?" === t5[r5 + 1]) {
138375
+ let e6 = et2(t5, r5, false, "?>");
137403
138376
  if (!e6) throw new Error("Pi Tag is not closed.");
137404
- if (i5 = this.saveTextToParentTag(i5, n5, s7), this.options.ignoreDeclaration && "?xml" === e6.tagName || this.options.ignorePiTags) ;
138377
+ if (n5 = this.saveTextToParentTag(n5, i5, this.matcher), this.options.ignoreDeclaration && "?xml" === e6.tagName || this.options.ignorePiTags) ;
137405
138378
  else {
137406
- const t6 = new I4(e6.tagName);
137407
- t6.add(this.options.textNodeName, ""), e6.tagName !== e6.tagExp && e6.attrExpPresent && (t6[":@"] = this.buildAttributesMap(e6.tagExp, s7, e6.tagName)), this.addChild(n5, t6, s7, o5);
138379
+ const t6 = new $3(e6.tagName);
138380
+ t6.add(this.options.textNodeName, ""), e6.tagName !== e6.tagExp && e6.attrExpPresent && (t6[":@"] = this.buildAttributesMap(e6.tagExp, this.matcher, e6.tagName)), this.addChild(i5, t6, this.matcher, r5);
137408
138381
  }
137409
- o5 = e6.closeIndex + 1;
137410
- } else if ("!--" === t5.substr(o5 + 1, 3)) {
137411
- const e6 = W3(t5, "-->", o5 + 4, "Comment is not closed.");
138382
+ r5 = e6.closeIndex + 1;
138383
+ } else if ("!--" === t5.substr(r5 + 1, 3)) {
138384
+ const e6 = tt2(t5, "-->", r5 + 4, "Comment is not closed.");
137412
138385
  if (this.options.commentPropName) {
137413
- const r6 = t5.substring(o5 + 4, e6 - 2);
137414
- i5 = this.saveTextToParentTag(i5, n5, s7), n5.add(this.options.commentPropName, [{ [this.options.textNodeName]: r6 }]);
137415
- }
137416
- o5 = e6;
137417
- } else if ("!D" === t5.substr(o5 + 1, 2)) {
137418
- const e6 = r5.readDocType(t5, o5);
137419
- this.docTypeEntities = e6.entities, o5 = e6.i;
137420
- } else if ("![" === t5.substr(o5 + 1, 2)) {
137421
- const e6 = W3(t5, "]]>", o5, "CDATA is not closed.") - 2, r6 = t5.substring(o5 + 9, e6);
137422
- i5 = this.saveTextToParentTag(i5, n5, s7);
137423
- let a5 = this.parseTextData(r6, n5.tagname, s7, true, false, true, true);
137424
- null == a5 && (a5 = ""), this.options.cdataPropName ? n5.add(this.options.cdataPropName, [{ [this.options.textNodeName]: r6 }]) : n5.add(this.options.textNodeName, a5), o5 = e6 + 2;
138386
+ const s8 = t5.substring(r5 + 4, e6 - 2);
138387
+ n5 = this.saveTextToParentTag(n5, i5, this.matcher), i5.add(this.options.commentPropName, [{ [this.options.textNodeName]: s8 }]);
138388
+ }
138389
+ r5 = e6;
138390
+ } else if ("!D" === t5.substr(r5 + 1, 2)) {
138391
+ const e6 = s7.readDocType(t5, r5);
138392
+ this.docTypeEntities = e6.entities, r5 = e6.i;
138393
+ } else if ("![" === t5.substr(r5 + 1, 2)) {
138394
+ const e6 = tt2(t5, "]]>", r5, "CDATA is not closed.") - 2, s8 = t5.substring(r5 + 9, e6);
138395
+ n5 = this.saveTextToParentTag(n5, i5, this.matcher);
138396
+ let o5 = this.parseTextData(s8, i5.tagname, this.matcher, true, false, true, true);
138397
+ null == o5 && (o5 = ""), this.options.cdataPropName ? i5.add(this.options.cdataPropName, [{ [this.options.textNodeName]: s8 }]) : i5.add(this.options.textNodeName, o5), r5 = e6 + 2;
137425
138398
  } else {
137426
- let r6 = q6(t5, o5, this.options.removeNSPrefix), a5 = r6.tagName;
137427
- const l5 = r6.rawTagName;
137428
- let u8 = r6.tagExp, d6 = r6.attrExpPresent, h5 = r6.closeIndex;
137429
- if (this.options.transformTagName) {
137430
- const t6 = this.options.transformTagName(a5);
137431
- u8 === a5 && (u8 = t6), a5 = t6;
137432
- }
137433
- n5 && i5 && "!xml" !== n5.tagname && (i5 = this.saveTextToParentTag(i5, n5, s7, false));
137434
- const p6 = n5;
137435
- p6 && -1 !== this.options.unpairedTags.indexOf(p6.tagname) && (n5 = this.tagsNodeStack.pop(), s7 = s7.substring(0, s7.lastIndexOf("."))), a5 !== e5.tagname && (s7 += s7 ? "." + a5 : a5);
137436
- const c5 = o5;
137437
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s7, a5)) {
138399
+ let s8 = et2(t5, r5, this.options.removeNSPrefix);
138400
+ if (!s8) {
138401
+ const e6 = t5.substring(Math.max(0, r5 - 50), Math.min(t5.length, r5 + 50));
138402
+ throw new Error(`readTagExp returned undefined at position ${r5}. Context: "${e6}"`);
138403
+ }
138404
+ let o5 = s8.tagName;
138405
+ const a5 = s8.rawTagName;
138406
+ let h5 = s8.tagExp, l5 = s8.attrExpPresent, p6 = s8.closeIndex;
138407
+ if ({ tagName: o5, tagExp: h5 } = rt2(this.options.transformTagName, o5, h5, this.options), this.options.strictReservedNames && (o5 === this.options.commentPropName || o5 === this.options.cdataPropName || o5 === this.options.textNodeName || o5 === this.options.attributesGroupName)) throw new Error(`Invalid tag name: ${o5}`);
138408
+ i5 && n5 && "!xml" !== i5.tagname && (n5 = this.saveTextToParentTag(n5, i5, this.matcher, false));
138409
+ const u8 = i5;
138410
+ u8 && -1 !== this.options.unpairedTags.indexOf(u8.tagname) && (i5 = this.tagsNodeStack.pop(), this.matcher.pop());
138411
+ let c5 = false;
138412
+ h5.length > 0 && h5.lastIndexOf("/") === h5.length - 1 && (c5 = true, "/" === o5[o5.length - 1] ? (o5 = o5.substr(0, o5.length - 1), h5 = o5) : h5 = h5.substr(0, h5.length - 1), l5 = o5 !== h5);
138413
+ let d6, f6 = null, g6 = {};
138414
+ d6 = U3(a5), o5 !== e5.tagname && this.matcher.push(o5, {}, d6), o5 !== h5 && l5 && (f6 = this.buildAttributesMap(h5, this.matcher, o5), f6 && (g6 = R2(f6, this.options))), o5 !== e5.tagname && (this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher));
138415
+ const m7 = r5;
138416
+ if (this.isCurrentNodeStopNode) {
137438
138417
  let e6 = "";
137439
- if (u8.length > 0 && u8.lastIndexOf("/") === u8.length - 1) "/" === a5[a5.length - 1] ? (a5 = a5.substr(0, a5.length - 1), s7 = s7.substr(0, s7.length - 1), u8 = a5) : u8 = u8.substr(0, u8.length - 1), o5 = r6.closeIndex;
137440
- else if (-1 !== this.options.unpairedTags.indexOf(a5)) o5 = r6.closeIndex;
138418
+ if (c5) r5 = s8.closeIndex;
138419
+ else if (-1 !== this.options.unpairedTags.indexOf(o5)) r5 = s8.closeIndex;
137441
138420
  else {
137442
- const n6 = this.readStopNodeData(t5, l5, h5 + 1);
137443
- if (!n6) throw new Error(`Unexpected end of ${l5}`);
137444
- o5 = n6.i, e6 = n6.tagContent;
138421
+ const i6 = this.readStopNodeData(t5, a5, p6 + 1);
138422
+ if (!i6) throw new Error(`Unexpected end of ${a5}`);
138423
+ r5 = i6.i, e6 = i6.tagContent;
137445
138424
  }
137446
- const i6 = new I4(a5);
137447
- a5 !== u8 && d6 && (i6[":@"] = this.buildAttributesMap(u8, s7, a5)), e6 && (e6 = this.parseTextData(e6, a5, s7, true, d6, true, true)), s7 = s7.substr(0, s7.lastIndexOf(".")), i6.add(this.options.textNodeName, e6), this.addChild(n5, i6, s7, c5);
138425
+ const n6 = new $3(o5);
138426
+ f6 && (n6[":@"] = f6), n6.add(this.options.textNodeName, e6), this.matcher.pop(), this.isCurrentNodeStopNode = false, this.addChild(i5, n6, this.matcher, m7);
137448
138427
  } else {
137449
- if (u8.length > 0 && u8.lastIndexOf("/") === u8.length - 1) {
137450
- if ("/" === a5[a5.length - 1] ? (a5 = a5.substr(0, a5.length - 1), s7 = s7.substr(0, s7.length - 1), u8 = a5) : u8 = u8.substr(0, u8.length - 1), this.options.transformTagName) {
137451
- const t7 = this.options.transformTagName(a5);
137452
- u8 === a5 && (u8 = t7), a5 = t7;
137453
- }
137454
- const t6 = new I4(a5);
137455
- a5 !== u8 && d6 && (t6[":@"] = this.buildAttributesMap(u8, s7, a5)), this.addChild(n5, t6, s7, c5), s7 = s7.substr(0, s7.lastIndexOf("."));
138428
+ if (c5) {
138429
+ ({ tagName: o5, tagExp: h5 } = rt2(this.options.transformTagName, o5, h5, this.options));
138430
+ const t6 = new $3(o5);
138431
+ f6 && (t6[":@"] = f6), this.addChild(i5, t6, this.matcher, m7), this.matcher.pop(), this.isCurrentNodeStopNode = false;
137456
138432
  } else {
137457
- const t6 = new I4(a5);
137458
- if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
137459
- this.tagsNodeStack.push(n5), a5 !== u8 && d6 && (t6[":@"] = this.buildAttributesMap(u8, s7, a5)), this.addChild(n5, t6, s7, c5), n5 = t6;
138433
+ if (-1 !== this.options.unpairedTags.indexOf(o5)) {
138434
+ const t6 = new $3(o5);
138435
+ f6 && (t6[":@"] = f6), this.addChild(i5, t6, this.matcher, m7), this.matcher.pop(), this.isCurrentNodeStopNode = false, r5 = s8.closeIndex;
138436
+ continue;
138437
+ }
138438
+ {
138439
+ const t6 = new $3(o5);
138440
+ if (this.tagsNodeStack.length > this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
138441
+ this.tagsNodeStack.push(i5), f6 && (t6[":@"] = f6), this.addChild(i5, t6, this.matcher, m7), i5 = t6;
138442
+ }
137460
138443
  }
137461
- i5 = "", o5 = h5;
138444
+ n5 = "", r5 = p6;
137462
138445
  }
137463
138446
  }
137464
- else i5 += t5[o5];
138447
+ else n5 += t5[r5];
137465
138448
  return e5.child;
137466
138449
  };
137467
- function Y2(t5, e5, n5, i5) {
137468
- this.options.captureMetaData || (i5 = void 0);
137469
- const s7 = this.options.updateTag(e5.tagname, n5, e5[":@"]);
137470
- false === s7 || ("string" == typeof s7 ? (e5.tagname = s7, t5.addChild(e5, i5)) : t5.addChild(e5, i5));
138450
+ function J4(t5, e5, i5, n5) {
138451
+ this.options.captureMetaData || (n5 = void 0);
138452
+ const s7 = this.options.jPath ? i5.toString() : i5, r5 = this.options.updateTag(e5.tagname, s7, e5[":@"]);
138453
+ false === r5 || ("string" == typeof r5 ? (e5.tagname = r5, t5.addChild(e5, n5)) : t5.addChild(e5, n5));
137471
138454
  }
137472
- const G4 = function(t5, e5, n5) {
137473
- if (-1 === t5.indexOf("&")) return t5;
137474
- const i5 = this.options.processEntities;
137475
- if (!i5.enabled) return t5;
137476
- if (i5.allowedTags && !i5.allowedTags.includes(e5)) return t5;
137477
- if (i5.tagFilter && !i5.tagFilter(e5, n5)) return t5;
137478
- for (let e6 in this.docTypeEntities) {
137479
- const n6 = this.docTypeEntities[e6], s7 = t5.match(n6.regx);
138455
+ function K3(t5, e5, i5) {
138456
+ const n5 = this.options.processEntities;
138457
+ if (!n5 || !n5.enabled) return t5;
138458
+ if (n5.allowedTags) {
138459
+ const s7 = this.options.jPath ? i5.toString() : i5;
138460
+ if (!(Array.isArray(n5.allowedTags) ? n5.allowedTags.includes(e5) : n5.allowedTags(e5, s7))) return t5;
138461
+ }
138462
+ if (n5.tagFilter) {
138463
+ const s7 = this.options.jPath ? i5.toString() : i5;
138464
+ if (!n5.tagFilter(e5, s7)) return t5;
138465
+ }
138466
+ for (const e6 of Object.keys(this.docTypeEntities)) {
138467
+ const i6 = this.docTypeEntities[e6], s7 = t5.match(i6.regx);
137480
138468
  if (s7) {
137481
- if (this.entityExpansionCount += s7.length, i5.maxTotalExpansions && this.entityExpansionCount > i5.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${i5.maxTotalExpansions}`);
138469
+ if (this.entityExpansionCount += s7.length, n5.maxTotalExpansions && this.entityExpansionCount > n5.maxTotalExpansions) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n5.maxTotalExpansions}`);
137482
138470
  const e7 = t5.length;
137483
- if (t5 = t5.replace(n6.regx, n6.val), i5.maxExpandedLength && (this.currentExpandedLength += t5.length - e7, this.currentExpandedLength > i5.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${i5.maxExpandedLength}`);
138471
+ if (t5 = t5.replace(i6.regx, i6.val), n5.maxExpandedLength && (this.currentExpandedLength += t5.length - e7, this.currentExpandedLength > n5.maxExpandedLength)) throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${n5.maxExpandedLength}`);
137484
138472
  }
137485
138473
  }
137486
- if (-1 === t5.indexOf("&")) return t5;
137487
- for (let e6 in this.lastEntities) {
137488
- const n6 = this.lastEntities[e6];
137489
- t5 = t5.replace(n6.regex, n6.val);
138474
+ for (const e6 of Object.keys(this.lastEntities)) {
138475
+ const i6 = this.lastEntities[e6], s7 = t5.match(i6.regex);
138476
+ if (s7 && (this.entityExpansionCount += s7.length, n5.maxTotalExpansions && this.entityExpansionCount > n5.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n5.maxTotalExpansions}`);
138477
+ t5 = t5.replace(i6.regex, i6.val);
137490
138478
  }
137491
138479
  if (-1 === t5.indexOf("&")) return t5;
137492
- if (this.options.htmlEntities) for (let e6 in this.htmlEntities) {
137493
- const n6 = this.htmlEntities[e6];
137494
- t5 = t5.replace(n6.regex, n6.val);
138480
+ if (this.options.htmlEntities) for (const e6 of Object.keys(this.htmlEntities)) {
138481
+ const i6 = this.htmlEntities[e6], s7 = t5.match(i6.regex);
138482
+ if (s7 && (this.entityExpansionCount += s7.length, n5.maxTotalExpansions && this.entityExpansionCount > n5.maxTotalExpansions)) throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${n5.maxTotalExpansions}`);
138483
+ t5 = t5.replace(i6.regex, i6.val);
137495
138484
  }
137496
138485
  return t5.replace(this.ampEntity.regex, this.ampEntity.val);
137497
- };
137498
- function X3(t5, e5, n5, i5) {
137499
- return t5 && (void 0 === i5 && (i5 = 0 === e5.child.length), void 0 !== (t5 = this.parseTextData(t5, e5.tagname, n5, false, !!e5[":@"] && 0 !== Object.keys(e5[":@"]).length, i5)) && "" !== t5 && e5.add(this.options.textNodeName, t5), t5 = ""), t5;
137500
138486
  }
137501
- function z4(t5, e5, n5, i5) {
137502
- return !(!e5 || !e5.has(i5)) || !(!t5 || !t5.has(n5));
138487
+ function Q3(t5, e5, i5, n5) {
138488
+ return t5 && (void 0 === n5 && (n5 = 0 === e5.child.length), void 0 !== (t5 = this.parseTextData(t5, e5.tagname, i5, false, !!e5[":@"] && 0 !== Object.keys(e5[":@"]).length, n5)) && "" !== t5 && e5.add(this.options.textNodeName, t5), t5 = ""), t5;
138489
+ }
138490
+ function H3(t5, e5) {
138491
+ if (!t5 || 0 === t5.length) return false;
138492
+ for (let i5 = 0; i5 < t5.length; i5++) if (e5.matches(t5[i5])) return true;
138493
+ return false;
137503
138494
  }
137504
- function W3(t5, e5, n5, i5) {
137505
- const s7 = t5.indexOf(e5, n5);
137506
- if (-1 === s7) throw new Error(i5);
138495
+ function tt2(t5, e5, i5, n5) {
138496
+ const s7 = t5.indexOf(e5, i5);
138497
+ if (-1 === s7) throw new Error(n5);
137507
138498
  return s7 + e5.length - 1;
137508
138499
  }
137509
- function q6(t5, e5, n5, i5 = ">") {
137510
- const s7 = (function(t6, e6, n6 = ">") {
137511
- let i6, s8 = "";
138500
+ function et2(t5, e5, i5, n5 = ">") {
138501
+ const s7 = (function(t6, e6, i6 = ">") {
138502
+ let n6, s8 = "";
137512
138503
  for (let r6 = e6; r6 < t6.length; r6++) {
137513
138504
  let e7 = t6[r6];
137514
- if (i6) e7 === i6 && (i6 = "");
137515
- else if ('"' === e7 || "'" === e7) i6 = e7;
137516
- else if (e7 === n6[0]) {
137517
- if (!n6[1]) return { data: s8, index: r6 };
137518
- if (t6[r6 + 1] === n6[1]) return { data: s8, index: r6 };
138505
+ if (n6) e7 === n6 && (n6 = "");
138506
+ else if ('"' === e7 || "'" === e7) n6 = e7;
138507
+ else if (e7 === i6[0]) {
138508
+ if (!i6[1]) return { data: s8, index: r6 };
138509
+ if (t6[r6 + 1] === i6[1]) return { data: s8, index: r6 };
137519
138510
  } else " " === e7 && (e7 = " ");
137520
138511
  s8 += e7;
137521
138512
  }
137522
- })(t5, e5 + 1, i5);
138513
+ })(t5, e5 + 1, n5);
137523
138514
  if (!s7) return;
137524
138515
  let r5 = s7.data;
137525
138516
  const o5 = s7.index, a5 = r5.search(/\s/);
137526
- let l5 = r5, u8 = true;
137527
- -1 !== a5 && (l5 = r5.substring(0, a5), r5 = r5.substring(a5 + 1).trimStart());
137528
- const d6 = l5;
137529
- if (n5) {
137530
- const t6 = l5.indexOf(":");
137531
- -1 !== t6 && (l5 = l5.substr(t6 + 1), u8 = l5 !== s7.data.substr(t6 + 1));
138517
+ let h5 = r5, l5 = true;
138518
+ -1 !== a5 && (h5 = r5.substring(0, a5), r5 = r5.substring(a5 + 1).trimStart());
138519
+ const p6 = h5;
138520
+ if (i5) {
138521
+ const t6 = h5.indexOf(":");
138522
+ -1 !== t6 && (h5 = h5.substr(t6 + 1), l5 = h5 !== s7.data.substr(t6 + 1));
137532
138523
  }
137533
- return { tagName: l5, tagExp: r5, closeIndex: o5, attrExpPresent: u8, rawTagName: d6 };
138524
+ return { tagName: h5, tagExp: r5, closeIndex: o5, attrExpPresent: l5, rawTagName: p6 };
137534
138525
  }
137535
- function Z3(t5, e5, n5) {
137536
- const i5 = n5;
138526
+ function it2(t5, e5, i5) {
138527
+ const n5 = i5;
137537
138528
  let s7 = 1;
137538
- for (; n5 < t5.length; n5++) if ("<" === t5[n5]) if ("/" === t5[n5 + 1]) {
137539
- const r5 = W3(t5, ">", n5, `${e5} is not closed`);
137540
- if (t5.substring(n5 + 2, r5).trim() === e5 && (s7--, 0 === s7)) return { tagContent: t5.substring(i5, n5), i: r5 };
137541
- n5 = r5;
137542
- } else if ("?" === t5[n5 + 1]) n5 = W3(t5, "?>", n5 + 1, "StopNode is not closed.");
137543
- else if ("!--" === t5.substr(n5 + 1, 3)) n5 = W3(t5, "-->", n5 + 3, "StopNode is not closed.");
137544
- else if ("![" === t5.substr(n5 + 1, 2)) n5 = W3(t5, "]]>", n5, "StopNode is not closed.") - 2;
138529
+ for (; i5 < t5.length; i5++) if ("<" === t5[i5]) if ("/" === t5[i5 + 1]) {
138530
+ const r5 = tt2(t5, ">", i5, `${e5} is not closed`);
138531
+ if (t5.substring(i5 + 2, r5).trim() === e5 && (s7--, 0 === s7)) return { tagContent: t5.substring(n5, i5), i: r5 };
138532
+ i5 = r5;
138533
+ } else if ("?" === t5[i5 + 1]) i5 = tt2(t5, "?>", i5 + 1, "StopNode is not closed.");
138534
+ else if ("!--" === t5.substr(i5 + 1, 3)) i5 = tt2(t5, "-->", i5 + 3, "StopNode is not closed.");
138535
+ else if ("![" === t5.substr(i5 + 1, 2)) i5 = tt2(t5, "]]>", i5, "StopNode is not closed.") - 2;
137545
138536
  else {
137546
- const i6 = q6(t5, n5, ">");
137547
- i6 && ((i6 && i6.tagName) === e5 && "/" !== i6.tagExp[i6.tagExp.length - 1] && s7++, n5 = i6.closeIndex);
138537
+ const n6 = et2(t5, i5, ">");
138538
+ n6 && ((n6 && n6.tagName) === e5 && "/" !== n6.tagExp[n6.tagExp.length - 1] && s7++, i5 = n6.closeIndex);
137548
138539
  }
137549
138540
  }
137550
- function K3(t5, e5, n5) {
138541
+ function nt2(t5, e5, i5) {
137551
138542
  if (e5 && "string" == typeof t5) {
137552
138543
  const e6 = t5.trim();
137553
138544
  return "true" === e6 || "false" !== e6 && (function(t6, e7 = {}) {
137554
- if (e7 = Object.assign({}, D4, e7), !t6 || "string" != typeof t6) return t6;
137555
- let n6 = t6.trim();
137556
- if (void 0 !== e7.skipLike && e7.skipLike.test(n6)) return t6;
138545
+ if (e7 = Object.assign({}, M3, e7), !t6 || "string" != typeof t6) return t6;
138546
+ let i6 = t6.trim();
138547
+ if (void 0 !== e7.skipLike && e7.skipLike.test(i6)) return t6;
137557
138548
  if ("0" === t6) return 0;
137558
- if (e7.hex && $3.test(n6)) return (function(t7) {
138549
+ if (e7.hex && V2.test(i6)) return (function(t7) {
137559
138550
  if (parseInt) return parseInt(t7, 16);
137560
138551
  if (Number.parseInt) return Number.parseInt(t7, 16);
137561
138552
  if (window && window.parseInt) return window.parseInt(t7, 16);
137562
138553
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
137563
- })(n6);
137564
- if (n6.includes("e") || n6.includes("E")) return (function(t7, e8, n7) {
137565
- if (!n7.eNotation) return t7;
137566
- const i6 = e8.match(j6);
137567
- if (i6) {
137568
- let s7 = i6[1] || "";
137569
- const r5 = -1 === i6[3].indexOf("e") ? "E" : "e", o5 = i6[2], a5 = s7 ? t7[o5.length + 1] === r5 : t7[o5.length] === r5;
137570
- return o5.length > 1 && a5 ? t7 : 1 !== o5.length || !i6[3].startsWith(`.${r5}`) && i6[3][0] !== r5 ? n7.leadingZeros && !a5 ? (e8 = (i6[1] || "") + i6[3], Number(e8)) : t7 : Number(e8);
137571
- }
137572
- return t7;
137573
- })(t6, n6, e7);
137574
- {
137575
- const s7 = V2.exec(n6);
137576
- if (s7) {
137577
- const r5 = s7[1] || "", o5 = s7[2];
137578
- let a5 = (i5 = s7[3]) && -1 !== i5.indexOf(".") ? ("." === (i5 = i5.replace(/0+$/, "")) ? i5 = "0" : "." === i5[0] ? i5 = "0" + i5 : "." === i5[i5.length - 1] && (i5 = i5.substring(0, i5.length - 1)), i5) : i5;
137579
- const l5 = r5 ? "." === t6[o5.length + 1] : "." === t6[o5.length];
137580
- if (!e7.leadingZeros && (o5.length > 1 || 1 === o5.length && !l5)) return t6;
137581
- {
137582
- const i6 = Number(n6), s8 = String(i6);
137583
- if (0 === i6) return i6;
137584
- if (-1 !== s8.search(/[eE]/)) return e7.eNotation ? i6 : t6;
137585
- if (-1 !== n6.indexOf(".")) return "0" === s8 || s8 === a5 || s8 === `${r5}${a5}` ? i6 : t6;
137586
- let l6 = o5 ? a5 : n6;
137587
- return o5 ? l6 === s8 || r5 + l6 === s8 ? i6 : t6 : l6 === s8 || l6 === r5 + s8 ? i6 : t6;
138554
+ })(i6);
138555
+ if (isFinite(i6)) {
138556
+ if (i6.includes("e") || i6.includes("E")) return (function(t7, e8, i7) {
138557
+ if (!i7.eNotation) return t7;
138558
+ const n6 = e8.match(F4);
138559
+ if (n6) {
138560
+ let s7 = n6[1] || "";
138561
+ const r5 = -1 === n6[3].indexOf("e") ? "E" : "e", o5 = n6[2], a5 = s7 ? t7[o5.length + 1] === r5 : t7[o5.length] === r5;
138562
+ return o5.length > 1 && a5 ? t7 : (1 !== o5.length || !n6[3].startsWith(`.${r5}`) && n6[3][0] !== r5) && o5.length > 0 ? i7.leadingZeros && !a5 ? (e8 = (n6[1] || "") + n6[3], Number(e8)) : t7 : Number(e8);
138563
+ }
138564
+ return t7;
138565
+ })(t6, i6, e7);
138566
+ {
138567
+ const s7 = k6.exec(i6);
138568
+ if (s7) {
138569
+ const r5 = s7[1] || "", o5 = s7[2];
138570
+ let a5 = (n5 = s7[3]) && -1 !== n5.indexOf(".") ? ("." === (n5 = n5.replace(/0+$/, "")) ? n5 = "0" : "." === n5[0] ? n5 = "0" + n5 : "." === n5[n5.length - 1] && (n5 = n5.substring(0, n5.length - 1)), n5) : n5;
138571
+ const h5 = r5 ? "." === t6[o5.length + 1] : "." === t6[o5.length];
138572
+ if (!e7.leadingZeros && (o5.length > 1 || 1 === o5.length && !h5)) return t6;
138573
+ {
138574
+ const n6 = Number(i6), s8 = String(n6);
138575
+ if (0 === n6) return n6;
138576
+ if (-1 !== s8.search(/[eE]/)) return e7.eNotation ? n6 : t6;
138577
+ if (-1 !== i6.indexOf(".")) return "0" === s8 || s8 === a5 || s8 === `${r5}${a5}` ? n6 : t6;
138578
+ let h6 = o5 ? a5 : i6;
138579
+ return o5 ? h6 === s8 || r5 + h6 === s8 ? n6 : t6 : h6 === s8 || h6 === r5 + s8 ? n6 : t6;
138580
+ }
137588
138581
  }
138582
+ return t6;
137589
138583
  }
137590
- return t6;
137591
138584
  }
137592
- var i5;
137593
- })(t5, n5);
138585
+ var n5;
138586
+ return (function(t7, e8, i7) {
138587
+ const n6 = e8 === 1 / 0;
138588
+ switch (i7.infinity.toLowerCase()) {
138589
+ case "null":
138590
+ return null;
138591
+ case "infinity":
138592
+ return e8;
138593
+ case "string":
138594
+ return n6 ? "Infinity" : "-Infinity";
138595
+ default:
138596
+ return t7;
138597
+ }
138598
+ })(t6, Number(i6), e7);
138599
+ })(t5, i5);
137594
138600
  }
137595
138601
  return void 0 !== t5 ? t5 : "";
137596
138602
  }
137597
- function Q3(t5, e5, n5) {
137598
- const i5 = Number.parseInt(t5, e5);
137599
- return i5 >= 0 && i5 <= 1114111 ? String.fromCodePoint(i5) : n5 + t5 + ";";
138603
+ function st2(t5, e5, i5) {
138604
+ const n5 = Number.parseInt(t5, e5);
138605
+ return n5 >= 0 && n5 <= 1114111 ? String.fromCodePoint(n5) : i5 + t5 + ";";
137600
138606
  }
137601
- const J4 = I4.getMetaDataSymbol();
137602
- function H3(t5, e5) {
137603
- return tt2(t5, e5);
138607
+ function rt2(t5, e5, i5, n5) {
138608
+ if (t5) {
138609
+ const n6 = t5(e5);
138610
+ i5 === e5 && (i5 = n6), e5 = n6;
138611
+ }
138612
+ return { tagName: e5 = ot2(e5, n5), tagExp: i5 };
137604
138613
  }
137605
- function tt2(t5, e5, n5) {
137606
- let i5;
138614
+ function ot2(t5, e5) {
138615
+ if (a4.includes(t5)) throw new Error(`[SECURITY] Invalid name: "${t5}" is a reserved JavaScript keyword that could cause prototype pollution`);
138616
+ return o4.includes(t5) ? e5.onDangerousProperty(t5) : t5;
138617
+ }
138618
+ const at2 = $3.getMetaDataSymbol();
138619
+ function ht2(t5, e5) {
138620
+ if (!t5 || "object" != typeof t5) return {};
138621
+ if (!e5) return t5;
138622
+ const i5 = {};
138623
+ for (const n5 in t5) n5.startsWith(e5) ? i5[n5.substring(e5.length)] = t5[n5] : i5[n5] = t5[n5];
138624
+ return i5;
138625
+ }
138626
+ function lt2(t5, e5, i5) {
138627
+ return pt2(t5, e5, i5);
138628
+ }
138629
+ function pt2(t5, e5, i5) {
138630
+ let n5;
137607
138631
  const s7 = {};
137608
138632
  for (let r5 = 0; r5 < t5.length; r5++) {
137609
- const o5 = t5[r5], a5 = et2(o5);
137610
- let l5 = "";
137611
- if (l5 = void 0 === n5 ? a5 : n5 + "." + a5, a5 === e5.textNodeName) void 0 === i5 ? i5 = o5[a5] : i5 += "" + o5[a5];
138633
+ const o5 = t5[r5], a5 = ut2(o5);
138634
+ if (void 0 !== a5 && a5 !== e5.textNodeName) {
138635
+ const t6 = ht2(o5[":@"] || {}, e5.attributeNamePrefix);
138636
+ i5.push(a5, t6);
138637
+ }
138638
+ if (a5 === e5.textNodeName) void 0 === n5 ? n5 = o5[a5] : n5 += "" + o5[a5];
137612
138639
  else {
137613
138640
  if (void 0 === a5) continue;
137614
138641
  if (o5[a5]) {
137615
- let t6 = tt2(o5[a5], e5, l5);
137616
- const n6 = it2(t6, e5);
137617
- o5[":@"] ? nt2(t6, o5[":@"], l5, e5) : 1 !== Object.keys(t6).length || void 0 === t6[e5.textNodeName] || e5.alwaysCreateTextNode ? 0 === Object.keys(t6).length && (e5.alwaysCreateTextNode ? t6[e5.textNodeName] = "" : t6 = "") : t6 = t6[e5.textNodeName], void 0 !== o5[J4] && "object" == typeof t6 && null !== t6 && (t6[J4] = o5[J4]), void 0 !== s7[a5] && Object.prototype.hasOwnProperty.call(s7, a5) ? (Array.isArray(s7[a5]) || (s7[a5] = [s7[a5]]), s7[a5].push(t6)) : e5.isArray(a5, l5, n6) ? s7[a5] = [t6] : s7[a5] = t6;
138642
+ let t6 = pt2(o5[a5], e5, i5);
138643
+ const n6 = dt2(t6, e5);
138644
+ if (o5[":@"] ? ct2(t6, o5[":@"], i5, e5) : 1 !== Object.keys(t6).length || void 0 === t6[e5.textNodeName] || e5.alwaysCreateTextNode ? 0 === Object.keys(t6).length && (e5.alwaysCreateTextNode ? t6[e5.textNodeName] = "" : t6 = "") : t6 = t6[e5.textNodeName], void 0 !== o5[at2] && "object" == typeof t6 && null !== t6 && (t6[at2] = o5[at2]), void 0 !== s7[a5] && Object.prototype.hasOwnProperty.call(s7, a5)) Array.isArray(s7[a5]) || (s7[a5] = [s7[a5]]), s7[a5].push(t6);
138645
+ else {
138646
+ const r6 = e5.jPath ? i5.toString() : i5;
138647
+ e5.isArray(a5, r6, n6) ? s7[a5] = [t6] : s7[a5] = t6;
138648
+ }
138649
+ void 0 !== a5 && a5 !== e5.textNodeName && i5.pop();
137618
138650
  }
137619
138651
  }
137620
138652
  }
137621
- return "string" == typeof i5 ? i5.length > 0 && (s7[e5.textNodeName] = i5) : void 0 !== i5 && (s7[e5.textNodeName] = i5), s7;
138653
+ return "string" == typeof n5 ? n5.length > 0 && (s7[e5.textNodeName] = n5) : void 0 !== n5 && (s7[e5.textNodeName] = n5), s7;
137622
138654
  }
137623
- function et2(t5) {
138655
+ function ut2(t5) {
137624
138656
  const e5 = Object.keys(t5);
137625
138657
  for (let t6 = 0; t6 < e5.length; t6++) {
137626
- const n5 = e5[t6];
137627
- if (":@" !== n5) return n5;
138658
+ const i5 = e5[t6];
138659
+ if (":@" !== i5) return i5;
137628
138660
  }
137629
138661
  }
137630
- function nt2(t5, e5, n5, i5) {
138662
+ function ct2(t5, e5, i5, n5) {
137631
138663
  if (e5) {
137632
138664
  const s7 = Object.keys(e5), r5 = s7.length;
137633
138665
  for (let o5 = 0; o5 < r5; o5++) {
137634
- const r6 = s7[o5];
137635
- i5.isArray(r6, n5 + "." + r6, true, true) ? t5[r6] = [e5[r6]] : t5[r6] = e5[r6];
138666
+ const r6 = s7[o5], a5 = r6.startsWith(n5.attributeNamePrefix) ? r6.substring(n5.attributeNamePrefix.length) : r6, h5 = n5.jPath ? i5.toString() + "." + a5 : i5;
138667
+ n5.isArray(r6, h5, true, true) ? t5[r6] = [e5[r6]] : t5[r6] = e5[r6];
137636
138668
  }
137637
138669
  }
137638
138670
  }
137639
- function it2(t5, e5) {
137640
- const { textNodeName: n5 } = e5, i5 = Object.keys(t5).length;
137641
- return 0 === i5 || !(1 !== i5 || !t5[n5] && "boolean" != typeof t5[n5] && 0 !== t5[n5]);
138671
+ function dt2(t5, e5) {
138672
+ const { textNodeName: i5 } = e5, n5 = Object.keys(t5).length;
138673
+ return 0 === n5 || !(1 !== n5 || !t5[i5] && "boolean" != typeof t5[i5] && 0 !== t5[i5]);
137642
138674
  }
137643
- class st2 {
138675
+ class ft2 {
137644
138676
  constructor(t5) {
137645
- this.externalEntities = {}, this.options = v9(t5);
138677
+ this.externalEntities = {}, this.options = C4(t5);
137646
138678
  }
137647
138679
  parse(t5, e5) {
137648
138680
  if ("string" != typeof t5 && t5.toString) t5 = t5.toString();
137649
138681
  else if ("string" != typeof t5) throw new Error("XML data is accepted in String or Bytes[] form.");
137650
138682
  if (e5) {
137651
138683
  true === e5 && (e5 = {});
137652
- const n6 = a4(t5, e5);
137653
- if (true !== n6) throw Error(`${n6.err.msg}:${n6.err.line}:${n6.err.col}`);
138684
+ const i6 = l4(t5, e5);
138685
+ if (true !== i6) throw Error(`${i6.err.msg}:${i6.err.line}:${i6.err.col}`);
137654
138686
  }
137655
- const n5 = new F4(this.options);
137656
- n5.addExternalEntities(this.externalEntities);
137657
- const i5 = n5.parseXml(t5);
137658
- return this.options.preserveOrder || void 0 === i5 ? i5 : H3(i5, this.options);
138687
+ const i5 = new B4(this.options);
138688
+ i5.addExternalEntities(this.externalEntities);
138689
+ const n5 = i5.parseXml(t5);
138690
+ return this.options.preserveOrder || void 0 === n5 ? n5 : lt2(n5, this.options, i5.matcher);
137659
138691
  }
137660
138692
  addEntity(t5, e5) {
137661
138693
  if (-1 !== e5.indexOf("&")) throw new Error("Entity value can't have '&'");
@@ -137664,166 +138696,305 @@ var require_fxp = __commonJS({
137664
138696
  this.externalEntities[t5] = e5;
137665
138697
  }
137666
138698
  static getMetaDataSymbol() {
137667
- return I4.getMetaDataSymbol();
138699
+ return $3.getMetaDataSymbol();
137668
138700
  }
137669
138701
  }
137670
- function rt2(t5, e5) {
137671
- let n5 = "";
137672
- return e5.format && e5.indentBy.length > 0 && (n5 = "\n"), ot2(t5, e5, "", n5);
138702
+ function gt2(t5, e5) {
138703
+ let i5 = "";
138704
+ e5.format && e5.indentBy.length > 0 && (i5 = "\n");
138705
+ const n5 = [];
138706
+ if (e5.stopNodes && Array.isArray(e5.stopNodes)) for (let t6 = 0; t6 < e5.stopNodes.length; t6++) {
138707
+ const i6 = e5.stopNodes[t6];
138708
+ "string" == typeof i6 ? n5.push(new G4(i6)) : i6 instanceof G4 && n5.push(i6);
138709
+ }
138710
+ return mt2(t5, e5, i5, new L3(), n5);
137673
138711
  }
137674
- function ot2(t5, e5, n5, i5) {
137675
- let s7 = "", r5 = false;
138712
+ function mt2(t5, e5, i5, n5, s7) {
138713
+ let r5 = "", o5 = false;
138714
+ if (e5.maxNestedTags && n5.getDepth() > e5.maxNestedTags) throw new Error("Maximum nested tags exceeded");
137676
138715
  if (!Array.isArray(t5)) {
137677
138716
  if (null != t5) {
137678
- let n6 = t5.toString();
137679
- return n6 = dt2(n6, e5), n6;
138717
+ let i6 = t5.toString();
138718
+ return i6 = vt2(i6, e5), i6;
137680
138719
  }
137681
138720
  return "";
137682
138721
  }
137683
- for (let o5 = 0; o5 < t5.length; o5++) {
137684
- const a5 = t5[o5], l5 = at2(a5);
138722
+ for (let a5 = 0; a5 < t5.length; a5++) {
138723
+ const h5 = t5[a5], l5 = Et2(h5);
137685
138724
  if (void 0 === l5) continue;
137686
- let u8 = "";
137687
- if (u8 = 0 === n5.length ? l5 : `${n5}.${l5}`, l5 === e5.textNodeName) {
137688
- let t6 = a5[l5];
137689
- ut2(u8, e5) || (t6 = e5.tagValueProcessor(l5, t6), t6 = dt2(t6, e5)), r5 && (s7 += i5), s7 += t6, r5 = false;
138725
+ const p6 = xt2(h5[":@"], e5);
138726
+ n5.push(l5, p6);
138727
+ const u8 = wt2(n5, s7);
138728
+ if (l5 === e5.textNodeName) {
138729
+ let t6 = h5[l5];
138730
+ u8 || (t6 = e5.tagValueProcessor(l5, t6), t6 = vt2(t6, e5)), o5 && (r5 += i5), r5 += t6, o5 = false, n5.pop();
137690
138731
  continue;
137691
138732
  }
137692
138733
  if (l5 === e5.cdataPropName) {
137693
- r5 && (s7 += i5), s7 += `<![CDATA[${a5[l5][0][e5.textNodeName]}]]>`, r5 = false;
138734
+ o5 && (r5 += i5), r5 += `<![CDATA[${h5[l5][0][e5.textNodeName]}]]>`, o5 = false, n5.pop();
137694
138735
  continue;
137695
138736
  }
137696
138737
  if (l5 === e5.commentPropName) {
137697
- s7 += i5 + `<!--${a5[l5][0][e5.textNodeName]}-->`, r5 = true;
138738
+ r5 += i5 + `<!--${h5[l5][0][e5.textNodeName]}-->`, o5 = true, n5.pop();
137698
138739
  continue;
137699
138740
  }
137700
138741
  if ("?" === l5[0]) {
137701
- const t6 = lt2(a5[":@"], e5), n6 = "?xml" === l5 ? "" : i5;
137702
- let o6 = a5[l5][0][e5.textNodeName];
137703
- o6 = 0 !== o6.length ? " " + o6 : "", s7 += n6 + `<${l5}${o6}${t6}?>`, r5 = true;
138742
+ const t6 = yt2(h5[":@"], e5, u8), s8 = "?xml" === l5 ? "" : i5;
138743
+ let a6 = h5[l5][0][e5.textNodeName];
138744
+ a6 = 0 !== a6.length ? " " + a6 : "", r5 += s8 + `<${l5}${a6}${t6}?>`, o5 = true, n5.pop();
137704
138745
  continue;
137705
138746
  }
137706
- let d6 = i5;
137707
- "" !== d6 && (d6 += e5.indentBy);
137708
- const h5 = i5 + `<${l5}${lt2(a5[":@"], e5)}`, p6 = ot2(a5[l5], e5, u8, d6);
137709
- -1 !== e5.unpairedTags.indexOf(l5) ? e5.suppressUnpairedNode ? s7 += h5 + ">" : s7 += h5 + "/>" : p6 && 0 !== p6.length || !e5.suppressEmptyNode ? p6 && p6.endsWith(">") ? s7 += h5 + `>${p6}${i5}</${l5}>` : (s7 += h5 + ">", p6 && "" !== i5 && (p6.includes("/>") || p6.includes("</")) ? s7 += i5 + e5.indentBy + p6 + i5 : s7 += p6, s7 += `</${l5}>`) : s7 += h5 + "/>", r5 = true;
138747
+ let c5 = i5;
138748
+ "" !== c5 && (c5 += e5.indentBy);
138749
+ const d6 = i5 + `<${l5}${yt2(h5[":@"], e5, u8)}`;
138750
+ let f6;
138751
+ f6 = u8 ? Nt3(h5[l5], e5) : mt2(h5[l5], e5, c5, n5, s7), -1 !== e5.unpairedTags.indexOf(l5) ? e5.suppressUnpairedNode ? r5 += d6 + ">" : r5 += d6 + "/>" : f6 && 0 !== f6.length || !e5.suppressEmptyNode ? f6 && f6.endsWith(">") ? r5 += d6 + `>${f6}${i5}</${l5}>` : (r5 += d6 + ">", f6 && "" !== i5 && (f6.includes("/>") || f6.includes("</")) ? r5 += i5 + e5.indentBy + f6 + i5 : r5 += f6, r5 += `</${l5}>`) : r5 += d6 + "/>", o5 = true, n5.pop();
138752
+ }
138753
+ return r5;
138754
+ }
138755
+ function xt2(t5, e5) {
138756
+ if (!t5 || e5.ignoreAttributes) return null;
138757
+ const i5 = {};
138758
+ let n5 = false;
138759
+ for (let s7 in t5) Object.prototype.hasOwnProperty.call(t5, s7) && (i5[s7.startsWith(e5.attributeNamePrefix) ? s7.substr(e5.attributeNamePrefix.length) : s7] = t5[s7], n5 = true);
138760
+ return n5 ? i5 : null;
138761
+ }
138762
+ function Nt3(t5, e5) {
138763
+ if (!Array.isArray(t5)) return null != t5 ? t5.toString() : "";
138764
+ let i5 = "";
138765
+ for (let n5 = 0; n5 < t5.length; n5++) {
138766
+ const s7 = t5[n5], r5 = Et2(s7);
138767
+ if (r5 === e5.textNodeName) i5 += s7[r5];
138768
+ else if (r5 === e5.cdataPropName) i5 += s7[r5][0][e5.textNodeName];
138769
+ else if (r5 === e5.commentPropName) i5 += s7[r5][0][e5.textNodeName];
138770
+ else {
138771
+ if (r5 && "?" === r5[0]) continue;
138772
+ if (r5) {
138773
+ const t6 = bt2(s7[":@"], e5), n6 = Nt3(s7[r5], e5);
138774
+ n6 && 0 !== n6.length ? i5 += `<${r5}${t6}>${n6}</${r5}>` : i5 += `<${r5}${t6}/>`;
138775
+ }
138776
+ }
137710
138777
  }
137711
- return s7;
138778
+ return i5;
137712
138779
  }
137713
- function at2(t5) {
138780
+ function bt2(t5, e5) {
138781
+ let i5 = "";
138782
+ if (t5 && !e5.ignoreAttributes) for (let n5 in t5) {
138783
+ if (!Object.prototype.hasOwnProperty.call(t5, n5)) continue;
138784
+ let s7 = t5[n5];
138785
+ true === s7 && e5.suppressBooleanAttributes ? i5 += ` ${n5.substr(e5.attributeNamePrefix.length)}` : i5 += ` ${n5.substr(e5.attributeNamePrefix.length)}="${s7}"`;
138786
+ }
138787
+ return i5;
138788
+ }
138789
+ function Et2(t5) {
137714
138790
  const e5 = Object.keys(t5);
137715
- for (let n5 = 0; n5 < e5.length; n5++) {
137716
- const i5 = e5[n5];
137717
- if (Object.prototype.hasOwnProperty.call(t5, i5) && ":@" !== i5) return i5;
138791
+ for (let i5 = 0; i5 < e5.length; i5++) {
138792
+ const n5 = e5[i5];
138793
+ if (Object.prototype.hasOwnProperty.call(t5, n5) && ":@" !== n5) return n5;
137718
138794
  }
137719
138795
  }
137720
- function lt2(t5, e5) {
138796
+ function yt2(t5, e5, i5) {
137721
138797
  let n5 = "";
137722
- if (t5 && !e5.ignoreAttributes) for (let i5 in t5) {
137723
- if (!Object.prototype.hasOwnProperty.call(t5, i5)) continue;
137724
- let s7 = e5.attributeValueProcessor(i5, t5[i5]);
137725
- s7 = dt2(s7, e5), true === s7 && e5.suppressBooleanAttributes ? n5 += ` ${i5.substr(e5.attributeNamePrefix.length)}` : n5 += ` ${i5.substr(e5.attributeNamePrefix.length)}="${s7}"`;
138798
+ if (t5 && !e5.ignoreAttributes) for (let s7 in t5) {
138799
+ if (!Object.prototype.hasOwnProperty.call(t5, s7)) continue;
138800
+ let r5;
138801
+ i5 ? r5 = t5[s7] : (r5 = e5.attributeValueProcessor(s7, t5[s7]), r5 = vt2(r5, e5)), true === r5 && e5.suppressBooleanAttributes ? n5 += ` ${s7.substr(e5.attributeNamePrefix.length)}` : n5 += ` ${s7.substr(e5.attributeNamePrefix.length)}="${r5}"`;
137726
138802
  }
137727
138803
  return n5;
137728
138804
  }
137729
- function ut2(t5, e5) {
137730
- let n5 = (t5 = t5.substr(0, t5.length - e5.textNodeName.length - 1)).substr(t5.lastIndexOf(".") + 1);
137731
- for (let i5 in e5.stopNodes) if (e5.stopNodes[i5] === t5 || e5.stopNodes[i5] === "*." + n5) return true;
138805
+ function wt2(t5, e5) {
138806
+ if (!e5 || 0 === e5.length) return false;
138807
+ for (let i5 = 0; i5 < e5.length; i5++) if (t5.matches(e5[i5])) return true;
137732
138808
  return false;
137733
138809
  }
137734
- function dt2(t5, e5) {
137735
- if (t5 && t5.length > 0 && e5.processEntities) for (let n5 = 0; n5 < e5.entities.length; n5++) {
137736
- const i5 = e5.entities[n5];
137737
- t5 = t5.replace(i5.regex, i5.val);
138810
+ function vt2(t5, e5) {
138811
+ if (t5 && t5.length > 0 && e5.processEntities) for (let i5 = 0; i5 < e5.entities.length; i5++) {
138812
+ const n5 = e5.entities[i5];
138813
+ t5 = t5.replace(n5.regex, n5.val);
137738
138814
  }
137739
138815
  return t5;
137740
138816
  }
137741
- const ht2 = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t5, e5) {
138817
+ const Tt2 = { attributeNamePrefix: "@_", attributesGroupName: false, textNodeName: "#text", ignoreAttributes: true, cdataPropName: false, format: false, indentBy: " ", suppressEmptyNode: false, suppressUnpairedNode: true, suppressBooleanAttributes: true, tagValueProcessor: function(t5, e5) {
137742
138818
  return e5;
137743
138819
  }, attributeValueProcessor: function(t5, e5) {
137744
138820
  return e5;
137745
- }, preserveOrder: false, commentPropName: false, 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: true, stopNodes: [], oneListGroup: false };
137746
- function pt2(t5) {
137747
- this.options = Object.assign({}, ht2, t5), true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
138821
+ }, preserveOrder: false, commentPropName: false, 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: true, stopNodes: [], oneListGroup: false, maxNestedTags: 100, jPath: true };
138822
+ function Pt2(t5) {
138823
+ if (this.options = Object.assign({}, Tt2, t5), this.options.stopNodes && Array.isArray(this.options.stopNodes) && (this.options.stopNodes = this.options.stopNodes.map((t6) => "string" == typeof t6 && t6.startsWith("*.") ? ".." + t6.substring(2) : t6)), this.stopNodeExpressions = [], this.options.stopNodes && Array.isArray(this.options.stopNodes)) for (let t6 = 0; t6 < this.options.stopNodes.length; t6++) {
138824
+ const e6 = this.options.stopNodes[t6];
138825
+ "string" == typeof e6 ? this.stopNodeExpressions.push(new G4(e6)) : e6 instanceof G4 && this.stopNodeExpressions.push(e6);
138826
+ }
138827
+ var e5;
138828
+ true === this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
137748
138829
  return false;
137749
- } : (this.ignoreAttributesFn = L3(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = gt2), this.processTextOrObjNode = ct2, this.options.format ? (this.indentate = ft2, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
138830
+ } : (this.ignoreAttributesFn = "function" == typeof (e5 = this.options.ignoreAttributes) ? e5 : Array.isArray(e5) ? (t6) => {
138831
+ for (const i5 of e5) {
138832
+ if ("string" == typeof i5 && t6 === i5) return true;
138833
+ if (i5 instanceof RegExp && i5.test(t6)) return true;
138834
+ }
138835
+ } : () => false, this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Ct2), this.processTextOrObjNode = St2, this.options.format ? (this.indentate = At2, this.tagEndChar = ">\n", this.newLine = "\n") : (this.indentate = function() {
137750
138836
  return "";
137751
138837
  }, this.tagEndChar = ">", this.newLine = "");
137752
138838
  }
137753
- function ct2(t5, e5, n5, i5) {
137754
- const s7 = this.j2x(t5, n5 + 1, i5.concat(e5));
137755
- return void 0 !== t5[this.options.textNodeName] && 1 === Object.keys(t5).length ? this.buildTextValNode(t5[this.options.textNodeName], e5, s7.attrStr, n5) : this.buildObjectNode(s7.val, e5, s7.attrStr, n5);
138839
+ function St2(t5, e5, i5, n5) {
138840
+ const s7 = this.extractAttributes(t5);
138841
+ if (n5.push(e5, s7), this.checkStopNode(n5)) {
138842
+ const s8 = this.buildRawContent(t5), r6 = this.buildAttributesForStopNode(t5);
138843
+ return n5.pop(), this.buildObjectNode(s8, e5, r6, i5);
138844
+ }
138845
+ const r5 = this.j2x(t5, i5 + 1, n5);
138846
+ return n5.pop(), void 0 !== t5[this.options.textNodeName] && 1 === Object.keys(t5).length ? this.buildTextValNode(t5[this.options.textNodeName], e5, r5.attrStr, i5, n5) : this.buildObjectNode(r5.val, e5, r5.attrStr, i5);
137756
138847
  }
137757
- function ft2(t5) {
138848
+ function At2(t5) {
137758
138849
  return this.options.indentBy.repeat(t5);
137759
138850
  }
137760
- function gt2(t5) {
138851
+ function Ct2(t5) {
137761
138852
  return !(!t5.startsWith(this.options.attributeNamePrefix) || t5 === this.options.textNodeName) && t5.substr(this.attrPrefixLen);
137762
138853
  }
137763
- pt2.prototype.build = function(t5) {
137764
- return this.options.preserveOrder ? rt2(t5, this.options) : (Array.isArray(t5) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t5 = { [this.options.arrayNodeName]: t5 }), this.j2x(t5, 0, []).val);
137765
- }, pt2.prototype.j2x = function(t5, e5, n5) {
137766
- let i5 = "", s7 = "";
137767
- const r5 = n5.join(".");
137768
- for (let o5 in t5) if (Object.prototype.hasOwnProperty.call(t5, o5)) if (void 0 === t5[o5]) this.isAttribute(o5) && (s7 += "");
137769
- else if (null === t5[o5]) this.isAttribute(o5) || o5 === this.options.cdataPropName ? s7 += "" : "?" === o5[0] ? s7 += this.indentate(e5) + "<" + o5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + o5 + "/" + this.tagEndChar;
137770
- else if (t5[o5] instanceof Date) s7 += this.buildTextValNode(t5[o5], o5, "", e5);
137771
- else if ("object" != typeof t5[o5]) {
137772
- const n6 = this.isAttribute(o5);
137773
- if (n6 && !this.ignoreAttributesFn(n6, r5)) i5 += this.buildAttrPairStr(n6, "" + t5[o5]);
137774
- else if (!n6) if (o5 === this.options.textNodeName) {
137775
- let e6 = this.options.tagValueProcessor(o5, "" + t5[o5]);
138854
+ Pt2.prototype.build = function(t5) {
138855
+ if (this.options.preserveOrder) return gt2(t5, this.options);
138856
+ {
138857
+ Array.isArray(t5) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (t5 = { [this.options.arrayNodeName]: t5 });
138858
+ const e5 = new L3();
138859
+ return this.j2x(t5, 0, e5).val;
138860
+ }
138861
+ }, Pt2.prototype.j2x = function(t5, e5, i5) {
138862
+ let n5 = "", s7 = "";
138863
+ if (this.options.maxNestedTags && i5.getDepth() >= this.options.maxNestedTags) throw new Error("Maximum nested tags exceeded");
138864
+ const r5 = this.options.jPath ? i5.toString() : i5, o5 = this.checkStopNode(i5);
138865
+ for (let a5 in t5) if (Object.prototype.hasOwnProperty.call(t5, a5)) if (void 0 === t5[a5]) this.isAttribute(a5) && (s7 += "");
138866
+ else if (null === t5[a5]) this.isAttribute(a5) || a5 === this.options.cdataPropName ? s7 += "" : "?" === a5[0] ? s7 += this.indentate(e5) + "<" + a5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + a5 + "/" + this.tagEndChar;
138867
+ else if (t5[a5] instanceof Date) s7 += this.buildTextValNode(t5[a5], a5, "", e5, i5);
138868
+ else if ("object" != typeof t5[a5]) {
138869
+ const h5 = this.isAttribute(a5);
138870
+ if (h5 && !this.ignoreAttributesFn(h5, r5)) n5 += this.buildAttrPairStr(h5, "" + t5[a5], o5);
138871
+ else if (!h5) if (a5 === this.options.textNodeName) {
138872
+ let e6 = this.options.tagValueProcessor(a5, "" + t5[a5]);
137776
138873
  s7 += this.replaceEntitiesValue(e6);
137777
- } else s7 += this.buildTextValNode(t5[o5], o5, "", e5);
137778
- } else if (Array.isArray(t5[o5])) {
137779
- const i6 = t5[o5].length;
137780
- let r6 = "", a5 = "";
137781
- for (let l5 = 0; l5 < i6; l5++) {
137782
- const i7 = t5[o5][l5];
137783
- if (void 0 === i7) ;
137784
- else if (null === i7) "?" === o5[0] ? s7 += this.indentate(e5) + "<" + o5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + o5 + "/" + this.tagEndChar;
137785
- else if ("object" == typeof i7) if (this.options.oneListGroup) {
137786
- const t6 = this.j2x(i7, e5 + 1, n5.concat(o5));
137787
- r6 += t6.val, this.options.attributesGroupName && i7.hasOwnProperty(this.options.attributesGroupName) && (a5 += t6.attrStr);
137788
- } else r6 += this.processTextOrObjNode(i7, o5, e5, n5);
138874
+ } else {
138875
+ i5.push(a5);
138876
+ const n6 = this.checkStopNode(i5);
138877
+ if (i5.pop(), n6) {
138878
+ const i6 = "" + t5[a5];
138879
+ s7 += "" === i6 ? this.indentate(e5) + "<" + a5 + this.closeTag(a5) + this.tagEndChar : this.indentate(e5) + "<" + a5 + ">" + i6 + "</" + a5 + this.tagEndChar;
138880
+ } else s7 += this.buildTextValNode(t5[a5], a5, "", e5, i5);
138881
+ }
138882
+ } else if (Array.isArray(t5[a5])) {
138883
+ const n6 = t5[a5].length;
138884
+ let r6 = "", o6 = "";
138885
+ for (let h5 = 0; h5 < n6; h5++) {
138886
+ const n7 = t5[a5][h5];
138887
+ if (void 0 === n7) ;
138888
+ else if (null === n7) "?" === a5[0] ? s7 += this.indentate(e5) + "<" + a5 + "?" + this.tagEndChar : s7 += this.indentate(e5) + "<" + a5 + "/" + this.tagEndChar;
138889
+ else if ("object" == typeof n7) if (this.options.oneListGroup) {
138890
+ i5.push(a5);
138891
+ const t6 = this.j2x(n7, e5 + 1, i5);
138892
+ i5.pop(), r6 += t6.val, this.options.attributesGroupName && n7.hasOwnProperty(this.options.attributesGroupName) && (o6 += t6.attrStr);
138893
+ } else r6 += this.processTextOrObjNode(n7, a5, e5, i5);
137789
138894
  else if (this.options.oneListGroup) {
137790
- let t6 = this.options.tagValueProcessor(o5, i7);
138895
+ let t6 = this.options.tagValueProcessor(a5, n7);
137791
138896
  t6 = this.replaceEntitiesValue(t6), r6 += t6;
137792
- } else r6 += this.buildTextValNode(i7, o5, "", e5);
137793
- }
137794
- this.options.oneListGroup && (r6 = this.buildObjectNode(r6, o5, a5, e5)), s7 += r6;
137795
- } else if (this.options.attributesGroupName && o5 === this.options.attributesGroupName) {
137796
- const e6 = Object.keys(t5[o5]), n6 = e6.length;
137797
- for (let s8 = 0; s8 < n6; s8++) i5 += this.buildAttrPairStr(e6[s8], "" + t5[o5][e6[s8]]);
137798
- } else s7 += this.processTextOrObjNode(t5[o5], o5, e5, n5);
137799
- return { attrStr: i5, val: s7 };
137800
- }, pt2.prototype.buildAttrPairStr = function(t5, e5) {
137801
- return e5 = this.options.attributeValueProcessor(t5, "" + e5), e5 = this.replaceEntitiesValue(e5), this.options.suppressBooleanAttributes && "true" === e5 ? " " + t5 : " " + t5 + '="' + e5 + '"';
137802
- }, pt2.prototype.buildObjectNode = function(t5, e5, n5, i5) {
137803
- if ("" === t5) return "?" === e5[0] ? this.indentate(i5) + "<" + e5 + n5 + "?" + this.tagEndChar : this.indentate(i5) + "<" + e5 + n5 + this.closeTag(e5) + this.tagEndChar;
138897
+ } else {
138898
+ i5.push(a5);
138899
+ const t6 = this.checkStopNode(i5);
138900
+ if (i5.pop(), t6) {
138901
+ const t7 = "" + n7;
138902
+ r6 += "" === t7 ? this.indentate(e5) + "<" + a5 + this.closeTag(a5) + this.tagEndChar : this.indentate(e5) + "<" + a5 + ">" + t7 + "</" + a5 + this.tagEndChar;
138903
+ } else r6 += this.buildTextValNode(n7, a5, "", e5, i5);
138904
+ }
138905
+ }
138906
+ this.options.oneListGroup && (r6 = this.buildObjectNode(r6, a5, o6, e5)), s7 += r6;
138907
+ } else if (this.options.attributesGroupName && a5 === this.options.attributesGroupName) {
138908
+ const e6 = Object.keys(t5[a5]), i6 = e6.length;
138909
+ for (let s8 = 0; s8 < i6; s8++) n5 += this.buildAttrPairStr(e6[s8], "" + t5[a5][e6[s8]], o5);
138910
+ } else s7 += this.processTextOrObjNode(t5[a5], a5, e5, i5);
138911
+ return { attrStr: n5, val: s7 };
138912
+ }, Pt2.prototype.buildAttrPairStr = function(t5, e5, i5) {
138913
+ return i5 || (e5 = this.options.attributeValueProcessor(t5, "" + e5), e5 = this.replaceEntitiesValue(e5)), this.options.suppressBooleanAttributes && "true" === e5 ? " " + t5 : " " + t5 + '="' + e5 + '"';
138914
+ }, Pt2.prototype.extractAttributes = function(t5) {
138915
+ if (!t5 || "object" != typeof t5) return null;
138916
+ const e5 = {};
138917
+ let i5 = false;
138918
+ if (this.options.attributesGroupName && t5[this.options.attributesGroupName]) {
138919
+ const n5 = t5[this.options.attributesGroupName];
138920
+ for (let t6 in n5) Object.prototype.hasOwnProperty.call(n5, t6) && (e5[t6.startsWith(this.options.attributeNamePrefix) ? t6.substring(this.options.attributeNamePrefix.length) : t6] = n5[t6], i5 = true);
138921
+ } else for (let n5 in t5) {
138922
+ if (!Object.prototype.hasOwnProperty.call(t5, n5)) continue;
138923
+ const s7 = this.isAttribute(n5);
138924
+ s7 && (e5[s7] = t5[n5], i5 = true);
138925
+ }
138926
+ return i5 ? e5 : null;
138927
+ }, Pt2.prototype.buildRawContent = function(t5) {
138928
+ if ("string" == typeof t5) return t5;
138929
+ if ("object" != typeof t5 || null === t5) return String(t5);
138930
+ if (void 0 !== t5[this.options.textNodeName]) return t5[this.options.textNodeName];
138931
+ let e5 = "";
138932
+ for (let i5 in t5) {
138933
+ if (!Object.prototype.hasOwnProperty.call(t5, i5)) continue;
138934
+ if (this.isAttribute(i5)) continue;
138935
+ if (this.options.attributesGroupName && i5 === this.options.attributesGroupName) continue;
138936
+ const n5 = t5[i5];
138937
+ if (i5 === this.options.textNodeName) e5 += n5;
138938
+ else if (Array.isArray(n5)) {
138939
+ for (let t6 of n5) if ("string" == typeof t6 || "number" == typeof t6) e5 += `<${i5}>${t6}</${i5}>`;
138940
+ else if ("object" == typeof t6 && null !== t6) {
138941
+ const n6 = this.buildRawContent(t6), s7 = this.buildAttributesForStopNode(t6);
138942
+ e5 += "" === n6 ? `<${i5}${s7}/>` : `<${i5}${s7}>${n6}</${i5}>`;
138943
+ }
138944
+ } else if ("object" == typeof n5 && null !== n5) {
138945
+ const t6 = this.buildRawContent(n5), s7 = this.buildAttributesForStopNode(n5);
138946
+ e5 += "" === t6 ? `<${i5}${s7}/>` : `<${i5}${s7}>${t6}</${i5}>`;
138947
+ } else e5 += `<${i5}>${n5}</${i5}>`;
138948
+ }
138949
+ return e5;
138950
+ }, Pt2.prototype.buildAttributesForStopNode = function(t5) {
138951
+ if (!t5 || "object" != typeof t5) return "";
138952
+ let e5 = "";
138953
+ if (this.options.attributesGroupName && t5[this.options.attributesGroupName]) {
138954
+ const i5 = t5[this.options.attributesGroupName];
138955
+ for (let t6 in i5) {
138956
+ if (!Object.prototype.hasOwnProperty.call(i5, t6)) continue;
138957
+ const n5 = t6.startsWith(this.options.attributeNamePrefix) ? t6.substring(this.options.attributeNamePrefix.length) : t6, s7 = i5[t6];
138958
+ true === s7 && this.options.suppressBooleanAttributes ? e5 += " " + n5 : e5 += " " + n5 + '="' + s7 + '"';
138959
+ }
138960
+ } else for (let i5 in t5) {
138961
+ if (!Object.prototype.hasOwnProperty.call(t5, i5)) continue;
138962
+ const n5 = this.isAttribute(i5);
138963
+ if (n5) {
138964
+ const s7 = t5[i5];
138965
+ true === s7 && this.options.suppressBooleanAttributes ? e5 += " " + n5 : e5 += " " + n5 + '="' + s7 + '"';
138966
+ }
138967
+ }
138968
+ return e5;
138969
+ }, Pt2.prototype.buildObjectNode = function(t5, e5, i5, n5) {
138970
+ if ("" === t5) return "?" === e5[0] ? this.indentate(n5) + "<" + e5 + i5 + "?" + this.tagEndChar : this.indentate(n5) + "<" + e5 + i5 + this.closeTag(e5) + this.tagEndChar;
137804
138971
  {
137805
138972
  let s7 = "</" + e5 + this.tagEndChar, r5 = "";
137806
- return "?" === e5[0] && (r5 = "?", s7 = ""), !n5 && "" !== n5 || -1 !== t5.indexOf("<") ? false !== this.options.commentPropName && e5 === this.options.commentPropName && 0 === r5.length ? this.indentate(i5) + `<!--${t5}-->` + this.newLine : this.indentate(i5) + "<" + e5 + n5 + r5 + this.tagEndChar + t5 + this.indentate(i5) + s7 : this.indentate(i5) + "<" + e5 + n5 + r5 + ">" + t5 + s7;
138973
+ return "?" === e5[0] && (r5 = "?", s7 = ""), !i5 && "" !== i5 || -1 !== t5.indexOf("<") ? false !== this.options.commentPropName && e5 === this.options.commentPropName && 0 === r5.length ? this.indentate(n5) + `<!--${t5}-->` + this.newLine : this.indentate(n5) + "<" + e5 + i5 + r5 + this.tagEndChar + t5 + this.indentate(n5) + s7 : this.indentate(n5) + "<" + e5 + i5 + r5 + ">" + t5 + s7;
137807
138974
  }
137808
- }, pt2.prototype.closeTag = function(t5) {
138975
+ }, Pt2.prototype.closeTag = function(t5) {
137809
138976
  let e5 = "";
137810
138977
  return -1 !== this.options.unpairedTags.indexOf(t5) ? this.options.suppressUnpairedNode || (e5 = "/") : e5 = this.options.suppressEmptyNode ? "/" : `></${t5}`, e5;
137811
- }, pt2.prototype.buildTextValNode = function(t5, e5, n5, i5) {
137812
- if (false !== this.options.cdataPropName && e5 === this.options.cdataPropName) return this.indentate(i5) + `<![CDATA[${t5}]]>` + this.newLine;
137813
- if (false !== this.options.commentPropName && e5 === this.options.commentPropName) return this.indentate(i5) + `<!--${t5}-->` + this.newLine;
137814
- if ("?" === e5[0]) return this.indentate(i5) + "<" + e5 + n5 + "?" + this.tagEndChar;
138978
+ }, Pt2.prototype.checkStopNode = function(t5) {
138979
+ if (!this.stopNodeExpressions || 0 === this.stopNodeExpressions.length) return false;
138980
+ for (let e5 = 0; e5 < this.stopNodeExpressions.length; e5++) if (t5.matches(this.stopNodeExpressions[e5])) return true;
138981
+ return false;
138982
+ }, Pt2.prototype.buildTextValNode = function(t5, e5, i5, n5, s7) {
138983
+ if (false !== this.options.cdataPropName && e5 === this.options.cdataPropName) return this.indentate(n5) + `<![CDATA[${t5}]]>` + this.newLine;
138984
+ if (false !== this.options.commentPropName && e5 === this.options.commentPropName) return this.indentate(n5) + `<!--${t5}-->` + this.newLine;
138985
+ if ("?" === e5[0]) return this.indentate(n5) + "<" + e5 + i5 + "?" + this.tagEndChar;
137815
138986
  {
137816
- let s7 = this.options.tagValueProcessor(e5, t5);
137817
- return s7 = this.replaceEntitiesValue(s7), "" === s7 ? this.indentate(i5) + "<" + e5 + n5 + this.closeTag(e5) + this.tagEndChar : this.indentate(i5) + "<" + e5 + n5 + ">" + s7 + "</" + e5 + this.tagEndChar;
138987
+ let s8 = this.options.tagValueProcessor(e5, t5);
138988
+ return s8 = this.replaceEntitiesValue(s8), "" === s8 ? this.indentate(n5) + "<" + e5 + i5 + this.closeTag(e5) + this.tagEndChar : this.indentate(n5) + "<" + e5 + i5 + ">" + s8 + "</" + e5 + this.tagEndChar;
137818
138989
  }
137819
- }, pt2.prototype.replaceEntitiesValue = function(t5) {
138990
+ }, Pt2.prototype.replaceEntitiesValue = function(t5) {
137820
138991
  if (t5 && t5.length > 0 && this.options.processEntities) for (let e5 = 0; e5 < this.options.entities.length; e5++) {
137821
- const n5 = this.options.entities[e5];
137822
- t5 = t5.replace(n5.regex, n5.val);
138992
+ const i5 = this.options.entities[e5];
138993
+ t5 = t5.replace(i5.regex, i5.val);
137823
138994
  }
137824
138995
  return t5;
137825
138996
  };
137826
- const xt2 = { validate: a4 };
138997
+ const Ot2 = Pt2, $t2 = { validate: l4 };
137827
138998
  module2.exports = e4;
137828
138999
  })();
137829
139000
  }
@@ -155067,7 +156238,9 @@ async function getRegionsFromAws() {
155067
156238
  path: "/?Action=DescribeRegions&Version=2013-10-15"
155068
156239
  });
155069
156240
  const url2 = `https://${hostname3}${path19}`;
155070
- const response = await (0, import_node_fetch4.default)(url2, { headers });
156241
+ const response = await (0, import_node_fetch4.default)(url2, {
156242
+ headers
156243
+ });
155071
156244
  if (!response.ok) {
155072
156245
  throw new Error(
155073
156246
  `Unexpected HTTP response from ${url2}: ${response.status} (${response.statusText})`
@@ -157896,7 +159069,7 @@ var require_package6 = __commonJS({
157896
159069
  "package.json"(exports2, module2) {
157897
159070
  module2.exports = {
157898
159071
  name: "@sentry/craft",
157899
- version: "2.24.2",
159072
+ version: "2.25.1",
157900
159073
  description: "The universal sentry workflow CLI",
157901
159074
  main: "dist/craft",
157902
159075
  repository: "https://github.com/getsentry/craft",
@@ -157942,7 +159115,7 @@ var require_package6 = __commonJS({
157942
159115
  "eslint-config-prettier": "^9.1.0",
157943
159116
  "eslint-formatter-github-annotations": "^0.1.0",
157944
159117
  "extract-zip": "^2.0.1",
157945
- "fast-xml-parser": "^5.3.4",
159118
+ "fast-xml-parser": "^5.5.7",
157946
159119
  "git-url-parse": "^16.1.0",
157947
159120
  glob: "^11.0.0",
157948
159121
  "is-ci": "^2.0.0",
@@ -157978,6 +159151,8 @@ var require_package6 = __commonJS({
157978
159151
  clean: "rm -rf dist coverage",
157979
159152
  lint: "eslint --cache --cache-strategy content",
157980
159153
  fix: "pnpm lint --fix",
159154
+ format: "prettier --write .",
159155
+ "format:check": "prettier --check .",
157981
159156
  test: "vitest run",
157982
159157
  "test:watch": "vitest",
157983
159158
  typecheck: "tsc --noEmit",
@@ -157997,11 +159172,11 @@ var require_package6 = __commonJS({
157997
159172
  },
157998
159173
  pnpm: {
157999
159174
  overrides: {
158000
- "fast-xml-parser": "^5.3.4",
159175
+ "fast-xml-parser": "^5.5.7",
158001
159176
  minimatch: "^10.2.1",
158002
159177
  "ajv@<6.14.0": "^6.14.0",
158003
159178
  rollup: "^4.59.0",
158004
- flatted: "^3.4.0"
159179
+ flatted: "^3.4.2"
158005
159180
  }
158006
159181
  }
158007
159182
  };
@@ -158065,7 +159240,7 @@ function getPackage() {
158065
159240
  }
158066
159241
  function getPackageVersion() {
158067
159242
  const { version: version2 } = getPackage();
158068
- const buildInfo = "78da70b88de5cf6245d5d7e3263a9e8952667dec";
159243
+ const buildInfo = "14aca37e23aa6d8239a4013cae86d3bae4b4e0cd";
158069
159244
  return buildInfo ? `${version2} (${buildInfo})` : version2;
158070
159245
  }
158071
159246
  function semVerToString(s6) {
@@ -161350,12 +162525,12 @@ function sync_default(start, callback) {
161350
162525
  }
161351
162526
 
161352
162527
  // node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/lib/platform-shims/esm.mjs
161353
- var import_util26 = require("util");
162528
+ var import_util27 = require("util");
161354
162529
  var import_url4 = require("url");
161355
162530
 
161356
162531
  // node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/index.js
161357
162532
  init_import_meta_url();
161358
- var import_util24 = require("util");
162533
+ var import_util25 = require("util");
161359
162534
  var import_path24 = require("path");
161360
162535
 
161361
162536
  // node_modules/.pnpm/yargs-parser@22.0.0/node_modules/yargs-parser/build/lib/string-utils.js
@@ -162320,7 +163495,7 @@ var parser4 = new YargsParser({
162320
163495
  env: () => {
162321
163496
  return env;
162322
163497
  },
162323
- format: import_util24.format,
163498
+ format: import_util25.format,
162324
163499
  normalize: import_path24.normalize,
162325
163500
  resolve: import_path24.resolve,
162326
163501
  require: (path19) => {
@@ -162371,14 +163546,14 @@ init_import_meta_url();
162371
163546
  // node_modules/.pnpm/y18n@5.0.8/node_modules/y18n/build/lib/platform-shims/node.js
162372
163547
  init_import_meta_url();
162373
163548
  var import_fs28 = require("fs");
162374
- var import_util25 = require("util");
163549
+ var import_util26 = require("util");
162375
163550
  var import_path25 = require("path");
162376
163551
  var node_default = {
162377
163552
  fs: {
162378
163553
  readFileSync: import_fs28.readFileSync,
162379
163554
  writeFile: import_fs28.writeFile
162380
163555
  },
162381
- format: import_util25.format,
163556
+ format: import_util26.format,
162382
163557
  resolve: import_path25.resolve,
162383
163558
  exists: (file) => {
162384
163559
  try {
@@ -162574,7 +163749,7 @@ var esm_default3 = {
162574
163749
  getEnv: (key) => {
162575
163750
  return process.env[key];
162576
163751
  },
162577
- inspect: import_util26.inspect,
163752
+ inspect: import_util27.inspect,
162578
163753
  getProcessArgvBin,
162579
163754
  mainFilename: mainFilename || process.cwd(),
162580
163755
  Parser: lib_default,
@@ -166044,7 +167219,9 @@ async function calculateCalVer(git, config3) {
166044
167219
  const date2 = /* @__PURE__ */ new Date();
166045
167220
  date2.setDate(date2.getDate() - config3.offset);
166046
167221
  const datePart = formatCalVerDate(date2, config3.format);
166047
- logger.debug(`CalVer: using date ${date2.toISOString()}, date part: ${datePart}`);
167222
+ logger.debug(
167223
+ `CalVer: using date ${date2.toISOString()}, date part: ${datePart}`
167224
+ );
166048
167225
  const gitTagPrefix = getGitTagPrefix();
166049
167226
  const searchPrefix = `${gitTagPrefix}${datePart}.`;
166050
167227
  logger.debug(`CalVer: searching for tags with prefix: ${searchPrefix}`);
@@ -166131,6 +167308,7 @@ __export(publish_exports, {
166131
167308
  builder: () => builder,
166132
167309
  command: () => command2,
166133
167310
  description: () => description,
167311
+ handleReleaseBranch: () => handleReleaseBranch,
166134
167312
  handler: () => handler2,
166135
167313
  publishMain: () => publishMain,
166136
167314
  runPostReleaseCommand: () => runPostReleaseCommand
@@ -166153,6 +167331,7 @@ init_helpers();
166153
167331
  init_strings();
166154
167332
  init_system();
166155
167333
  init_version9();
167334
+ init_esm9();
166156
167335
  init_git();
166157
167336
  init_tracing3();
166158
167337
  var DEFAULT_POST_RELEASE_SCRIPT_PATH = (0, import_path27.join)("scripts", "post-release.sh");
@@ -166370,8 +167549,41 @@ async function handleReleaseBranch(git, remoteName, branch, mergeTarget, keepBra
166370
167549
  }
166371
167550
  logger.debug(`Checking out merge target branch:`, mergeTarget);
166372
167551
  await git.checkout(mergeTarget);
167552
+ logger.debug(`Pulling latest changes from ${remoteName}/${mergeTarget}`);
167553
+ try {
167554
+ await git.pull(remoteName, mergeTarget, ["--rebase"]);
167555
+ } catch (pullError) {
167556
+ try {
167557
+ await git.raw(["rebase", "--abort"]);
167558
+ } catch (_abortError) {
167559
+ logger.trace("git rebase --abort failed (may be no rebase in progress)");
167560
+ }
167561
+ throw pullError;
167562
+ }
166373
167563
  logger.debug(`Merging ${branch} into: ${mergeTarget}`);
166374
- await git.pull(remoteName, mergeTarget, ["--rebase"]).merge(["--no-ff", "--no-edit", branch]).push(remoteName, mergeTarget);
167564
+ try {
167565
+ await git.merge(["--no-ff", "--no-edit", branch]);
167566
+ } catch (mergeError) {
167567
+ logger.warn(
167568
+ `Merge with default strategy failed (${mergeError instanceof Error ? mergeError.message : mergeError}), retrying with "resolve" strategy...`
167569
+ );
167570
+ try {
167571
+ await git.merge(["--abort"]);
167572
+ } catch (_abortError) {
167573
+ logger.trace("git merge --abort failed (may be no merge in progress)");
167574
+ }
167575
+ try {
167576
+ await git.merge(["-s", "resolve", "--no-ff", "--no-edit", branch]);
167577
+ } catch (resolveError) {
167578
+ try {
167579
+ await git.merge(["--abort"]);
167580
+ } catch (_abortError) {
167581
+ logger.trace("git merge --abort failed after resolve strategy");
167582
+ }
167583
+ throw resolveError;
167584
+ }
167585
+ }
167586
+ await git.push(remoteName, mergeTarget);
166375
167587
  if (keepBranch) {
166376
167588
  logger.info("Not deleting the release branch.");
166377
167589
  } else {
@@ -166561,13 +167773,30 @@ Original error: ${err instanceof Error ? err.message : String(err)}`;
166561
167773
  "Not merging because cannot determine a branch name to merge from."
166562
167774
  );
166563
167775
  } else if (targetsToPublish.has("all" /* All */) || targetsToPublish.has("none" /* None */) || earlierStateExists) {
166564
- await handleReleaseBranch(
166565
- git,
166566
- argv.remote,
166567
- branchName,
166568
- argv.mergeTarget,
166569
- argv.keepBranch
166570
- );
167776
+ try {
167777
+ await handleReleaseBranch(
167778
+ git,
167779
+ argv.remote,
167780
+ branchName,
167781
+ argv.mergeTarget,
167782
+ argv.keepBranch
167783
+ );
167784
+ } catch (mergeError) {
167785
+ captureException(mergeError);
167786
+ logger.warn(
167787
+ [
167788
+ `Failed to merge release branch "${branchName}" into the target branch.`,
167789
+ `This is likely due to a merge conflict (e.g., in CHANGELOG.md).`,
167790
+ `All publish targets completed successfully \u2014 only the post-publish merge failed.`,
167791
+ ``,
167792
+ `To resolve manually:`,
167793
+ ` 1. Merge the release branch into the target branch, resolving conflicts`,
167794
+ ` 2. Delete the release branch: git push ${argv.remote} --delete ${branchName}`,
167795
+ ``,
167796
+ `Error: ${mergeError instanceof Error ? mergeError.message : String(mergeError)}`
167797
+ ].join("\n")
167798
+ );
167799
+ }
166571
167800
  safeFs.unlink(publishStateFile).catch(
166572
167801
  (err) => logger.trace("Couldn't remove publish state file: ", err)
166573
167802
  );
@@ -166689,15 +167918,30 @@ async function pushReleaseBranch(git, branchName, remoteName, pushFlag = true) {
166689
167918
  );
166690
167919
  }
166691
167920
  }
166692
- async function commitNewVersion(git, newVersion) {
167921
+ async function commitChanges(git, newVersion, preReleaseCommandRan) {
166693
167922
  const message = `release: ${newVersion}`;
167923
+ if (preReleaseCommandRan) {
167924
+ const repoStatus2 = await git.status();
167925
+ if (!(repoStatus2.created.length || repoStatus2.modified.length || repoStatus2.staged.length)) {
167926
+ reportError(
167927
+ "Nothing to commit: has the pre-release command done its job?"
167928
+ );
167929
+ }
167930
+ logger.debug("Committing the release changes...");
167931
+ logger.trace(`Commit message: "${message}"`);
167932
+ await git.commit(message, ["--all"]);
167933
+ return;
167934
+ }
166694
167935
  const repoStatus = await git.status();
166695
- if (!(repoStatus.created.length || repoStatus.modified.length)) {
166696
- reportError("Nothing to commit: has the pre-release command done its job?");
167936
+ if (!(repoStatus.staged.length || repoStatus.created.length)) {
167937
+ logger.debug(
167938
+ "Nothing to commit: no changelog changes and no version bumping occurred."
167939
+ );
167940
+ return;
166697
167941
  }
166698
167942
  logger.debug("Committing the release changes...");
166699
167943
  logger.trace(`Commit message: "${message}"`);
166700
- await git.commit(message, ["--all"]);
167944
+ await git.commit(message);
166701
167945
  }
166702
167946
  async function runPreReleaseCommand(options) {
166703
167947
  const { oldVersion, newVersion, preReleaseCommand, targets, rootDir } = options;
@@ -166706,7 +167950,11 @@ async function runPreReleaseCommand(options) {
166706
167950
  return false;
166707
167951
  }
166708
167952
  if (preReleaseCommand) {
166709
- return runCustomPreReleaseCommand(oldVersion, newVersion, preReleaseCommand);
167953
+ return runCustomPreReleaseCommand(
167954
+ oldVersion,
167955
+ newVersion,
167956
+ preReleaseCommand
167957
+ );
166710
167958
  }
166711
167959
  if (requiresMinVersion(AUTO_BUMP_MIN_VERSION) && targets && targets.length > 0) {
166712
167960
  logger.info("Running automatic version bumping from targets...");
@@ -166751,10 +167999,15 @@ function checkGitStatus(repoStatus, rev) {
166751
167999
  logger.info("Checking the local repository status...");
166752
168000
  logger.debug("Repository status:", formatJson(repoStatus));
166753
168001
  if (isRepoDirty(repoStatus)) {
166754
- reportError("Your repository is in a dirty state. Please stash or commit the pending changes.", logger);
168002
+ reportError(
168003
+ "Your repository is in a dirty state. Please stash or commit the pending changes.",
168004
+ logger
168005
+ );
166755
168006
  }
166756
168007
  if (repoStatus.current !== rev) {
166757
- logger.warn(`You are releasing from '${rev}', not '${repoStatus.current}' which you are currently on.`);
168008
+ logger.warn(
168009
+ `You are releasing from '${rev}', not '${repoStatus.current}' which you are currently on.`
168010
+ );
166758
168011
  }
166759
168012
  }
166760
168013
  async function execPublish(remote, newVersion, noGitChecks) {
@@ -166768,7 +168021,9 @@ async function execPublish(remote, newVersion, noGitChecks) {
166768
168021
  noStatusCheck: false,
166769
168022
  noGitChecks
166770
168023
  };
166771
- logger.info(`Sleeping for ${SLEEP_BEFORE_PUBLISH_SECONDS} seconds before publishing...`);
168024
+ logger.info(
168025
+ `Sleeping for ${SLEEP_BEFORE_PUBLISH_SECONDS} seconds before publishing...`
168026
+ );
166772
168027
  if (!isDryRun()) {
166773
168028
  await sleep(SLEEP_BEFORE_PUBLISH_SECONDS * 1e3);
166774
168029
  } else {
@@ -166788,11 +168043,15 @@ async function execPublish(remote, newVersion, noGitChecks) {
166788
168043
  }
166789
168044
  async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "none" /* None */, changelogPath = DEFAULT_CHANGELOG_PATH) {
166790
168045
  if (changelogPolicy === "none" /* None */) {
166791
- logger.debug(`Changelog policy is set to "${changelogPolicy}", nothing to do.`);
168046
+ logger.debug(
168047
+ `Changelog policy is set to "${changelogPolicy}", nothing to do.`
168048
+ );
166792
168049
  return void 0;
166793
168050
  }
166794
168051
  if (changelogPolicy !== "auto" /* Auto */ && changelogPolicy !== "simple" /* Simple */) {
166795
- throw new ConfigurationError(`Invalid changelog policy: "${changelogPolicy}"`);
168052
+ throw new ConfigurationError(
168053
+ `Invalid changelog policy: "${changelogPolicy}"`
168054
+ );
166796
168055
  }
166797
168056
  logger.info("Checking the changelog...");
166798
168057
  logger.debug(`Changelog policy: "${changelogPolicy}".`);
@@ -166806,11 +168065,17 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
166806
168065
  logger.info(`Creating changelog file: ${relativePath}`);
166807
168066
  await safeFs.writeFile(relativePath, "# Changelog\n");
166808
168067
  } else {
166809
- throw new ConfigurationError(`Changelog does not exist: "${changelogPath}"`);
168068
+ throw new ConfigurationError(
168069
+ `Changelog does not exist: "${changelogPath}"`
168070
+ );
166810
168071
  }
166811
168072
  }
166812
168073
  let changelogString = (await import_fs30.promises.readFile(relativePath)).toString();
166813
- let changeset = findChangeset(changelogString, newVersion, changelogPolicy === "auto" /* Auto */);
168074
+ let changeset = findChangeset(
168075
+ changelogString,
168076
+ newVersion,
168077
+ changelogPolicy === "auto" /* Auto */
168078
+ );
166814
168079
  switch (changelogPolicy) {
166815
168080
  case "auto" /* Auto */:
166816
168081
  let replaceSection;
@@ -166826,7 +168091,9 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
166826
168091
  replaceSection = changeset.name;
166827
168092
  changeset.name = newVersion;
166828
168093
  }
166829
- logger.debug(`Updating the changelog file for the new version: ${newVersion}`);
168094
+ logger.debug(
168095
+ `Updating the changelog file for the new version: ${newVersion}`
168096
+ );
166830
168097
  if (replaceSection) {
166831
168098
  changelogString = removeChangeset(changelogString, replaceSection);
166832
168099
  changelogString = prependChangeset(changelogString, changeset);
@@ -166835,7 +168102,9 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
166835
168102
  break;
166836
168103
  default:
166837
168104
  if (!changeset?.body) {
166838
- throw new ConfigurationError(`No changelog entry found for version "${newVersion}"`);
168105
+ throw new ConfigurationError(
168106
+ `No changelog entry found for version "${newVersion}"`
168107
+ );
166839
168108
  }
166840
168109
  }
166841
168110
  logger.debug("Changelog entry found:", changeset.name);
@@ -166846,7 +168115,9 @@ async function getChangelogLineRange(git, changelogPath, version2) {
166846
168115
  try {
166847
168116
  const content = await git.show([`HEAD:${changelogPath}`]);
166848
168117
  const lines = content.split("\n");
166849
- const startIdx = lines.findIndex((l4) => l4.trimEnd() === `## ${version2}` || l4.trimEnd() === version2);
168118
+ const startIdx = lines.findIndex(
168119
+ (l4) => l4.trimEnd() === `## ${version2}` || l4.trimEnd() === version2
168120
+ );
166850
168121
  if (startIdx < 0) {
166851
168122
  return "";
166852
168123
  }
@@ -166924,7 +168195,9 @@ async function resolveVersion(git, options) {
166924
168195
  }
166925
168196
  const currentVersion = latestTag && getVersion(latestTag) || "0.0.0";
166926
168197
  const newVersion = calculateNextVersion(currentVersion, bumpType);
166927
- logger.info(`Version bump: ${currentVersion} -> ${newVersion} (${bumpType} bump)`);
168198
+ logger.info(
168199
+ `Version bump: ${currentVersion} -> ${newVersion} (${bumpType} bump)`
168200
+ );
166928
168201
  return newVersion;
166929
168202
  }
166930
168203
  return version2;
@@ -166935,7 +168208,9 @@ async function prepareMain(argv) {
166935
168208
  logger.info(`Loading configuration from remote branch: ${argv.configFrom}`);
166936
168209
  try {
166937
168210
  await git.fetch([argv.remote, argv.configFrom]);
166938
- const configContent = await git.show([`${argv.remote}/${argv.configFrom}:${CONFIG_FILE_NAME}`]);
168211
+ const configContent = await git.show([
168212
+ `${argv.remote}/${argv.configFrom}:${CONFIG_FILE_NAME}`
168213
+ ]);
166939
168214
  loadConfigurationFromString(configContent);
166940
168215
  } catch (error3) {
166941
168216
  throw new ConfigurationError(
@@ -166968,7 +168243,13 @@ async function prepareMain(argv) {
166968
168243
  const isolation = await createDryRunIsolation(git, rev);
166969
168244
  git = isolation.git;
166970
168245
  try {
166971
- const branchName = await createReleaseBranch(git, rev, newVersion, argv.remote, config3.releaseBranchPrefix);
168246
+ const branchName = await createReleaseBranch(
168247
+ git,
168248
+ rev,
168249
+ newVersion,
168250
+ argv.remote,
168251
+ config3.releaseBranchPrefix
168252
+ );
166972
168253
  const oldVersion = await getLatestTag(git);
166973
168254
  const changelogPath = typeof config3.changelog === "string" ? config3.changelog : config3.changelog?.filePath;
166974
168255
  const changelogPolicy = typeof config3.changelog === "object" && config3.changelog?.policy ? config3.changelog.policy : config3.changelogPolicy;
@@ -166979,6 +168260,13 @@ async function prepareMain(argv) {
166979
168260
  argv.noChangelog ? "none" /* None */ : changelogPolicy,
166980
168261
  changelogPath
166981
168262
  );
168263
+ if (changelogBody) {
168264
+ const resolvedChangelogPath = (0, import_path28.relative)(
168265
+ "",
168266
+ changelogPath || DEFAULT_CHANGELOG_PATH
168267
+ );
168268
+ await git.add(resolvedChangelogPath);
168269
+ }
166982
168270
  const rootDir = getConfigFileDir() || process.cwd();
166983
168271
  const preReleaseCommandRan = await runPreReleaseCommand({
166984
168272
  oldVersion,
@@ -166987,11 +168275,7 @@ async function prepareMain(argv) {
166987
168275
  targets: config3.targets,
166988
168276
  rootDir
166989
168277
  });
166990
- if (preReleaseCommandRan) {
166991
- await commitNewVersion(git, newVersion);
166992
- } else {
166993
- logger.debug("Not committing anything since preReleaseCommand is empty.");
166994
- }
168278
+ await commitChanges(git, newVersion, preReleaseCommandRan);
166995
168279
  await isolation.showDiff();
166996
168280
  await pushReleaseBranch(git, branchName, argv.remote, !argv.noPush);
166997
168281
  const releaseSha = await git.revparse(["HEAD"]);
@@ -167003,11 +168287,20 @@ async function prepareMain(argv) {
167003
168287
  const issueChangelog = isCalVer ? disableChangelogMentions(changelogBody) : changelogBody;
167004
168288
  writeGitHubActionsFile("changelog", issueChangelog);
167005
168289
  const resolvedChangelogPath = changelogPath || DEFAULT_CHANGELOG_PATH;
167006
- const lineRange = await getChangelogLineRange(git, resolvedChangelogPath, newVersion);
168290
+ const lineRange = await getChangelogLineRange(
168291
+ git,
168292
+ resolvedChangelogPath,
168293
+ newVersion
168294
+ );
167007
168295
  const changelogFileUrl = `https://github.com/${githubConfig.owner}/${githubConfig.repo}/blob/${branchName}/${resolvedChangelogPath}` + lineRange;
167008
- setGitHubActionsOutput("changelog", truncateForOutput(issueChangelog, changelogFileUrl));
168296
+ setGitHubActionsOutput(
168297
+ "changelog",
168298
+ truncateForOutput(issueChangelog, changelogFileUrl)
168299
+ );
167009
168300
  }
167010
- logger.info(`View diff at: https://github.com/${githubConfig.owner}/${githubConfig.repo}/compare/${branchName}`);
168301
+ logger.info(
168302
+ `View diff at: https://github.com/${githubConfig.owner}/${githubConfig.repo}/compare/${branchName}`
168303
+ );
167011
168304
  if (argv.publish) {
167012
168305
  if (isolation.isIsolated) {
167013
168306
  logger.info(`[dry-run] Would run: craft publish ${newVersion}`);
@@ -167164,10 +168457,13 @@ async function handlerMain(argv) {
167164
168457
  return void 0;
167165
168458
  }
167166
168459
  const filesToDownload = argv.all ? artifacts.map((ar2) => ar2.filename) : argv.names;
167167
- const nameToArtifact = artifacts.reduce((dict, artifact) => {
167168
- dict[artifact.filename] = artifact;
167169
- return dict;
167170
- }, {});
168460
+ const nameToArtifact = artifacts.reduce(
168461
+ (dict, artifact) => {
168462
+ dict[artifact.filename] = artifact;
168463
+ return dict;
168464
+ },
168465
+ {}
168466
+ );
167171
168467
  logger.info(`Fetching artifacts for revision: ${revision}`);
167172
168468
  for (const name of filesToDownload) {
167173
168469
  logger.info(`Artifact to fetch: "${name}"`);