@carbon/ibmdotcom-web-components 2.23.0 → 2.25.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 (70) hide show
  1. package/custom-elements.json +17 -9
  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-1dfaa907.js} +529 -701
  7. package/dist/{index-90537714.js → index-8e5904a0.js} +5 -5
  8. package/dist/{left-nav-menu-ccf3a6ec.js → left-nav-menu-08b77355.js} +2 -2
  9. package/dist/{left-nav-menu-category-heading-3016e990.js → left-nav-menu-category-heading-1874e85f.js} +2 -2
  10. package/dist/{left-nav-menu-category-heading-cb17a84f.js → left-nav-menu-category-heading-907c5870.js} +3 -3
  11. package/dist/{left-nav-menu-a22a1a6e.js → left-nav-menu-ee66480f.js} +3 -3
  12. package/dist/{left-nav-menu-item-18d051bc.js → left-nav-menu-item-463c0a47.js} +2 -2
  13. package/dist/{left-nav-menu-item-85006ef1.js → left-nav-menu-item-62b3aeb4.js} +3 -3
  14. package/dist/{left-nav-menu-section-027d6043.js → left-nav-menu-section-36fa5f37.js} +2 -2
  15. package/dist/{left-nav-menu-section-cee5e8b9.js → left-nav-menu-section-620f3e39.js} +3 -3
  16. package/dist/{left-nav-overlay-225f893f.js → left-nav-overlay-11083652.js} +2 -2
  17. package/dist/{left-nav-overlay-e559d687.js → left-nav-overlay-4aa89969.js} +3 -3
  18. package/dist/{megamenu-category-group-75dd0587.js → megamenu-category-group-38ebe02a.js} +2 -2
  19. package/dist/{megamenu-category-group-89eb9dd2.js → megamenu-category-group-768aa48a.js} +3 -3
  20. package/dist/{megamenu-category-group-copy-94e321c8.js → megamenu-category-group-copy-0036630c.js} +3 -3
  21. package/dist/{megamenu-category-group-copy-533d77ca.js → megamenu-category-group-copy-0770e2d1.js} +2 -2
  22. package/dist/{megamenu-category-heading-5c562696.js → megamenu-category-heading-25325ce1.js} +3 -3
  23. package/dist/{megamenu-category-heading-370cb6dc.js → megamenu-category-heading-5fae5a7f.js} +2 -2
  24. package/dist/{megamenu-category-link-6060a359.js → megamenu-category-link-3a79d2ea.js} +2 -2
  25. package/dist/{megamenu-category-link-66573e4b.js → megamenu-category-link-d1712222.js} +3 -3
  26. package/dist/{megamenu-category-link-group-83d39e8b.js → megamenu-category-link-group-ba6e3528.js} +3 -3
  27. package/dist/{megamenu-category-link-group-4f9fcb1a.js → megamenu-category-link-group-fe0164c9.js} +2 -2
  28. package/dist/{megamenu-left-navigation-35cca50a.js → megamenu-left-navigation-29fdbefc.js} +2 -2
  29. package/dist/{megamenu-left-navigation-ab38535c.js → megamenu-left-navigation-dba059eb.js} +3 -3
  30. package/dist/{megamenu-overlay-977e9e98.js → megamenu-overlay-6fcf6e91.js} +2 -2
  31. package/dist/{megamenu-overlay-9b73f118.js → megamenu-overlay-899719ba.js} +3 -3
  32. package/dist/{megamenu-tab-e4488ebd.js → megamenu-tab-1835d1a2.js} +3 -3
  33. package/dist/{megamenu-tab-69382393.js → megamenu-tab-1a79a248.js} +2 -2
  34. package/es/components/background-media/background-media.css.js +1 -1
  35. package/es/components/background-media/background-media.d.ts +7 -1
  36. package/es/components/background-media/background-media.js +29 -1
  37. package/es/components/background-media/background-media.js.map +1 -1
  38. package/es/components/background-media/defs.d.ts +5 -1
  39. package/es/components/background-media/defs.js +2 -1
  40. package/es/components/background-media/defs.js.map +1 -1
  41. package/es/components/card-group/card-group.css.js +1 -1
  42. package/es/components/card-group/card-group.d.ts +688 -1
  43. package/es/components/card-group/card-group.js +47 -12
  44. package/es/components/card-group/card-group.js.map +1 -1
  45. package/es/components/card-section-offset/card-section-offset.css.js +1 -1
  46. package/es/components/content-block/content-block.css.js +1 -1
  47. package/es/components/content-block-cards/content-block-cards.d.ts +2 -1
  48. package/es/components/content-block-cards/content-block-cards.js +17 -1
  49. package/es/components/content-block-cards/content-block-cards.js.map +1 -1
  50. package/es/components/cta/video-cta-container.d.ts +1 -0
  51. package/es/components/lightbox-media-viewer/lightbox-video-player-container.d.ts +1 -0
  52. package/es/components/masthead/left-nav.d.ts +2 -1
  53. package/es/components/masthead/left-nav.js +23 -6
  54. package/es/components/masthead/left-nav.js.map +1 -1
  55. package/es/components/table-of-contents/table-of-contents.js +2 -2
  56. package/es/components/table-of-contents/table-of-contents.js.map +1 -1
  57. package/es/components/video-player/video-player-container.d.ts +3 -1
  58. package/es/components/video-player/video-player-container.js +276 -195
  59. package/es/components/video-player/video-player-container.js.map +1 -1
  60. package/es/components/video-player/video-player.d.ts +2 -1
  61. package/es/components/video-player/video-player.js +5 -3
  62. package/es/components/video-player/video-player.js.map +1 -1
  63. package/es/components-react/video-player/video-player.d.ts +1 -0
  64. package/es/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayer/KalturaPlayer.js +7 -1
  65. package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  66. package/lib/components/background-media/defs.js +2 -1
  67. package/lib/components/background-media/defs.js.map +1 -1
  68. package/lib/internal/vendor/@carbon/ibmdotcom-services/services/KalturaPlayer/KalturaPlayer.js +7 -1
  69. package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  70. 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.25.0',
106
106
  */
107
107
  var settings = {
108
- version: 'Carbon for IBM.com v2.23.0',
108
+ version: 'Carbon for IBM.com v2.25.0',
109
109
  stablePrefix: 'c4d',
110
110
  prefix: 'cds'
111
111
  };
