@nsshunt/stsuxvue 1.0.125 → 1.0.127

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/stsuxvue.cjs CHANGED
@@ -6,7 +6,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getProtoOf = Object.getPrototypeOf;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
9
+ var __esmMin = (fn, res, err) => () => {
10
+ if (err) throw err[0];
11
+ try {
12
+ return fn && (res = fn(fn = 0)), res;
13
+ } catch (e) {
14
+ throw err = [e], e;
15
+ }
16
+ };
10
17
  var __commonJSMin$1 = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
11
18
  var __exportAll = (all, no_symbols) => {
12
19
  let target = {};
@@ -6036,7 +6043,7 @@ var import_ansi_to_html = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin
6036
6043
  return Filter;
6037
6044
  }();
6038
6045
  })))(), 1);
6039
- /*! @license DOMPurify 3.4.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.8/LICENSE */
6046
+ /*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE */
6040
6047
  function _arrayLikeToArray(r, a) {
6041
6048
  (null == a || a > r.length) && (a = r.length);
6042
6049
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -6077,9 +6084,17 @@ function _unsupportedIterableToArray(r, a) {
6077
6084
  return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
6078
6085
  }
6079
6086
  }
6080
- var entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf$1 = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
6081
- var freeze = Object.freeze, seal = Object.seal, create = Object.create;
6082
- var _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
6087
+ var entries = Object.entries;
6088
+ var setPrototypeOf = Object.setPrototypeOf;
6089
+ var isFrozen = Object.isFrozen;
6090
+ var getPrototypeOf$1 = Object.getPrototypeOf;
6091
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
6092
+ var freeze = Object.freeze;
6093
+ var seal = Object.seal;
6094
+ var create = Object.create;
6095
+ var _ref = typeof Reflect !== "undefined" && Reflect;
6096
+ var apply = _ref.apply;
6097
+ var construct = _ref.construct;
6083
6098
  if (!freeze) freeze = function freeze(x) {
6084
6099
  return x;
6085
6100
  };
