@carbon/ibmdotcom-web-components 2.23.0 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/custom-elements.json +4 -0
  2. package/dist/dotcom-shell.js +3 -3
  3. package/dist/dotcom-shell.min.js +2 -2
  4. package/dist/ibmdotcom-web-components-dotcom-shell.js +3 -3
  5. package/dist/ibmdotcom-web-components-dotcom-shell.min.js +2 -2
  6. package/dist/{index-4a2b99e5.js → index-e763be5b.js} +523 -701
  7. package/dist/{index-90537714.js → index-e9e0dc0d.js} +5 -5
  8. package/dist/{left-nav-menu-a22a1a6e.js → left-nav-menu-353311b3.js} +3 -3
  9. package/dist/{left-nav-menu-ccf3a6ec.js → left-nav-menu-a2e98b5a.js} +2 -2
  10. package/dist/{left-nav-menu-category-heading-3016e990.js → left-nav-menu-category-heading-404801f6.js} +2 -2
  11. package/dist/{left-nav-menu-category-heading-cb17a84f.js → left-nav-menu-category-heading-70403118.js} +3 -3
  12. package/dist/{left-nav-menu-item-18d051bc.js → left-nav-menu-item-1930f6e3.js} +2 -2
  13. package/dist/{left-nav-menu-item-85006ef1.js → left-nav-menu-item-1c788c22.js} +3 -3
  14. package/dist/{left-nav-menu-section-027d6043.js → left-nav-menu-section-a5aacf10.js} +2 -2
  15. package/dist/{left-nav-menu-section-cee5e8b9.js → left-nav-menu-section-ce8644e6.js} +3 -3
  16. package/dist/{left-nav-overlay-225f893f.js → left-nav-overlay-5abc69f8.js} +2 -2
  17. package/dist/{left-nav-overlay-e559d687.js → left-nav-overlay-5e37dc8f.js} +3 -3
  18. package/dist/{megamenu-category-group-89eb9dd2.js → megamenu-category-group-921d7e31.js} +3 -3
  19. package/dist/{megamenu-category-group-75dd0587.js → megamenu-category-group-a9045c01.js} +2 -2
  20. package/dist/{megamenu-category-group-copy-94e321c8.js → megamenu-category-group-copy-d173c916.js} +3 -3
  21. package/dist/{megamenu-category-group-copy-533d77ca.js → megamenu-category-group-copy-dc085be6.js} +2 -2
  22. package/dist/{megamenu-category-heading-5c562696.js → megamenu-category-heading-90e67482.js} +3 -3
  23. package/dist/{megamenu-category-heading-370cb6dc.js → megamenu-category-heading-f07f73c0.js} +2 -2
  24. package/dist/{megamenu-category-link-66573e4b.js → megamenu-category-link-dcd41f45.js} +3 -3
  25. package/dist/{megamenu-category-link-6060a359.js → megamenu-category-link-e0c9fc7a.js} +2 -2
  26. package/dist/{megamenu-category-link-group-4f9fcb1a.js → megamenu-category-link-group-1a30ccc7.js} +2 -2
  27. package/dist/{megamenu-category-link-group-83d39e8b.js → megamenu-category-link-group-6ff3a30d.js} +3 -3
  28. package/dist/{megamenu-left-navigation-ab38535c.js → megamenu-left-navigation-4b810f29.js} +3 -3
  29. package/dist/{megamenu-left-navigation-35cca50a.js → megamenu-left-navigation-fcd7c3f0.js} +2 -2
  30. package/dist/{megamenu-overlay-977e9e98.js → megamenu-overlay-69613b97.js} +2 -2
  31. package/dist/{megamenu-overlay-9b73f118.js → megamenu-overlay-e179976a.js} +3 -3
  32. package/dist/{megamenu-tab-e4488ebd.js → megamenu-tab-4e651fc9.js} +3 -3
  33. package/dist/{megamenu-tab-69382393.js → megamenu-tab-fa23e87d.js} +2 -2
  34. package/es/components/card-group/card-group.css.js +1 -1
  35. package/es/components/card-group/card-group.d.ts +688 -1
  36. package/es/components/card-group/card-group.js +47 -12
  37. package/es/components/card-group/card-group.js.map +1 -1
  38. package/es/components/content-block/content-block.css.js +1 -1
  39. package/es/components/content-block-cards/content-block-cards.d.ts +2 -1
  40. package/es/components/content-block-cards/content-block-cards.js +17 -1
  41. package/es/components/content-block-cards/content-block-cards.js.map +1 -1
  42. package/es/components/masthead/left-nav.d.ts +2 -1
  43. package/es/components/masthead/left-nav.js +23 -6
  44. package/es/components/masthead/left-nav.js.map +1 -1
  45. package/es/components/table-of-contents/table-of-contents.js +2 -2
  46. package/es/components/table-of-contents/table-of-contents.js.map +1 -1
  47. package/es/components/video-player/video-player.d.ts +2 -1
  48. package/es/components/video-player/video-player.js +5 -3
  49. package/es/components/video-player/video-player.js.map +1 -1
  50. package/es/components-react/video-player/video-player.d.ts +1 -0
  51. package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  52. package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  53. package/package.json +6 -6
@@ -29,7 +29,7 @@
29
29
  * lit-html:
30
30
  *
31
31
  * @license
32
- * Copyright 2017 Google LLC
32
+ * Copyright 2022 Google LLC
33
33
  * SPDX-License-Identifier: BSD-3-Clause
34
34
  *
35
35
  * @lit/reactive-element:
@@ -72,7 +72,7 @@
72
72
  *
73
73
  * dompurify:
74
74
  *
75
- @license DOMPurify 2.5.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.6/LICENSE
75
+ @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE
76
76
  *
77
77
  * Also refer to the following links for the license of other third-party dependencies:
78
78
  *
@@ -102,10 +102,10 @@ let process = { env: {} };
102
102
  * @type {object} Settings object
103
103
  * @property {string} [stablePrefix=c4d] stable prefix
104
104
  * @property {string} [prefix=cds] core Carbon prefix
105
- * Carbon for IBM.com v2.23.0',
105
+ * Carbon for IBM.com v2.24.0',
106
106
  */
107
107
  var settings = {
108
- version: 'Carbon for IBM.com v2.23.0',
108
+ version: 'Carbon for IBM.com v2.24.0',
109
109
  stablePrefix: 'c4d',
110
110
  prefix: 'cds'
111
111
  };