@@ -16076,6 +16076,12 @@ var KalturaPlayerAPI = /*#__PURE__*/function () {
16076
16076
  closedCaptions: {
16077
16077
  plugin: true
16078
16078
  },
16079
+ /**
16080
+ * When altering this default prop,
16081
+ * please also check the video-player-container
16082
+ * _getPlayerOptions prop of same name - as it also
16083
+ * replicates the value below except for text
16084
+ */
16079
16085
  titleLabel: {
16080
16086
  plugin: true,
16081
16087
  align: 'left',
@@ -19391,96 +19397,28 @@ _decorate$Q([carbonElement(`${c4dPrefix$Q}-regions`)], function (_initialize, _S
19391
19397
 
19392
19398
  var purify = {exports: {}};
19393
19399
 
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 */
19400
+ /*! @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
19401
 
19396
19402
  (function (module, exports) {
19397
19403
  (function (global, factory) {
19398
19404
  module.exports = factory() ;
19399
19405
  })(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
- }
19406
+ const {
19407
+ entries,
19408
+ setPrototypeOf,
19409
+ isFrozen,
19410
+ getPrototypeOf,
19411
+ getOwnPropertyDescriptor
19412
+ } = Object;
19413
+ let {
19414
+ freeze,
19415
+ seal,
19416
+ create
19417
+ } = Object; // eslint-disable-line import/no-mutable-exports
19418
+ let {
19419
+ apply,
19420
+ construct
19421
+ } = typeof Reflect !== 'undefined' && Reflect;
19484
19422
  if (!freeze) {
19485
19423
  freeze = function freeze(x) {
19486
19424
  return x;
@@ -19491,30 +19429,53 @@ var purify = {exports: {}};
19491
19429
  return x;
19492
19430
  };
19493
19431
  }
19432
+ if (!apply) {
19433
+ apply = function apply(fun, thisValue, args) {
19434
+ return fun.apply(thisValue, args);
19435
+ };
19436
+ }
19494
19437
  if (!construct) {
19495
19438
  construct = function construct(Func, args) {
19496
- return _construct(Func, _toConsumableArray(args));
19439
+ return new Func(...args);
19497
19440
  };
19498
19441
  }
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);
19442
+ const arrayForEach = unapply(Array.prototype.forEach);
19443
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
19444
+ const arrayPop = unapply(Array.prototype.pop);
19445
+ const arrayPush = unapply(Array.prototype.push);
19446
+ const arraySplice = unapply(Array.prototype.splice);
19447
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
19448
+ const stringToString = unapply(String.prototype.toString);
19449
+ const stringMatch = unapply(String.prototype.match);
19450
+ const stringReplace = unapply(String.prototype.replace);
19451
+ const stringIndexOf = unapply(String.prototype.indexOf);
19452
+ const stringTrim = unapply(String.prototype.trim);
19453
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
19454
+ const regExpTest = unapply(RegExp.prototype.test);
19455
+ const typeErrorCreate = unconstruct(TypeError);
19456
+ /**
19457
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
19458
+ *
19459
+ * @param func - The function to be wrapped and called.
19460
+ * @returns A new function that calls the given function with a specified thisArg and arguments.
19461
+ */
19510
19462
  function unapply(func) {
19511
19463
  return function (thisArg) {
19464
+ if (thisArg instanceof RegExp) {
19465
+ thisArg.lastIndex = 0;
19466
+ }
19512
19467
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
19513
19468
  args[_key - 1] = arguments[_key];
19514
19469
  }
19515
19470
  return apply(func, thisArg, args);
19516
19471
  };
19517
19472
  }
19473
+ /**
19474
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
19475
+ *
19476
+ * @param func - The constructor function to be wrapped and called.
19477
+ * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
19478
+ */
19518
19479
  function unconstruct(func) {
19519
19480
  return function () {
19520
19481
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -19523,22 +19484,27 @@ var purify = {exports: {}};
19523
19484
  return construct(func, args);
19524
19485
  };
19525
19486
  }
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;
19487
+ /**
19488
+ * Add properties to a lookup table
19489
+ *
19490
+ * @param set - The set to which elements will be added.
19491
+ * @param array - The array containing elements to be added to the set.
19492
+ * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.
19493
+ * @returns The modified set with added elements.
19494
+ */
19495
+ function addToSet(set, array) {
19496
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
19531
19497
  if (setPrototypeOf) {
19532
19498
  // Make 'in' and truthy checks like Boolean(set.constructor)
19533
19499
  // independent of any properties defined on Object.prototype.
19534
19500
  // Prevent prototype setters from intercepting set as a this value.
19535
19501
  setPrototypeOf(set, null);
19536
19502
  }
19537
- var l = array.length;
19503
+ let l = array.length;
19538
19504
  while (l--) {
19539
- var element = array[l];
19505
+ let element = array[l];
19540
19506
  if (typeof element === 'string') {
19541
- var lcElement = transformCaseFunc(element);
19507
+ const lcElement = transformCaseFunc(element);
19542
19508
  if (lcElement !== element) {
19543
19509
  // Config presets (e.g. tags.js, attrs.js) are immutable.
19544
19510
  if (!isFrozen(array)) {
@@ -19551,26 +19517,53 @@ var purify = {exports: {}};
19551
19517
  }
19552
19518
  return set;
19553
19519
  }
19554
-
19555
- /* Shallow clone an object */
19520
+ /**
19521
+ * Clean up an array to harden against CSPP
19522
+ *
19523
+ * @param array - The array to be cleaned.
19524
+ * @returns The cleaned version of the array
19525
+ */
19526
+ function cleanArray(array) {
19527
+ for (let index = 0; index < array.length; index++) {
19528
+ const isPropertyExist = objectHasOwnProperty(array, index);
19529
+ if (!isPropertyExist) {
19530
+ array[index] = null;
19531
+ }
19532
+ }
19533
+ return array;
19534
+ }
19535
+ /**
19536
+ * Shallow clone an object
19537
+ *
19538
+ * @param object - The object to be cloned.
19539
+ * @returns A new object that copies the original.
19540
+ */
19556
19541
  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];
19542
+ const newObject = create(null);
19543
+ for (const [property, value] of entries(object)) {
19544
+ const isPropertyExist = objectHasOwnProperty(object, property);
19545
+ if (isPropertyExist) {
19546
+ if (Array.isArray(value)) {
19547
+ newObject[property] = cleanArray(value);
19548
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
19549
+ newObject[property] = clone(value);
19550
+ } else {
19551
+ newObject[property] = value;
19552
+ }
19562
19553
  }
19563
19554
  }
19564
19555
  return newObject;
19565
19556
  }
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. */
19557
+ /**
19558
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
19559
+ *
19560
+ * @param object - The object to look up the getter function in its prototype chain.
19561
+ * @param prop - The property name for which to find the getter function.
19562
+ * @returns The getter function found in the prototype chain or a fallback function.
19563
+ */
19571
19564
  function lookupGetter(object, prop) {
19572
19565
  while (object !== null) {
19573
- var desc = getOwnPropertyDescriptor(object, prop);
19566
+ const desc = getOwnPropertyDescriptor(object, prop);
19574
19567
  if (desc) {
19575
19568
  if (desc.get) {
19576
19569
  return unapply(desc.get);
@@ -19581,82 +19574,107 @@ var purify = {exports: {}};
19581
19574
  }
19582
19575
  object = getPrototypeOf(object);
19583
19576
  }
19584
- function fallbackValue(element) {
19585
- console.warn('fallback value for', element);
19577
+ function fallbackValue() {
19586
19578
  return null;
19587
19579
  }
19588
19580
  return fallbackValue;
19589
19581
  }
19590
19582
 
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
-
19583
+ 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']);
19584
+ 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']);
19585
+ 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
19586
  // List of SVG elements that are disallowed by default.
19598
19587
  // We still need to know them so that we can do namespace
19599
19588
  // checks properly in case one wants to add them to
19600
19589
  // 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
-
19590
+ 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']);
19591
+ 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
19592
  // Similarly to SVG, we want to know all MathML elements,
19605
19593
  // 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']);
19594
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
19595
+ const text = freeze(['#text']);
19608
19596
 
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']);
19597
+ 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']);
19598
+ 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']);
19599
+ 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']);
19600
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
19613
19601
 
19614
19602
  // 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
19603
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
19604
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
19605
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
19606
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
19607
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
19608
+ 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
19609
  );
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
19610
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
19611
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
19624
19612
  );
19625
- var DOCTYPE_NAME = seal(/^html$/i);
19626
- var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
19613
+ const DOCTYPE_NAME = seal(/^html$/i);
19614
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
19615
+
19616
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
19617
+ __proto__: null,
19618
+ ARIA_ATTR: ARIA_ATTR,
19619
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
19620
+ CUSTOM_ELEMENT: CUSTOM_ELEMENT,
19621
+ DATA_ATTR: DATA_ATTR,
19622
+ DOCTYPE_NAME: DOCTYPE_NAME,
19623
+ ERB_EXPR: ERB_EXPR,
19624
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
19625
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
19626
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
19627
+ TMPLIT_EXPR: TMPLIT_EXPR
19628
+ });
19627
19629
 
19628
- var getGlobal = function getGlobal() {
19630
+ /* eslint-disable @typescript-eslint/indent */
19631
+ // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
19632
+ const NODE_TYPE = {
19633
+ element: 1,
19634
+ attribute: 2,
19635
+ text: 3,
19636
+ cdataSection: 4,
19637
+ entityReference: 5,
19638
+ // Deprecated
19639
+ entityNode: 6,
19640
+ // Deprecated
19641
+ progressingInstruction: 7,
19642
+ comment: 8,
19643
+ document: 9,
19644
+ documentType: 10,
19645
+ documentFragment: 11,
19646
+ notation: 12 // Deprecated
19647
+ };
19648
+ const getGlobal = function getGlobal() {
19629
19649
  return typeof window === 'undefined' ? null : window;
19630
19650
  };
19631
-
19632
19651
  /**
19633
19652
  * Creates a no-op policy for internal use only.
19634
19653
  * 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).
19654
+ * @param trustedTypes The policy factory.
19655
+ * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
19656
+ * @return The policy created (or null, if Trusted Types
19657
+ * are not supported or creating the policy failed).
19639
19658
  */
19640
- var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
19641
- if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
19659
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
19660
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
19642
19661
  return null;
19643
19662
  }
19644
-
19645
19663
  // Allow the callers to control the unique policy name
19646
19664
  // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
19647
19665
  // 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);
19666
+ let suffix = null;
19667
+ const ATTR_NAME = 'data-tt-policy-suffix';
19668
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
19669
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
19652
19670
  }
19653
- var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
19671
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
19654
19672
  try {
19655
19673
  return trustedTypes.createPolicy(policyName, {
19656
- createHTML: function createHTML(html) {
19674
+ createHTML(html) {
19657
19675
  return html;
19658
19676
  },
19659
- createScriptURL: function createScriptURL(scriptUrl) {
19677
+ createScriptURL(scriptUrl) {
19660
19678
  return scriptUrl;
19661
19679
  }
19662
19680
  });
@@ -19668,47 +19686,52 @@ var purify = {exports: {}};
19668
19686
  return null;
19669
19687
  }
19670
19688
  };
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);
19689
+ const _createHooksMap = function _createHooksMap() {
19690
+ return {
19691
+ afterSanitizeAttributes: [],
19692
+ afterSanitizeElements: [],
19693
+ afterSanitizeShadowDOM: [],
19694
+ beforeSanitizeAttributes: [],
19695
+ beforeSanitizeElements: [],
19696
+ beforeSanitizeShadowDOM: [],
19697
+ uponSanitizeAttribute: [],
19698
+ uponSanitizeElement: [],
19699
+ uponSanitizeShadowNode: []
19675
19700
  };
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
- */
19701
+ };
19702
+ function createDOMPurify() {
19703
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
19704
+ const DOMPurify = root => createDOMPurify(root);
19705
+ DOMPurify.version = '3.2.5';
19687
19706
  DOMPurify.removed = [];
19688
- if (!window || !window.document || window.document.nodeType !== 9) {
19707
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
19689
19708
  // Not running in a browser, provide a factory function
19690
19709
  // so that you can pass your own Window
19691
19710
  DOMPurify.isSupported = false;
19692
19711
  return DOMPurify;
19693
19712
  }
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
-
19713
+ let {
19714
+ document
19715
+ } = window;
19716
+ const originalDocument = document;
19717
+ const currentScript = originalDocument.currentScript;
19718
+ const {
19719
+ DocumentFragment,
19720
+ HTMLTemplateElement,
19721
+ Node,
19722
+ Element,
19723
+ NodeFilter,
19724
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
19725
+ HTMLFormElement,
19726
+ DOMParser,
19727
+ trustedTypes
19728
+ } = window;
19729
+ const ElementPrototype = Element.prototype;
19730
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
19731
+ const remove = lookupGetter(ElementPrototype, 'remove');
19732
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
19733
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
19734
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
19712
19735
  // As per issue #47, the web-components registry is inherited by a
19713
19736
  // new document created via createHTMLDocument. As per the spec
19714
19737
  // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
@@ -19716,59 +19739,57 @@ var purify = {exports: {}};
19716
19739
  // document, so we use that as our parent document to ensure nothing
19717
19740
  // is inherited.
19718
19741
  if (typeof HTMLTemplateElement === 'function') {
19719
- var template = document.createElement('template');
19742
+ const template = document.createElement('template');
19720
19743
  if (template.content && template.content.ownerDocument) {
19721
19744
  document = template.content.ownerDocument;
19722
19745
  }
19723
19746
  }
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
-
19747
+ let trustedTypesPolicy;
19748
+ let emptyHTML = '';
19749
+ const {
19750
+ implementation,
19751
+ createNodeIterator,
19752
+ createDocumentFragment,
19753
+ getElementsByTagName
19754
+ } = document;
19755
+ const {
19756
+ importNode
19757
+ } = originalDocument;
19758
+ let hooks = _createHooksMap();
19738
19759
  /**
19739
19760
  * Expose whether this browser supports running the full DOMPurify.
19740
19761
  */
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
-
19762
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
19763
+ const {
19764
+ MUSTACHE_EXPR,
19765
+ ERB_EXPR,
19766
+ TMPLIT_EXPR,
19767
+ DATA_ATTR,
19768
+ ARIA_ATTR,
19769
+ IS_SCRIPT_OR_DATA,
19770
+ ATTR_WHITESPACE,
19771
+ CUSTOM_ELEMENT
19772
+ } = EXPRESSIONS;
19773
+ let {
19774
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
19775
+ } = EXPRESSIONS;
19752
19776
  /**
19753
19777
  * We consider the elements and attributes below to be safe. Ideally
19754
19778
  * don't add any new ones but feel free to remove unwanted ones.
19755
19779
  */
19756
-
19757
19780
  /* 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
-
19781
+ let ALLOWED_TAGS = null;
19782
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
19761
19783
  /* Allowed attribute names */
19762
- var ALLOWED_ATTR = null;
19763
- var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
19764
-
19784
+ let ALLOWED_ATTR = null;
19785
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
19765
19786
  /*
19766
- * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
19787
+ * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.
19767
19788
  * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
19768
19789
  * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
19769
19790
  * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
19770
19791
  */
19771
- var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
19792
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
19772
19793
  tagNameCheck: {
19773
19794
  writable: true,
19774
19795
  configurable: false,
@@ -19788,65 +19809,49 @@ var purify = {exports: {}};
19788
19809
  value: false
19789
19810
  }
19790
19811
  }));