@@ -6675,6 +6690,7 @@ var svg = freeze([
6675
6690
  "direction",
6676
6691
  "display",
6677
6692
  "divisor",
6693
+ "dominant-baseline",
6678
6694
  "dur",
6679
6695
  "edgemode",
6680
6696
  "elevation",
@@ -6802,6 +6818,7 @@ var svg = freeze([
6802
6818
  "transform-origin",
6803
6819
  "text-anchor",
6804
6820
  "text-decoration",
6821
+ "text-orientation",
6805
6822
  "text-rendering",
6806
6823
  "textlength",
6807
6824
  "type",
@@ -6904,6 +6921,10 @@ var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
6904
6921
  var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
6905
6922
  var DOCTYPE_NAME = seal(/^html$/i);
6906
6923
  var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
6924
+ var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
6925
+ var COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
6926
+ var FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
6927
+ var SELF_CLOSING_TAG = seal(/\/>/i);
6907
6928
  var NODE_TYPE = {
6908
6929
  element: 1,
6909
6930
  attribute: 2,
@@ -6911,7 +6932,7 @@ var NODE_TYPE = {
6911
6932
  cdataSection: 4,
6912
6933
  entityReference: 5,
6913
6934
  entityNode: 6,
6914
- progressingInstruction: 7,
6935
+ processingInstruction: 7,
6915
6936
  comment: 8,
6916
6937
  document: 9,
6917
6938
  documentType: 10,
@@ -6962,10 +6983,25 @@ var _createHooksMap = function _createHooksMap() {
6962
6983
  uponSanitizeShadowNode: []
6963
6984
  };
6964
6985
  };
6986
+ /**
6987
+ * Resolve a set-valued configuration option: a fresh set built from
6988
+ * cfg[key] when it is an own array property (seeded with a clone of
6989
+ * options.base when given, case-normalized via options.transform),
6990
+ * the fallback set otherwise.
6991
+ *
6992
+ * @param cfg the cloned, prototype-free configuration object
6993
+ * @param key the configuration property to read
6994
+ * @param fallback the set to use when the option is absent or not an array
6995
+ * @param options transform and optional base set to merge into
6996
+ * @returns the resolved set
6997
+ */
6998
+ var _resolveSetOption = function _resolveSetOption(cfg, key, fallback, options) {
6999
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
7000
+ };
6965
7001
  function createDOMPurify() {
6966
7002
  let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal$1();
6967
7003
  const DOMPurify = (root) => createDOMPurify(root);
6968
- DOMPurify.version = "3.4.8";
7004
+ DOMPurify.version = "3.4.12";
6969
7005
  DOMPurify.removed = [];
6970
7006
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
6971
7007
  DOMPurify.isSupported = false;
@@ -6995,15 +7031,36 @@ function createDOMPurify() {
6995
7031
  }
6996
7032
  let trustedTypesPolicy;
6997
7033
  let emptyHTML = "";
6998
- let IN_POLICY_CREATE_HTML = 0;
7034
+ let defaultTrustedTypesPolicy;
7035
+ let defaultTrustedTypesPolicyResolved = false;
7036
+ let IN_TRUSTED_TYPES_POLICY = 0;
7037
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy() {
7038
+ if (IN_TRUSTED_TYPES_POLICY > 0) throw typeErrorCreate("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
7039
+ };
6999
7040
  const _createTrustedHTML = function _createTrustedHTML(html) {
7000
- if (IN_POLICY_CREATE_HTML > 0) throw typeErrorCreate("The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
7001
- IN_POLICY_CREATE_HTML++;
7041
+ _assertNotInTrustedTypesPolicy();
7042
+ IN_TRUSTED_TYPES_POLICY++;
7002
7043
  try {
7003
7044
  return trustedTypesPolicy.createHTML(html);
7004
7045
  } finally {
7005
- IN_POLICY_CREATE_HTML--;
7046
+ IN_TRUSTED_TYPES_POLICY--;
7047
+ }
7048
+ };
7049
+ const _createTrustedScriptURL = function _createTrustedScriptURL(scriptUrl) {
7050
+ _assertNotInTrustedTypesPolicy();
7051
+ IN_TRUSTED_TYPES_POLICY++;
7052
+ try {
7053
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
7054
+ } finally {
7055
+ IN_TRUSTED_TYPES_POLICY--;
7056
+ }
7057
+ };
7058
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy() {
7059
+ if (!defaultTrustedTypesPolicyResolved) {
7060
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
7061
+ defaultTrustedTypesPolicyResolved = true;
7006
7062
  }
7063
+ return defaultTrustedTypesPolicy;
7007
7064
  };
7008
7065
  const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
7009
7066
  const importNode = originalDocument.importNode;
@@ -7077,6 +7134,8 @@ function createDOMPurify() {
7077
7134
  let SAFE_FOR_XML = true;
7078
7135
  let WHOLE_DOCUMENT = false;
7079
7136
  let SET_CONFIG = false;
7137
+ let SET_CONFIG_ALLOWED_TAGS = null;
7138
+ let SET_CONFIG_ALLOWED_ATTR = null;
7080
7139
  let FORCE_BODY = false;
7081
7140
  let RETURN_DOM = false;
7082
7141
  let RETURN_DOM_FRAGMENT = false;
@@ -7107,6 +7166,7 @@ function createDOMPurify() {
7107
7166
  "noscript",
7108
7167
  "plaintext",
7109
7168
  "script",
7169
+ "selectedcontent",
7110
7170
  "style",
7111
7171
  "svg",
7112
7172
  "template",
@@ -7152,14 +7212,16 @@ function createDOMPurify() {
7152
7212
  SVG_NAMESPACE,
7153
7213
  HTML_NAMESPACE
7154
7214
  ], stringToString);
7155
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, [
7215
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
7156
7216
  "mi",
7157
7217
  "mo",
7158
7218
  "mn",
7159
7219
  "ms",
7160
7220
  "mtext"
7161
7221
  ]);
7162
- let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
7222
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
7223
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
7224
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
7163
7225
  const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
7164
7226
  "title",
7165
7227
  "style",
@@ -7188,14 +7250,20 @@ function createDOMPurify() {
7188
7250
  cfg = clone(cfg);
7189
7251
  PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
7190
7252
  transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
7191
- ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
7192
- ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
7193
- ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
7194
- URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
7195
- DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
7196
- FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
7197
- FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
7198
- FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
7253
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
7254
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
7255
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
7256
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
7257
+ transform: transformCaseFunc,
7258
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
7259
+ });
7260
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
7261
+ transform: transformCaseFunc,
7262
+ base: DEFAULT_DATA_URI_TAGS
7263
+ });
7264
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
7265
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
7266
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
7199
7267
  USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
7200
7268
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
7201
7269
  ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
@@ -7214,19 +7282,14 @@ function createDOMPurify() {
7214
7282
  IN_PLACE = cfg.IN_PLACE || false;
7215
7283
  IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
7216
7284
  NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
7217
- MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, [
7218
- "mi",
7219
- "mo",
7220
- "mn",
7221
- "ms",
7222
- "mtext"
7223
- ]);
7224
- HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
7285
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
7286
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
7225
7287
  const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
7226
7288
  CUSTOM_ELEMENT_HANDLING = create(null);
7227
7289
  if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
7228
7290
  if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
7229
7291
  if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
7292
+ seal(CUSTOM_ELEMENT_HANDLING);
7230
7293
  if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
7231
7294
  if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
7232
7295
  if (USE_PROFILES) {
@@ -7298,12 +7361,13 @@ function createDOMPurify() {
7298
7361
  trustedTypesPolicy = previousTrustedTypesPolicy;
7299
7362
  throw error;
7300
7363
  }
7364
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
7365
+ trustedTypesPolicy = void 0;
7366
+ emptyHTML = "";
7301
7367
  } else {
7302
- if (trustedTypesPolicy === void 0 && cfg.TRUSTED_TYPES_POLICY !== null) trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
7368
+ if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
7303
7369
  if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
7304
7370
  }
7305
- if ((hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) && ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS = clone(ALLOWED_TAGS);
7306
- if (hooks.uponSanitizeAttribute.length > 0 && ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR = clone(ALLOWED_ATTR);
7307
7371
  if (freeze) freeze(cfg);
7308
7372
  CONFIG = cfg;
7309
7373
  };
@@ -7314,6 +7378,45 @@ function createDOMPurify() {
7314
7378
  ]);
7315
7379
  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
7316
7380
  /**
7381
+ * Namespace rules for an element in the SVG namespace.
7382
+ *
7383
+ * @param tagName the element's lowercase tag name
7384
+ * @param parent the (possibly simulated) parent node
7385
+ * @param parentTagName the parent's lowercase tag name
7386
+ * @returns true if a spec-compliant parser could produce this element
7387
+ */
7388
+ const _checkSvgNamespace = function _checkSvgNamespace(tagName, parent, parentTagName) {
7389
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
7390
+ if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
7391
+ return Boolean(ALL_SVG_TAGS[tagName]);
7392
+ };
7393
+ /**
7394
+ * Namespace rules for an element in the MathML namespace.
7395
+ *
7396
+ * @param tagName the element's lowercase tag name
7397
+ * @param parent the (possibly simulated) parent node
7398
+ * @param parentTagName the parent's lowercase tag name
7399
+ * @returns true if a spec-compliant parser could produce this element
7400
+ */
7401
+ const _checkMathMlNamespace = function _checkMathMlNamespace(tagName, parent, parentTagName) {
7402
+ if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
7403
+ if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
7404
+ return Boolean(ALL_MATHML_TAGS[tagName]);
7405
+ };
7406
+ /**
7407
+ * Namespace rules for an element in the HTML namespace.
7408
+ *
7409
+ * @param tagName the element's lowercase tag name
7410
+ * @param parent the (possibly simulated) parent node
7411
+ * @param parentTagName the parent's lowercase tag name
7412
+ * @returns true if a spec-compliant parser could produce this element
7413
+ */
7414
+ const _checkHtmlNamespace = function _checkHtmlNamespace(tagName, parent, parentTagName) {
7415
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
7416
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
7417
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
7418
+ };
7419
+ /**
7317
7420
  * @param element a DOM element whose namespace is being checked
7318
7421
  * @returns Return false if the element has a
7319
7422
  * namespace that a spec-compliant parser would never
@@ -7328,21 +7431,9 @@ function createDOMPurify() {
7328
7431
  const tagName = stringToLowerCase(element.tagName);
7329
7432
  const parentTagName = stringToLowerCase(parent.tagName);
7330
7433
  if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
7331
- if (element.namespaceURI === SVG_NAMESPACE) {
7332
- if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
7333
- if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
7334
- return Boolean(ALL_SVG_TAGS[tagName]);
7335
- }
7336
- if (element.namespaceURI === MATHML_NAMESPACE) {
7337
- if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
7338
- if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
7339
- return Boolean(ALL_MATHML_TAGS[tagName]);
7340
- }
7341
- if (element.namespaceURI === HTML_NAMESPACE) {
7342
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
7343
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
7344
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
7345
- }
7434
+ if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
7435
+ if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
7436
+ if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
7346
7437
  if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
7347
7438
  return false;
7348
7439
  };
@@ -7357,6 +7448,46 @@ function createDOMPurify() {
7357
7448
  getParentNode(node).removeChild(node);
7358
7449
  } catch (_) {
7359
7450
  remove(node);
7451
+ if (!getParentNode(node)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
7452
+ }
7453
+ };
7454
+ /**
7455
+ * _neutralizeRoot
7456
+ *
7457
+ * Fail-closed teardown of an in-place root after the sanitize walk aborts
7458
+ * (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
7459
+ * custom element's reaction detaches a node so `_forceRemove`'s deliberate
7460
+ * parentless guard throws, or any other re-entrant engine mutation — would
7461
+ * otherwise leave the caller's *live* tree half-sanitized, with everything
7462
+ * after the abort point still carrying its handlers. There is no safe way
7463
+ * to resume the walk (the tree mutated under us), so we strip the root bare:
7464
+ * remove every child and every attribute, then let the caller's catch see
7465
+ * the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
7466
+ * getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
7467
+ *
7468
+ * @param root the in-place root to empty
7469
+ */
7470
+ const _neutralizeRoot = function _neutralizeRoot(root) {
7471
+ _neutralizeSubtree(root);
7472
+ const childNodes = getChildNodes(root);
7473
+ if (childNodes) {
7474
+ const snapshot = [];
7475
+ arrayForEach(childNodes, (child) => {
7476
+ arrayPush(snapshot, child);
7477
+ });
7478
+ arrayForEach(snapshot, (child) => {
7479
+ try {
7480
+ remove(child);
7481
+ } catch (_) {}
7482
+ });
7483
+ }
7484
+ const attributes = getAttributes(root);
7485
+ if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
7486
+ const attribute = attributes[i];
7487
+ const name = attribute && attribute.name;
7488
+ if (typeof name === "string") try {
7489
+ root.removeAttribute(name);
7490
+ } catch (_) {}
7360
7491
  }
7361
7492
  };
7362
7493
  /**
@@ -7386,6 +7517,118 @@ function createDOMPurify() {
7386
7517
  } catch (_) {}
7387
7518
  };
7388
7519
  /**
7520
+ * _stripDisallowedAttributes
7521
+ *
7522
+ * Removes every attribute the active configuration does not allow from a
7523
+ * single element, using the same allowlist as the main attribute pass (so
7524
+ * `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
7525
+ * neutralise nodes that are being discarded from an in-place tree.
7526
+ *
7527
+ * @param element the element to strip
7528
+ */
7529
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes(element) {
7530
+ const attributes = getAttributes(element);
7531
+ if (!attributes) return;
7532
+ for (let i = attributes.length - 1; i >= 0; --i) {
7533
+ const attribute = attributes[i];
7534
+ const name = attribute && attribute.name;
7535
+ if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)]) continue;
7536
+ try {
7537
+ element.removeAttribute(name);
7538
+ } catch (_) {}
7539
+ }
7540
+ };
7541
+ /**
7542
+ * _neutralizeSubtree
7543
+ *
7544
+ * Completes the audit-5 F1 fix across every removal path. The KEEP_CONTENT
7545
+ * move-hoist neutralises only disallowed-tag removals; clobber, mXSS-canary,
7546
+ * namespace, comment, processing-instruction and KEEP_CONTENT:false removals
7547
+ * all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
7548
+ * those dropped nodes are detached from the caller's LIVE tree but a
7549
+ * handler-bearing original among them (an `<img onerror>`/`<video>` that was
7550
+ * loading) keeps its queued resource event, which fires in page scope after
7551
+ * sanitize returns. This walks a removed subtree and strips every attribute
7552
+ * the active configuration does not allow — so `on*` handlers are cancelled
7553
+ * through the SAME allowlist that governs kept nodes, not a separate `/^on/`
7554
+ * blocklist. Run synchronously before sanitize returns, i.e. before any
7555
+ * queued event can fire. Hook-free by design: these nodes leave the output,
7556
+ * so firing attribute hooks for them would be surprising. Clobber-safe reads;
7557
+ * a doomed clobbered node may shadow `removeAttribute` (its own attributes are
7558
+ * irrelevant — it is discarded — while its non-clobbered descendants, e.g.
7559
+ * the `<img>`, are reached and scrubbed).
7560
+ *
7561
+ * @param root the root of a removed subtree to neutralise
7562
+ */
7563
+ const _neutralizeSubtree = function _neutralizeSubtree(root) {
7564
+ const stack = [root];
7565
+ while (stack.length > 0) {
7566
+ const node = stack.pop();
7567
+ if ((getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element) _stripDisallowedAttributes(node);
7568
+ const childNodes = getChildNodes(node);
7569
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
7570
+ }
7571
+ };
7572
+ /**
7573
+ * _neutralizePatchLinkage
7574
+ *
7575
+ * IN_PLACE entry pre-pass (declarative-partial-updates / streaming
7576
+ * hardening, https://github.com/WICG/declarative-partial-updates).
7577
+ *
7578
+ * The main walk strips patch linkage (`for`/`patchsrc`) and removes range
7579
+ * markers (PIs / markup comments) node-by-node, in document order, AS it
7580
+ * reaches each node. On a live in-place root that leaves a window: from the
7581
+ * moment the root is connected until the walk arrives at a given node, that
7582
+ * node's linkage is live. A patch applied on connection/stream can fire as
7583
+ * a microtask during the walk and inject or teleport an unsanitized DOM
7584
+ * range into a region the iterator has already passed and will not revisit,
7585
+ * so the post-return "tree is sanitized" contract is violated. Sweep the
7586
+ * whole tree once up front and sever every linkage before the walk begins,
7587
+ * closing that window.
7588
+ *
7589
+ * This CANNOT undo a patch that already fired before sanitize ran — that is
7590
+ * the irreducible "do not IN_PLACE a live-connected attacker tree" caveat —
7591
+ * but it closes everything from sanitize-start onward. Gated on SAFE_FOR_XML
7592
+ * to group with the rest of the declarative-partial-updates handling and
7593
+ * stay overridable, consistent with the codebase.
7594
+ *
7595
+ * Clobber-safe traversal (cached childNodes getter); per-node try/catch so a
7596
+ * clobbered root cannot defeat the sweep of its non-clobbered descendants.
7597
+ *
7598
+ * NOTE (pending real-Chrome confirmation, see test/declarative-patch-probe
7599
+ * .html Q1): this mirrors the existing policy of keeping `for` on
7600
+ * <label>/<output>. If the shipping feature can drive a patch through a
7601
+ * surviving `for`-on-label/output + `id` pair, this pre-pass and the
7602
+ * attribute check at _isBasicCustomElement's caller must additionally drop
7603
+ * that pair on the IN_PLACE path. Left as-is until the taxonomy is verified.
7604
+ *
7605
+ * @param root the in-place root to sweep
7606
+ */
7607
+ const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
7608
+ if (!SAFE_FOR_XML) return;
7609
+ const stack = [root];
7610
+ while (stack.length > 0) {
7611
+ const node = stack.pop();
7612
+ const nodeType = getNodeType ? getNodeType(node) : node.nodeType;
7613
+ if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
7614
+ try {
7615
+ remove(node);
7616
+ } catch (_) {}
7617
+ continue;
7618
+ }
7619
+ if (nodeType === NODE_TYPE.element) {
7620
+ const element = node;
7621
+ const lcTag = transformCaseFunc(getNodeName ? getNodeName(node) : node.nodeName);
7622
+ try {
7623
+ if (element.hasAttribute && element.hasAttribute("patchsrc")) element.removeAttribute("patchsrc");
7624
+ if (element.hasAttribute && element.hasAttribute("for") && lcTag !== "label" && lcTag !== "output") element.removeAttribute("for");
7625
+ } catch (_) {}
7626
+ }
7627
+ const childNodes = getChildNodes(node);
7628
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
7629
+ }
7630
+ };
7631
+ /**
7389
7632
  * _initDocument
7390
7633
  *
7391
7634
  * @param dirty - a string of dirty markup
@@ -7425,6 +7668,20 @@ function createDOMPurify() {
7425
7668
  return createNodeIterator.call(root.ownerDocument || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
7426
7669
  };
7427
7670
  /**
7671
+ * Replace template expression syntax (mustache, ERB, template
7672
+ * literal) with a space; shared by all SAFE_FOR_TEMPLATES scrub
7673
+ * sites. Order matters: mustache, then ERB, then template literal.
7674
+ *
7675
+ * @param value the string to scrub
7676
+ * @returns the scrubbed string
7677
+ */
7678
+ const _stripTemplateExpressions = function _stripTemplateExpressions(value) {
7679
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
7680
+ value = stringReplace(value, ERB_EXPR$1, " ");
7681
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
7682
+ return value;
7683
+ };
7684
+ /**
7428
7685
  * Strip template-engine expressions ({{...}}, ${...}, <%...%>) from the
7429
7686
  * character data of an element subtree. Used as the final safety net for
7430
7687
  * SAFE_FOR_TEMPLATES on every DOM-returning code path so that expressions
@@ -7444,24 +7701,16 @@ function createDOMPurify() {
7444
7701
  * @param node The root element whose character data should be scrubbed.
7445
7702
  */
