@happyvertical/smrt-content 0.51.13 → 0.51.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { t as __exportAll } from "./chunks/rolldown-runtime-D7D4PA-g.js";
2
- import { $ as parseContentReviewResponse, A as normalizeContentTransparency, B as getAcceptedContentReviewStatuses, C as resolveContentTenantReadScope, F as smrtContentReviewPrompt, G as getContentReviewProfile, H as getContentReviewKind, I as smrtContentThumbnailAIGeneratePrompt, J as getEffectiveContentGovernanceConfig, K as getContentReviewProfileKeys, L as buildContentGovernanceAssignmentKey, M as ContentReference, N as promptMessageOptions, O as getQueryRows, P as smrtContentApplyCorrectionPrompt, R as buildContentReviewPrompt, S as mergeContentQueryScope, T as ThumbnailGenerator, U as getContentReviewPolicies, V as getContentGovernanceConfig, W as getContentReviewPolicy, X as hasStaticContentGovernancePolicy, Y as getFallbackPolicyKind, Z as hasStaticContentGovernanceProfile, _ as assertContentQuerySchema, a as CONTENT_QUERY_IDENTITY_FIELD, at as isAssetAssociable, b as clearContentQuerySchemaCache, c as CONTENT_QUERY_MIN_RESULT_BYTES, d as DATA_QUERY_MAX_JSON_DEPTH, et as resetContentGovernanceConfig, f as DATA_QUERY_MAX_JSON_STRING_LENGTH, g as MAX_CONTENT_QUERY_OR_BRANCHES, h as DATA_QUERY_MAX_WARNING_LENGTH, i as CONTENT_QUERY_EXCLUDED_FIELD_IDS, it as ContentAsset, j as ContentReferences, k as isMissingTableError, l as DATA_QUERY_FORBIDDEN_JSON_KEYS, m as DATA_QUERY_MAX_WARNINGS, n as CONTENT_QUERY_DEFAULT_PAGE_LIMIT, nt as resolveEffectiveContentGovernance, o as CONTENT_QUERY_MAX_PAGE_LIMIT, ot as isMetadataAccessor, p as DATA_QUERY_MAX_STRING_LENGTH, q as getContentReviewRequirements, r as CONTENT_QUERY_DEFAULT_SORT, rt as ContentAssetCollection, s as CONTENT_QUERY_MAX_RESULT_BYTES, t as CONTENT_QUERY_CLASS_NAME, tt as resolveConfiguredContentGovernance, u as DATA_QUERY_MAX_JSON_CONTAINER_ITEMS, v as buildContentQuerySchema, w as Content, x as executeContentQuery, y as buildDataQuerySchemaForClass, z as configureContentGovernance } from "./chunks/content-query-DR5tevXB.js";
2
+ import { $ as parseContentReviewResponse, A as normalizeContentTransparency, B as getAcceptedContentReviewStatuses, C as resolveContentTenantReadScope, F as smrtContentReviewPrompt, G as getContentReviewProfile, H as getContentReviewKind, I as smrtContentThumbnailAIGeneratePrompt, J as getEffectiveContentGovernanceConfig, K as getContentReviewProfileKeys, L as buildContentGovernanceAssignmentKey, M as ContentReference, N as promptMessageOptions, O as getQueryRows, P as smrtContentApplyCorrectionPrompt, R as buildContentReviewPrompt, S as mergeContentQueryScope, T as ThumbnailGenerator, U as getContentReviewPolicies, V as getContentGovernanceConfig, W as getContentReviewPolicy, X as hasStaticContentGovernancePolicy, Y as getFallbackPolicyKind, Z as hasStaticContentGovernanceProfile, _ as assertContentQuerySchema, a as CONTENT_QUERY_IDENTITY_FIELD, at as isAssetAssociable, b as clearContentQuerySchemaCache, c as CONTENT_QUERY_MIN_RESULT_BYTES, d as DATA_QUERY_MAX_JSON_DEPTH, et as resetContentGovernanceConfig, f as DATA_QUERY_MAX_JSON_STRING_LENGTH, g as MAX_CONTENT_QUERY_OR_BRANCHES, h as DATA_QUERY_MAX_WARNING_LENGTH, i as CONTENT_QUERY_EXCLUDED_FIELD_IDS, it as ContentAsset, j as ContentReferences, k as isMissingTableError, l as DATA_QUERY_FORBIDDEN_JSON_KEYS, m as DATA_QUERY_MAX_WARNINGS, n as CONTENT_QUERY_DEFAULT_PAGE_LIMIT, nt as resolveEffectiveContentGovernance, o as CONTENT_QUERY_MAX_PAGE_LIMIT, ot as isMetadataAccessor, p as DATA_QUERY_MAX_STRING_LENGTH, q as getContentReviewRequirements, r as CONTENT_QUERY_DEFAULT_SORT, rt as ContentAssetCollection, s as CONTENT_QUERY_MAX_RESULT_BYTES, t as CONTENT_QUERY_CLASS_NAME, tt as resolveConfiguredContentGovernance, u as DATA_QUERY_MAX_JSON_CONTAINER_ITEMS, v as buildContentQuerySchema, w as Content, x as executeContentQuery, y as buildDataQuerySchemaForClass, z as configureContentGovernance } from "./chunks/content-query-fYqJubb-.js";
3
3
  import { DEFAULT_CONTENT_BODY_FORMAT, bodyToEditorHtml, editorHtmlToBody, extractBodyImages, htmlToMarkdown, renderMarkdownToHtml, resolveBodyFormat, sanitizeHtml, stripHtml } from "./body-format.js";