19791
-
19792
19812
  /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
19793
- var FORBID_TAGS = null;
19794
-
19813
+ let FORBID_TAGS = null;
19795
19814
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
19796
- var FORBID_ATTR = null;
19797
-
19815
+ let FORBID_ATTR = null;
19798
19816
  /* Decide if ARIA attributes are okay */
19799
- var ALLOW_ARIA_ATTR = true;
19800
-
19817
+ let ALLOW_ARIA_ATTR = true;
19801
19818
  /* Decide if custom data attributes are okay */
19802
- var ALLOW_DATA_ATTR = true;
19803
-
19819
+ let ALLOW_DATA_ATTR = true;
19804
19820
  /* Decide if unknown protocols are okay */
19805
- var ALLOW_UNKNOWN_PROTOCOLS = false;
19806
-
19821
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
19807
19822
  /* Decide if self-closing tags in attributes are allowed.
19808
19823
  * Usually removed due to a mXSS issue in jQuery 3.0 */
19809
- var ALLOW_SELF_CLOSE_IN_ATTR = true;
19810
-
19824
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
19811
19825
  /* Output should be safe for common template engines.
19812
19826
  * This means, DOMPurify removes data attributes, mustaches and ERB
19813
19827
  */
19814
- var SAFE_FOR_TEMPLATES = false;
19815
-
19828
+ let SAFE_FOR_TEMPLATES = false;
19816
19829
  /* Output should be safe even for XML used within HTML and alike.
19817
19830
  * This means, DOMPurify removes comments when containing risky content.
19818
19831
  */
19819
- var SAFE_FOR_XML = true;
19820
-
19832
+ let SAFE_FOR_XML = true;
19821
19833
  /* Decide if document with <html>... should be returned */
19822
- var WHOLE_DOCUMENT = false;
19823
-
19834
+ let WHOLE_DOCUMENT = false;
19824
19835
  /* Track whether config is already set on this instance of DOMPurify. */
19825
- var SET_CONFIG = false;
19826
-
19836
+ let SET_CONFIG = false;
19827
19837
  /* Decide if all elements (e.g. style, script) must be children of
19828
19838
  * document.body. By default, browsers might move them to document.head */
19829
- var FORCE_BODY = false;
19830
-
19839
+ let FORCE_BODY = false;
19831
19840
  /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
19832
19841
  * string (or a TrustedHTML object if Trusted Types are supported).
19833
19842
  * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
19834
19843
  */
19835
- var RETURN_DOM = false;
19836
-
19844
+ let RETURN_DOM = false;
19837
19845
  /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
19838
19846
  * string (or a TrustedHTML object if Trusted Types are supported) */
19839
- var RETURN_DOM_FRAGMENT = false;
19840
-
19847
+ let RETURN_DOM_FRAGMENT = false;
19841
19848
  /* Try to return a Trusted Type object instead of a string, return a string in
19842
19849
  * case Trusted Types are not supported */
19843
- var RETURN_TRUSTED_TYPE = false;
19844
-
19850
+ let RETURN_TRUSTED_TYPE = false;
19845
19851
  /* Output should be free from DOM clobbering attacks?
19846
19852
  * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
19847
19853
  */