7446
7703
  const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
7447
- var _node$querySelectorAl, _node$querySelectorAl2;
7704
+ var _node$querySelectorAl;
7448
7705
  node.normalize();
7449
7706
  const walker = createNodeIterator.call(node.ownerDocument || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
7450
7707
  let currentNode = walker.nextNode();
7451
7708
  while (currentNode) {
7452
- let data = currentNode.data;
7453
- arrayForEach([
7454
- MUSTACHE_EXPR$1,
7455
- ERB_EXPR$1,
7456
- TMPLIT_EXPR$1
7457
- ], (expr) => {
7458
- data = stringReplace(data, expr, " ");
7459
- });
7460
- currentNode.data = data;
7709
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
7461
7710
  currentNode = walker.nextNode();
7462
7711
  }
7463
- const templates = (_node$querySelectorAl = (_node$querySelectorAl2 = node.querySelectorAll) === null || _node$querySelectorAl2 === void 0 ? void 0 : _node$querySelectorAl2.call(node, "template")) !== null && _node$querySelectorAl !== void 0 ? _node$querySelectorAl : [];
7464
- arrayForEach(Array.from(templates), (tmpl) => {
7712
+ const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
7713
+ if (templates) arrayForEach(templates, (tmpl) => {
7465
7714
  if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
7466
7715
  });
7467
7716
  };
@@ -7522,11 +7771,65 @@ function createDOMPurify() {
7522
7771
  }
7523
7772
  };
7524
7773
  function _executeHooks(hooks, currentNode, data) {
7774
+ if (hooks.length === 0) return;
7525
7775
  arrayForEach(hooks, (hook) => {
7526
7776
  hook.call(DOMPurify, currentNode, data, CONFIG);
7527
7777
  });
7528
7778
  }
7529
7779
  /**
7780
+ * Structural-threat checks that condemn a node regardless of the
7781
+ * allowlists: mXSS via namespace confusion, risky CSS construction,
7782
+ * processing instructions, markup-bearing comments. Pure predicate;
7783
+ * the caller removes. Check order is load-bearing.
7784
+ *
7785
+ * @param currentNode the node to inspect
7786
+ * @param tagName the node's transformCaseFunc'd tag name
7787
+ * @return true if the node must be removed
7788
+ */
7789
+ const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
7790
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
7791
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) return true;
7792
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
7793
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
7794
+ return false;
7795
+ };
7796
+ /**
7797
+ * Handle a node whose tag is forbidden or not allowlisted: keep
7798
+ * allowed custom elements (false return exits _sanitizeElements
7799
+ * early - the namespace and fallback-tag removal checks are
7800
+ * intentionally skipped for kept custom elements), else hoist
7801
+ * content per KEEP_CONTENT and remove.
7802
+ *
7803
+ * A kept custom element is the ONLY case in which this function
7804
+ * returns false, so the caller uses that return value to run the
7805
+ * afterSanitizeElements hook on the kept element and keep the
7806
+ * element-hook lifecycle consistent with normal allowlisted
7807
+ * elements (GHSA-c2j3-45gr-mqc4).
7808
+ *
7809
+ * @param currentNode the disallowed node
7810
+ * @param tagName the node's transformCaseFunc'd tag name
7811
+ * @return true if the node was removed, false if kept
7812
+ */
7813
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName) {
7814
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
7815
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
7816
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
7817
+ }
7818
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
7819
+ const parentNode = getParentNode(currentNode);
7820
+ const childNodes = getChildNodes(currentNode);
7821
+ if (childNodes && parentNode) {
7822
+ const childCount = childNodes.length;
7823
+ for (let i = childCount - 1; i >= 0; --i) {
7824
+ const hoisted = IN_PLACE ? childNodes[i] : cloneNode(childNodes[i], true);
7825
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
7826
+ }
7827
+ }
7828
+ }
7829
+ _forceRemove(currentNode);
7830
+ return true;
7831
+ };
7832
+ /**
7530
7833
  * _sanitizeElements
7531
7834
  *
7532
7835
  * @protect nodeName
@@ -7535,9 +7838,9 @@ function createDOMPurify() {
7535
7838
  * @param currentNode to check for permission to exist
7536
7839
  * @return true if node was killed, false if left alive
7537
7840
  */
7538
- const _sanitizeElements = function _sanitizeElements(currentNode) {
7539
- let content = null;
7841
+ const _sanitizeElements = function _sanitizeElements(currentNode, root) {
7540
7842
  _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
7843
+ if (currentNode !== root && getParentNode(currentNode) === null) return true;
7541
7844
  if (_isClobbered(currentNode)) {
7542
7845
  _forceRemove(currentNode);
7543
7846
  return true;
@@ -7547,58 +7850,26 @@ function createDOMPurify() {
7547
7850
  tagName,
7548
7851
  allowedTags: ALLOWED_TAGS
7549
7852
  });
7550
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
7551
- _forceRemove(currentNode);
7552
- return true;
7553
- }
7554
- if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
7555
- _forceRemove(currentNode);
7556
- return true;
7557
- }
7558
- if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
7559
- _forceRemove(currentNode);
7560
- return true;
7561
- }
7562
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
7853
+ if (currentNode !== root && getParentNode(currentNode) === null) return true;
7854
+ if (_isUnsafeNode(currentNode, tagName)) {
7563
7855
  _forceRemove(currentNode);
7564
7856
  return true;
7565
7857
  }
7566
7858
  if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
7567
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
7568
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
7569
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
7570
- }
7571
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
7572
- const parentNode = getParentNode(currentNode);
7573
- const childNodes = getChildNodes(currentNode);
7574
- if (childNodes && parentNode) {
7575
- const childCount = childNodes.length;
7576
- for (let i = childCount - 1; i >= 0; --i) {
7577
- const childClone = cloneNode(childNodes[i], true);
7578
- parentNode.insertBefore(childClone, getNextSibling(currentNode));
7579
- }
7580
- }
7581
- }
7582
- _forceRemove(currentNode);
7583
- return true;
7859
+ const removed = _sanitizeDisallowedNode(currentNode, tagName);
7860
+ if (removed === false) _executeHooks(hooks.afterSanitizeElements, currentNode, null);
7861
+ return removed;
7584
7862
  }
7585
7863
  if ((getNodeType ? getNodeType(currentNode) : currentNode.nodeType) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
7586
7864
  _forceRemove(currentNode);
7587
7865
  return true;
7588
7866
  }
7589
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
7867
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
7590
7868
  _forceRemove(currentNode);
7591
7869
  return true;
7592
7870
  }
7593
7871
  if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
7594
- content = currentNode.textContent;
7595
- arrayForEach([
7596
- MUSTACHE_EXPR$1,
7597
- ERB_EXPR$1,
7598
- TMPLIT_EXPR$1
7599
- ], (expr) => {
7600
- content = stringReplace(content, expr, " ");
7601
- });
7872
+ const content = _stripTemplateExpressions(currentNode.textContent);
7602
7873
  if (currentNode.textContent !== content) {
7603
7874
  arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
7604
7875
  currentNode.textContent = content;
@@ -7617,11 +7888,13 @@ function createDOMPurify() {
7617
7888
  */
7618
7889
  const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
7619
7890
  if (FORBID_ATTR[lcName]) return false;
7891
+ if (SAFE_FOR_XML && lcName === "patchsrc") return false;
7892
+ if (SAFE_FOR_XML && lcName === "for" && lcTag !== "label" && lcTag !== "output") return false;
7620
7893
  if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) return false;
7621
7894
  const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
7622
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName));
7895
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName));
7623
7896
  else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName));