@@ -19391,96 +19391,28 @@ _decorate$Q([carbonElement(`${c4dPrefix$Q}-regions`)], function (_initialize, _S
19391
19391
 
19392
19392
  var purify = {exports: {}};
19393
19393
 
19394
- /*! @license DOMPurify 2.5.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.6/LICENSE */
19394
+ /*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
19395
19395
 
19396
19396
  (function (module, exports) {
19397
19397
  (function (global, factory) {
19398
19398
  module.exports = factory() ;
19399
19399
  })(commonjsGlobal, (function () {
19400
- function _typeof(obj) {
19401
- "@babel/helpers - typeof";
19402
-
19403
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
19404
- return typeof obj;
19405
- } : function (obj) {
19406
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19407
- }, _typeof(obj);
19408
- }
19409
- function _setPrototypeOf(o, p) {
19410
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
19411
- o.__proto__ = p;
19412
- return o;
19413
- };
19414
- return _setPrototypeOf(o, p);
19415
- }
19416
- function _isNativeReflectConstruct() {
19417
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
19418
- if (Reflect.construct.sham) return false;
19419
- if (typeof Proxy === "function") return true;
19420
- try {
19421
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
19422
- return true;
19423
- } catch (e) {
19424
- return false;
19425
- }
19426
- }
19427
- function _construct(Parent, args, Class) {
19428
- if (_isNativeReflectConstruct()) {
19429
- _construct = Reflect.construct;
19430
- } else {
19431
- _construct = function _construct(Parent, args, Class) {
19432
- var a = [null];
19433
- a.push.apply(a, args);
19434
- var Constructor = Function.bind.apply(Parent, a);
19435
- var instance = new Constructor();
19436
- if (Class) _setPrototypeOf(instance, Class.prototype);
19437
- return instance;
19438
- };
19439
- }
19440
- return _construct.apply(null, arguments);
19441
- }
19442
- function _toConsumableArray(arr) {
19443
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
19444
- }
19445
- function _arrayWithoutHoles(arr) {
19446
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
19447
- }
19448
- function _iterableToArray(iter) {
19449
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
19450
- }
19451
- function _unsupportedIterableToArray(o, minLen) {
19452
- if (!o) return;
19453
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
19454
- var n = Object.prototype.toString.call(o).slice(8, -1);
19455
- if (n === "Object" && o.constructor) n = o.constructor.name;
19456
- if (n === "Map" || n === "Set") return Array.from(o);
19457
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
19458
- }
19459
- function _arrayLikeToArray(arr, len) {
19460
- if (len == null || len > arr.length) len = arr.length;
19461
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
19462
- return arr2;
19463
- }
19464
- function _nonIterableSpread() {
19465
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
19466
- }
19467
-
19468
- var hasOwnProperty = Object.hasOwnProperty,
19469
- setPrototypeOf = Object.setPrototypeOf,
19470
- isFrozen = Object.isFrozen,
19471
- getPrototypeOf = Object.getPrototypeOf,
19472
- getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
19473
- var freeze = Object.freeze,
19474
- seal = Object.seal,
19475
- create = Object.create; // eslint-disable-line import/no-mutable-exports
19476
- var _ref = typeof Reflect !== 'undefined' && Reflect,
19477
- apply = _ref.apply,
19478
- construct = _ref.construct;
19479
- if (!apply) {
19480
- apply = function apply(fun, thisValue, args) {
19481
- return fun.apply(thisValue, args);
19482
- };
19483
- }
19400
+ const {
19401
+ entries,
19402
+ setPrototypeOf,
19403
+ isFrozen,
19404
+ getPrototypeOf,
19405
+ getOwnPropertyDescriptor
19406
+ } = Object;
19407
+ let {
19408
+ freeze,
19409
+ seal,
19410
+ create
19411
+ } = Object; // eslint-disable-line import/no-mutable-exports
19412
+ let {
19413
+ apply,
19414
+ construct
19415
+ } = typeof Reflect !== 'undefined' && Reflect;
19484
19416
  if (!freeze) {
19485
19417
  freeze = function freeze(x) {
19486
19418
  return x;
@@ -19491,30 +19423,53 @@ var purify = {exports: {}};
19491
19423
  return x;
19492
19424
  };
19493
19425
  }
19426
+ if (!apply) {
19427
+ apply = function apply(fun, thisValue, args) {
19428
+ return fun.apply(thisValue, args);
19429
+ };
19430
+ }
19494
19431
  if (!construct) {
19495
19432
  construct = function construct(Func, args) {
19496
- return _construct(Func, _toConsumableArray(args));
19433
+ return new Func(...args);
19497
19434
  };
19498
19435
  }
19499
- var arrayForEach = unapply(Array.prototype.forEach);
19500
- var arrayPop = unapply(Array.prototype.pop);
19501
- var arrayPush = unapply(Array.prototype.push);
19502
- var stringToLowerCase = unapply(String.prototype.toLowerCase);
19503
- var stringToString = unapply(String.prototype.toString);
19504
- var stringMatch = unapply(String.prototype.match);
19505
- var stringReplace = unapply(String.prototype.replace);
19506
- var stringIndexOf = unapply(String.prototype.indexOf);
19507
- var stringTrim = unapply(String.prototype.trim);
19508
- var regExpTest = unapply(RegExp.prototype.test);
19509
- var typeErrorCreate = unconstruct(TypeError);
19436
+ const arrayForEach = unapply(Array.prototype.forEach);
19437
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
19438
+ const arrayPop = unapply(Array.prototype.pop);
19439
+ const arrayPush = unapply(Array.prototype.push);
19440
+ const arraySplice = unapply(Array.prototype.splice);
19441
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
19442
+ const stringToString = unapply(String.prototype.toString);
19443
+ const stringMatch = unapply(String.prototype.match);
19444
+ const stringReplace = unapply(String.prototype.replace);
19445
+ const stringIndexOf = unapply(String.prototype.indexOf);
19446
+ const stringTrim = unapply(String.prototype.trim);
19447
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
19448
+ const regExpTest = unapply(RegExp.prototype.test);
19449
+ const typeErrorCreate = unconstruct(TypeError);
19450
+ /**
19451
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
19452
+ *
19453
+ * @param func - The function to be wrapped and called.
19454
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
19455
+ */
19510
19456
  function unapply(func) {
19511
19457
  return function (thisArg) {
19458
+ if (thisArg instanceof RegExp) {
19459
+ thisArg.lastIndex = 0;
19460
+ }
19512
19461
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
19513
19462
  args[_key - 1] = arguments[_key];
19514
19463
  }
19515
19464
  return apply(func, thisArg, args);
19516
19465
  };
19517
19466
  }
19467
+ /**
19468
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
19469
+ *
19470
+ * @param func - The constructor function to be wrapped and called.
19471
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
19472
+ */
19518
19473
  function unconstruct(func) {
19519
19474
  return function () {
19520
19475
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -19523,22 +19478,27 @@ var purify = {exports: {}};
19523
19478
  return construct(func, args);
19524
19479
  };
19525
19480
  }
19526
-
19527
- /* Add properties to a lookup table */
19528
- function addToSet(set, array, transformCaseFunc) {
19529
- var _transformCaseFunc;
19530
- transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase;
19481
+ /**
19482
+ * Add properties to a lookup table
19483
+ *
19484
+ * @param set - The set to which elements will be added.
19485
+ * @param array - The array containing elements to be added to the set.
19486
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
19487
+ * @returns The modified set with added elements.
19488
+ */
19489
+ function addToSet(set, array) {
19490
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
19531
19491
  if (setPrototypeOf) {
19532
19492
  // Make 'in' and truthy checks like Boolean(set.constructor)
19533
19493
  // independent of any properties defined on Object.prototype.
19534
19494
  // Prevent prototype setters from intercepting set as a this value.
19535
19495
  setPrototypeOf(set, null);
19536
19496
  }
19537
- var l = array.length;
19497
+ let l = array.length;
19538
19498
  while (l--) {
19539
- var element = array[l];
19499
+ let element = array[l];
19540
19500
  if (typeof element === 'string') {
19541
- var lcElement = transformCaseFunc(element);
19501
+ const lcElement = transformCaseFunc(element);
19542
19502
  if (lcElement !== element) {
19543
19503
  // Config presets (e.g. tags.js, attrs.js) are immutable.
19544
19504
  if (!isFrozen(array)) {
@@ -19551,26 +19511,53 @@ var purify = {exports: {}};
19551
19511
  }
19552
19512
  return set;
19553
19513
  }
19554
-
19555
- /* Shallow clone an object */
19514
+ /**
19515
+ * Clean up an array to harden against CSPP
19516
+ *
19517
+ * @param array - The array to be cleaned.
19518
+ * @returns The cleaned version of the array
19519
+ */
19520
+ function cleanArray(array) {
19521
+ for (let index = 0; index < array.length; index++) {
19522
+ const isPropertyExist = objectHasOwnProperty(array, index);
19523
+ if (!isPropertyExist) {
19524
+ array[index] = null;
19525
+ }
19526
+ }
19527
+ return array;
19528
+ }
19529
+ /**
19530
+ * Shallow clone an object
19531
+ *
19532
+ * @param object - The object to be cloned.
19533
+ * @returns A new object that copies the original.
19534
+ */
19556
19535
  function clone(object) {
19557
- var newObject = create(null);
19558
- var property;
19559
- for (property in object) {
19560
- if (apply(hasOwnProperty, object, [property]) === true) {
19561
- newObject[property] = object[property];
19536
+ const newObject = create(null);
19537
+ for (const [property, value] of entries(object)) {
19538
+ const isPropertyExist = objectHasOwnProperty(object, property);
19539
+ if (isPropertyExist) {
19540
+ if (Array.isArray(value)) {
19541
+ newObject[property] = cleanArray(value);
19542
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
19543
+ newObject[property] = clone(value);
19544
+ } else {
19545
+ newObject[property] = value;
19546
+ }
19562
19547
  }
19563
19548
  }
19564
19549
  return newObject;
19565
19550
  }
19566
-
19567
- /* IE10 doesn't support __lookupGetter__ so lets'
19568
- * simulate it. It also automatically checks
19569
- * if the prop is function or getter and behaves
19570
- * accordingly. */
19551
+ /**
19552
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
19553
+ *
19554
+ * @param object - The object to look up the getter function in its prototype chain.
19555
+ * @param prop - The property name for which to find the getter function.
19556
+ * @returns The getter function found in the prototype chain or a fallback function.
19557
+ */
19571
19558
  function lookupGetter(object, prop) {
19572
19559
  while (object !== null) {
19573
- var desc = getOwnPropertyDescriptor(object, prop);
19560
+ const desc = getOwnPropertyDescriptor(object, prop);
19574
19561
  if (desc) {
19575
19562
  if (desc.get) {
19576
19563
  return unapply(desc.get);
@@ -19581,82 +19568,107 @@ var purify = {exports: {}};
19581
19568
  }
19582
19569
  object = getPrototypeOf(object);
19583
19570
  }
19584
- function fallbackValue(element) {
19585
- console.warn('fallback value for', element);
19571
+ function fallbackValue() {
19586
19572
  return null;
19587
19573
  }
19588
19574
  return fallbackValue;
19589
19575
  }
19590
19576
 
19591
- var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
19592
-
19593
- // SVG
19594
- var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
19595
- var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
19596
-
19577
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
19578
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
19579
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
19597
19580
  // List of SVG elements that are disallowed by default.
19598
19581
  // We still need to know them so that we can do namespace
19599
19582
  // checks properly in case one wants to add them to
19600
19583
  // allow-list.
19601
- var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
19602
- var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']);
19603
-
19584
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
19585
+ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
19604
19586
  // Similarly to SVG, we want to know all MathML elements,
19605
19587
  // even those that we disallow by default.
19606
- var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
19607
- var text = freeze(['#text']);
19588
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
19589
+ const text = freeze(['#text']);
19608
19590
 
19609
- var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
19610
- var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
19611
- var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
19612
- var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
19591
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
19592
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
19593
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
19594
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
19613
19595
 
19614
19596
  // eslint-disable-next-line unicorn/better-regex
19615
- var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
19616
- var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
19617
- var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
19618
- var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
19619
- var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
19620
- var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
19597
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
19598
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
19599
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
19600
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
19601
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
19602
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
19621
19603
  );
19622
- var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
19623
- var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
19604
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
19605
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
19624
19606
  );
19625
- var DOCTYPE_NAME = seal(/^html$/i);
19626
- var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
19607
+ const DOCTYPE_NAME = seal(/^html$/i);
19608
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
19609
+
19610
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
19611
+ __proto__: null,
19612
+ ARIA_ATTR: ARIA_ATTR,
19613
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
19614
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT,
19615
+ DATA_ATTR: DATA_ATTR,
19616
+ DOCTYPE_NAME: DOCTYPE_NAME,
19617
+ ERB_EXPR: ERB_EXPR,
19618
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
19619
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
19620
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
19621
+ TMPLIT_EXPR: TMPLIT_EXPR
19622
+ });
19627
19623
 
19628
- var getGlobal = function getGlobal() {
19624
+ /* eslint-disable @typescript-eslint/indent */
19625
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
19626
+ const NODE_TYPE = {
19627
+ element: 1,
19628
+ attribute: 2,
19629
+ text: 3,
19630
+ cdataSection: 4,
19631
+ entityReference: 5,
19632
+ // Deprecated
19633
+ entityNode: 6,
19634
+ // Deprecated
19635
+ progressingInstruction: 7,
19636
+ comment: 8,
19637
+ document: 9,
19638
+ documentType: 10,
19639
+ documentFragment: 11,
19640
+ notation: 12 // Deprecated
19641
+ };
19642
+ const getGlobal = function getGlobal() {
19629
19643
  return typeof window === 'undefined' ? null : window;
19630
19644
  };
19631
-
19632
19645
  /**
19633
19646
  * Creates a no-op policy for internal use only.
19634
19647
  * Don't export this function outside this module!
19635
- * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
19636
- * @param {Document} document The document object (to determine policy name suffix)
19637
- * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
19638
- * are not supported).
19648
+ * @param trustedTypes The policy factory.
19649
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
19650
+ * @return The policy created (or null, if Trusted Types
19651
+ * are not supported or creating the policy failed).
19639
19652
  */
19640
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
19641
- if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
19653
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
19654
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
19642
19655
  return null;
19643
19656
  }
19644
-
19645
19657
  // Allow the callers to control the unique policy name
19646
19658
  // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
19647
19659
  // Policy creation with duplicate names throws in Trusted Types.
19648
- var suffix = null;
19649
- var ATTR_NAME = 'data-tt-policy-suffix';
19650
- if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
19651
- suffix = document.currentScript.getAttribute(ATTR_NAME);
19660
+ let suffix = null;
19661
+ const ATTR_NAME = 'data-tt-policy-suffix';
19662
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
19663
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
19652
19664
  }
19653
- var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
19665
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
19654
19666
  try {
19655
19667
  return trustedTypes.createPolicy(policyName, {
19656
- createHTML: function createHTML(html) {
19668
+ createHTML(html) {
19657
19669
  return html;
19658
19670
  },
19659
- createScriptURL: function createScriptURL(scriptUrl) {
19671
+ createScriptURL(scriptUrl) {
19660
19672
  return scriptUrl;
19661
19673
  }
19662
19674
  });
@@ -19668,47 +19680,52 @@ var purify = {exports: {}};
19668
19680
  return null;
19669
19681
  }
19670
19682
  };
19671
- function createDOMPurify() {
19672
- var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
19673
- var DOMPurify = function DOMPurify(root) {
19674
- return createDOMPurify(root);
19683
+ const _createHooksMap = function _createHooksMap() {
19684
+ return {
19685
+ afterSanitizeAttributes: [],
19686
+ afterSanitizeElements: [],
19687
+ afterSanitizeShadowDOM: [],
19688
+ beforeSanitizeAttributes: [],
19689
+ beforeSanitizeElements: [],
19690
+ beforeSanitizeShadowDOM: [],
19691
+ uponSanitizeAttribute: [],
19692
+ uponSanitizeElement: [],
19693
+ uponSanitizeShadowNode: []
19675
19694
  };
19676
-
19677
- /**
19678
- * Version label, exposed for easier checks
19679
- * if DOMPurify is up to date or not
19680
- */
19681
- DOMPurify.version = '2.5.6';
19682
-
19683
- /**
19684
- * Array of elements that DOMPurify removed during sanitation.
19685
- * Empty if nothing was removed.
19686
- */
19695
+ };
19696
+ function createDOMPurify() {
19697
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
19698
+ const DOMPurify = root => createDOMPurify(root);
19699
+ DOMPurify.version = '3.2.5';
19687
19700
  DOMPurify.removed = [];
19688
- if (!window || !window.document || window.document.nodeType !== 9) {
19701
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
19689
19702
  // Not running in a browser, provide a factory function
19690
19703
  // so that you can pass your own Window
19691
19704
  DOMPurify.isSupported = false;
19692
19705
  return DOMPurify;
19693
19706
  }
19694
- var originalDocument = window.document;
19695
- var document = window.document;
19696
- var DocumentFragment = window.DocumentFragment,
19697
- HTMLTemplateElement = window.HTMLTemplateElement,
19698
- Node = window.Node,
19699
- Element = window.Element,
19700
- NodeFilter = window.NodeFilter,
19701
- _window$NamedNodeMap = window.NamedNodeMap,
19702
- NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap,
19703
- HTMLFormElement = window.HTMLFormElement,
19704
- DOMParser = window.DOMParser,
19705
- trustedTypes = window.trustedTypes;
19706
- var ElementPrototype = Element.prototype;
19707
- var cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
19708
- var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
19709
- var getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
19710
- var getParentNode = lookupGetter(ElementPrototype, 'parentNode');
19711
-
19707
+ let {
19708
+ document
19709
+ } = window;
19710
+ const originalDocument = document;
19711
+ const currentScript = originalDocument.currentScript;
19712
+ const {
19713
+ DocumentFragment,
19714
+ HTMLTemplateElement,
19715
+ Node,
19716
+ Element,
19717
+ NodeFilter,
19718
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
19719
+ HTMLFormElement,
19720
+ DOMParser,
19721
+ trustedTypes
19722
+ } = window;
19723
+ const ElementPrototype = Element.prototype;
19724
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
19725
+ const remove = lookupGetter(ElementPrototype, 'remove');
19726
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
19727
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
19728
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
19712
19729
  // As per issue #47, the web-components registry is inherited by a
19713
19730
  // new document created via createHTMLDocument. As per the spec
19714
19731
  // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
@@ -19716,59 +19733,57 @@ var purify = {exports: {}};
19716
19733
  // document, so we use that as our parent document to ensure nothing
19717
19734
  // is inherited.
19718
19735
  if (typeof HTMLTemplateElement === 'function') {
19719
- var template = document.createElement('template');
19736
+ const template = document.createElement('template');
19720
19737
  if (template.content && template.content.ownerDocument) {
19721
19738
  document = template.content.ownerDocument;
19722
19739
  }
19723
19740
  }
19724
- var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
19725
- var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
19726
- var _document = document,
19727
- implementation = _document.implementation,
19728
- createNodeIterator = _document.createNodeIterator,
19729
- createDocumentFragment = _document.createDocumentFragment,
19730
- getElementsByTagName = _document.getElementsByTagName;
19731
- var importNode = originalDocument.importNode;
19732
- var documentMode = {};
19733
- try {
19734
- documentMode = clone(document).documentMode ? document.documentMode : {};
19735
- } catch (_) {}
19736
- var hooks = {};
19737
-
19741
+ let trustedTypesPolicy;
19742
+ let emptyHTML = '';
19743
+ const {
19744
+ implementation,
19745
+ createNodeIterator,
19746
+ createDocumentFragment,
19747
+ getElementsByTagName
19748
+ } = document;
19749
+ const {
19750
+ importNode
19751
+ } = originalDocument;
19752
+ let hooks = _createHooksMap();
19738
19753
  /**
19739
19754
  * Expose whether this browser supports running the full DOMPurify.
19740
19755
  */
19741
- DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined && documentMode !== 9;
19742
- var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
19743
- ERB_EXPR$1 = ERB_EXPR,
19744
- TMPLIT_EXPR$1 = TMPLIT_EXPR,
19745
- DATA_ATTR$1 = DATA_ATTR,
19746
- ARIA_ATTR$1 = ARIA_ATTR,
19747
- IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
19748
- ATTR_WHITESPACE$1 = ATTR_WHITESPACE,
19749
- CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
19750
- var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
19751
-
19756
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
19757
+ const {
19758
+ MUSTACHE_EXPR,
19759
+ ERB_EXPR,
19760
+ TMPLIT_EXPR,
19761
+ DATA_ATTR,
19762
+ ARIA_ATTR,
19763
+ IS_SCRIPT_OR_DATA,
19764
+ ATTR_WHITESPACE,
19765
+ CUSTOM_ELEMENT
19766
+ } = EXPRESSIONS;
19767
+ let {
19768
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
19769
+ } = EXPRESSIONS;
19752
19770
  /**
19753
19771
  * We consider the elements and attributes below to be safe. Ideally
19754
19772
  * don't add any new ones but feel free to remove unwanted ones.
19755
19773
  */
19756
-
19757
19774
  /* allowed element names */
19758
- var ALLOWED_TAGS = null;
19759
- var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
19760
-
19775
+ let ALLOWED_TAGS = null;
19776
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
19761
19777
  /* Allowed attribute names */
19762
- var ALLOWED_ATTR = null;
19763
- var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
19764
-
19778
+ let ALLOWED_ATTR = null;
19779
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
19765
19780
  /*
19766
- * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
19781
+ * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
19767
19782
  * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
19768
19783
  * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
19769
19784
  * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
19770
19785
  */
19771
- var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
19786
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
19772
19787
  tagNameCheck: {
19773
19788
  writable: true,
19774
19789
  configurable: false,
@@ -19788,65 +19803,49 @@ var purify = {exports: {}};
19788
19803
  value: false
19789
19804
  }
19790
19805
  }));
19791
-
19792
19806
  /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
19793
- var FORBID_TAGS = null;
19794
-
19807
+ let FORBID_TAGS = null;
19795
19808
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
19796
- var FORBID_ATTR = null;
19797
-
19809
+ let FORBID_ATTR = null;
19798
19810
  /* Decide if ARIA attributes are okay */
19799
- var ALLOW_ARIA_ATTR = true;
19800
-
19811
+ let ALLOW_ARIA_ATTR = true;
19801
19812
  /* Decide if custom data attributes are okay */
19802
- var ALLOW_DATA_ATTR = true;
19803
-
19813
+ let ALLOW_DATA_ATTR = true;
19804
19814
  /* Decide if unknown protocols are okay */
19805
- var ALLOW_UNKNOWN_PROTOCOLS = false;
19806
-
19815
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
19807
19816
  /* Decide if self-closing tags in attributes are allowed.
19808
19817
  * Usually removed due to a mXSS issue in jQuery 3.0 */
19809
- var ALLOW_SELF_CLOSE_IN_ATTR = true;
19810
-
19818
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
19811
19819
  /* Output should be safe for common template engines.
19812
19820
  * This means, DOMPurify removes data attributes, mustaches and ERB
19813
19821
  */
19814
- var SAFE_FOR_TEMPLATES = false;
19815
-
19822
+ let SAFE_FOR_TEMPLATES = false;
19816
19823
  /* Output should be safe even for XML used within HTML and alike.
19817
19824
  * This means, DOMPurify removes comments when containing risky content.
19818
19825
  */
19819
- var SAFE_FOR_XML = true;
19820
-
19826
+ let SAFE_FOR_XML = true;
19821
19827
  /* Decide if document with <html>... should be returned */
19822
- var WHOLE_DOCUMENT = false;
19823
-
19828
+ let WHOLE_DOCUMENT = false;
19824
19829
  /* Track whether config is already set on this instance of DOMPurify. */
19825
- var SET_CONFIG = false;
19826
-
19830
+ let SET_CONFIG = false;
19827
19831
  /* Decide if all elements (e.g. style, script) must be children of
19828
19832
  * document.body. By default, browsers might move them to document.head */
19829
- var FORCE_BODY = false;
19830
-
19833
+ let FORCE_BODY = false;
19831
19834
  /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
19832
19835
  * string (or a TrustedHTML object if Trusted Types are supported).
19833
19836
  * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
19834
19837
  */
19835
- var RETURN_DOM = false;
19836
-
19838
+ let RETURN_DOM = false;
19837
19839
  /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
19838
19840
  * string (or a TrustedHTML object if Trusted Types are supported) */
19839
- var RETURN_DOM_FRAGMENT = false;
19840
-
19841
+ let RETURN_DOM_FRAGMENT = false;
19841
19842
  /* Try to return a Trusted Type object instead of a string, return a string in
19842
19843
  * case Trusted Types are not supported */
19843
- var RETURN_TRUSTED_TYPE = false;
19844
-
19844
+ let RETURN_TRUSTED_TYPE = false;
19845
19845
  /* Output should be free from DOM clobbering attacks?
19846
19846
  * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
19847
19847
  */
19848
- var SANITIZE_DOM = true;
19849
-
19848
+ let SANITIZE_DOM = true;
19850
19849
  /* Achieve full DOM Clobbering protection by isolating the namespace of named
19851
19850
  * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
19852
19851
  *
@@ -19860,105 +19859,85 @@ var purify = {exports: {}};
19860
19859
  * Namespace isolation is implemented by prefixing `id` and `name` attributes
19861
19860
  * with a constant string, i.e., `user-content-`
19862
19861
  */
19863
- var SANITIZE_NAMED_PROPS = false;
19864
- var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
19865
-
19862
+ let SANITIZE_NAMED_PROPS = false;
19863
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
19866
19864
  /* Keep element content when removing element? */
19867
- var KEEP_CONTENT = true;
19868
-
19865
+ let KEEP_CONTENT = true;
19869
19866
  /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
19870
19867
  * of importing it into a new Document and returning a sanitized copy */
19871
- var IN_PLACE = false;
19872
-
19868
+ let IN_PLACE = false;
19873
19869
  /* Allow usage of profiles like html, svg and mathMl */
19874
- var USE_PROFILES = {};
19875
-
19870
+ let USE_PROFILES = {};
19876
19871
  /* Tags to ignore content of when KEEP_CONTENT is true */
19877
- var FORBID_CONTENTS = null;
19878
- var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
19879
-
19872
+ let FORBID_CONTENTS = null;
19873
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
19880
19874
  /* Tags that are safe for data: URIs */
19881
- var DATA_URI_TAGS = null;
19882
- var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
19883
-
19875
+ let DATA_URI_TAGS = null;
19876
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
19884
19877
  /* Attributes safe for values like "javascript:" */
19885
- var URI_SAFE_ATTRIBUTES = null;
19886
- var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
19887
- var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
19888
- var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
19889
- var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
19878
+ let URI_SAFE_ATTRIBUTES = null;
19879
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
19880
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
19881
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
19882
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
19890
19883
  /* Document namespace */
19891
- var NAMESPACE = HTML_NAMESPACE;
19892
- var IS_EMPTY_INPUT = false;
19893
-
19884
+ let NAMESPACE = HTML_NAMESPACE;
19885
+ let IS_EMPTY_INPUT = false;
19894
19886
  /* Allowed XHTML+XML namespaces */
19895
- var ALLOWED_NAMESPACES = null;
19896
- var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
19897
-
19887
+ let ALLOWED_NAMESPACES = null;
19888
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
19889
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
19890
+ let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
19891
+ // Certain elements are allowed in both SVG and HTML
19892
+ // namespace. We need to specify them explicitly
19893
+ // so that they don't get erroneously deleted from
19894
+ // HTML namespace.
19895
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
19898
19896
  /* Parsing of strict XHTML documents */
19899
- var PARSER_MEDIA_TYPE;
19900
- var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
19901
- var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
19902
- var transformCaseFunc;
19903
-
19897
+ let PARSER_MEDIA_TYPE = null;
19898
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
19899
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
19900
+ let transformCaseFunc = null;
19904
19901
  /* Keep a reference to config to pass to hooks */
19905
- var CONFIG = null;
19906
-
19902
+ let CONFIG = null;
19907
19903
  /* Ideally, do not touch anything below this line */
19908
19904
  /* ______________________________________________ */
19909
-
19910
- var formElement = document.createElement('form');
19911
- var isRegexOrFunction = function isRegexOrFunction(testValue) {
19905
+ const formElement = document.createElement('form');
19906
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
19912
19907
  return testValue instanceof RegExp || testValue instanceof Function;
19913
19908
  };
19914
-
19915
19909
  /**
19916
19910
  * _parseConfig
19917
19911
  *
19918
- * @param {Object} cfg optional config literal
19912
+ * @param cfg optional config literal
19919
19913
  */
19920
19914
  // eslint-disable-next-line complexity
19921
- var _parseConfig = function _parseConfig(cfg) {
19915
+ const _parseConfig = function _parseConfig() {
19916
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19922
19917
  if (CONFIG && CONFIG === cfg) {
19923
19918
  return;
19924
19919
  }
19925
-
19926
19920
  /* Shield configuration object from tampering */
19927
- if (!cfg || _typeof(cfg) !== 'object') {
19921
+ if (!cfg || typeof cfg !== 'object') {
19928
19922
  cfg = {};
19929
19923
  }
19930
-
19931
19924
  /* Shield configuration object from prototype pollution */
19932
19925
  cfg = clone(cfg);
19933
19926
  PARSER_MEDIA_TYPE =
19934
19927
  // eslint-disable-next-line unicorn/prefer-includes
19935
- SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
19936
-
19928
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
19937
19929
  // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
19938
19930
  transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
19939
-
19940
19931
  /* Set configuration parameters */
19941
- ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
19942
- ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
19943
- ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
19944
- URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
19945
- // eslint-disable-line indent
19946
- cfg.ADD_URI_SAFE_ATTR,
19947
- // eslint-disable-line indent
19948
- transformCaseFunc // eslint-disable-line indent
19949
- ) // eslint-disable-line indent
19950
- : DEFAULT_URI_SAFE_ATTRIBUTES;
19951
- DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
19952
- // eslint-disable-line indent
19953
- cfg.ADD_DATA_URI_TAGS,
19954
- // eslint-disable-line indent
19955
- transformCaseFunc // eslint-disable-line indent
19956
- ) // eslint-disable-line indent
19957
- : DEFAULT_DATA_URI_TAGS;
19958
- FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
19959
- FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
19960
- FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
19961
- USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
19932
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
19933
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
19934
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
19935
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
19936
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
19937
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
19938
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
19939
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
19940
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
19962
19941
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
19963
19942
  ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
19964
19943
  ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
@@ -19974,8 +19953,10 @@ var purify = {exports: {}};
19974
19953
  SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
19975
19954
  KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
19976
19955
  IN_PLACE = cfg.IN_PLACE || false; // Default false
19977
- IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
19956
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
19978
19957
  NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
19958
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
19959
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
19979
19960
  CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
19980
19961
  if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
19981
19962
  CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
@@ -19992,10 +19973,9 @@ var purify = {exports: {}};
19992
19973
  if (RETURN_DOM_FRAGMENT) {
19993
19974
  RETURN_DOM = true;
19994
19975
  }
19995
-
19996
19976
  /* Parse profile info */
19997
19977
  if (USE_PROFILES) {
19998
- ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
19978
+ ALLOWED_TAGS = addToSet({}, text);
19999
19979
  ALLOWED_ATTR = [];
20000
19980
  if (USE_PROFILES.html === true) {
20001
19981
  addToSet(ALLOWED_TAGS, html$1);
@@ -20017,7 +19997,6 @@ var purify = {exports: {}};
20017
19997
  addToSet(ALLOWED_ATTR, xml);
20018
19998
  }
20019
19999
  }
20020
-
20021
20000
  /* Merge configuration parameters */
20022
20001
  if (cfg.ADD_TAGS) {
20023
20002
  if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
@@ -20040,23 +20019,40 @@ var purify = {exports: {}};
20040
20019
  }
20041
20020
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
20042
20021
  }
20043
-
20044
20022
  /* Add #text in case KEEP_CONTENT is set to true */
20045
20023
  if (KEEP_CONTENT) {
20046
20024
  ALLOWED_TAGS['#text'] = true;
20047
20025
  }
20048
-
20049
20026
  /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
20050
20027
  if (WHOLE_DOCUMENT) {
20051
20028
  addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
20052
20029
  }
20053
-
20054
20030
  /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
20055
20031
  if (ALLOWED_TAGS.table) {
20056
20032
  addToSet(ALLOWED_TAGS, ['tbody']);
20057
20033
  delete FORBID_TAGS.tbody;
20058
20034
  }
20059
-
20035
+ if (cfg.TRUSTED_TYPES_POLICY) {
20036
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
20037
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
20038
+ }
20039
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
20040
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
20041
+ }
20042
+ // Overwrite existing TrustedTypes policy.
20043
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
20044
+ // Sign local variables required by `sanitize`.
20045
+ emptyHTML = trustedTypesPolicy.createHTML('');
20046
+ } else {
20047
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
20048
+ if (trustedTypesPolicy === undefined) {
20049
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
20050
+ }
20051
+ // If creating the internal policy succeeded sign internal variables.
20052
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
20053
+ emptyHTML = trustedTypesPolicy.createHTML('');
20054
+ }
20055
+ }
20060
20056
  // Prevent further manipulation of configuration.
20061
20057
  // Not available in IE8, Safari 5, etc.
20062
20058
  if (freeze) {
@@ -20064,35 +20060,19 @@ var purify = {exports: {}};
20064
20060
  }
20065
20061
  CONFIG = cfg;
20066
20062
  };
20067
- var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
20068
- var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'annotation-xml']);
20069
-
20070
- // Certain elements are allowed in both SVG and HTML
20071
- // namespace. We need to specify them explicitly
20072
- // so that they don't get erroneously deleted from
20073
- // HTML namespace.
20074
- var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
20075
-
20076
20063
  /* Keep track of all possible SVG and MathML tags
20077
20064
  * so that we can perform the namespace checks
20078
20065
  * correctly. */