19848
- var SANITIZE_DOM = true;
19849
-
19854
+ let SANITIZE_DOM = true;
19850
19855
  /* Achieve full DOM Clobbering protection by isolating the namespace of named
19851
19856
  * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
19852
19857
  *
@@ -19860,105 +19865,85 @@ var purify = {exports: {}};
19860
19865
  * Namespace isolation is implemented by prefixing `id` and `name` attributes
19861
19866
  * with a constant string, i.e., `user-content-`
19862
19867
  */
19863
- var SANITIZE_NAMED_PROPS = false;
19864
- var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
19865
-
19868
+ let SANITIZE_NAMED_PROPS = false;
19869
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
19866
19870
  /* Keep element content when removing element? */
19867
- var KEEP_CONTENT = true;
19868
-
19871
+ let KEEP_CONTENT = true;
19869
19872
  /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
19870
19873
  * of importing it into a new Document and returning a sanitized copy */
19871
- var IN_PLACE = false;
19872
-
19874
+ let IN_PLACE = false;
19873
19875
  /* Allow usage of profiles like html, svg and mathMl */
19874
- var USE_PROFILES = {};
19875
-
19876
+ let USE_PROFILES = {};
19876
19877
  /* 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
-
19878
+ let FORBID_CONTENTS = null;
19879
+ 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
19880
  /* 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
-
19881
+ let DATA_URI_TAGS = null;
19882
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
19884
19883
  /* 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';
19884
+ let URI_SAFE_ATTRIBUTES = null;
19885
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
19886
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
19887
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
19888
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
19890
19889
  /* Document namespace */
19891
- var NAMESPACE = HTML_NAMESPACE;
19892
- var IS_EMPTY_INPUT = false;
19893
-
19890
+ let NAMESPACE = HTML_NAMESPACE;
19891
+ let IS_EMPTY_INPUT = false;
19894
19892
  /* Allowed XHTML+XML namespaces */
19895
- var ALLOWED_NAMESPACES = null;
19896
- var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
19897
-
19893
+ let ALLOWED_NAMESPACES = null;
19894
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
19895
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
19896
+ let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
19897
+ // Certain elements are allowed in both SVG and HTML
19898
+ // namespace. We need to specify them explicitly
19899
+ // so that they don't get erroneously deleted from
19900
+ // HTML namespace.
19901
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
19898
19902
  /* 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
-
19903
+ let PARSER_MEDIA_TYPE = null;
19904
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
19905
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
19906
+ let transformCaseFunc = null;
19904
19907
  /* Keep a reference to config to pass to hooks */
19905
- var CONFIG = null;
19906
-
19908
+ let CONFIG = null;
19907
19909
  /* Ideally, do not touch anything below this line */
19908
19910
  /* ______________________________________________ */
19909
-
19910
- var formElement = document.createElement('form');
19911
- var isRegexOrFunction = function isRegexOrFunction(testValue) {
19911
+ const formElement = document.createElement('form');
19912
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
19912
19913
  return testValue instanceof RegExp || testValue instanceof Function;
19913
19914
  };
19914
-
19915
19915
  /**
19916
19916
  * _parseConfig
19917
19917
  *
19918
- * @param {Object} cfg optional config literal
19918
+ * @param cfg optional config literal
19919
19919
  */
19920
19920
  // eslint-disable-next-line complexity
19921
- var _parseConfig = function _parseConfig(cfg) {
19921
+ const _parseConfig = function _parseConfig() {
19922
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19922
19923
  if (CONFIG && CONFIG === cfg) {
19923
19924
  return;
19924
19925
  }
19925
-
19926
19926
  /* Shield configuration object from tampering */
19927
- if (!cfg || _typeof(cfg) !== 'object') {
19927
+ if (!cfg || typeof cfg !== 'object') {
19928
19928
  cfg = {};
19929
19929
  }
19930
-
19931
19930
  /* Shield configuration object from prototype pollution */
19932
19931
  cfg = clone(cfg);
19933
19932
  PARSER_MEDIA_TYPE =
19934
19933
  // 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
-
19934
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
19937
19935
  // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
19938
19936
  transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
19939
-
19940
19937
  /* 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;
19938
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
19939
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
19940
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
19941
+ 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;
19942
+ 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;
19943
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
19944
+ FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
19945
+ FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
19946
+ USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
19962
19947
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
19963
19948
  ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
19964
19949
  ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
@@ -19974,8 +19959,10 @@ var purify = {exports: {}};
19974
19959
  SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
19975
19960
  KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
19976
19961
  IN_PLACE = cfg.IN_PLACE || false; // Default false
19977
- IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
19962
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
19978
19963
  NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
19964
+ MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
19965
+ HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
19979
19966
  CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
19980
19967
  if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
19981
19968
  CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
@@ -19992,10 +19979,9 @@ var purify = {exports: {}};
19992
19979
  if (RETURN_DOM_FRAGMENT) {
19993
19980
  RETURN_DOM = true;
19994
19981
  }
19995
-
19996
19982
  /* Parse profile info */
19997
19983
  if (USE_PROFILES) {
19998
- ALLOWED_TAGS = addToSet({}, _toConsumableArray(text));
19984
+ ALLOWED_TAGS = addToSet({}, text);
19999
19985
  ALLOWED_ATTR = [];
20000
19986
  if (USE_PROFILES.html === true) {
20001
19987
  addToSet(ALLOWED_TAGS, html$1);
@@ -20017,7 +20003,6 @@ var purify = {exports: {}};
20017
20003
  addToSet(ALLOWED_ATTR, xml);
20018
20004
  }
20019
20005
  }
20020
-
20021
20006
  /* Merge configuration parameters */
20022
20007
  if (cfg.ADD_TAGS) {
20023
20008
  if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
@@ -20040,23 +20025,40 @@ var purify = {exports: {}};
20040
20025
  }
20041
20026
  addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
20042
20027
  }
20043
-
20044
20028
  /* Add #text in case KEEP_CONTENT is set to true */
20045
20029
  if (KEEP_CONTENT) {
20046
20030
  ALLOWED_TAGS['#text'] = true;
20047
20031
  }
20048
-
20049
20032
  /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
20050
20033
  if (WHOLE_DOCUMENT) {
20051
20034
  addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
20052
20035
  }
20053
-
20054
20036
  /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
20055
20037
  if (ALLOWED_TAGS.table) {
20056
20038
  addToSet(ALLOWED_TAGS, ['tbody']);
20057
20039
  delete FORBID_TAGS.tbody;
20058
20040
  }
20059
-
20041
+ if (cfg.TRUSTED_TYPES_POLICY) {
20042
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
20043
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
20044
+ }
20045
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
20046
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
20047
+ }
20048
+ // Overwrite existing TrustedTypes policy.
20049
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
20050
+ // Sign local variables required by `sanitize`.
20051
+ emptyHTML = trustedTypesPolicy.createHTML('');
20052
+ } else {
20053
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
20054
+ if (trustedTypesPolicy === undefined) {
20055
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
20056
+ }
20057
+ // If creating the internal policy succeeded sign internal variables.
20058
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
20059
+ emptyHTML = trustedTypesPolicy.createHTML('');
20060
+ }
20061
+ }
20060
20062
  // Prevent further manipulation of configuration.
20061
20063
  // Not available in IE8, Safari 5, etc.
20062
20064
  if (freeze) {
@@ -20064,35 +20066,19 @@ var purify = {exports: {}};
20064
20066
  }
20065
20067
  CONFIG = cfg;
20066
20068
  };
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
20069
  /* Keep track of all possible SVG and MathML tags
20077
20070
  * so that we can perform the namespace checks
20078
20071
  * 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
-
20072
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
20073
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
20085
20074
  /**
20086
- *
20087
- *
20088
- * @param {Element} element a DOM element whose namespace is being checked
20089
- * @returns {boolean} Return false if the element has a
20075
+ * @param element a DOM element whose namespace is being checked
20076
+ * @returns Return false if the element has a
20090
20077
  * namespace that a spec-compliant parser would never
20091
20078
  * return. Return true otherwise.
20092
20079
  */