7624
- else if (!nameIsPermitted || FORBID_ATTR[lcName]) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
7897
+ else if (!nameIsPermitted) if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)));
7625
7898
  else return false;
7626
7899
  else if (URI_SAFE_ATTRIBUTES[lcName]);
7627
7900
  else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, "")));
@@ -7652,6 +7925,48 @@ function createDOMPurify() {
7652
7925
  return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
7653
7926
  };
7654
7927
  /**
7928
+ * Wrap an attribute value in the matching Trusted Types object when
7929
+ * the active policy requires it. Namespaced attributes pass through
7930
+ * unchanged (no TT support yet, see
7931
+ * https://bugs.chromium.org/p/chromium/issues/detail?id=1305293).
7932
+ *
7933
+ * @param lcTag lowercase tag name of the containing element
7934
+ * @param lcName lowercase attribute name
7935
+ * @param namespaceURI the attribute's namespace, if any
7936
+ * @param value the attribute value to wrap
7937
+ * @return the value, wrapped when Trusted Types demand it
7938
+ */
7939
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value) {
7940
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
7941
+ case "TrustedHTML": return _createTrustedHTML(value);
7942
+ case "TrustedScriptURL": return _createTrustedScriptURL(value);
7943
+ }
7944
+ return value;
7945
+ };
7946
+ /**
7947
+ * Write a modified attribute value back onto the element. On
7948
+ * success, re-probe for clobbering introduced by the new value and
7949
+ * remove the element when found; otherwise pop the removal entry
7950
+ * recorded by the earlier _removeAttribute (long-standing pairing
7951
+ * with the SANITIZE_NAMED_PROPS path - do not "fix" casually). On
7952
+ * failure, remove the attribute instead.
7953
+ *
7954
+ * @param currentNode the element carrying the attribute
7955
+ * @param name the attribute name as present on the element
7956
+ * @param namespaceURI the attribute's namespace, if any
7957
+ * @param value the new attribute value
7958
+ */
7959
+ const _setAttributeValue = function _setAttributeValue(currentNode, name, namespaceURI, value) {
7960
+ try {
7961
+ if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
7962
+ else currentNode.setAttribute(name, value);
7963
+ if (_isClobbered(currentNode)) _forceRemove(currentNode);
7964
+ else arrayPop(DOMPurify.removed);
7965
+ } catch (_) {
7966
+ _removeAttribute(name, currentNode);
7967
+ }
7968
+ };
7969
+ /**
7655
7970
  * _sanitizeAttributes
7656
7971
  *
7657
7972
  * @protect attributes
@@ -7673,6 +7988,7 @@ function createDOMPurify() {
7673
7988
  forceKeepAttr: void 0
7674
7989
  };
7675
7990
  let l = attributes.length;
7991
+ const lcTag = transformCaseFunc(currentNode.nodeName);
7676
7992
  while (l--) {
7677
7993
  const attr = attributes[l];
7678
7994
  const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
@@ -7702,39 +8018,17 @@ function createDOMPurify() {
7702
8018
  _removeAttribute(name, currentNode);
7703
8019
  continue;
7704
8020
  }
7705
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
8021
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
7706
8022
  _removeAttribute(name, currentNode);
7707
8023
  continue;
7708
8024
  }
7709
- if (SAFE_FOR_TEMPLATES) arrayForEach([
7710
- MUSTACHE_EXPR$1,
7711
- ERB_EXPR$1,
7712
- TMPLIT_EXPR$1
7713
- ], (expr) => {
7714
- value = stringReplace(value, expr, " ");
7715
- });
7716
- const lcTag = transformCaseFunc(currentNode.nodeName);
8025
+ if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
7717
8026
  if (!_isValidAttribute(lcTag, lcName, value)) {
7718
8027
  _removeAttribute(name, currentNode);
7719
8028
  continue;
7720
8029
  }
7721
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") if (namespaceURI);
7722
- else switch (trustedTypes.getAttributeType(lcTag, lcName)) {
7723
- case "TrustedHTML":
7724
- value = _createTrustedHTML(value);
7725
- break;
7726
- case "TrustedScriptURL":
7727
- value = trustedTypesPolicy.createScriptURL(value);
7728
- break;
7729
- }
7730
- if (value !== initValue) try {
7731
- if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
7732
- else currentNode.setAttribute(name, value);
7733
- if (_isClobbered(currentNode)) _forceRemove(currentNode);
7734
- else arrayPop(DOMPurify.removed);
7735
- } catch (_) {
7736
- _removeAttribute(name, currentNode);
7737
- }
8030
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
8031
+ if (value !== initValue) _setAttributeValue(currentNode, name, namespaceURI, value);
7738
8032
  }
7739
8033
  _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
7740
8034
  };
@@ -7749,13 +8043,13 @@ function createDOMPurify() {
7749
8043
  _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
7750
8044
  while (shadowNode = shadowIterator.nextNode()) {
7751
8045
  _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
7752
- _sanitizeElements(shadowNode);
8046
+ _sanitizeElements(shadowNode, fragment);
7753
8047
  _sanitizeAttributes(shadowNode);
7754
8048
  if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
7755
8049
  if ((getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType) === NODE_TYPE.element) {
7756
- const innerSr = getShadowRoot ? getShadowRoot(shadowNode) : shadowNode.shadowRoot;
8050
+ const innerSr = getShadowRoot(shadowNode);
7757
8051
  if (_isDocumentFragment(innerSr)) {
7758
- _sanitizeAttachedShadowRoots2(innerSr);
8052
+ _sanitizeAttachedShadowRoots(innerSr);
7759
8053
  _sanitizeShadowDOM2(innerSr);
7760
8054
  }
7761
8055
  }
@@ -7781,27 +8075,43 @@ function createDOMPurify() {
7781
8075
  *
7782
8076
  * @param root the subtree root to walk for attached shadow roots
7783
8077
  */
7784
- const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root) {
7785
- const nodeType = getNodeType ? getNodeType(root) : root.nodeType;
7786
- if (nodeType === NODE_TYPE.element) {
7787
- const sr = getShadowRoot ? getShadowRoot(root) : root.shadowRoot;
7788
- if (_isDocumentFragment(sr)) {
7789
- _sanitizeAttachedShadowRoots2(sr);
7790
- _sanitizeShadowDOM2(sr);
7791
- }
7792
- }
7793
- const childNodes = getChildNodes ? getChildNodes(root) : root.childNodes;
7794
- if (!childNodes) return;
7795
- const snapshot = [];
7796
- arrayForEach(childNodes, (child) => {
7797
- arrayPush(snapshot, child);
7798
- });
7799
- for (const child of snapshot) _sanitizeAttachedShadowRoots2(child);
7800
- if (nodeType === NODE_TYPE.element) {
7801
- const rootName = getNodeName ? getNodeName(root) : null;
7802
- if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
7803
- const content = root.content;
7804
- if (_isDocumentFragment(content)) _sanitizeAttachedShadowRoots2(content);
8078
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots(root) {
8079
+ const stack = [{
8080
+ node: root,
8081
+ shadow: null
8082
+ }];
8083
+ while (stack.length > 0) {
8084
+ const item = stack.pop();
8085
+ if (item.shadow) {
8086
+ _sanitizeShadowDOM2(item.shadow);
8087
+ continue;
8088
+ }
8089
+ const node = item.node;
8090
+ const isElement = (getNodeType ? getNodeType(node) : node.nodeType) === NODE_TYPE.element;
8091
+ const childNodes = getChildNodes(node);
8092
+ if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
8093
+ node: childNodes[i],
8094
+ shadow: null
8095
+ });
8096
+ if (isElement) {
8097
+ const rootName = getNodeName ? getNodeName(node) : null;
8098
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
8099
+ const content = node.content;
8100
+ if (_isDocumentFragment(content)) stack.push({
8101
+ node: content,
8102
+ shadow: null
8103
+ });
8104
+ }
8105
+ }
8106
+ if (isElement) {
8107
+ const sr = getShadowRoot(node);
8108
+ if (_isDocumentFragment(sr)) stack.push({
8109
+ node: null,
8110
+ shadow: sr
8111
+ }, {
8112
+ node: sr,
8113
+ shadow: null
8114
+ });
7805
8115
  }
7806
8116
  }
7807
8117
  };
@@ -7818,37 +8128,68 @@ function createDOMPurify() {
7818
8128
  if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
7819
8129
  }
7820
8130
  if (!DOMPurify.isSupported) return dirty;
7821
- if (!SET_CONFIG) _parseConfig(cfg);
8131
+ if (SET_CONFIG) {
8132
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
8133
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
8134
+ } else _parseConfig(cfg);
8135
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS = clone(ALLOWED_TAGS);
8136
+ if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
7822
8137
  DOMPurify.removed = [];