20079
- var ALL_SVG_TAGS = addToSet({}, svg$1);
20080
- addToSet(ALL_SVG_TAGS, svgFilters);
20081
- addToSet(ALL_SVG_TAGS, svgDisallowed);
20082
- var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
20083
- addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
20084
-
20066
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
20067
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
20085
20068
  /**
20086
- *
20087
- *
20088
- * @param {Element} element a DOM element whose namespace is being checked
20089
- * @returns {boolean} Return false if the element has a
20069
+ * @param element a DOM element whose namespace is being checked
20070
+ * @returns Return false if the element has a
20090
20071
  * namespace that a spec-compliant parser would never
20091
20072
  * return. Return true otherwise.
20092
20073
  */
20093
- var _checkValidNamespace = function _checkValidNamespace(element) {
20094
- var parent = getParentNode(element);
20095
-
20074
+ const _checkValidNamespace = function _checkValidNamespace(element) {
20075
+ let parent = getParentNode(element);
20096
20076
  // In JSDOM, if we're inside shadow DOM, then parentNode
20097
20077
  // can be null. We just simulate parent in this case.
20098
20078
  if (!parent || !parent.tagName) {
@@ -20101,8 +20081,8 @@ var purify = {exports: {}};
20101
20081
  tagName: 'template'
20102
20082
  };
20103
20083
  }
20104
- var tagName = stringToLowerCase(element.tagName);
20105
- var parentTagName = stringToLowerCase(parent.tagName);
20084
+ const tagName = stringToLowerCase(element.tagName);
20085
+ const parentTagName = stringToLowerCase(parent.tagName);
20106
20086
  if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
20107
20087
  return false;
20108
20088
  }