20093
- var _checkValidNamespace = function _checkValidNamespace(element) {
20094
- var parent = getParentNode(element);
20095
-
20080
+ const _checkValidNamespace = function _checkValidNamespace(element) {
20081
+ let parent = getParentNode(element);
20096
20082
  // In JSDOM, if we're inside shadow DOM, then parentNode
20097
20083
  // can be null. We just simulate parent in this case.
20098
20084
  if (!parent || !parent.tagName) {
@@ -20101,8 +20087,8 @@ var purify = {exports: {}};
20101
20087
  tagName: 'template'
20102
20088
  };
20103
20089
  }
20104
- var tagName = stringToLowerCase(element.tagName);
20105
- var parentTagName = stringToLowerCase(parent.tagName);
20090
+ const tagName = stringToLowerCase(element.tagName);
20091
+ const parentTagName = stringToLowerCase(parent.tagName);
20106
20092
  if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
20107
20093
  return false;
20108
20094
  }
@@ -20113,14 +20099,12 @@ var purify = {exports: {}};
20113
20099
  if (parent.namespaceURI === HTML_NAMESPACE) {
20114
20100
  return tagName === 'svg';
20115
20101
  }
20116
-
20117
20102
  // The only way to switch from MathML to SVG is via`
20118
20103
  // svg if parent is either <annotation-xml> or MathML
20119
20104
  // text integration points.
20120
20105
  if (parent.namespaceURI === MATHML_NAMESPACE) {
20121
20106
  return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
20122
20107
  }
20123
-
20124
20108
  // We only allow elements that are defined in SVG
20125
20109
  // spec. All others are disallowed in SVG namespace.
20126
20110
  return Boolean(ALL_SVG_TAGS[tagName]);
@@ -20132,13 +20116,11 @@ var purify = {exports: {}};
20132
20116
  if (parent.namespaceURI === HTML_NAMESPACE) {
20133
20117
  return tagName === 'math';
20134
20118
  }
20135
-
20136
20119
  // The only way to switch from SVG to MathML is via
20137
20120
  // <math> and HTML integration points
20138
20121
  if (parent.namespaceURI === SVG_NAMESPACE) {
20139
20122
  return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
20140
20123
  }
20141
-
20142
20124
  // We only allow elements that are defined in MathML
20143
20125
  // spec. All others are disallowed in MathML namespace.
20144
20126
  return Boolean(ALL_MATHML_TAGS[tagName]);
@@ -20153,101 +20135,90 @@ var purify = {exports: {}};
20153
20135
  if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
20154
20136
  return false;
20155
20137
  }
20156
-
20157
20138
  // We disallow tags that are specific for MathML
20158
20139
  // or SVG and should never appear in HTML namespace
20159
20140
  return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
20160
20141
  }
20161
-
20162
20142
  // For XHTML and XML documents that support custom namespaces
20163
20143
  if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
20164
20144
  return true;
20165
20145
  }
20166
-
20167
20146
  // The code should never reach this place (this means
20168
20147
  // that the element somehow got namespace that is not
20169
20148
  // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
20170
20149
  // Return false just in case.
20171
20150
  return false;
20172
20151
  };
20173
-
20174
20152
  /**
20175
20153
  * _forceRemove
20176
20154
  *
20177
- * @param {Node} node a DOM node
20155
+ * @param node a DOM node
20178
20156
  */
20179
- var _forceRemove = function _forceRemove(node) {
20157
+ const _forceRemove = function _forceRemove(node) {
20180
20158
  arrayPush(DOMPurify.removed, {
20181
20159
  element: node
20182
20160
  });
20183
20161
  try {
20184
20162
  // eslint-disable-next-line unicorn/prefer-dom-node-remove
20185
- node.parentNode.removeChild(node);
20163
+ getParentNode(node).removeChild(node);
20186
20164
  } catch (_) {
20187
- try {
20188
- node.outerHTML = emptyHTML;
20189
- } catch (_) {
20190
- node.remove();
20191
- }
20165
+ remove(node);
20192
20166
  }
20193
20167
  };
20194
-
20195
20168
  /**
20196
20169
  * _removeAttribute
20197
20170
  *
20198
- * @param {String} name an Attribute name
20199
- * @param {Node} node a DOM node
20171
+ * @param name an Attribute name
20172
+ * @param element a DOM node
20200
20173
  */
20201
- var _removeAttribute = function _removeAttribute(name, node) {
20174
+ const _removeAttribute = function _removeAttribute(name, element) {
20202
20175
  try {
20203
20176
  arrayPush(DOMPurify.removed, {
20204
- attribute: node.getAttributeNode(name),
20205
- from: node
20177
+ attribute: element.getAttributeNode(name),
20178
+ from: element
20206
20179
  });
20207
20180
  } catch (_) {
20208
20181
  arrayPush(DOMPurify.removed, {
20209
20182
  attribute: null,
20210
- from: node
20183
+ from: element
20211
20184
  });
20212
20185
  }
20213
- node.removeAttribute(name);
20214
-
20215
- // We void attribute values for unremovable "is"" attributes
20216
- if (name === 'is' && !ALLOWED_ATTR[name]) {
20186
+ element.removeAttribute(name);
20187
+ // We void attribute values for unremovable "is" attributes
20188
+ if (name === 'is') {
20217
20189
  if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
20218
20190
  try {
20219
- _forceRemove(node);
20191
+ _forceRemove(element);
20220
20192
  } catch (_) {}
20221
20193
  } else {
20222
20194
  try {
20223
- node.setAttribute(name, '');
20195
+ element.setAttribute(name, '');
20224
20196
  } catch (_) {}
20225
20197
  }
20226
20198
  }
20227
20199
  };
20228
-
20229
20200
  /**
20230
20201
  * _initDocument
20231
20202
  *
20232
- * @param {String} dirty a string of dirty markup
20233
- * @return {Document} a DOM, filled with the dirty markup
20203
+ * @param dirty - a string of dirty markup
20204
+ * @return a DOM, filled with the dirty markup
20234
20205
  */
20235
- var _initDocument = function _initDocument(dirty) {
20206
+ const _initDocument = function _initDocument(dirty) {
20236
20207
  /* Create a HTML document */
20237
- var doc;
20238
- var leadingWhitespace;
20208
+ let doc = null;
20209
+ let leadingWhitespace = null;
20239
20210
  if (FORCE_BODY) {
20240
20211
  dirty = '<remove></remove>' + dirty;
20241
20212
  } else {
20242
20213
  /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
20243
- var matches = stringMatch(dirty, /^[\r\n\t ]+/);
20214
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
20244
20215
  leadingWhitespace = matches && matches[0];
20245
20216
  }
20246
20217
  if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
20247
20218
  // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
20248
20219
  dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
20249
20220
  }
20250
- var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
20221
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
20251
20222
  /*
20252
20223
  * Use the DOMParser API by default, fallback later if needs be
20253
20224
  * DOMParser not work for svg when has multiple root element.
@@ -20257,7 +20228,6 @@ var purify = {exports: {}};
20257
20228
  doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
20258
20229
  } catch (_) {}
20259
20230
  }
20260
-
20261
20231
  /* Use createHTMLDocument in case DOMParser is not available */
20262
20232
  if (!doc || !doc.documentElement) {
20263
20233
  doc = implementation.createDocument(NAMESPACE, 'template', null);
@@ -20267,144 +20237,109 @@ var purify = {exports: {}};
20267
20237
  // Syntax error if dirtyPayload is invalid xml
20268
20238
  }
20269
20239
  }
20270
- var body = doc.body || doc.documentElement;
20240
+ const body = doc.body || doc.documentElement;
20271
20241
  if (dirty && leadingWhitespace) {
20272
20242
  body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
20273
20243
  }
20274
-
20275
20244
  /* Work on whole document or just its body */
20276
20245
  if (NAMESPACE === HTML_NAMESPACE) {
20277
20246
  return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
20278
20247
  }
20279
20248
  return WHOLE_DOCUMENT ? doc.documentElement : body;
20280
20249
  };
20281
-
20282
20250
  /**
20283
- * _createIterator
20251
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
20284
20252
  *
20285
- * @param {Document} root document/fragment to create iterator for
20286
- * @return {Iterator} iterator instance
20253
+ * @param root The root element or node to start traversing on.
20254
+ * @return The created NodeIterator
20287
20255
  */
20288
- var _createIterator = function _createIterator(root) {
20256
+ const _createNodeIterator = function _createNodeIterator(root) {
20289
20257
  return createNodeIterator.call(root.ownerDocument || root, root,
20290
20258
  // 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);
20259
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
20292
20260
  };
20293
-
20294
20261
  /**
20295
20262
  * _isClobbered
20296
20263
  *
20297
- * @param {Node} elm element to check for clobbering attacks
20298
- * @return {Boolean} true if clobbered, false if safe
20264
+ * @param element element to check for clobbering attacks
20265
+ * @return true if clobbered, false if safe
20299
20266
  */
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');
20267
+ const _isClobbered = function _isClobbered(element) {
20268
+ 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
20269
  };
20303
-
20304
20270
  /**
20305
- * _isNode
20271
+ * Checks whether the given object is a DOM node.
20306
20272
  *
20307
- * @param {Node} obj object to check whether it's a DOM node
20308
- * @return {Boolean} true is object is a DOM node
20273
+ * @param value object to check whether it's a DOM node
20274
+ * @return true is object is a DOM node
20309
20275
  */
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';
20276
+ const _isNode = function _isNode(value) {
20277
+ return typeof Node === 'function' && value instanceof Node;
20312
20278
  };
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) {
20279
+ function _executeHooks(hooks, currentNode, data) {
20280
+ arrayForEach(hooks, hook => {
20327
20281
  hook.call(DOMPurify, currentNode, data, CONFIG);
20328
20282
  });
20329
- };
20330
-
20283
+ }
20331
20284
  /**
20332
20285
  * _sanitizeElements
20333
20286
  *
20334
20287
  * @protect nodeName
20335
20288
  * @protect textContent
20336
20289
  * @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
20290
+ * @param currentNode to check for permission to exist
20291
+ * @return true if node was killed, false if left alive
20340
20292
  */
20341
- var _sanitizeElements = function _sanitizeElements(currentNode) {
20342
- var content;
20343
-
20293
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
20294
+ let content = null;
20344
20295
  /* Execute a hook if present */
20345
- _executeHook('beforeSanitizeElements', currentNode, null);
20346
-
20296
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
20347
20297
  /* Check if element is clobbered or can clobber */
20348
20298
  if (_isClobbered(currentNode)) {
20349
20299
  _forceRemove(currentNode);
20350
20300
  return true;
20351
20301
  }
20352
-
20353
- /* Check if tagname contains Unicode */
20354
- if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
20355
- _forceRemove(currentNode);
20356
- return true;
20357
- }
20358
-
20359
20302
  /* Now let's check the element's type and name */
20360
- var tagName = transformCaseFunc(currentNode.nodeName);
20361
-
20303
+ const tagName = transformCaseFunc(currentNode.nodeName);
20362
20304
  /* Execute a hook if present */
20363
- _executeHook('uponSanitizeElement', currentNode, {
20364
- tagName: tagName,
20305
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
20306
+ tagName,
20365
20307
  allowedTags: ALLOWED_TAGS
20366
20308
  });
20367
-
20368
20309
  /* 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)) {
20310
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
20370
20311
  _forceRemove(currentNode);
20371
20312
  return true;
20372
20313
  }
20373
-
20374
- /* Mitigate a problem with templates inside select */
20375
- if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) {
20314
+ /* Remove any occurrence of processing instructions */
20315
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
20376
20316
  _forceRemove(currentNode);
20377
20317
  return true;
20378
20318
  }
20379
-
20380
- /* Remove any ocurrence of processing instructions */
20381
- if (currentNode.nodeType === 7) {
20382
- _forceRemove(currentNode);
20383
- return true;
20384
- }
20385
-
20386
20319
  /* Remove any kind of possibly harmful comments */
20387
- if (SAFE_FOR_XML && currentNode.nodeType === 8 && regExpTest(/<[/\w]/g, currentNode.data)) {
20320
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
20388
20321
  _forceRemove(currentNode);
20389
20322
  return true;
20390
20323
  }
20391
-
20392
20324
  /* Remove element if anything forbids its presence */
20393
20325
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
20394
20326
  /* 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;
20327
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
20328
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
20329
+ return false;
20330
+ }
20331
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
20332
+ return false;
20333
+ }
20398
20334
  }
20399
-
20400
20335
  /* Keep content except for bad-listed elements */
20401
20336
  if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
20402
- var parentNode = getParentNode(currentNode) || currentNode.parentNode;
20403
- var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
20337
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
20338
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
20404
20339
  if (childNodes && parentNode) {
20405
- var childCount = childNodes.length;
20406
- for (var i = childCount - 1; i >= 0; --i) {
20407
- var childClone = cloneNode(childNodes[i], true);
20340
+ const childCount = childNodes.length;
20341
+ for (let i = childCount - 1; i >= 0; --i) {
20342
+ const childClone = cloneNode(childNodes[i], true);
20408
20343
  childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
20409
20344
  parentNode.insertBefore(childClone, getNextSibling(currentNode));
20410
20345
  }
@@ -20413,26 +20348,23 @@ var purify = {exports: {}};
20413
20348
  _forceRemove(currentNode);
20414
20349
  return true;
20415
20350
  }
20416
-
20417
20351
  /* Check whether element has a valid namespace */
20418
20352
  if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
20419
20353
  _forceRemove(currentNode);
20420
20354
  return true;
20421
20355
  }
20422
-
20423
20356
  /* Make sure that older browsers don't get fallback-tag mXSS */
20424
20357
  if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
20425
20358
  _forceRemove(currentNode);
20426
20359
  return true;
20427
20360
  }