7823
- if (typeof dirty === "string") IN_PLACE = false;
7824
- if (IN_PLACE) {
8138
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
8139
+ if (inPlace) {
8140
+ _neutralizePatchLinkage(dirty);
7825
8141
  const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
7826
8142
  if (typeof nn === "string") {
7827
8143
  const tagName = transformCaseFunc(nn);
7828
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
8144
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
8145
+ _neutralizeRoot(dirty);
8146
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
8147
+ }
8148
+ }
8149
+ if (_isClobbered(dirty)) {
8150
+ _neutralizeRoot(dirty);
8151
+ throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
8152
+ }
8153
+ try {
8154
+ _sanitizeAttachedShadowRoots(dirty);
8155
+ } catch (error) {
8156
+ _neutralizeRoot(dirty);
8157
+ throw error;
7829
8158
  }
7830
- if (_isClobbered(dirty)) throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
7831
- _sanitizeAttachedShadowRoots2(dirty);
7832
8159
  } else if (_isNode(dirty)) {
7833
8160
  body = _initDocument("<!---->");
7834
8161
  importedNode = body.ownerDocument.importNode(dirty, true);
7835
8162
  if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
7836
8163
  else if (importedNode.nodeName === "HTML") body = importedNode;
7837
8164
  else body.appendChild(importedNode);
7838
- _sanitizeAttachedShadowRoots2(importedNode);
8165
+ _sanitizeAttachedShadowRoots(importedNode);
7839
8166
  } else {
7840
8167
  if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
7841
8168
  body = _initDocument(dirty);
7842
8169
  if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
7843
8170
  }
7844
8171
  if (body && FORCE_BODY) _forceRemove(body.firstChild);