@@ -20113,14 +20093,12 @@ var purify = {exports: {}};
20113
20093
  if (parent.namespaceURI === HTML_NAMESPACE) {
20114
20094
  return tagName === 'svg';
20115
20095
  }
20116
-
20117
20096
  // The only way to switch from MathML to SVG is via`
20118
20097
  // svg if parent is either <annotation-xml> or MathML
20119
20098
  // text integration points.
20120
20099
  if (parent.namespaceURI === MATHML_NAMESPACE) {
20121
20100
  return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
20122
20101
  }
20123
-
20124
20102
  // We only allow elements that are defined in SVG
20125
20103
  // spec. All others are disallowed in SVG namespace.
20126
20104
  return Boolean(ALL_SVG_TAGS[tagName]);
@@ -20132,13 +20110,11 @@ var purify = {exports: {}};
20132
20110
  if (parent.namespaceURI === HTML_NAMESPACE) {
20133
20111
  return tagName === 'math';
20134
20112
  }
20135
-
20136
20113
  // The only way to switch from SVG to MathML is via
20137
20114
  // <math> and HTML integration points
20138
20115
  if (parent.namespaceURI === SVG_NAMESPACE) {
20139
20116
  return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
20140
20117
  }
20141
-
20142
20118
  // We only allow elements that are defined in MathML