20428
-
20429
20361
  /* Sanitize element content to be template-safe */
20430
- if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
20362
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
20431
20363
  /* Get the element's text content */
20432
20364
  content = currentNode.textContent;
20433
- content = stringReplace(content, MUSTACHE_EXPR$1, ' ');
20434
- content = stringReplace(content, ERB_EXPR$1, ' ');
20435
- content = stringReplace(content, TMPLIT_EXPR$1, ' ');
20365
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
20366
+ content = stringReplace(content, expr, ' ');
20367
+ });
20436
20368
  if (currentNode.textContent !== content) {
20437
20369
  arrayPush(DOMPurify.removed, {
20438
20370
  element: currentNode.cloneNode()
@@ -20440,59 +20372,56 @@ var purify = {exports: {}};
20440
20372
  currentNode.textContent = content;
20441
20373
  }
20442
20374
  }
20443
-
20444
20375
  /* Execute a hook if present */
20445
- _executeHook('afterSanitizeElements', currentNode, null);
20376
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
20446
20377
  return false;
20447
20378
  };
20448
-
20449
20379
  /**
20450
20380
  * _isValidAttribute
20451
20381
  *
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.
20382
+ * @param lcTag Lowercase tag name of containing element.
20383
+ * @param lcName Lowercase attribute name.
20384
+ * @param value Attribute value.
20385
+ * @return Returns true if `value` is valid, otherwise false.
20456
20386
  */
20457
20387
  // eslint-disable-next-line complexity
20458
- var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
20388
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
20459
20389
  /* Make sure attribute cannot clobber */
20460
20390
  if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
20461
20391
  return false;
20462
20392
  }
20463
-
20464
20393
  /* Allow valid data-* attributes: At least one character after "-"
20465
20394
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
20466
20395
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
20467
20396
  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]) {
20397
+ 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
20398
  if (
20470
20399
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
20471
20400
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
20472
20401
  // 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)) ||
20402
+ _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
20403
  // Alternative, second condition checks if it's an `is`-attribute, AND
20475
20404
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
20476
20405
  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
20406
  return false;
20478
20407
  }
20479
20408
  /* 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) {
20409
+ } 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
20410
  return false;
20482
20411
  } else ;
20483
20412
  return true;
20484
20413
  };
20485
-
20486
20414
  /**
20487
- * _basicCustomElementCheck
20415
+ * _isBasicCustomElement
20488
20416
  * checks if at least one dash is included in tagName, and it's not the first char
20489
20417
  * 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
20418
+ *
20419
+ * @param tagName name of the tag of the node to sanitize
20420
+ * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
20491
20421
  */
20492
- var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
20493
- return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT$1);
20422
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
20423
+ return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
20494
20424
  };
20495
-
20496
20425
  /**
20497
20426
  * _sanitizeAttributes
20498
20427
  *
@@ -20501,97 +20430,85 @@ var purify = {exports: {}};
20501
20430
  * @protect removeAttribute
20502
20431
  * @protect setAttribute
20503
20432
  *
20504
- * @param {Node} currentNode to sanitize
20433
+ * @param currentNode to sanitize
20505
20434
  */
20506
- var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
20507
- var attr;
20508
- var value;
20509
- var lcName;
20510
- var l;
20435
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
20511
20436
  /* Execute a hook if present */