4
4
  import { r as ContentCorrection, t as ContentCorrectionCollection } from "./chunks/content-corrections-CKuY-MSv.js";
5
5
  import { contentEditorAssistantContextToChatProps, createContentEditorAssistantContext, sanitizeContentEditorAssistantFieldUpdates } from "./content-editor-assistant.js";
6
- import { r as assertSafeRemoteUrl, t as Contents } from "./chunks/contents-CmtUwuBM.js";
6
+ import { r as assertSafeRemoteUrl, t as Contents } from "./chunks/contents-CMsHWnUd.js";
7
7
  import { r as ContentReview, t as ContentReviewCollection } from "./chunks/content-reviews-D6o0zK8s.js";
8
- import { r as ContentVersion, t as ContentVersionCollection } from "./chunks/content-versions-BtjGm445.js";
8
+ import { r as ContentVersion, t as ContentVersionCollection } from "./chunks/content-versions-BrsKlgBE.js";
9
9
  import { evaluateContentPublishReadiness } from "./publish-readiness.js";
10
10
  import { ObjectRegistry, SmrtCollection, SmrtObject, crossPackageRef, field, foreignKey, smrt } from "@happyvertical/smrt-core";
11
11
  import { AssetCollection, AssetStatusCollection, AssetTypeCollection } from "@happyvertical/smrt-assets";
@@ -888,7 +888,7 @@ var ContentContribution = class extends SmrtObject {
888
888
  return ContentContributorCollection.create(this.options);
889
889
  }
890
890
  async getContentsCollection() {
891
- const { Contents } = await import("./chunks/contents-CmtUwuBM.js").then((n) => n.n);
891
+ const { Contents } = await import("./chunks/contents-CMsHWnUd.js").then((n) => n.n);
892
892
  return Contents.create({ db: this.db });
893
893
  }