20143
20119
  // spec. All others are disallowed in MathML namespace.
20144
20120
  return Boolean(ALL_MATHML_TAGS[tagName]);
@@ -20153,101 +20129,90 @@ var purify = {exports: {}};
20153
20129
  if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
20154
20130
  return false;
20155
20131
  }
20156
-
20157
20132
  // We disallow tags that are specific for MathML
20158
20133
  // or SVG and should never appear in HTML namespace
20159
20134
  return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
20160
20135
  }
20161
-
20162
20136
  // For XHTML and XML documents that support custom namespaces
20163
20137
  if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
20164
20138
  return true;
20165
20139
  }
20166
-
20167
20140
  // The code should never reach this place (this means
20168
20141
  // that the element somehow got namespace that is not
20169
20142
  // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
20170
20143
  // Return false just in case.
20171
20144
  return false;
20172
20145
  };
20173
-
20174
20146
  /**
20175
20147
  * _forceRemove
20176
20148
  *
20177
- * @param {Node} node a DOM node
20149
+ * @param node a DOM node
20178
20150
  */
20179
- var _forceRemove = function _forceRemove(node) {
20151
+ const _forceRemove = function _forceRemove(node) {
20180
20152
  arrayPush(DOMPurify.removed, {
20181
20153
  element: node
20182
20154
  });
20183
20155
  try {
20184
20156
  // eslint-disable-next-line unicorn/prefer-dom-node-remove
20185
- node.parentNode.removeChild(node);
20157
+ getParentNode(node).removeChild(node);
20186
20158
  } catch (_) {
20187
- try {
20188
- node.outerHTML = emptyHTML;
20189
- } catch (_) {
20190
- node.remove();
20191
- }
20159
+ remove(node);
20192
20160
  }
20193
20161
  };
20194
-
20195
20162
  /**
20196
20163
  * _removeAttribute
20197
20164
  *
20198
- * @param {String} name an Attribute name
20199
- * @param {Node} node a DOM node
20165
+ * @param name an Attribute name
20166
+ * @param element a DOM node
20200
20167
  */
20201
- var _removeAttribute = function _removeAttribute(name, node) {
20168
+ const _removeAttribute = function _removeAttribute(name, element) {
20202
20169
  try {
20203
20170
  arrayPush(DOMPurify.removed, {
20204
- attribute: node.getAttributeNode(name),
20205
- from: node
20171
+ attribute: element.getAttributeNode(name),
20172
+ from: element
20206
20173
  });
20207
20174
  } catch (_) {
20208
20175
  arrayPush(DOMPurify.removed, {
20209
20176
  attribute: null,
20210
- from: node
20177
+ from: element
20211
20178
  });
20212
20179
  }
20213
- node.removeAttribute(name);
20214
-
20215
- // We void attribute values for unremovable "is"" attributes
20216
- if (name === 'is' && !ALLOWED_ATTR[name]) {
20180
+ element.removeAttribute(name);
20181
+ // We void attribute values for unremovable "is" attributes
20182
+ if (name === 'is') {
20217
20183
  if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
20218
20184
  try {
20219
- _forceRemove(node);
20185
+ _forceRemove(element);
20220
20186
  } catch (_) {}
20221
20187
  } else {
20222
20188
  try {
20223
- node.setAttribute(name, '');
20189
+ element.setAttribute(name, '');
20224
20190
  } catch (_) {}
20225
20191
  }
20226
20192
  }
20227
20193
  };
20228
-
20229
20194
  /**
20230
20195
  * _initDocument
20231
20196
  *
20232
- * @param {String} dirty a string of dirty markup
20233
- * @return {Document} a DOM, filled with the dirty markup
20197
+ * @param dirty - a string of dirty markup
20198
+ * @return a DOM, filled with the dirty markup
20234
20199
  */
20235
- var _initDocument = function _initDocument(dirty) {
20200
+ const _initDocument = function _initDocument(dirty) {
20236
20201
  /* Create a HTML document */
20237
- var doc;
20238
- var leadingWhitespace;
20202
+ let doc = null;
20203
+ let leadingWhitespace = null;
20239
20204
  if (FORCE_BODY) {
20240
20205
  dirty = '<remove></remove>' + dirty;
20241
20206
  } else {
20242
20207
  /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
20243
- var matches = stringMatch(dirty, /^[\r\n\t ]+/);
20208
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
20244
20209
  leadingWhitespace = matches && matches[0];
20245
20210
  }
20246
20211
  if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
20247
20212
  // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
20248
20213
  dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
20249
20214
  }
20250
- var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
20215
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
20251
20216
  /*
20252
20217
  * Use the DOMParser API by default, fallback later if needs be
20253
20218
  * DOMParser not work for svg when has multiple root element.
@@ -20257,7 +20222,6 @@ var purify = {exports: {}};
20257
20222
  doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
20258
20223
  } catch (_) {}
20259
20224
  }
20260
-
20261
20225
  /* Use createHTMLDocument in case DOMParser is not available */
20262
20226
  if (!doc || !doc.documentElement) {
20263
20227
  doc = implementation.createDocument(NAMESPACE, 'template', null);
@@ -20267,144 +20231,109 @@ var purify = {exports: {}};
20267
20231
  // Syntax error if dirtyPayload is invalid xml
20268
20232
  }
20269
20233
  }
20270
- var body = doc.body || doc.documentElement;
20234
+ const body = doc.body || doc.documentElement;
20271
20235
  if (dirty && leadingWhitespace) {
20272
20236
  body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
20273
20237
  }
20274
-
20275
20238
  /* Work on whole document or just its body */
20276
20239
  if (NAMESPACE === HTML_NAMESPACE) {
20277
20240
  return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
20278
20241
  }
20279
20242
  return WHOLE_DOCUMENT ? doc.documentElement : body;
20280
20243
  };
20281
-
20282
20244
  /**
20283
- * _createIterator
20245
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
20284
20246
  *
20285
- * @param {Document} root document/fragment to create iterator for
20286
- * @return {Iterator} iterator instance
20247
+ * @param root The root element or node to start traversing on.
20248
+ * @return The created NodeIterator
20287
20249
  */
20288
- var _createIterator = function _createIterator(root) {
20250
+ const _createNodeIterator = function _createNodeIterator(root) {
20289
20251
  return createNodeIterator.call(root.ownerDocument || root, root,
20290
20252
  // eslint-disable-next-line no-bitwise
20291
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null, false);
20253
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
20292
20254
  };
20293
-
20294
20255
  /**
20295
20256
  * _isClobbered
20296
20257
  *
20297
- * @param {Node} elm element to check for clobbering attacks
20298
- * @return {Boolean} true if clobbered, false if safe
20258
+ * @param element element to check for clobbering attacks
20259
+ * @return true if clobbered, false if safe
20299
20260
  */
20300
- var _isClobbered = function _isClobbered(elm) {
20301
- return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
20261
+ const _isClobbered = function _isClobbered(element) {
20262
+ return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');
20302
20263
  };
20303
-
20304
20264
  /**
20305
- * _isNode
20265
+ * Checks whether the given object is a DOM node.
20306
20266
  *
20307
- * @param {Node} obj object to check whether it's a DOM node
20308
- * @return {Boolean} true is object is a DOM node
20267
+ * @param value object to check whether it's a DOM node
20268
+ * @return true is object is a DOM node
20309
20269
  */
20310
- var _isNode = function _isNode(object) {
20311
- return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
20270
+ const _isNode = function _isNode(value) {
20271
+ return typeof Node === 'function' && value instanceof Node;
20312
20272
  };
20313
-
20314
- /**
20315
- * _executeHook
20316
- * Execute user configurable hooks
20317
- *
20318
- * @param {String} entryPoint Name of the hook's entry point
20319
- * @param {Node} currentNode node to work on with the hook
20320
- * @param {Object} data additional hook parameters
20321
- */
20322
- var _executeHook = function _executeHook(entryPoint, currentNode, data) {
20323
- if (!hooks[entryPoint]) {
20324
- return;
20325
- }
20326
- arrayForEach(hooks[entryPoint], function (hook) {
20273
+ function _executeHooks(hooks, currentNode, data) {
20274
+ arrayForEach(hooks, hook => {
20327
20275
  hook.call(DOMPurify, currentNode, data, CONFIG);
20328
20276
  });
20329
- };
20330
-
20277
+ }
20331
20278
  /**
20332
20279
  * _sanitizeElements
20333
20280
  *
20334
20281
  * @protect nodeName
20335
20282
  * @protect textContent
20336
20283
  * @protect removeChild
20337
- *
20338
- * @param {Node} currentNode to check for permission to exist
20339
- * @return {Boolean} true if node was killed, false if left alive
20284
+ * @param currentNode to check for permission to exist
20285
+ * @return true if node was killed, false if left alive
20340
20286
  */
20341
- var _sanitizeElements = function _sanitizeElements(currentNode) {
20342
- var content;
20343
-
20287
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
20288
+ let content = null;
20344
20289
  /* Execute a hook if present */
20345
- _executeHook('beforeSanitizeElements', currentNode, null);
20346
-
20290
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
20347
20291
  /* Check if element is clobbered or can clobber */
20348
20292
  if (_isClobbered(currentNode)) {
20349
20293
  _forceRemove(currentNode);
20350
20294
  return true;
20351
20295
  }
20352
-
20353
- /* Check if tagname contains Unicode */
20354
- if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
20355
- _forceRemove(currentNode);
20356
- return true;
20357
- }
20358
-
20359
20296
  /* Now let's check the element's type and name */
20360
- var tagName = transformCaseFunc(currentNode.nodeName);
20361
-
20297
+ const tagName = transformCaseFunc(currentNode.nodeName);
20362
20298
  /* Execute a hook if present */
20363
- _executeHook('uponSanitizeElement', currentNode, {
20364
- tagName: tagName,
20299
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
20300
+ tagName,
20365
20301
  allowedTags: ALLOWED_TAGS
20366
20302
  });
20367
-
20368
20303
  /* Detect mXSS attempts abusing namespace confusion */
20369
- if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
20304
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
20370
20305
  _forceRemove(currentNode);
20371
20306
  return true;
20372
20307
  }
20373
-
20374
- /* Mitigate a problem with templates inside select */
20375
- if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
20308
+ /* Remove any occurrence of processing instructions */
20309
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
20376
20310
  _forceRemove(currentNode);
20377
20311
  return true;
20378
20312
  }
20379
-
20380
- /* Remove any ocurrence of processing instructions */
20381
- if (currentNode.nodeType === 7) {
20382
- _forceRemove(currentNode);
20383
- return true;
20384
- }
20385
-
20386
20313
  /* Remove any kind of possibly harmful comments */
20387
- if (SAFE_FOR_XML && currentNode.nodeType === 8 && regExpTest(/<[/\w]/g, currentNode.data)) {
20314
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
20388
20315
  _forceRemove(currentNode);
20389
20316
  return true;
20390
20317
  }
20391
-
20392
20318
  /* Remove element if anything forbids its presence */
20393
20319
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
20394
20320
  /* Check if we have a custom element to handle */
20395
- if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
20396
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
20397
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
20321
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
20322
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
20323
+ return false;
20324
+ }
20325
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
20326
+ return false;
20327
+ }
20398
20328
  }
20399
-
20400
20329
  /* Keep content except for bad-listed elements */
20401
20330
  if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
20402
- var parentNode = getParentNode(currentNode) || currentNode.parentNode;
20403
- var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
20331
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
20332
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
20404
20333
  if (childNodes && parentNode) {
20405
- var childCount = childNodes.length;
20406
- for (var i = childCount - 1; i >= 0; --i) {
20407
- var childClone = cloneNode(childNodes[i], true);
20334
+ const childCount = childNodes.length;
20335
+ for (let i = childCount - 1; i >= 0; --i) {
20336
+ const childClone = cloneNode(childNodes[i], true);
20408
20337
  childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
20409
20338
  parentNode.insertBefore(childClone, getNextSibling(currentNode));
20410
20339
  }
@@ -20413,26 +20342,23 @@ var purify = {exports: {}};
20413
20342
  _forceRemove(currentNode);
20414
20343
  return true;
20415
20344
  }
20416
-
20417
20345
  /* Check whether element has a valid namespace */
20418
20346
  if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
20419
20347
  _forceRemove(currentNode);
20420
20348
  return true;
20421
20349
  }
20422
-
20423
20350
  /* Make sure that older browsers don't get fallback-tag mXSS */
20424
20351
  if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
20425
20352
  _forceRemove(currentNode);
20426
20353
  return true;
20427
20354
  }