20512
- _executeHook('beforeSanitizeAttributes', currentNode, null);
20513
- var attributes = currentNode.attributes;
20514
-
20437
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
20438
+ const {
20439
+ attributes
20440
+ } = currentNode;
20515
20441
  /* Check if we have attributes; if not we might have a text node */
20516
- if (!attributes) {
20442
+ if (!attributes || _isClobbered(currentNode)) {
20517
20443
  return;
20518
20444
  }
20519
- var hookEvent = {
20445
+ const hookEvent = {
20520
20446
  attrName: '',
20521
20447
  attrValue: '',
20522
20448
  keepAttr: true,
20523
- allowedAttributes: ALLOWED_ATTR
20449
+ allowedAttributes: ALLOWED_ATTR,
20450
+ forceKeepAttr: undefined
20524
20451
  };
20525
- l = attributes.length;
20526
-
20452
+ let l = attributes.length;
20527
20453
  /* Go backwards over all attributes; safely remove bad ones */
20528
20454
  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
-
20455
+ const attr = attributes[l];
20456
+ const {
20457
+ name,
20458
+ namespaceURI,
20459
+ value: attrValue
20460
+ } = attr;
20461
+ const lcName = transformCaseFunc(name);
20462
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
20536
20463
  /* Execute a hook if present */
20537
20464
  hookEvent.attrName = lcName;
20538
20465
  hookEvent.attrValue = value;
20539
20466
  hookEvent.keepAttr = true;
20540
20467
  hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
20541
- _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
20468
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
20542
20469
  value = hookEvent.attrValue;
20543
-
20470
+ /* Full DOM Clobbering protection via namespace isolation,
20471
+ * Prefix id and name attributes with `user-content-`
20472
+ */
20473
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
20474
+ // Remove the attribute with this value
20475
+ _removeAttribute(name, currentNode);
20476
+ // Prefix the value and later re-create the attribute with the sanitized value
20477
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
20478
+ }
20544
20479
  /* Work around a security issue with comments inside attributes */
20545
20480
  if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
20546
20481
  _removeAttribute(name, currentNode);
20547
20482
  continue;
20548
20483
  }
20549
-
20550
20484
  /* Did the hooks approve of the attribute? */
20551
20485
  if (hookEvent.forceKeepAttr) {
20552
20486
  continue;
20553
20487
  }
20554
-
20555
20488
  /* Remove attribute */
20556
20489
  _removeAttribute(name, currentNode);
20557
-
20558
20490
  /* Did the hooks approve of the attribute? */
20559
20491
  if (!hookEvent.keepAttr) {
20560
20492
  continue;
20561
20493
  }
20562
-
20563
20494
  /* Work around a security issue in jQuery 3.0 */
20564
20495
  if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
20565
20496
  _removeAttribute(name, currentNode);
20566
20497
  continue;
20567
20498
  }
20568
-
20569
20499
  /* Sanitize attribute content to be template-safe */
20570
20500
  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, ' ');
20501
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
20502
+ value = stringReplace(value, expr, ' ');
20503
+ });
20574
20504
  }
20575
-
20576
20505
  /* Is `value` valid for this attribute? */
20577
- var lcTag = transformCaseFunc(currentNode.nodeName);
20506
+ const lcTag = transformCaseFunc(currentNode.nodeName);
20578
20507
  if (!_isValidAttribute(lcTag, lcName, value)) {
20579
20508
  continue;
20580
20509
  }
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
20510
  /* Handle attributes that require Trusted Types */
20594
- if (trustedTypesPolicy && _typeof(trustedTypes) === 'object' && typeof trustedTypes.getAttributeType === 'function') {
20511
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
20595
20512
  if (namespaceURI) ; else {
20596
20513
  switch (trustedTypes.getAttributeType(lcTag, lcName)) {
20597
20514
  case 'TrustedHTML':
@@ -20607,7 +20524,6 @@ var purify = {exports: {}};
20607
20524
  }
20608
20525
  }
20609
20526
  }
20610
-
20611
20527
  /* Handle invalid data-* attribute set by try-catching it */
20612
20528
  try {
20613
20529
  if (namespaceURI) {
@@ -20623,59 +20539,41 @@ var purify = {exports: {}};
20623
20539
  }
20624
20540
  } catch (_) {}
20625
20541
  }
20626
-
20627
20542
  /* Execute a hook if present */
20628
- _executeHook('afterSanitizeAttributes', currentNode, null);
20543
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
20629
20544
  };
20630
-
20631
20545
  /**
20632
20546
  * _sanitizeShadowDOM
20633
20547
  *
20634
- * @param {DocumentFragment} fragment to iterate over recursively
20548
+ * @param fragment to iterate over recursively
20635
20549
  */
20636
- var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
20637
- var shadowNode;
20638
- var shadowIterator = _createIterator(fragment);
20639
-
20550
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
20551
+ let shadowNode = null;
20552
+ const shadowIterator = _createNodeIterator(fragment);
20640
20553
  /* Execute a hook if present */
20641
- _executeHook('beforeSanitizeShadowDOM', fragment, null);
20554
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
20642
20555
  while (shadowNode = shadowIterator.nextNode()) {
20643
20556
  /* Execute a hook if present */
20644
- _executeHook('uponSanitizeShadowNode', shadowNode, null);
20645
-
20557
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
20646
20558
  /* Sanitize tags and elements */
20647
- if (_sanitizeElements(shadowNode)) {
20648
- continue;
20649
- }
20650
-
20559
+ _sanitizeElements(shadowNode);
20560
+ /* Check attributes next */
20561
+ _sanitizeAttributes(shadowNode);
20651
20562
  /* Deep shadow DOM detected */
20652
20563
  if (shadowNode.content instanceof DocumentFragment) {
20653
20564
  _sanitizeShadowDOM(shadowNode.content);
20654
20565
  }
20655
-
20656
- /* Check attributes, sanitize if necessary */
20657
- _sanitizeAttributes(shadowNode);
20658
20566
  }
20659
-
20660
20567
  /* Execute a hook if present */
20661
- _executeHook('afterSanitizeShadowDOM', fragment, null);
20568
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
20662
20569
  };
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
20570
  // eslint-disable-next-line complexity
20672
20571
  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;
20572
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20573
+ let body = null;
20574
+ let importedNode = null;
20575
+ let currentNode = null;
20576
+ let returnNode = null;
20679
20577
  /* Make sure we have a string to sanitize.
20680
20578
  DO NOT return early, as this will return the wrong type if
20681
20579
  the user has requested a DOM object rather than a string */
@@ -20683,7 +20581,6 @@ var purify = {exports: {}};
20683
20581
  if (IS_EMPTY_INPUT) {
20684
20582
  dirty = '<!-->';
20685
20583
  }
20686
-
20687
20584
  /* Stringify, in case dirty is an object */
20688
20585
  if (typeof dirty !== 'string' && !_isNode(dirty)) {
20689
20586
  if (typeof dirty.toString === 'function') {
@@ -20695,28 +20592,16 @@ var purify = {exports: {}};
20695
20592
  throw typeErrorCreate('toString is not a function');
20696
20593
  }
20697
20594
  }
20698
-
20699
- /* Check we can run. Otherwise fall back or ignore */
20595
+ /* Return dirty HTML if DOMPurify cannot run */
20700
20596
  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
20597
  return dirty;
20710
20598
  }
20711
-
20712
20599
  /* Assign config vars */
20713
20600
  if (!SET_CONFIG) {
20714
20601
  _parseConfig(cfg);
20715
20602
  }
20716
-
20717
20603
  /* Clean up removed elements */
20718
20604
  DOMPurify.removed = [];
20719
-
20720
20605
  /* Check if dirty is correctly typed for IN_PLACE */
20721
20606
  if (typeof dirty === 'string') {
20722
20607
  IN_PLACE = false;
@@ -20724,7 +20609,7 @@ var purify = {exports: {}};
20724
20609
  if (IN_PLACE) {
20725
20610
  /* Do some early pre-sanitization to avoid unsafe root nodes */
20726
20611
  if (dirty.nodeName) {
20727
- var tagName = transformCaseFunc(dirty.nodeName);
20612
+ const tagName = transformCaseFunc(dirty.nodeName);
20728
20613
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
20729
20614
  throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
20730
20615
  }
@@ -20734,7 +20619,7 @@ var purify = {exports: {}};
20734
20619
  elements being stripped by the parser */
20735
20620
  body = _initDocument('<!---->');
20736
20621
  importedNode = body.ownerDocument.importNode(dirty, true);
20737
- if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
20622
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
20738
20623
  /* Node is already a body, use as is */
20739
20624
  body = importedNode;
20740
20625
  } else if (importedNode.nodeName === 'HTML') {
@@ -20750,52 +20635,34 @@ var purify = {exports: {}};
20750
20635
  dirty.indexOf('<') === -1) {
20751
20636
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
20752
20637
  }
20753
-
20754
20638
  /* Initialize the document to work on */
20755
20639
  body = _initDocument(dirty);
20756
-
20757
20640
  /* Check we have a DOM node from the data */
20758
20641
  if (!body) {
20759
20642
  return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
20760
20643
  }
20761
20644
  }