7845
- const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
7846
- while (currentNode = nodeIterator.nextNode()) {
7847
- _sanitizeElements(currentNode);
7848
- _sanitizeAttributes(currentNode);
7849
- if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
8172
+ const walkRoot = inPlace ? dirty : body;
8173
+ const nodeIterator = _createNodeIterator(walkRoot);
8174
+ try {
8175
+ while (currentNode = nodeIterator.nextNode()) {
8176
+ _sanitizeElements(currentNode, walkRoot);
8177
+ _sanitizeAttributes(currentNode);
8178
+ if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
8179
+ }
8180
+ } catch (error) {
8181
+ if (inPlace) {
8182
+ _neutralizeRoot(dirty);
8183
+ arrayForEach(DOMPurify.removed, (entry) => {
8184
+ if (entry.element) _neutralizeSubtree(entry.element);
8185
+ });
8186
+ }
8187
+ throw error;
7850
8188
  }
7851
- if (IN_PLACE) {
8189
+ if (inPlace) {
8190
+ arrayForEach(DOMPurify.removed, (entry) => {
8191
+ if (entry.element) _neutralizeSubtree(entry.element);
8192
+ });
7852
8193
  if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
7853
8194
  return dirty;
7854
8195
  }
@@ -7863,32 +8204,37 @@ function createDOMPurify() {
7863
8204
  }
7864
8205
  let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
7865
8206
  if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
7866
- if (SAFE_FOR_TEMPLATES) arrayForEach([
7867
- MUSTACHE_EXPR$1,
7868
- ERB_EXPR$1,
7869
- TMPLIT_EXPR$1
7870
- ], (expr) => {
7871
- serializedHTML = stringReplace(serializedHTML, expr, " ");
7872
- });
8207
+ if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
7873
8208
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
7874
8209
  };
7875
8210
  DOMPurify.setConfig = function() {
7876
- _parseConfig(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {});
8211
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
8212
+ _parseConfig(cfg);
7877
8213
  SET_CONFIG = true;
8214
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
8215
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
7878
8216
  };
7879
8217
  DOMPurify.clearConfig = function() {
7880
8218
  CONFIG = null;
7881
8219
  SET_CONFIG = false;
8220
+ SET_CONFIG_ALLOWED_TAGS = null;
8221
+ SET_CONFIG_ALLOWED_ATTR = null;
8222
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
8223
+ emptyHTML = "";
7882
8224
  };
7883
8225
  DOMPurify.isValidAttribute = function(tag, attr, value) {
7884
8226
  if (!CONFIG) _parseConfig({});
7885
- return _isValidAttribute(transformCaseFunc(tag), transformCaseFunc(attr), value);
8227
+ const lcTag = transformCaseFunc(tag);
8228
+ const lcName = transformCaseFunc(attr);
8229
+ return _isValidAttribute(lcTag, lcName, value);
7886
8230
  };
7887
8231
  DOMPurify.addHook = function(entryPoint, hookFunction) {
7888
8232
  if (typeof hookFunction !== "function") return;
8233
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
7889
8234
  arrayPush(hooks[entryPoint], hookFunction);
7890
8235
  };
7891
8236
  DOMPurify.removeHook = function(entryPoint, hookFunction) {
8237
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
7892
8238
  if (hookFunction !== void 0) {
7893
8239
  const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
7894
8240
  return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
@@ -7896,6 +8242,7 @@ function createDOMPurify() {
7896
8242
  return arrayPop(hooks[entryPoint]);
7897
8243
  };
7898
8244
  DOMPurify.removeHooks = function(entryPoint) {
8245
+ if (!objectHasOwnProperty(hooks, entryPoint)) return;
7899
8246
  hooks[entryPoint] = [];
7900
8247
  };
7901
8248
  DOMPurify.removeAllHooks = function() {
@@ -9729,6 +10076,42 @@ function bind(fn, thisArg) {
9729
10076
  var { toString } = Object.prototype;
9730
10077
  var { getPrototypeOf } = Object;
9731
10078
  var { iterator, toStringTag } = Symbol;
10079
+ var hasOwnProperty = (({ hasOwnProperty }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
10080
+ /**
10081
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
10082
+ * an own `prop`. This distinguishes genuine own/inherited members — including
10083
+ * class accessors and template prototypes — from members injected via
10084
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
10085
+ * live on Object.prototype itself and are therefore never matched.
10086
+ *
10087
+ * @param {*} thing The value whose chain to inspect
10088
+ * @param {string|symbol} prop The property key to look for
10089
+ *
10090
+ * @returns {boolean} True when `prop` is owned below Object.prototype
10091
+ */
10092
+ var hasOwnInPrototypeChain = (thing, prop) => {
10093
+ let obj = thing;
10094
+ const seen = [];
10095
+ while (obj != null && obj !== Object.prototype) {
10096
+ if (seen.indexOf(obj) !== -1) return false;
10097
+ seen.push(obj);
10098
+ if (hasOwnProperty(obj, prop)) return true;
10099
+ obj = getPrototypeOf(obj);
10100
+ }
10101
+ return false;
10102
+ };
10103
+ /**
10104
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
10105
+ * properties and members inherited from a non-Object.prototype source (a class
10106
+ * instance or template object) are honored; a value reachable only through a
10107
+ * polluted Object.prototype is ignored and `undefined` is returned.
10108
+ *
10109
+ * @param {*} obj The source object
10110
+ * @param {string|symbol} prop The property key to read
10111
+ *
10112
+ * @returns {*} The resolved value, or undefined when unsafe/absent
10113
+ */
10114
+ var getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : void 0;
9732
10115
  var kindOf = ((cache) => (thing) => {
9733
10116
  const str = toString.call(thing);
9734
10117
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -9831,9 +10214,9 @@ var isBoolean = (thing) => thing === true || thing === false;
9831
10214
  * @returns {boolean} True if value is a plain Object, otherwise false
9832
10215
  */
9833
10216
  var isPlainObject = (val) => {
9834
- if (kindOf(val) !== "object") return false;
10217
+ if (!isObject(val)) return false;
9835
10218
  const prototype = getPrototypeOf(val);
9836
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
10219
+ return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) && !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
9837
10220
  };
9838
10221
  /**
9839
10222
  * Determine if a value is an empty object (safely handles Buffers)
@@ -10239,7 +10622,6 @@ var toCamelCase = (str) => {
10239
10622
  return p1.toUpperCase() + p2;
10240
10623
  });
10241
10624
  };
10242
- var hasOwnProperty = (({ hasOwnProperty }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
10243
10625
  var { propertyIsEnumerable } = Object.prototype;
10244
10626
  /**
10245
10627
  * Determine if a value is a RegExp object
@@ -10382,6 +10764,18 @@ var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
10382
10764
  */
10383
10765
  var asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
10384
10766
  var isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
10767
+ /**
10768
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
10769
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
10770
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
10771
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
10772
+ * into an attacker-controlled entries iterator.
10773
+ *
10774
+ * @param {*} thing The value to test
10775
+ *
10776
+ * @returns {boolean} True if value has a non-polluted iterator
10777
+ */
10778
+ var isSafeIterable = (thing) => thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
10385
10779
  var utils_default = {
10386
10780
  isArray,
10387
10781
  isArrayBuffer,
@@ -10426,6 +10820,8 @@ var utils_default = {
10426
10820
  isHTMLForm,
10427
10821
  hasOwnProperty,
10428
10822
  hasOwnProp: hasOwnProperty,
10823
+ hasOwnInPrototypeChain,
10824
+ getSafeProp,
10429
10825
  reduceDescriptors,
10430
10826
  freezeMethods,
10431
10827
  toObjectSet,
@@ -10441,7 +10837,8 @@ var utils_default = {
10441
10837
  isThenable,
10442
10838
  setImmediate: _setImmediate,
10443
10839
  asap,
10444
- isIterable
10840
+ isIterable,
10841
+ isSafeIterable
10445
10842
  };
10446
10843
  //#endregion
10447
10844
  //#region node_modules/axios/lib/helpers/parseHeaders.js
@@ -10587,11 +10984,15 @@ var AxiosHeaders = class {
10587
10984
  const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
10588
10985
  if (utils_default.isPlainObject(header) || header instanceof this.constructor) setHeaders(header, valueOrRewrite);
10589
10986
  else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) setHeaders(parseHeaders_default(header), valueOrRewrite);
10590
- else if (utils_default.isObject(header) && utils_default.isIterable(header)) {
10591
- let obj = {}, dest, key;
10987
+ else if (utils_default.isObject(header) && utils_default.isSafeIterable(header)) {
10988
+ let obj = Object.create(null), dest, key;
10592
10989
  for (const entry of header) {
10593
10990
  if (!utils_default.isArray(entry)) throw new TypeError("Object iterator must return a key-value pair");
10594
- obj[key = entry[0]] = (dest = obj[key]) ? utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
10991
+ key = entry[0];
10992
+ if (utils_default.hasOwnProp(obj, key)) {
10993
+ dest = obj[key];
10994
+ obj[key] = utils_default.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
10995
+ } else obj[key] = entry[1];
10595
10996
  }
10596
10997
  setHeaders(obj, valueOrRewrite);
10597
10998
  } else header != null && setHeader(valueOrRewrite, header, rewrite);
@@ -10775,7 +11176,13 @@ function redactConfig(config, redactKeys) {
10775
11176
  var AxiosError = class AxiosError extends Error {
10776
11177
  static from(error, code, config, request, response, customProps) {
10777
11178
  const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
10778
- axiosError.cause = error;
11179
+ Object.defineProperty(axiosError, "cause", {
11180
+ __proto__: null,
11181
+ value: error,
11182
+ writable: true,
11183
+ enumerable: false,
11184
+ configurable: true
11185
+ });
10779
11186
  axiosError.name = error.name;
10780
11187
  if (error.status != null && axiosError.status == null) axiosError.status = error.status;
10781
11188
  customProps && Object.assign(axiosError, customProps);
@@ -10844,8 +11251,6 @@ AxiosError.ERR_CANCELED = "ERR_CANCELED";
10844
11251
  AxiosError.ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";
10845
11252
  AxiosError.ERR_INVALID_URL = "ERR_INVALID_URL";
10846
11253
  AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = "ERR_FORM_DATA_DEPTH_EXCEEDED";
10847
- //#endregion
10848
- //#region node_modules/axios/lib/helpers/toFormData.js
10849
11254
  /**
10850
11255
  * Determines if the given thing is a array or js object.
10851
11256
  *
@@ -10934,15 +11339,34 @@ function toFormData(obj, formData, options) {
10934
11339
  const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
10935
11340
  const maxDepth = options.maxDepth === void 0 ? 100 : options.maxDepth;
10936
11341
  const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
11342
+ const stack = [];
10937
11343
  if (!utils_default.isFunction(visitor)) throw new TypeError("visitor must be a function");
10938
11344
  function convertValue(value) {
10939
11345
  if (value === null) return "";
10940
11346
  if (utils_default.isDate(value)) return value.toISOString();
10941
11347
  if (utils_default.isBoolean(value)) return value.toString();
10942
11348
  if (!useBlob && utils_default.isBlob(value)) throw new AxiosError("Blob is not supported. Use a Buffer instead.");
10943
- if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
11349
+ if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) {
11350
+ if (useBlob && typeof _Blob === "function") return new _Blob([value]);
11351
+ if (typeof Buffer !== "undefined") return Buffer.from(value);
11352
+ throw new AxiosError("Blob is not supported. Use a Buffer instead.", AxiosError.ERR_NOT_SUPPORT);
11353
+ }
10944
11354
  return value;
10945
11355
  }
11356
+ function throwIfMaxDepthExceeded(depth) {
11357
+ if (depth > maxDepth) throw new AxiosError("Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
11358
+ }
11359
+ function stringifyWithDepthLimit(value, depth) {
11360
+ if (maxDepth === Infinity) return JSON.stringify(value);
11361
+ const ancestors = [];
11362
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
11363
+ if (!utils_default.isObject(currentValue)) return currentValue;
11364
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) ancestors.pop();
11365
+ ancestors.push(currentValue);
11366
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
11367
+ return currentValue;
11368
+ });
11369
+ }
10946
11370
  /**
10947
11371
  * Default visitor.
10948
11372
  *
@@ -10962,7 +11386,7 @@ function toFormData(obj, formData, options) {
10962
11386
  if (value && !path && typeof value === "object") {
10963
11387
  if (utils_default.endsWith(key, "{}")) {
10964
11388
  key = metaTokens ? key : key.slice(0, -2);
10965
- value = JSON.stringify(value);
11389
+ value = stringifyWithDepthLimit(value, 1);
10966
11390
  } else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) {
10967
11391
  key = removeBrackets(key);
10968
11392
  arr.forEach(function each(el, index) {
@@ -10975,7 +11399,6 @@ function toFormData(obj, formData, options) {
10975
11399
  formData.append(renderKey(path, key, dots), convertValue(value));
10976
11400
  return false;
10977
11401
  }
10978
- const stack = [];
10979
11402
  const exposedHelpers = Object.assign(predicates, {
10980
11403
  defaultVisitor,
10981
11404
  convertValue,
@@ -10983,7 +11406,7 @@ function toFormData(obj, formData, options) {
10983
11406
  });
10984
11407
  function build(value, path, depth = 0) {
10985
11408
  if (utils_default.isUndefined(value)) return;
10986
- if (depth > maxDepth) throw new AxiosError("Object is too deeply nested (" + depth + " levels). Max depth: " + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
11409
+ throwIfMaxDepthExceeded(depth);
10987
11410
  if (stack.indexOf(value) !== -1) throw new Error("Circular reference detected in " + path.join("."));
10988
11411
  stack.push(value);
10989
11412
  utils_default.forEach(value, function each(el, key) {
@@ -11035,9 +11458,7 @@ prototype.append = function append(name, value) {
11035
11458
  this._pairs.push([name, value]);
11036
11459
  };
11037
11460
  prototype.toString = function toString(encoder) {
11038
- const _encode = encoder ? function(value) {
11039
- return encoder.call(this, value, encode$1);
11040
- } : encode$1;
11461
+ const _encode = encoder ? (value) => encoder.call(this, value, encode$1) : encode$1;
11041
11462
  return this._pairs.map(function each(pair) {
11042
11463
  return _encode(pair[0]) + "=" + _encode(pair[1]);
11043
11464
  }, "").join("&");
@@ -11066,9 +11487,10 @@ function encode(val) {
11066
11487
  */
11067
11488
  function buildURL(url, params, options) {
11068
11489
  if (!params) return url;
11069
- const _encode = options && options.encode || encode;
11490
+ url = url || "";
11070
11491
  const _options = utils_default.isFunction(options) ? { serialize: options } : options;
11071
- const serializeFn = _options && _options.serialize;
11492
+ const _encode = utils_default.getSafeProp(_options, "encode") || encode;
11493
+ const serializeFn = utils_default.getSafeProp(_options, "serialize");
11072
11494
  let serializedParams;
11073
11495
  if (serializeFn) serializedParams = serializeFn(params, _options);
11074
11496
  else serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
@@ -11144,7 +11566,8 @@ var transitional_default = {
11144
11566
  forcedJSONParsing: true,
11145
11567
  clarifyTimeoutError: false,
11146
11568
  legacyInterceptorReqResOrdering: true,
11147
- advertiseZstdAcceptEncoding: false
11569
+ advertiseZstdAcceptEncoding: false,
11570
+ validateStatusUndefinedResolves: true
11148
11571
  };
11149
11572
  //#endregion
11150
11573
  //#region node_modules/axios/lib/platform/browser/index.js
@@ -11232,6 +11655,10 @@ function toURLEncodedForm(data, options) {
11232
11655
  }
11233
11656
  //#endregion
11234
11657
  //#region node_modules/axios/lib/helpers/formDataToJSON.js
11658
+ var MAX_DEPTH = 100;
11659
+ function throwIfDepthExceeded(index) {
11660
+ if (index > MAX_DEPTH) throw new AxiosError("FormData field is too deeply nested (" + index + " levels). Max depth: " + MAX_DEPTH, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
11661
+ }
11235
11662
  /**
11236
11663
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
11237
11664
  *
@@ -11240,9 +11667,14 @@ function toURLEncodedForm(data, options) {
11240
11667
  * @returns An array of strings.
11241
11668
  */
11242
11669
  function parsePropPath(name) {
11243
- return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
11244
- return match[0] === "[]" ? "" : match[1] || match[0];
11245
- });
11670
+ const path = [];
11671
+ const pattern = /\w+|\[(\w*)]/g;
11672
+ let match;
11673
+ while ((match = pattern.exec(name)) !== null) {
11674
+ throwIfDepthExceeded(path.length);
11675
+ path.push(match[0] === "[]" ? "" : match[1] || match[0]);
11676
+ }
11677
+ return path;
11246
11678
  }
11247
11679
  /**
11248
11680
  * Convert an array to an object.
@@ -11272,6 +11704,7 @@ function arrayToObject(arr) {
11272
11704
  */
11273
11705
  function formDataToJSON(formData) {
11274
11706
  function buildPath(path, value, target, index) {
11707
+ throwIfDepthExceeded(index);
11275
11708
  let name = path[index++];
11276
11709
  if (name === "__proto__") return true;
11277
11710
  const isNumericKey = Number.isFinite(+name);
@@ -11601,7 +12034,11 @@ var cookies_default = platform_default.hasStandardBrowserEnv ? {
11601
12034
  for (let i = 0; i < cookies.length; i++) {
11602
12035
  const cookie = cookies[i].replace(/^\s+/, "");
11603
12036
  const eq = cookie.indexOf("=");
11604
- if (eq !== -1 && cookie.slice(0, eq) === name) return decodeURIComponent(cookie.slice(eq + 1));
12037
+ if (eq !== -1 && cookie.slice(0, eq) === name) try {
12038
+ return decodeURIComponent(cookie.slice(eq + 1));
12039
+ } catch (e) {
12040
+ return cookie.slice(eq + 1);
12041
+ }
11605
12042
  }
11606
12043
  return null;
11607
12044
  },
@@ -11643,6 +12080,19 @@ function combineURLs(baseURL, relativeURL) {
11643
12080
  }
11644
12081
  //#endregion
11645
12082
  //#region node_modules/axios/lib/core/buildFullPath.js
12083
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
12084
+ var httpProtocolControlCharacters = /[\t\n\r]/g;
12085
+ function stripLeadingC0ControlOrSpace(url) {
12086
+ let i = 0;
12087
+ while (i < url.length && url.charCodeAt(i) <= 32) i++;
12088
+ return url.slice(i);
12089
+ }
12090
+ function normalizeURLForProtocolCheck(url) {
12091
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, "");
12092
+ }
12093
+ function assertValidHttpProtocolURL(url, config) {
12094
+ if (typeof url === "string" && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) throw new AxiosError("Invalid URL: missing \"//\" after protocol", AxiosError.ERR_INVALID_URL, config);
12095
+ }
11646
12096
  /**
11647
12097
  * Creates a new URL by combining the baseURL with the requestedURL,
11648
12098
  * only when the requestedURL is not already an absolute URL.
@@ -11653,9 +12103,13 @@ function combineURLs(baseURL, relativeURL) {
11653
12103
  *
11654
12104
  * @returns {string} The combined full path
11655
12105
  */
11656
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
12106
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
12107
+ assertValidHttpProtocolURL(requestedURL, config);
11657
12108
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
11658
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) return combineURLs(baseURL, requestedURL);
12109
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
12110
+ assertValidHttpProtocolURL(baseURL, config);
12111
+ return combineURLs(baseURL, requestedURL);
12112
+ }
11659
12113
  return requestedURL;
11660
12114
  }
11661
12115
  //#endregion
@@ -11671,6 +12125,7 @@ var headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } :
11671
12125
  * @returns {Object} New object resulting from merging config2 to config1
11672
12126
  */
11673
12127
  function mergeConfig(config1, config2) {
12128
+ config1 = config1 || {};
11674
12129
  config2 = config2 || {};
11675
12130
  const config = Object.create(null);
11676
12131
  Object.defineProperty(config, "hasOwnProperty", {
@@ -11697,6 +12152,14 @@ function mergeConfig(config1, config2) {
11697
12152
  if (!utils_default.isUndefined(b)) return getMergedValue(void 0, b);
11698
12153
  else if (!utils_default.isUndefined(a)) return getMergedValue(void 0, a);
11699
12154
  }
12155
+ function getMergedTransitionalOption(prop) {
12156
+ const transitional2 = utils_default.hasOwnProp(config2, "transitional") ? config2.transitional : void 0;
12157
+ if (!utils_default.isUndefined(transitional2)) if (utils_default.isPlainObject(transitional2)) {
12158
+ if (utils_default.hasOwnProp(transitional2, prop)) return transitional2[prop];
12159
+ } else return;
12160
+ const transitional1 = utils_default.hasOwnProp(config1, "transitional") ? config1.transitional : void 0;
12161
+ if (utils_default.isPlainObject(transitional1) && utils_default.hasOwnProp(transitional1, prop)) return transitional1[prop];
12162
+ }
11700
12163
  function mergeDirectKeys(a, b, prop) {
11701
12164
  if (utils_default.hasOwnProp(config2, prop)) return getMergedValue(a, b);
11702
12165
  else if (utils_default.hasOwnProp(config1, prop)) return getMergedValue(void 0, a);
@@ -11742,6 +12205,8 @@ function mergeConfig(config1, config2) {
11742
12205
  const configValue = merge(utils_default.hasOwnProp(config1, prop) ? config1[prop] : void 0, utils_default.hasOwnProp(config2, prop) ? config2[prop] : void 0, prop);
11743
12206
  utils_default.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
11744
12207
  });
12208
+ if (utils_default.hasOwnProp(config2, "validateStatus") && utils_default.isUndefined(config2.validateStatus) && getMergedTransitionalOption("validateStatusUndefinedResolves") === false) if (utils_default.hasOwnProp(config1, "validateStatus")) config.validateStatus = getMergedValue(void 0, config1.validateStatus);
12209
+ else delete config.validateStatus;
11745
12210
  return config;
11746
12211
  }
11747
12212
  //#endregion
@@ -11752,7 +12217,7 @@ function setFormDataHeaders(headers, formHeaders, policy) {
11752
12217
  headers.set(formHeaders);
11753
12218
  return;
11754
12219
  }
11755
- Object.entries(formHeaders).forEach(([key, val]) => {
12220
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
11756
12221
  if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) headers.set(key, val);
11757
12222
  });
11758
12223
  }
@@ -11778,8 +12243,16 @@ function resolveConfig(config) {
11778
12243
  const allowAbsoluteUrls = own("allowAbsoluteUrls");
11779
12244
  const url = own("url");
11780
12245
  newConfig.headers = headers = AxiosHeaders.from(headers);
11781
- newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), own("params"), own("paramsSerializer"));
11782
- if (auth) headers.set("Authorization", "Basic " + btoa((auth.username || "") + ":" + (auth.password ? encodeUTF8$1(auth.password) : "")));
12246
+ newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig), own("params"), own("paramsSerializer"));
12247
+ if (auth) {
12248
+ const username = utils_default.getSafeProp(auth, "username") || "";
12249
+ const password = utils_default.getSafeProp(auth, "password") || "";
12250
+ try {
12251
+ headers.set("Authorization", "Basic " + btoa(username + ":" + (password ? encodeUTF8$1(password) : "")));
12252
+ } catch (e) {
12253
+ throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
12254
+ }
12255
+ }
11783
12256
  if (utils_default.isFormData(data)) {
11784
12257
  if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv || utils_default.isReactNative(data)) headers.setContentType(void 0);
11785
12258
  else if (utils_default.isFunction(data.getHeaders)) setFormDataHeaders(headers, data.getHeaders(), own("formDataHeaderPolicy"));
@@ -11886,6 +12359,7 @@ var xhr_default = typeof XMLHttpRequest !== "undefined" && function(config) {
11886
12359
  const protocol = parseProtocol(_config.url);
11887
12360
  if (protocol && !platform_default.protocols.includes(protocol)) {
11888
12361
  reject(new AxiosError("Unsupported protocol " + protocol + ":", AxiosError.ERR_BAD_REQUEST, config));
12362
+ done();
11889
12363
  return;
11890
12364
  }
11891
12365
  request.send(requestData || null);
@@ -11919,7 +12393,7 @@ var composeSignals = (signals, timeout) => {
11919
12393
  });
11920
12394
  signals = null;
11921
12395
  };
11922
- signals.forEach((signal) => signal.addEventListener("abort", onabort));
12396
+ signals.forEach((signal) => signal.addEventListener("abort", onabort, { once: true }));
11923
12397
  const { signal } = controller;
11924
12398
  signal.unsubscribe = () => utils_default.asap(unsubscribe);
11925
12399
  return signal;
@@ -11998,11 +12472,13 @@ var trackStream = (stream, chunkSize, onProgress, onFinish) => {
11998
12472
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
11999
12473
  * - For base64: compute exact decoded size using length and padding;
12000
12474
  * handle %XX at the character-count level (no string allocation).
12001
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
12475
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
12002
12476
  *
12003
12477
  * @param {string} url
12004
12478
  * @returns {number}
12005
12479
  */
12480
+ var isHexDigit = (charCode) => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
12481
+ var isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
12006
12482
  function estimateDataURLDecodedBytes(url) {
12007
12483
  if (!url || typeof url !== "string") return 0;
12008
12484
  if (!url.startsWith("data:")) return 0;
@@ -12016,7 +12492,7 @@ function estimateDataURLDecodedBytes(url) {
12016
12492
  for (let i = 0; i < len; i++) if (body.charCodeAt(i) === 37 && i + 2 < len) {
12017
12493
  const a = body.charCodeAt(i + 1);
12018
12494
  const b = body.charCodeAt(i + 2);
12019
- if ((a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102)) {
12495
+ if (isHexDigit(a) && isHexDigit(b)) {
12020
12496
  effectiveLen -= 2;
12021
12497
  i += 2;
12022
12498
  }
@@ -12040,11 +12516,13 @@ function estimateDataURLDecodedBytes(url) {
12040
12516
  const bytes = Math.floor(effectiveLen / 4) * 3 - (pad || 0);
12041
12517
  return bytes > 0 ? bytes : 0;
12042
12518
  }
12043
- if (typeof Buffer !== "undefined" && typeof Buffer.byteLength === "function") return Buffer.byteLength(body, "utf8");
12044
12519
  let bytes = 0;
12045
12520
  for (let i = 0, len = body.length; i < len; i++) {
12046
12521
  const c = body.charCodeAt(i);
12047
- if (c < 128) bytes += 1;
12522
+ if (c === 37 && isPercentEncodedByte(body, i, len)) {
12523
+ bytes += 1;
12524
+ i += 2;
12525
+ } else if (c < 128) bytes += 1;
12048
12526
  else if (c < 2048) bytes += 2;
12049
12527
  else if (c >= 55296 && c <= 56319 && i + 1 < len) {
12050
12528
  const next = body.charCodeAt(i + 1);
@@ -12058,7 +12536,7 @@ function estimateDataURLDecodedBytes(url) {
12058
12536
  }
12059
12537
  //#endregion
12060
12538
  //#region node_modules/axios/lib/env/data.js
12061
- var VERSION = "1.17.0";
12539
+ var VERSION = "1.18.1";
12062
12540
  //#endregion
12063
12541
  //#region node_modules/axios/lib/adapters/fetch.js
12064
12542
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
@@ -12166,12 +12644,14 @@ var factory = (env) => {
12166
12644
  composedSignal.unsubscribe();
12167
12645
  });
12168
12646
  let requestContentLength;
12647
+ let pendingBodyError = null;
12648
+ const maxBodyLengthError = () => new AxiosError("Request body larger than maxBodyLength limit", AxiosError.ERR_BAD_REQUEST, config, request);
12169
12649
  try {
12170
12650
  let auth = void 0;
12171
12651
  const configAuth = own("auth");
12172
12652
  if (configAuth) auth = {
12173
- username: configAuth.username || "",
12174
- password: configAuth.password || ""
12653
+ username: utils_default.getSafeProp(configAuth, "username") || "",
12654
+ password: utils_default.getSafeProp(configAuth, "password") || ""
12175
12655
  };
12176
12656
  if (maybeWithAuthCredentials(url)) {
12177
12657
  const parsedURL = new URL(url, platform_default.origin);
@@ -12193,22 +12673,34 @@ var factory = (env) => {
12193
12673
  if (estimateDataURLDecodedBytes(url) > maxContentLength) throw new AxiosError("maxContentLength size of " + maxContentLength + " exceeded", AxiosError.ERR_BAD_RESPONSE, config, request);
12194
12674
  }
12195
12675
  if (hasMaxBodyLength && method !== "get" && method !== "head") {
12196
- const outboundLength = await resolveBodyLength(headers, data);
12197
- if (typeof outboundLength === "number" && isFinite(outboundLength) && outboundLength > maxBodyLength) throw new AxiosError("Request body larger than maxBodyLength limit", AxiosError.ERR_BAD_REQUEST, config, request);
12198
- }
12199
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
12200
- let _request = new Request(url, {
12201
- method: "POST",
12202
- body: data,
12203
- duplex: "half"
12204
- });
12205
- let contentTypeHeader;
12206
- if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) headers.setContentType(contentTypeHeader);
12207
- if (_request.body) {
12208
- const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
12209
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
12676
+ const outboundLength = await getBodyLength(data);
12677
+ if (typeof outboundLength === "number" && isFinite(outboundLength)) {
12678
+ requestContentLength = outboundLength;
12679
+ if (outboundLength > maxBodyLength) throw maxBodyLengthError();
12210
12680
  }
12211
12681
  }
12682
+ const mustEnforceStreamBody = hasMaxBodyLength && (utils_default.isReadableStream(data) || utils_default.isStream(data));
12683
+ const trackRequestStream = (stream, onProgress, flush) => trackStream(stream, DEFAULT_CHUNK_SIZE, (loadedBytes) => {
12684
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) throw pendingBodyError = maxBodyLengthError();
12685
+ onProgress && onProgress(loadedBytes);
12686
+ }, flush);
12687
+ if (supportsRequestStream && method !== "get" && method !== "head" && (onUploadProgress || mustEnforceStreamBody)) {
12688
+ requestContentLength = requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
12689
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
12690
+ let _request = new Request(url, {
12691
+ method: "POST",
12692
+ body: data,
12693
+ duplex: "half"
12694
+ });
12695
+ let contentTypeHeader;
12696
+ if (utils_default.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) headers.setContentType(contentTypeHeader);
12697
+ if (_request.body) {
12698
+ const [onProgress, flush] = onUploadProgress && progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))) || [];
12699
+ data = trackRequestStream(_request.body, onProgress, flush);
12700
+ }
12701
+ }
12702
+ } else if (mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== "get" && method !== "head") data = trackRequestStream(data);
12703
+ else if (mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== "get" && method !== "head") throw new AxiosError("Stream request bodies are not supported by the current fetch implementation", AxiosError.ERR_NOT_SUPPORT, config, request);
12212
12704
  if (!utils_default.isString(withCredentials)) withCredentials = withCredentials ? "include" : "omit";
12213
12705
  const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
12214
12706
  if (utils_default.isFormData(data)) {
@@ -12227,8 +12719,9 @@ var factory = (env) => {
12227
12719
  };
12228
12720
  request = isRequestSupported && new Request(url, resolvedOptions);
12229
12721
  let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
12722
+ const responseHeaders = AxiosHeaders.from(response.headers);
12230
12723
  if (hasMaxContentLength) {
12231
- const declaredLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
12724
+ const declaredLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
12232
12725
  if (declaredLength != null && declaredLength > maxContentLength) throw new AxiosError("maxContentLength size of " + maxContentLength + " exceeded", AxiosError.ERR_BAD_RESPONSE, config, request);
12233
12726
  }
12234
12727
  const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
@@ -12241,7 +12734,7 @@ var factory = (env) => {
12241
12734
  ].forEach((prop) => {
12242
12735
  options[prop] = response[prop];
12243
12736
  });
12244
- const responseContentLength = utils_default.toFiniteNumber(response.headers.get("content-length"));
12737
+ const responseContentLength = utils_default.toFiniteNumber(responseHeaders.getContentLength());
12245
12738
  const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
12246
12739
  let bytesRead = 0;
12247
12740
  const onChunkProgress = (loadedBytes) => {
@@ -12284,10 +12777,34 @@ var factory = (env) => {
12284
12777
  const canceledError = composedSignal.reason;
12285
12778
  canceledError.config = config;
12286
12779
  request && (canceledError.request = request);
12287
- err !== canceledError && (canceledError.cause = err);
12780
+ if (err !== canceledError) Object.defineProperty(canceledError, "cause", {
12781
+ __proto__: null,
12782
+ value: err,
12783
+ writable: true,
12784
+ enumerable: false,
12785
+ configurable: true
12786
+ });
12288
12787
  throw canceledError;
12289
12788
  }
12290
- if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) throw Object.assign(new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request, err && err.response), { cause: err.cause || err });
12789
+ if (pendingBodyError) {
12790
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
12791
+ throw pendingBodyError;
12792
+ }
12793
+ if (err instanceof AxiosError) {
12794
+ request && !err.request && (err.request = request);
12795
+ throw err;
12796
+ }
12797
+ if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
12798
+ const networkError = new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request, err && err.response);
12799
+ Object.defineProperty(networkError, "cause", {
12800
+ __proto__: null,
12801
+ value: err.cause || err,
12802
+ writable: true,
12803
+ enumerable: false,
12804
+ configurable: true
12805
+ });
12806
+ throw networkError;
12807
+ }
12291
12808
  throw AxiosError.from(err, err && err.code, config, request, err && err.response);
12292
12809
  }
12293
12810
  };
@@ -12384,7 +12901,7 @@ function getAdapter(adapters, config) {
12384
12901
  }
12385
12902
  if (!adapter) {
12386
12903
  const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build"));
12387
- throw new AxiosError(`There is no suitable adapter to dispatch the request ` + (length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"), "ERR_NOT_SUPPORT");
12904
+ throw new AxiosError(`There is no suitable adapter to dispatch the request ` + (length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified"), AxiosError.ERR_NOT_SUPPORT);
12388
12905
  }
12389
12906
  return adapter;
12390
12907
  }
@@ -12512,7 +13029,7 @@ validators$1.spelling = function spelling(correctSpelling) {
12512
13029
  * @returns {object}
12513
13030
  */
12514
13031
  function assertOptions(options, schema, allowUnknown) {
12515
- if (typeof options !== "object") throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
13032
+ if (typeof options !== "object" || options === null) throw new AxiosError("options must be an object", AxiosError.ERR_BAD_OPTION_VALUE);
12516
13033
  const keys = Object.keys(options);
12517
13034
  let i = keys.length;
12518
13035
  while (i-- > 0) {
@@ -12594,7 +13111,8 @@ var Axios = class {
12594
13111
  forcedJSONParsing: validators.transitional(validators.boolean),
12595
13112
  clarifyTimeoutError: validators.transitional(validators.boolean),
12596
13113
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
12597
- advertiseZstdAcceptEncoding: validators.transitional(validators.boolean)
13114
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
13115
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean)
12598
13116
  }, false);
12599
13117
  if (paramsSerializer != null) if (utils_default.isFunction(paramsSerializer)) config.paramsSerializer = { serialize: paramsSerializer };
12600
13118
  else validator_default.assertOptions(paramsSerializer, {
@@ -12671,7 +13189,7 @@ var Axios = class {
12671
13189
  }
12672
13190
  getUri(config) {
12673
13191
  config = mergeConfig(this.defaults, config);
12674
- return buildURL(buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls), config.params, config.paramsSerializer);
13192
+ return buildURL(buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config), config.params, config.paramsSerializer);
12675
13193
  }
12676
13194
  };
12677
13195
  utils_default.forEach([
@@ -12684,7 +13202,7 @@ utils_default.forEach([
12684
13202
  return this.request(mergeConfig(config || {}, {
12685
13203
  method,
12686
13204
  url,
12687
- data: (config || {}).data
13205
+ data: config && utils_default.hasOwnProp(config, "data") ? config.data : void 0
12688
13206
  }));
12689
13207
  };
12690
13208
  });
@@ -13576,20 +14094,20 @@ var TIMESTAMP32_MAX_SEC = 4294967295;
13576
14094
  var TIMESTAMP64_MAX_SEC = 17179869183;
13577
14095
  function encodeTimeSpecToTimestamp({ sec, nsec }) {
13578
14096
  if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) {
13579
- const rv = new Uint8Array(4);
14097
+ const rv = /* @__PURE__ */ new Uint8Array(4);
13580
14098
  new DataView(rv.buffer).setUint32(0, sec);
13581
14099
  return rv;
13582
14100
  } else {
13583
14101
  const secHigh = sec / 4294967296;
13584
14102
  const secLow = sec & 4294967295;
13585
- const rv = new Uint8Array(8);
14103
+ const rv = /* @__PURE__ */ new Uint8Array(8);
13586
14104
  const view = new DataView(rv.buffer);
13587
14105
  view.setUint32(0, nsec << 2 | secHigh & 3);
13588
14106
  view.setUint32(4, secLow);
13589
14107
  return rv;
13590
14108
  }
13591
14109
  else {
13592
- const rv = new Uint8Array(12);
14110
+ const rv = /* @__PURE__ */ new Uint8Array(12);
13593
14111
  const view = new DataView(rv.buffer);
13594
14112
  view.setUint32(0, nsec);
13595
14113
  setInt64(view, 4, sec);