20428
-
20429
20355
  /* Sanitize element content to be template-safe */
20430
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
20356
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
20431
20357
  /* Get the element's text content */
20432
20358
  content = currentNode.textContent;
20433
- content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
20434
- content = stringReplace(content, ERB_EXPR$1, ' ');
20435
- content = stringReplace(content, TMPLIT_EXPR$1, ' ');
20359
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
20360
+ content = stringReplace(content, expr, ' ');
20361
+ });
20436
20362
  if (currentNode.textContent !== content) {
20437
20363
  arrayPush(DOMPurify.removed, {
20438
20364
  element: currentNode.cloneNode()
@@ -20440,59 +20366,56 @@ var purify = {exports: {}};
20440
20366
  currentNode.textContent = content;
20441
20367
  }
20442
20368
  }
20443
-
20444
20369
  /* Execute a hook if present */
20445
- _executeHook('afterSanitizeElements', currentNode, null);
20370
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
20446
20371
  return false;
20447
20372
  };
20448
-
20449
20373
  /**
20450
20374
  * _isValidAttribute
20451
20375
  *
20452
- * @param {string} lcTag Lowercase tag name of containing element.
20453
- * @param {string} lcName Lowercase attribute name.
20454
- * @param {string} value Attribute value.
20455
- * @return {Boolean} Returns true if `value` is valid, otherwise false.
20376
+ * @param lcTag Lowercase tag name of containing element.
20377
+ * @param lcName Lowercase attribute name.
20378
+ * @param value Attribute value.
20379
+ * @return Returns true if `value` is valid, otherwise false.
20456
20380
  */
20457
20381
  // eslint-disable-next-line complexity
20458
- var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
20382
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
20459
20383
  /* Make sure attribute cannot clobber */
20460
20384
  if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
20461
20385
  return false;
20462
20386
  }
20463
-
20464
20387
  /* Allow valid data-* attributes: At least one character after "-"
20465
20388
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
20466
20389
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
20467
20390
  We don't need to check the value; it's always URI safe. */
20468
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
20391
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
20469
20392
  if (
20470
20393
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
20471
20394
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
20472
20395
  // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
20473
- _basicCustomElementTest(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)) ||
20396
+ _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)) ||
20474
20397
  // Alternative, second condition checks if it's an `is`-attribute, AND
20475
20398
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
20476
20399
  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))) ; else {
20477
20400
  return false;
20478
20401
  }
20479
20402
  /* Check value is safe. First, is attr inert? If so, is safe */
20480
- } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if (value) {
20403
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
20481
20404
  return false;
20482
20405
  } else ;
20483
20406
  return true;
20484
20407
  };
20485
-
20486
20408
  /**
20487
- * _basicCustomElementCheck
20409
+ * _isBasicCustomElement
20488
20410
  * checks if at least one dash is included in tagName, and it's not the first char
20489
20411
  * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
20490
- * @param {string} tagName name of the tag of the node to sanitize
20412
+ *
20413
+ * @param tagName name of the tag of the node to sanitize
20414
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
20491
20415
  */
20492
- var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
20493
- return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT$1);
20416
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
20417
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
20494
20418
  };
20495
-
20496
20419
  /**
20497
20420
  * _sanitizeAttributes
20498
20421
  *
@@ -20501,97 +20424,85 @@ var purify = {exports: {}};
20501
20424
  * @protect removeAttribute
20502
20425
  * @protect setAttribute
20503
20426
  *
20504
- * @param {Node} currentNode to sanitize
20427
+ * @param currentNode to sanitize
20505
20428
  */
20506
- var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
20507
- var attr;
20508
- var value;
20509
- var lcName;
20510
- var l;
20429
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
20511
20430
  /* Execute a hook if present */
20512
- _executeHook('beforeSanitizeAttributes', currentNode, null);
20513
- var attributes = currentNode.attributes;
20514
-
20431
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
20432
+ const {
20433
+ attributes
20434
+ } = currentNode;
20515
20435
  /* Check if we have attributes; if not we might have a text node */