20762
-
20763
20645
  /* Remove first element node (ours) if FORCE_BODY is set */
20764
20646
  if (body && FORCE_BODY) {
20765
20647
  _forceRemove(body.firstChild);
20766
20648
  }
20767
-
20768
20649
  /* Get node iterator */
20769
- var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
20770
-
20650
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
20771
20651
  /* Now start iterating over the created document */
20772
20652
  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
20653
  /* Sanitize tags and elements */
20779
- if (_sanitizeElements(currentNode)) {
20780
- continue;
20781
- }
20782
-
20654
+ _sanitizeElements(currentNode);
20655
+ /* Check attributes next */
20656
+ _sanitizeAttributes(currentNode);
20783
20657
  /* Shadow DOM detected, sanitize it */
20784
20658
  if (currentNode.content instanceof DocumentFragment) {
20785
20659
  _sanitizeShadowDOM(currentNode.content);
20786
20660
  }
20787
-
20788
- /* Check attributes, sanitize if necessary */
20789
- _sanitizeAttributes(currentNode);
20790
- oldNode = currentNode;
20791
20661
  }
20792
- oldNode = null;
20793
-
20794
20662
  /* If we sanitized `dirty` in-place, return it. */
20795
20663
  if (IN_PLACE) {
20796
20664
  return dirty;
20797
20665
  }
20798
-
20799
20666
  /* Return sanitized string or DOM */
20800
20667
  if (RETURN_DOM) {
20801
20668
  if (RETURN_DOM_FRAGMENT) {
@@ -20807,7 +20674,7 @@ var purify = {exports: {}};
20807
20674
  } else {
20808
20675
  returnNode = body;
20809
20676
  }
20810
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) {
20677
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
20811
20678
  /*
20812
20679
  AdoptNode() is not used because internal state is not reset
20813
20680
  (e.g. the past names map of a HTMLFormElement), this is safe
@@ -20819,111 +20686,55 @@ var purify = {exports: {}};
20819
20686
  }
20820
20687
  return returnNode;
20821
20688
  }
20822
- var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
20823
-
20689
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
20824
20690
  /* Serialize doctype if allowed */
20825
20691
  if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
20826
20692
  serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
20827
20693
  }
20828
-
20829
20694
  /* Sanitize final string template-safe */
20830
20695
  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, ' ');
20696
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
20697
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
20698
+ });
20834
20699
  }
20835
20700
  return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
20836
20701
  };
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) {
20702
+ DOMPurify.setConfig = function () {
20703
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20845
20704
  _parseConfig(cfg);
20846
20705
  SET_CONFIG = true;
20847
20706
  };
20848
-
20849
- /**
20850
- * Public method to remove the configuration
20851
- * clearConfig
20852
- *
20853
- */
20854
20707
  DOMPurify.clearConfig = function () {
20855
20708
  CONFIG = null;
20856
20709
  SET_CONFIG = false;
20857
20710
  };
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
20711
  DOMPurify.isValidAttribute = function (tag, attr, value) {
20870
20712
  /* Initialize shared config vars if necessary. */
20871
20713
  if (!CONFIG) {
20872
20714
  _parseConfig({});
20873
20715
  }
20874
- var lcTag = transformCaseFunc(tag);
20875
- var lcName = transformCaseFunc(attr);
20716
+ const lcTag = transformCaseFunc(tag);
20717
+ const lcName = transformCaseFunc(attr);
20876
20718
  return _isValidAttribute(lcTag, lcName, value);
20877
20719
  };
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
20720
  DOMPurify.addHook = function (entryPoint, hookFunction) {
20887
20721
  if (typeof hookFunction !== 'function') {
20888
20722
  return;
20889
20723
  }
20890
- hooks[entryPoint] = hooks[entryPoint] || [];
20891
20724
  arrayPush(hooks[entryPoint], hookFunction);
20892
20725
  };
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]);
20726
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
20727
+ if (hookFunction !== undefined) {
20728
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
20729
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
20905
20730
  }
20731
+ return arrayPop(hooks[entryPoint]);
20906
20732
  };
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
20733
  DOMPurify.removeHooks = function (entryPoint) {
20915
- if (hooks[entryPoint]) {
20916
- hooks[entryPoint] = [];
20917
- }
20734
+ hooks[entryPoint] = [];
20918
20735
  };
20919
-
20920
- /**
20921
- * RemoveAllHooks
20922
- * Public method to remove all DOMPurify hooks
20923
- *
20924
- */
20925
20736
  DOMPurify.removeAllHooks = function () {
20926
- hooks = {};
20737
+ hooks = _createHooksMap();
20927
20738
  };
20928
20739
  return DOMPurify;
20929
20740
  }
@@ -32205,7 +32016,7 @@ let C4DMegaMenuTopNavMenu = _decorate$r([carbonElement(`${c4dPrefix$r}-megamenu-
32205
32016
  var _this$parentElement;
32206
32017
  // Import needed subcomponents on first expansion
32207
32018
  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; })]);
32019
+ await Promise.all([import('./megamenu-left-navigation-dba059eb.js'), import('./megamenu-category-link-d1712222.js'), import('./megamenu-category-link-group-ba6e3528.js'), import('./megamenu-category-group-768aa48a.js'), import('./megamenu-category-group-copy-0036630c.js'), import('./megamenu-category-heading-25325ce1.js'), Promise.resolve().then(function () { return megamenuLinkWithIcon; }), import('./megamenu-overlay-899719ba.js'), import('./megamenu-tab-1835d1a2.js'), Promise.resolve().then(function () { return megamenuTabs; })]);
32209
32020
  this.parentElement.importedMegamenu = true;
32210
32021
  }
32211
32022
 
@@ -37716,7 +37527,7 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
37716
37527
  value() {
37717
37528
  return async event => {
37718
37529
  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')]);
37530
+ await Promise.all([Promise.resolve().then(function () { return leftNavName; }), import('./left-nav-menu-ee66480f.js'), import('./left-nav-menu-section-620f3e39.js'), import('./left-nav-menu-item-62b3aeb4.js'), import('./left-nav-menu-category-heading-907c5870.js'), import('./left-nav-overlay-4aa89969.js')]);
37720
37531
  this._importedSideNav = true;
37721
37532
  }
37722
37533
  this.expanded = event.detail.active;
@@ -37862,6 +37673,27 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
37862
37673
  }
37863
37674
  };
37864
37675
  }
37676
+ }, {
37677
+ kind: "method",
37678
+ key: "_handleFocusOut",
37679
+ value: //TODO: Remove this override when upstream bug is fixed.
37680
+ //@ts-ignore: Overriding the Focus Out Function
37681
+ function _handleFocusOut({
37682
+ relatedTarget
37683
+ }) {
37684
+ const {
37685
+ collapseMode
37686
+ } = this;
37687
+ if (collapseMode !== this.collapseMode) {
37688
+ if (!this.contains(relatedTarget)) {
37689
+ this.expanded = false;
37690
+ }
37691
+ }
37692
+ }
37693
+
37694
+ /**
37695
+ * Usage mode of the side nav.
37696
+ */
37865
37697
  }, {
37866
37698
  kind: "field",
37867
37699
  decorators: [n$1({
@@ -37875,11 +37707,7 @@ let C4DLeftNav = _decorate$b([carbonElement(`${c4dPrefix$b}-left-nav`)], functio
37875
37707
  }, {
37876
37708
  kind: "method",
37877
37709
  key: "connectedCallback",
37878
- value:
37879
- /**
37880
- * Usage mode of the side nav.
37881
- */
37882
- function connectedCallback() {
37710
+ value: function connectedCallback() {
37883
37711
  _superPropGet$7(C4DLeftNav, "connectedCallback", this, 3)([]);
37884
37712
  document.addEventListener('click', this._handleClickOut.bind(this));
37885
37713
  }