894
894
  async getAssetCollection() {
@@ -1989,7 +1989,7 @@ ContentContributions = __decorateClass$5([smrt({
1989
1989
  cli: false
1990
1990
  })], ContentContributions);
1991
1991
  //#endregion
1992
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/util.js
1992
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/util.js
1993
1993
  var regexName = /* @__PURE__ */ new RegExp("^[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");
1994
1994
  function getAllMatches(string, regex) {
1995
1995
  const matches = [];
@@ -2029,7 +2029,7 @@ var criticalProperties = [
2029
2029
  "prototype"
2030
2030
  ];
2031
2031
  //#endregion
2032
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/validator.js
2032
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/validator.js
2033
2033
  var defaultOptions$1 = {
2034
2034
  allowBooleanAttributes: false,
2035
2035
  unpairedTags: []
@@ -2198,11 +2198,86 @@ function readAttributeStr(xmlData, i) {
2198
2198
  };
2199
2199
  }
2200
2200
  /**
2201
- * Select all the attributes whether valid or invalid.
2201
+ * Walk `attrStr` once, left to right, splitting it into attribute tokens.
2202
+ *
2203
+ * This replaces a regex that used to do the same job
2204
+ * (`(\s*)([^\s=]+)(\s*=)?(\s*(['"])(([\s\S])*?)\5)?`). That regex led with an
2205
+ * optional whitespace group followed by a required "non-whitespace" group.
2206
+ * On a long run of whitespace that never resolves into an attribute name
2207
+ * (e.g. a tag with thousands of trailing spaces before `>`), the engine
2208
+ * backtracks the whitespace group one character at a time before giving up
2209
+ * and moving to the next starting position — one full backtrack per
2210
+ * position, which is quadratic in the length of the run.
2211
+ *
2212
+ * A single forward-only scan can never backtrack, so it can't be made slow
2213
+ * this way no matter how much whitespace the input contains — it's always
2214
+ * proportional to the length of the string, once.
2215
+ *
2216
+ * Each returned token mirrors the shape the old regex match array had, so
2217
+ * the validation logic below (which reads token[1]..token[6]) didn't need
2218
+ * to change:
2219
+ * token.startIndex - where this token begins in attrStr
2220
+ * token[1] - leading whitespace before the name
2221
+ * token[2] - the attribute name
2222
+ * token[3] - whitespace + '=' if present, else undefined
2223
+ * token[4] - marker (any defined value) if a quoted value was found
2224
+ * token[5] - the quote character used ('"' or "'")
2225
+ * token[6] - the value's text, without the surrounding quotes
2226
+ *
2227
+ * A malformed leading character (e.g. a stray '=' with no name before it)
2228
+ * is simply skipped over, one character at a time — the same outcome the
2229
+ * old regex produced by failing to match at that position and retrying at
2230
+ * the next one.
2202
2231
  */
2203
- var validAttrStrRegxp = /* @__PURE__ */ new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
2232
+ function scanAttributeTokens(attrStr) {
2233
+ const tokens = [];
2234
+ const len = attrStr.length;
2235
+ let i = 0;
2236
+ while (i < len) {
2237
+ const tokenStart = i;
2238
+ while (i < len && isWhiteSpace(attrStr[i])) i++;
2239
+ if (i >= len) break;
2240
+ if (attrStr[i] === "=") {
2241
+ i = tokenStart + 1;
2242
+ continue;
2243
+ }
2244
+ const leadingWs = attrStr.slice(tokenStart, i);
2245
+ const nameStart = i;
2246
+ while (i < len && !isWhiteSpace(attrStr[i]) && attrStr[i] !== "=") i++;
2247
+ const name = attrStr.slice(nameStart, i);
2248
+ let equalsGroup;
2249
+ let j = i;
2250
+ while (j < len && isWhiteSpace(attrStr[j])) j++;
2251
+ if (j < len && attrStr[j] === "=") {
2252
+ equalsGroup = attrStr.slice(i, j + 1);
2253
+ i = j + 1;
2254
+ }
2255
+ let quoteChar;
2256
+ let value;
2257
+ let k = i;
2258
+ while (k < len && isWhiteSpace(attrStr[k])) k++;
2259
+ if (k < len && (attrStr[k] === "\"" || attrStr[k] === "'")) {
2260
+ const valueStart = k + 1;
2261
+ const closeIdx = attrStr.indexOf(attrStr[k], valueStart);
2262
+ if (closeIdx !== -1) {
2263
+ quoteChar = attrStr[k];
2264
+ value = attrStr.slice(valueStart, closeIdx);
2265
+ i = closeIdx + 1;
2266
+ }
2267
+ }
2268
+ const token = { startIndex: tokenStart };
2269
+ token[1] = leadingWs;
2270
+ token[2] = name;
2271
+ token[3] = equalsGroup;
2272
+ token[4] = quoteChar !== void 0 ? true : void 0;
2273
+ token[5] = quoteChar;
2274
+ token[6] = value;
2275
+ tokens.push(token);
2276
+ }
2277
+ return tokens;
2278
+ }
2204
2279
  function validateAttributeString(attrStr, options) {
2205
- const matches = getAllMatches(attrStr, validAttrStrRegxp);
2280
+ const matches = scanAttributeTokens(attrStr);
2206
2281
  const attrNames = {};
2207
2282
  for (let i = 0; i < matches.length; i++) {
2208
2283
  if (matches[i][1].length === 0) return getErrorObject("InvalidAttr", "Attribute '" + matches[i][2] + "' has no space in starting.", getPositionFromMatch(matches[i]));
@@ -2784,7 +2859,7 @@ var EntityDecoder = class {
2784
2859
  }
2785
2860
  };
2786
2861
  //#endregion
2787
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
2862
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
2788
2863
  var defaultOnDangerousProperty = (name) => {
2789
2864
  if (DANGEROUS_PROPERTY_NAMES.includes(name)) return "__" + name;
2790
2865
  return name;
@@ -2911,7 +2986,7 @@ var buildOptions = function(options) {
2911
2986
  return built;
2912
2987
  };
2913
2988
  //#endregion
2914
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
2989
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
2915
2990
  var METADATA_SYMBOL$1;
2916
2991
  if (typeof Symbol !== "function") METADATA_SYMBOL$1 = "@@xmlMetadata";
2917
2992
  else METADATA_SYMBOL$1 = Symbol("XML Node Metadata");
@@ -2932,8 +3007,15 @@ var XmlNode = class {
2932
3007
  [":@"]: node[":@"]
2933
3008
  });
2934
3009
  else this.child.push({ [node.tagname]: node.child });
3010
+ this.addStartIndex(startIndex);
3011
+ }
3012
+ addStartIndex(startIndex) {
2935
3013
  if (startIndex !== void 0) this.child[this.child.length - 1][METADATA_SYMBOL$1] = { startIndex };
2936
3014
  }
3015
+ addEndIndex(endIndex) {
3016
+ const lastChild = this.child[this.child.length - 1];
3017
+ if (lastChild !== void 0 && lastChild[METADATA_SYMBOL$1] !== void 0 && lastChild[METADATA_SYMBOL$1].endIndex === void 0) lastChild[METADATA_SYMBOL$1].endIndex = endIndex;
3018
+ }
2937
3019
  /** symbol used for metadata */
2938
3020
  static getMetaDataSymbol() {
2939
3021
  return METADATA_SYMBOL$1;
@@ -2981,7 +3063,7 @@ var getRegexes = (xmlVersion = "1.0", asciiOnly = false) => {
2981
3063
  */
2982
3064
  var qName = (str, { xmlVersion = "1.0", asciiOnly = false } = {}) => getRegexes(xmlVersion, asciiOnly).qName.test(str);
2983
3065
  //#endregion
2984
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
3066
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
2985
3067
  var DocTypeReader = class {
2986
3068
  constructor(options, xmlVersion) {
2987
3069
  this.suppressValidationErr = !options;
@@ -2998,41 +3080,54 @@ var DocTypeReader = class {
2998
3080
  i = i + 9;
2999
3081
  let angleBracketsCount = 1;
3000
3082
  let hasBody = false, comment = false;
3083
+ let quoteChar = null;
3001
3084
  let exp = "";
3002
- for (; i < xmlData.length; i++) if (xmlData[i] === "<" && !comment) {
3003
- if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
3004
- i += 7;
3005
- let entityName, val;
3006
- [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
3007
- if (val.indexOf("&") === -1) {
3008
- if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) throw new Error(`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
3009
- entities[entityName] = val;
3010
- entityCount++;
3011
- }
3012
- } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
3013
- i += 8;
3014
- const { index } = this.readElementExp(xmlData, i + 1);
3015
- i = index;
3016
- } else if (hasBody && hasSeq(xmlData, "!ATTLIST", i)) i += 8;
3017
- else if (hasBody && hasSeq(xmlData, "!NOTATION", i)) {
3018
- i += 9;
3019
- const { index } = this.readNotationExp(xmlData, i + 1, this.suppressValidationErr);
3020
- i = index;
3021
- } else if (hasSeq(xmlData, "!--", i)) comment = true;
3022
- else throw new Error(`Invalid DOCTYPE`);
3023
- angleBracketsCount++;
3024
- exp = "";
3025
- } else if (xmlData[i] === ">") {
3026
- if (comment) {
3027
- if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
3028
- comment = false;
3029
- angleBracketsCount--;
3030
- }
3031
- } else angleBracketsCount--;
3032
- if (angleBracketsCount === 0) break;
3033
- } else if (xmlData[i] === "[") hasBody = true;
3034
- else exp += xmlData[i];
3035
- if (angleBracketsCount !== 0) throw new Error(`Unclosed DOCTYPE`);
3085
+ for (; i < xmlData.length; i++) {
3086
+ if (quoteChar !== null) {
3087
+ if (xmlData[i] === quoteChar) quoteChar = null;
3088
+ exp += xmlData[i];
3089
+ continue;
3090
+ }
3091
+ if (!hasBody && !comment && (xmlData[i] === "\"" || xmlData[i] === "'")) {
3092
+ quoteChar = xmlData[i];
3093
+ exp += xmlData[i];
3094
+ continue;
3095
+ }
3096
+ if (xmlData[i] === "<" && !comment) {
3097
+ if (hasBody && hasSeq(xmlData, "!ENTITY", i)) {
3098
+ i += 7;
3099
+ let entityName, val;
3100
+ [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
3101
+ if (val.indexOf("&") === -1) {
3102
+ if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) throw new Error(`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
3103
+ entities[entityName] = val;
3104
+ entityCount++;
3105
+ }
3106
+ } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
3107
+ i += 8;
3108
+ const { index } = this.readElementExp(xmlData, i + 1);
3109
+ i = index;
3110
+ } else if (hasBody && hasSeq(xmlData, "!ATTLIST", i)) i += 8;
3111
+ else if (hasBody && hasSeq(xmlData, "!NOTATION", i)) {
3112
+ i += 9;
3113
+ const { index } = this.readNotationExp(xmlData, i + 1, this.suppressValidationErr);
3114
+ i = index;
3115
+ } else if (hasSeq(xmlData, "!--", i)) comment = true;
3116
+ else throw new Error(`Invalid DOCTYPE`);
3117
+ angleBracketsCount++;
3118
+ exp = "";
3119
+ } else if (xmlData[i] === ">") {
3120
+ if (comment) {
3121
+ if (xmlData[i - 1] === "-" && xmlData[i - 2] === "-") {
3122
+ comment = false;
3123
+ angleBracketsCount--;
3124
+ }
3125
+ } else angleBracketsCount--;
3126
+ if (angleBracketsCount === 0) break;
3127
+ } else if (xmlData[i] === "[") hasBody = true;
3128
+ else exp += xmlData[i];
3129
+ }
3130
+ if (quoteChar !== null || angleBracketsCount !== 0) throw new Error(`Unclosed DOCTYPE`);
3036
3131
  } else throw new Error(`Invalid Tag instead of DOCTYPE`);
3037
3132
  return {
3038
3133
  entities,
@@ -3386,7 +3481,7 @@ function anynum(str) {
3386
3481
  return chars.join("");
3387
3482
  }
3388
3483
  //#endregion
3389
- //#region ../../node_modules/.pnpm/strnum@2.4.1/node_modules/strnum/strnum.js
3484
+ //#region ../../node_modules/.pnpm/strnum@2.4.2/node_modules/strnum/strnum.js
3390
3485
  var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
3391
3486
  var binRegex = /^0b[01]+$/;
3392
3487
  var octRegex = /^0o[0-7]+$/;
@@ -3467,7 +3562,9 @@ function resolveEnotation(str, trimmedStr, options) {
3467
3562
  */
3468
3563
  function trimZeros(numStr) {
3469
3564
  if (numStr && numStr.indexOf(".") !== -1) {
3470
- numStr = numStr.replace(/0+$/, "");
3565
+ let end = numStr.length;
3566
+ while (end > 0 && numStr.charCodeAt(end - 1) === 48) end--;
3567
+ numStr = numStr.slice(0, end);
3471
3568
  if (numStr === ".") numStr = "0";
3472
3569
  else if (numStr[0] === ".") numStr = "0" + numStr;
3473
3570
  else if (numStr[numStr.length - 1] === ".") numStr = numStr.substring(0, numStr.length - 1);
@@ -3500,7 +3597,7 @@ function handleInfinity(str, num, options) {
3500
3597
  }
3501
3598
  }
3502
3599
  //#endregion
3503
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/ignoreAttributes.js
3600
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/ignoreAttributes.js
3504
3601
  function getIgnoreAttributesFn(ignoreAttributes) {
3505
3602
  if (typeof ignoreAttributes === "function") return ignoreAttributes;
3506
3603
  if (Array.isArray(ignoreAttributes)) return (attrName) => {
@@ -5182,7 +5279,7 @@ function isUnsafe(value, context) {
5182
5279
  return false;
5183
5280
  }
5184
5281
  //#endregion
5185
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
5282
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
5186
5283
  /**
5187
5284
  * Extract raw attributes (without prefix) from prefixed attribute map
5188
5285
  * @param {object} prefixedAttrs - Attributes with prefix from buildAttributesMap
@@ -5388,7 +5485,8 @@ var parseXml = function(xmlData) {
5388
5485
  }
5389
5486
  this.matcher.pop();
5390
5487
  this.isCurrentNodeStopNode = false;
5391
- currentNode = this.tagsNodeStack.pop();
5488
+ currentNode = this.tagsNodeStack.pop() || xmlObj;
5489
+ if (options.captureMetaData && currentNode) currentNode.addEndIndex(closeIndex + 1);
5392
5490
  textData = "";
5393
5491
  i = closeIndex;
5394
5492
  } else if (c1 === 63) {
@@ -5406,6 +5504,7 @@ var parseXml = function(xmlData) {
5406
5504
  childNode.add(options.textNodeName, "");
5407
5505
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options.ignoreAttributes !== true) childNode[":@"] = attsMap;
5408
5506
  this.addChild(currentNode, childNode, this.readonlyMatcher, i);
5507
+ if (options.captureMetaData) currentNode.addEndIndex(tagData.closeIndex + 2);
5409
5508
  }
5410
5509
  i = tagData.closeIndex + 1;
5411
5510
  } else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
@@ -5487,18 +5586,21 @@ var parseXml = function(xmlData) {
5487
5586
  this.matcher.pop();
5488
5587
  this.isCurrentNodeStopNode = false;
5489
5588
  this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
5589
+ if (options.captureMetaData) currentNode.addEndIndex(i + 1);
5490
5590
  } else {
5491
5591
  if (isSelfClosing) {
5492
5592
  ({tagName, tagExp} = transformTagName(options.transformTagName, tagName, tagExp, options));
5493
5593
  const childNode = new XmlNode(tagName);
5494
5594
  if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
5495
5595
  this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
5596
+ if (options.captureMetaData) currentNode.addEndIndex(closeIndex + 1);
5496
5597
  this.matcher.pop();
5497
5598
  this.isCurrentNodeStopNode = false;
5498
5599
  } else if (options.unpairedTagsSet.has(tagName)) {
5499
5600
  const childNode = new XmlNode(tagName);
5500
5601
  if (prefixedAttrs) childNode[":@"] = prefixedAttrs;
5501
5602
  this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
5603
+ if (options.captureMetaData) currentNode.addEndIndex(result.closeIndex + 1);
5502
5604
  this.matcher.pop();
5503
5605
  this.isCurrentNodeStopNode = false;
5504
5606
  i = result.closeIndex;
@@ -5700,7 +5802,7 @@ function sanitizeName(name, options) {
5700
5802
  return name;
5701
5803
  }
5702
5804
  //#endregion
5703
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/node2json.js
5805
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/node2json.js
5704
5806
  var METADATA_SYMBOL = XmlNode.getMetaDataSymbol();
5705
5807
  /**
5706
5808
  * Helper function to strip attribute prefix from attribute map
@@ -5800,7 +5902,7 @@ function isLeafTag(obj, options) {
5800
5902
  return false;
5801
5903
  }
5802
5904
  //#endregion
5803
- //#region ../../node_modules/.pnpm/fast-xml-parser@5.10.1/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
5905
+ //#region ../../node_modules/.pnpm/fast-xml-parser@5.11.1/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
5804
5906
  var XMLParser = class {
5805
5907
  constructor(options) {
5806
5908
  this.externalEntities = {};