20516
- if (!attributes) {
20436
+ if (!attributes || _isClobbered(currentNode)) {
20517
20437
  return;
20518
20438
  }
20519
- var hookEvent = {
20439
+ const hookEvent = {
20520
20440
  attrName: '',
20521
20441
  attrValue: '',
20522
20442
  keepAttr: true,
20523
- allowedAttributes: ALLOWED_ATTR
20443
+ allowedAttributes: ALLOWED_ATTR,
20444
+ forceKeepAttr: undefined
20524
20445
  };
20525
- l = attributes.length;
20526
-
20446
+ let l = attributes.length;
20527
20447
  /* Go backwards over all attributes; safely remove bad ones */
20528
20448
  while (l--) {
20529
- attr = attributes[l];
20530
- var _attr = attr,
20531
- name = _attr.name,
20532
- namespaceURI = _attr.namespaceURI;
20533
- value = name === 'value' ? attr.value : stringTrim(attr.value);
20534
- lcName = transformCaseFunc(name);
20535
-
20449
+ const attr = attributes[l];
20450
+ const {
20451
+ name,
20452
+ namespaceURI,
20453
+ value: attrValue
20454
+ } = attr;
20455
+ const lcName = transformCaseFunc(name);
20456
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
20536
20457
  /* Execute a hook if present */
20537
20458
  hookEvent.attrName = lcName;
20538
20459
  hookEvent.attrValue = value;
20539
20460
  hookEvent.keepAttr = true;
20540
20461
  hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
20541
- _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
20462
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
20542
20463
  value = hookEvent.attrValue;
20543
-
20464
+ /* Full DOM Clobbering protection via namespace isolation,
20465
+ * Prefix id and name attributes with `user-content-`
20466
+ */
20467
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
20468
+ // Remove the attribute with this value
20469
+ _removeAttribute(name, currentNode);
20470
+ // Prefix the value and later re-create the attribute with the sanitized value
20471
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
20472
+ }
20544
20473
  /* Work around a security issue with comments inside attributes */
20545
20474
  if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
20546
20475
  _removeAttribute(name, currentNode);
20547
20476
  continue;
20548
20477
  }
20549
-
20550
20478
  /* Did the hooks approve of the attribute? */
20551
20479
  if (hookEvent.forceKeepAttr) {
20552
20480
  continue;
20553
20481
  }
20554
-
20555
20482
  /* Remove attribute */
20556
20483
  _removeAttribute(name, currentNode);
20557
-
20558
20484
  /* Did the hooks approve of the attribute? */
20559
20485
  if (!hookEvent.keepAttr) {
20560
20486
  continue;
20561
20487
  }
20562
-
20563
20488
  /* Work around a security issue in jQuery 3.0 */
20564
20489
  if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
20565
20490
  _removeAttribute(name, currentNode);
20566
20491
  continue;
20567
20492
  }
20568
-
20569
20493
  /* Sanitize attribute content to be template-safe */
20570
20494
  if (SAFE_FOR_TEMPLATES) {
20571
- value = stringReplace(value, MUSTACHE_EXPR$1, ' ');
20572
- value = stringReplace(value, ERB_EXPR$1, ' ');
20573
- value = stringReplace(value, TMPLIT_EXPR$1, ' ');
20495
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
20496
+ value = stringReplace(value, expr, ' ');
20497
+ });
20574
20498
  }
20575
-
20576
20499
  /* Is `value` valid for this attribute? */
20577
- var lcTag = transformCaseFunc(currentNode.nodeName);
20500
+ const lcTag = transformCaseFunc(currentNode.nodeName);
20578
20501
  if (!_isValidAttribute(lcTag, lcName, value)) {
20579
20502
  continue;
20580
20503
  }
20581
-
20582
- /* Full DOM Clobbering protection via namespace isolation,
20583
- * Prefix id and name attributes with `user-content-`
20584
- */
20585
- if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
20586
- // Remove the attribute with this value
20587
- _removeAttribute(name, currentNode);
20588
-
20589
- // Prefix the value and later re-create the attribute with the sanitized value
20590
- value = SANITIZE_NAMED_PROPS_PREFIX + value;
20591
- }
20592
-
20593
20504
  /* Handle attributes that require Trusted Types */
20594
- if (trustedTypesPolicy && _typeof(trustedTypes) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
20505
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
20595
20506
  if (namespaceURI) ; else {
20596
20507
  switch (trustedTypes.getAttributeType(lcTag, lcName)) {
20597
20508
  case 'TrustedHTML':
@@ -20607,7 +20518,6 @@ var purify = {exports: {}};
20607
20518
  }
20608
20519
  }
20609
20520
  }
20610
-
20611
20521
  /* Handle invalid data-* attribute set by try-catching it */
20612
20522
  try {
20613
20523
  if (namespaceURI) {
@@ -20623,59 +20533,41 @@ var purify = {exports: {}};
20623
20533
  }
20624
20534
  } catch (_) {}
20625
20535
  }
20626
-
20627
20536
  /* Execute a hook if present */
20628
- _executeHook('afterSanitizeAttributes', currentNode, null);
20537
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
20629
20538
  };
20630
-
20631
20539
  /**
20632
20540
  * _sanitizeShadowDOM
20633
20541
  *
20634
- * @param {DocumentFragment} fragment to iterate over recursively
20542
+ * @param fragment to iterate over recursively
20635
20543
  */
20636
- var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
20637
- var shadowNode;
20638
- var shadowIterator = _createIterator(fragment);
20639
-
20544
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
20545
+ let shadowNode = null;
20546
+ const shadowIterator = _createNodeIterator(fragment);
20640
20547
  /* Execute a hook if present */
20641
- _executeHook('beforeSanitizeShadowDOM', fragment, null);
20548
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
20642
20549
  while (shadowNode = shadowIterator.nextNode()) {
20643
20550
  /* Execute a hook if present */
20644
- _executeHook('uponSanitizeShadowNode', shadowNode, null);
20645
-
20551
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
20646
20552
  /* Sanitize tags and elements */
20647
- if (_sanitizeElements(shadowNode)) {
20648
- continue;
20649
- }
20650
-
20553
+ _sanitizeElements(shadowNode);
20554
+ /* Check attributes next */
20555
+ _sanitizeAttributes(shadowNode);
20651
20556
  /* Deep shadow DOM detected */
20652
20557
  if (shadowNode.content instanceof DocumentFragment) {
20653
20558
  _sanitizeShadowDOM(shadowNode.content);
20654
20559
  }
20655
-
20656
- /* Check attributes, sanitize if necessary */
20657
- _sanitizeAttributes(shadowNode);
20658
20560
  }
20659
-
20660
20561
  /* Execute a hook if present */
20661
- _executeHook('afterSanitizeShadowDOM', fragment, null);
20562
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
20662
20563
  };
20663
-
20664
- /**
20665
- * Sanitize
20666
- * Public method providing core sanitation functionality
20667
- *
20668
- * @param {String|Node} dirty string or DOM node
20669
- * @param {Object} configuration object
20670
- */
20671
20564
  // eslint-disable-next-line complexity
20672
20565
  DOMPurify.sanitize = function (dirty) {
20673
- var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20674
- var body;
20675
- var importedNode;
20676
- var currentNode;
20677
- var oldNode;
20678
- var returnNode;
20566
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20567
+ let body = null;
20568
+ let importedNode = null;
20569
+ let currentNode = null;
20570
+ let returnNode = null;
20679
20571
  /* Make sure we have a string to sanitize.
20680
20572
  DO NOT return early, as this will return the wrong type if
20681
20573
  the user has requested a DOM object rather than a string */
@@ -20683,7 +20575,6 @@ var purify = {exports: {}};
20683
20575
  if (IS_EMPTY_INPUT) {
20684
20576
  dirty = '<!-->';
20685
20577
  }
20686
-
20687
20578
  /* Stringify, in case dirty is an object */
20688
20579
  if (typeof dirty !== 'string' && !_isNode(dirty)) {
20689
20580
  if (typeof dirty.toString === 'function') {
@@ -20695,28 +20586,16 @@ var purify = {exports: {}};
20695
20586
  throw typeErrorCreate('toString is not a function');
20696
20587
  }
20697
20588
  }
20698
-
20699
- /* Check we can run. Otherwise fall back or ignore */
20589
+ /* Return dirty HTML if DOMPurify cannot run */
20700
20590
  if (!DOMPurify.isSupported) {
20701
- if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
20702
- if (typeof dirty === 'string') {
20703
- return window.toStaticHTML(dirty);
20704
- }
20705
- if (_isNode(dirty)) {
20706
- return window.toStaticHTML(dirty.outerHTML);
20707
- }
20708
- }
20709
20591
  return dirty;
20710
20592
  }
20711
-
20712
20593
  /* Assign config vars */
20713
20594
  if (!SET_CONFIG) {
20714
20595
  _parseConfig(cfg);
20715
20596
  }
20716
-
20717
20597
  /* Clean up removed elements */
20718
20598
  DOMPurify.removed = [];
20719
-
20720
20599
  /* Check if dirty is correctly typed for IN_PLACE */
20721
20600
  if (typeof dirty === 'string') {
20722
20601
  IN_PLACE = false;
@@ -20724,7 +20603,7 @@ var purify = {exports: {}};
20724
20603
  if (IN_PLACE) {
20725
20604
  /* Do some early pre-sanitization to avoid unsafe root nodes */
20726
20605
  if (dirty.nodeName) {
20727
- var tagName = transformCaseFunc(dirty.nodeName);
20606
+ const tagName = transformCaseFunc(dirty.nodeName);
20728
20607
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
20729
20608
  throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
20730
20609
  }
@@ -20734,7 +20613,7 @@ var purify = {exports: {}};
20734
20613
  elements being stripped by the parser */
20735
20614
  body = _initDocument('<!---->');
20736
20615
  importedNode = body.ownerDocument.importNode(dirty, true);
20737
- if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
20616
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
20738
20617
  /* Node is already a body, use as is */
20739
20618
  body = importedNode;
20740
20619
  } else if (importedNode.nodeName === 'HTML') {
@@ -20750,52 +20629,34 @@ var purify = {exports: {}};
20750
20629
  dirty.indexOf('<') === -1) {
20751
20630
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
20752
20631
  }
20753
-
20754
20632
  /* Initialize the document to work on */
20755
20633
  body = _initDocument(dirty);
20756
-
20757
20634
  /* Check we have a DOM node from the data */
20758
20635
  if (!body) {
20759
20636
  return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
20760
20637
  }
20761
20638
  }
20762
-
20763
20639
  /* Remove first element node (ours) if FORCE_BODY is set */
20764
20640
  if (body && FORCE_BODY) {
20765
20641
  _forceRemove(body.firstChild);
20766
20642
  }
20767
-
20768
20643
  /* Get node iterator */
20769
- var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
20770
-
20644
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
20771
20645
  /* Now start iterating over the created document */
20772
20646
  while (currentNode = nodeIterator.nextNode()) {
20773
- /* Fix IE's strange behavior with manipulated textNodes #89 */
20774
- if (currentNode.nodeType === 3 && currentNode === oldNode) {
20775
- continue;
20776
- }
20777
-
20778
20647
  /* Sanitize tags and elements */
20779
- if (_sanitizeElements(currentNode)) {
20780
- continue;
20781
- }
20782
-
20648
+ _sanitizeElements(currentNode);
20649
+ /* Check attributes next */
20650
+ _sanitizeAttributes(currentNode);
20783
20651
  /* Shadow DOM detected, sanitize it */
20784
20652
  if (currentNode.content instanceof DocumentFragment) {
20785
20653
  _sanitizeShadowDOM(currentNode.content);
20786
20654
  }
20787
-
20788
- /* Check attributes, sanitize if necessary */
20789
- _sanitizeAttributes(currentNode);
20790
- oldNode = currentNode;
20791
20655
  }
20792
- oldNode = null;
20793
-
20794
20656
  /* If we sanitized `dirty` in-place, return it. */
20795
20657
  if (IN_PLACE) {
20796
20658
  return dirty;
20797
20659
  }
20798
-
20799
20660
  /* Return sanitized string or DOM */
20800
20661
  if (RETURN_DOM) {
20801
20662
  if (RETURN_DOM_FRAGMENT) {
@@ -20807,7 +20668,7 @@ var purify = {exports: {}};
20807
20668
  } else {
20808
20669
  returnNode = body;
20809
20670
  }
20810
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) {
20671
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
20811
20672
  /*
20812
20673
  AdoptNode() is not used because internal state is not reset
20813
20674
  (e.g. the past names map of a HTMLFormElement), this is safe
@@ -20819,111 +20680,55 @@ var purify = {exports: {}};
20819
20680
  }
20820
20681
  return returnNode;
20821
20682
  }
20822
- var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
20823
-
20683
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
20824
20684
  /* Serialize doctype if allowed */
20825
20685
  if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
20826
20686
  serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
20827
20687
  }
20828
-
20829
20688
  /* Sanitize final string template-safe */
20830
20689
  if (SAFE_FOR_TEMPLATES) {
20831
- serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' ');
20832
- serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' ');
20833
- serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR$1, ' ');
20690
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
20691
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
20692
+ });
20834
20693
  }
20835
20694
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
20836
20695
  };
20837
-
20838
- /**
20839
- * Public method to set the configuration once
20840
- * setConfig
20841
- *
20842
- * @param {Object} cfg configuration object
20843
- */
20844
- DOMPurify.setConfig = function (cfg) {
20696
+ DOMPurify.setConfig = function () {
20697
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20845
20698
  _parseConfig(cfg);
20846
20699
  SET_CONFIG = true;
20847
20700
  };
20848
-
20849
- /**
20850
- * Public method to remove the configuration
20851
- * clearConfig
20852
- *
20853
- */
20854
20701
  DOMPurify.clearConfig = function () {
20855
20702
  CONFIG = null;
20856
20703
  SET_CONFIG = false;
20857
20704
  };
20858
-
20859
- /**
20860
- * Public method to check if an attribute value is valid.
20861
- * Uses last set config, if any. Otherwise, uses config defaults.
20862
- * isValidAttribute
20863
- *
20864
- * @param {string} tag Tag name of containing element.
20865
- * @param {string} attr Attribute name.
20866
- * @param {string} value Attribute value.
20867
- * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
20868
- */
20869
20705
  DOMPurify.isValidAttribute = function (tag, attr, value) {
20870
20706
  /* Initialize shared config vars if necessary. */
20871
20707
  if (!CONFIG) {
20872
20708
  _parseConfig({});
20873
20709
  }
20874
- var lcTag = transformCaseFunc(tag);
20875
- var lcName = transformCaseFunc(attr);
20710
+ const lcTag = transformCaseFunc(tag);
20711
+ const lcName = transformCaseFunc(attr);
20876
20712
  return _isValidAttribute(lcTag, lcName, value);
20877
20713
  };
20878
-
20879
- /**
20880
- * AddHook
20881
- * Public method to add DOMPurify hooks
20882
- *
20883
- * @param {String} entryPoint entry point for the hook to add
20884
- * @param {Function} hookFunction function to execute
20885
- */
20886
20714
  DOMPurify.addHook = function (entryPoint, hookFunction) {
20887
20715
  if (typeof hookFunction !== 'function') {
20888
20716
  return;
20889
20717
  }
20890
- hooks[entryPoint] = hooks[entryPoint] || [];
20891
20718
  arrayPush(hooks[entryPoint], hookFunction);
20892
20719
  };
20893
-
20894
- /**
20895
- * RemoveHook
20896
- * Public method to remove a DOMPurify hook at a given entryPoint
20897
- * (pops it from the stack of hooks if more are present)
20898
- *
20899
- * @param {String} entryPoint entry point for the hook to remove
20900
- * @return {Function} removed(popped) hook
20901
- */
20902
- DOMPurify.removeHook = function (entryPoint) {
20903
- if (hooks[entryPoint]) {
20904
- return arrayPop(hooks[entryPoint]);
20720
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
20721
+ if (hookFunction !== undefined) {
20722
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
20723
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
20905
20724
  }
20725
+ return arrayPop(hooks[entryPoint]);
20906
20726
  };
20907
-
20908
- /**
20909
- * RemoveHooks
20910
- * Public method to remove all DOMPurify hooks at a given entryPoint
20911
- *
20912
- * @param {String} entryPoint entry point for the hooks to remove
20913
- */
20914
20727
  DOMPurify.removeHooks = function (entryPoint) {
20915
- if (hooks[entryPoint]) {
20916
- hooks[entryPoint] = [];
20917
- }
20728
+ hooks[entryPoint] = [];
20918
20729
  };
20919
-
20920
- /**
20921
- * RemoveAllHooks
20922
- * Public method to remove all DOMPurify hooks
20923
- *
20924
- */
20925
20730
  DOMPurify.removeAllHooks = function () {
20926
- hooks = {};
20731
+ hooks = _createHooksMap();
20927
20732
  };
20928
20733
  return DOMPurify;
20929
20734
  }
@@ -32205,7 +32010,7 @@ let C4DMegaMenuTopNavMenu = _decorate$r([carbonElement(`${c4dPrefix$r}-megamenu-
32205
32010
  var _this$parentElement;
32206
32011
  // Import needed subcomponents on first expansion
32207
32012
  if (!((_this$parentElement = this.parentElement) !== null && _this$parentElement !== void 0 && _this$parentElement.importedMegamenu)) {
32208
- await Promise.all([import('./megamenu-left-navigation-ab38535c.js'), import('./megamenu-category-link-66573e4b.js'), import('./megamenu-category-link-group-83d39e8b.js'), import('./megamenu-category-group-89eb9dd2.js'), import('./megamenu-category-group-copy-94e321c8.js'), import('./megamenu-category-heading-5c562696.js'), Promise.resolve().then(function () { return megamenuLinkWithIcon; }), import('./megamenu-overlay-9b73f118.js'), import('./megamenu-tab-e4488ebd.js'), Promise.resolve().then(function () { return megamenuTabs; })]);
32013
+ await Promise.all([import('./megamenu-left-navigation-4b810f29.js'), import('./megamenu-category-link-dcd41f45.js'), import('./megamenu-category-link-group-6ff3a30d.js'), import('./megamenu-category-group-921d7e31.js'), import('./megamenu-category-group-copy-d173c916.js'), import('./megamenu-category-heading-90e67482.js'), Promise.resolve().then(function () { return megamenuLinkWithIcon; }), import('./megamenu-overlay-e179976a.js'), import('./megamenu-tab-4e651fc9.js'), Promise.resolve().then(function () { return megamenuTabs; })]);
32209
32014
  this.parentElement.importedMegamenu = true;
32210
32015
  }
32211
32016
 
@@ -37716,7 +37521,7 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
37716
37521
  value() {
37717
37522
  return async event => {
37718
37523
  if (!this._importedSideNav) {
37719
- await Promise.all([Promise.resolve().then(function () { return leftNavName; }), import('./left-nav-menu-a22a1a6e.js'), import('./left-nav-menu-section-cee5e8b9.js'), import('./left-nav-menu-item-85006ef1.js'), import('./left-nav-menu-category-heading-cb17a84f.js'), import('./left-nav-overlay-e559d687.js')]);
37524
+ await Promise.all([Promise.resolve().then(function () { return leftNavName; }), import('./left-nav-menu-353311b3.js'), import('./left-nav-menu-section-ce8644e6.js'), import('./left-nav-menu-item-1c788c22.js'), import('./left-nav-menu-category-heading-70403118.js'), import('./left-nav-overlay-5e37dc8f.js')]);
37720
37525
  this._importedSideNav = true;
37721
37526
  }
37722
37527
  this.expanded = event.detail.active;
@@ -37862,6 +37667,27 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
37862
37667
  }
37863
37668
  };
37864
37669
  }
37670
+ }, {
37671
+ kind: "method",
37672
+ key: "_handleFocusOut",
37673
+ value: //TODO: Remove this override when upstream bug is fixed.
37674
+ //@ts-ignore: Overriding the Focus Out Function
37675
+ function _handleFocusOut({
37676
+ relatedTarget
37677
+ }) {
37678
+ const {
37679
+ collapseMode
37680
+ } = this;
37681
+ if (collapseMode !== this.collapseMode) {
37682
+ if (!this.contains(relatedTarget)) {
37683
+ this.expanded = false;
37684
+ }
37685
+ }
37686
+ }
37687
+
37688
+ /**
37689
+ * Usage mode of the side nav.
37690
+ */
37865
37691
  }, {
37866
37692
  kind: "field",
37867
37693
  decorators: [n$1({
@@ -37875,11 +37701,7 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
37875
37701
  }, {
37876
37702
  kind: "method",
37877
37703
  key: "connectedCallback",
37878
- value:
37879
- /**
37880
- * Usage mode of the side nav.
37881
- */
37882
- function connectedCallback() {
37704
+ value: function connectedCallback() {
37883
37705
  _superPropGet$7(C4DLeftNav, "connectedCallback", this, 3)([]);
37884
37706
  document.addEventListener('click', this._handleClickOut.bind(this));
37885
37707
  }