@blogmcp/mdx-render-vue 0.1.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 (249) hide show
  1. package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
  2. package/dist/_virtual/constants.js +4 -0
  3. package/dist/_virtual/index.js +5 -0
  4. package/dist/_virtual/index2.js +4 -0
  5. package/dist/composables/index.d.ts +11 -0
  6. package/dist/composables/index.js +24 -0
  7. package/dist/composables/useAudioPlayer.d.ts +22 -0
  8. package/dist/composables/useAudioPlayer.js +58 -0
  9. package/dist/composables/useCallout.d.ts +43 -0
  10. package/dist/composables/useCallout.js +71 -0
  11. package/dist/composables/useCodeBlock.d.ts +23 -0
  12. package/dist/composables/useCodeBlock.js +67 -0
  13. package/dist/composables/useGallery.d.ts +37 -0
  14. package/dist/composables/useGallery.js +84 -0
  15. package/dist/composables/useMedia.d.ts +18 -0
  16. package/dist/composables/useMedia.js +9 -0
  17. package/dist/composables/useYouTube.d.ts +31 -0
  18. package/dist/composables/useYouTube.js +32 -0
  19. package/dist/edit/AlertEdit.vue.d.ts +12 -0
  20. package/dist/edit/AlertEdit.vue.js +4 -0
  21. package/dist/edit/AlertEdit.vue2.js +18 -0
  22. package/dist/edit/AudioPlayerEdit.vue.d.ts +3 -0
  23. package/dist/edit/AudioPlayerEdit.vue.js +117 -0
  24. package/dist/edit/AudioPlayerEdit.vue2.js +4 -0
  25. package/dist/edit/BadgeEdit.vue.d.ts +2 -0
  26. package/dist/edit/BadgeEdit.vue.js +4 -0
  27. package/dist/edit/BadgeEdit.vue2.js +13 -0
  28. package/dist/edit/ButtonEdit.vue.d.ts +2 -0
  29. package/dist/edit/ButtonEdit.vue.js +4 -0
  30. package/dist/edit/ButtonEdit.vue2.js +13 -0
  31. package/dist/edit/CalloutEdit.vue.d.ts +13 -0
  32. package/dist/edit/CalloutEdit.vue.js +85 -0
  33. package/dist/edit/CalloutEdit.vue2.js +4 -0
  34. package/dist/edit/CardEdit.vue.d.ts +12 -0
  35. package/dist/edit/CardEdit.vue.js +4 -0
  36. package/dist/edit/CardEdit.vue2.js +18 -0
  37. package/dist/edit/CodeBlockEdit.vue.d.ts +12 -0
  38. package/dist/edit/CodeBlockEdit.vue.js +7 -0
  39. package/dist/edit/CodeBlockEdit.vue2.js +89 -0
  40. package/dist/edit/GalleryEdit.vue.d.ts +3 -0
  41. package/dist/edit/GalleryEdit.vue.js +64 -0
  42. package/dist/edit/GalleryEdit.vue2.js +4 -0
  43. package/dist/edit/IconEdit.vue.d.ts +2 -0
  44. package/dist/edit/IconEdit.vue.js +4 -0
  45. package/dist/edit/IconEdit.vue2.js +13 -0
  46. package/dist/edit/TooltipEdit.vue.d.ts +16 -0
  47. package/dist/edit/TooltipEdit.vue.js +4 -0
  48. package/dist/edit/TooltipEdit.vue2.js +24 -0
  49. package/dist/edit/YouTubeEdit.vue.d.ts +3 -0
  50. package/dist/edit/YouTubeEdit.vue.js +41 -0
  51. package/dist/edit/YouTubeEdit.vue2.js +4 -0
  52. package/dist/edit/index.d.ts +29 -0
  53. package/dist/edit/index.js +35 -0
  54. package/dist/index.d.ts +12 -0
  55. package/dist/index.js +75 -0
  56. package/dist/mdx-render-vue.css +31 -0
  57. package/dist/node_modules/@ark-ui/vue/dist/_virtual/_rolldown/runtime.js +13 -0
  58. package/dist/node_modules/@ark-ui/vue/dist/components/factory.js +35 -0
  59. package/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence-context.js +6 -0
  60. package/dist/node_modules/@ark-ui/vue/dist/components/presence/use-presence.js +40 -0
  61. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.js +5 -0
  62. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow-tip.vue_vue_type_script_setup_true_lang.js +21 -0
  63. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.js +5 -0
  64. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-arrow.vue_vue_type_script_setup_true_lang.js +21 -0
  65. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.js +5 -0
  66. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-content.vue_vue_type_script_setup_true_lang.js +25 -0
  67. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.js +5 -0
  68. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-context.vue_vue_type_script_setup_true_lang.js +14 -0
  69. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.js +5 -0
  70. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-positioner.vue_vue_type_script_setup_true_lang.js +23 -0
  71. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.js +5 -0
  72. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root-provider.vue_vue_type_script_setup_true_lang.js +38 -0
  73. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.js +5 -0
  74. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-root.vue_vue_type_script_setup_true_lang.js +68 -0
  75. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.js +5 -0
  76. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip-trigger.vue_vue_type_script_setup_true_lang.js +25 -0
  77. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/tooltip.js +22 -0
  78. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip-context.js +6 -0
  79. package/dist/node_modules/@ark-ui/vue/dist/components/tooltip/use-tooltip.js +36 -0
  80. package/dist/node_modules/@ark-ui/vue/dist/providers/environment/use-environment-context.js +13 -0
  81. package/dist/node_modules/@ark-ui/vue/dist/providers/locale/use-locale-context.js +12 -0
  82. package/dist/node_modules/@ark-ui/vue/dist/utils/clean-props.js +8 -0
  83. package/dist/node_modules/@ark-ui/vue/dist/utils/create-context.js +14 -0
  84. package/dist/node_modules/@ark-ui/vue/dist/utils/dynamic.js +34 -0
  85. package/dist/node_modules/@ark-ui/vue/dist/utils/unref-element.js +8 -0
  86. package/dist/node_modules/@ark-ui/vue/dist/utils/use-forward-expose.js +46 -0
  87. package/dist/node_modules/@ark-ui/vue/dist/utils/use-render-strategy.js +5 -0
  88. package/dist/node_modules/@braintree/sanitize-url/dist/constants.js +20 -0
  89. package/dist/node_modules/@braintree/sanitize-url/dist/index.js +75 -0
  90. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +728 -0
  91. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +629 -0
  92. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +176 -0
  93. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +151 -0
  94. package/dist/node_modules/@iconify/vue/dist/iconify.js +1691 -0
  95. package/dist/node_modules/@zag-js/anatomy/dist/create-anatomy.js +29 -0
  96. package/dist/node_modules/@zag-js/core/dist/create-machine.js +28 -0
  97. package/dist/node_modules/@zag-js/core/dist/merge-props.js +55 -0
  98. package/dist/node_modules/@zag-js/core/dist/scope.js +20 -0
  99. package/dist/node_modules/@zag-js/core/dist/state.js +176 -0
  100. package/dist/node_modules/@zag-js/core/dist/types.js +11 -0
  101. package/dist/node_modules/@zag-js/dom-query/dist/chunk-QZ7TP4HQ.js +6 -0
  102. package/dist/node_modules/@zag-js/dom-query/dist/computed-style.js +11 -0
  103. package/dist/node_modules/@zag-js/dom-query/dist/event.js +37 -0
  104. package/dist/node_modules/@zag-js/dom-query/dist/node.js +64 -0
  105. package/dist/node_modules/@zag-js/dom-query/dist/overflow.js +28 -0
  106. package/dist/node_modules/@zag-js/dom-query/dist/platform.js +23 -0
  107. package/dist/node_modules/@zag-js/dom-query/dist/query.js +6 -0
  108. package/dist/node_modules/@zag-js/dom-query/dist/raf.js +52 -0
  109. package/dist/node_modules/@zag-js/dom-query/dist/set.js +22 -0
  110. package/dist/node_modules/@zag-js/dom-query/dist/shared.js +8 -0
  111. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +159 -0
  112. package/dist/node_modules/@zag-js/popper/dist/get-anchor.js +39 -0
  113. package/dist/node_modules/@zag-js/popper/dist/get-placement.js +296 -0
  114. package/dist/node_modules/@zag-js/popper/dist/get-styles.js +47 -0
  115. package/dist/node_modules/@zag-js/popper/dist/middleware.js +79 -0
  116. package/dist/node_modules/@zag-js/popper/dist/placement.js +7 -0
  117. package/dist/node_modules/@zag-js/presence/dist/presence.connect.js +18 -0
  118. package/dist/node_modules/@zag-js/presence/dist/presence.machine.js +175 -0
  119. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.anatomy.js +7 -0
  120. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.connect.js +155 -0
  121. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.dom.js +24 -0
  122. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.machine.js +416 -0
  123. package/dist/node_modules/@zag-js/tooltip/dist/tooltip.store.js +9 -0
  124. package/dist/node_modules/@zag-js/types/dist/prop-types.js +14 -0
  125. package/dist/node_modules/@zag-js/utils/dist/array.js +7 -0
  126. package/dist/node_modules/@zag-js/utils/dist/equal.js +36 -0
  127. package/dist/node_modules/@zag-js/utils/dist/functions.js +11 -0
  128. package/dist/node_modules/@zag-js/utils/dist/guard.js +26 -0
  129. package/dist/node_modules/@zag-js/utils/dist/object.js +16 -0
  130. package/dist/node_modules/@zag-js/utils/dist/store.js +44 -0
  131. package/dist/node_modules/@zag-js/utils/dist/warning.js +31 -0
  132. package/dist/node_modules/@zag-js/vue/dist/bindable.js +48 -0
  133. package/dist/node_modules/@zag-js/vue/dist/machine.js +258 -0
  134. package/dist/node_modules/@zag-js/vue/dist/normalize-props.js +42 -0
  135. package/dist/node_modules/@zag-js/vue/dist/refs.js +14 -0
  136. package/dist/node_modules/@zag-js/vue/dist/track.js +22 -0
  137. package/dist/node_modules/dompurify/dist/purify.es.js +1190 -0
  138. package/dist/registry.d.ts +76 -0
  139. package/dist/registry.js +164 -0
  140. package/dist/render/alert/Alert.vue.d.ts +18 -0
  141. package/dist/render/alert/Alert.vue.js +4 -0
  142. package/dist/render/alert/Alert.vue2.js +43 -0
  143. package/dist/render/alert/index.d.ts +2 -0
  144. package/dist/render/audioplayer/AudioPlayerDefault.vue.d.ts +3 -0
  145. package/dist/render/audioplayer/AudioPlayerDefault.vue.js +116 -0
  146. package/dist/render/audioplayer/AudioPlayerDefault.vue2.js +4 -0
  147. package/dist/render/audioplayer/index.d.ts +5 -0
  148. package/dist/render/audioplayer/index.js +5 -0
  149. package/dist/render/badge/Badge.vue.d.ts +10 -0
  150. package/dist/render/badge/Badge.vue.js +4 -0
  151. package/dist/render/badge/Badge.vue2.js +28 -0
  152. package/dist/render/badge/index.d.ts +2 -0
  153. package/dist/render/button/Button.vue.d.ts +13 -0
  154. package/dist/render/button/Button.vue.js +4 -0
  155. package/dist/render/button/Button.vue2.js +42 -0
  156. package/dist/render/button/index.d.ts +2 -0
  157. package/dist/render/callout/CalloutDefault.vue.d.ts +13 -0
  158. package/dist/render/callout/CalloutDefault.vue.js +86 -0
  159. package/dist/render/callout/CalloutDefault.vue2.js +4 -0
  160. package/dist/render/callout/CalloutMinimal.vue.d.ts +13 -0
  161. package/dist/render/callout/CalloutMinimal.vue.js +27 -0
  162. package/dist/render/callout/CalloutMinimal.vue2.js +4 -0
  163. package/dist/render/callout/index.d.ts +6 -0
  164. package/dist/render/callout/index.js +7 -0
  165. package/dist/render/card/Card.vue.d.ts +15 -0
  166. package/dist/render/card/Card.vue.js +4 -0
  167. package/dist/render/card/Card.vue2.js +29 -0
  168. package/dist/render/card/index.d.ts +2 -0
  169. package/dist/render/codeblock/CodeBlockDefault.vue.d.ts +12 -0
  170. package/dist/render/codeblock/CodeBlockDefault.vue.js +7 -0
  171. package/dist/render/codeblock/CodeBlockDefault.vue2.js +92 -0
  172. package/dist/render/codeblock/index.d.ts +5 -0
  173. package/dist/render/codeblock/index.js +5 -0
  174. package/dist/render/gallery/GalleryGrid.vue.d.ts +3 -0
  175. package/dist/render/gallery/GalleryGrid.vue.js +125 -0
  176. package/dist/render/gallery/GalleryGrid.vue2.js +4 -0
  177. package/dist/render/gallery/GalleryLightbox.vue.d.ts +16 -0
  178. package/dist/render/gallery/GalleryLightbox.vue.js +7 -0
  179. package/dist/render/gallery/GalleryLightbox.vue2.js +170 -0
  180. package/dist/render/gallery/index.d.ts +6 -0
  181. package/dist/render/gallery/index.js +7 -0
  182. package/dist/render/icon/Icon.vue.d.ts +9 -0
  183. package/dist/render/icon/Icon.vue.js +4 -0
  184. package/dist/render/icon/Icon.vue2.js +25 -0
  185. package/dist/render/icon/index.d.ts +2 -0
  186. package/dist/render/index.d.ts +40 -0
  187. package/dist/render/index.js +63 -0
  188. package/dist/render/tooltip/Tooltip.vue.d.ts +18 -0
  189. package/dist/render/tooltip/Tooltip.vue.js +4 -0
  190. package/dist/render/tooltip/Tooltip.vue2.js +58 -0
  191. package/dist/render/tooltip/index.d.ts +2 -0
  192. package/dist/render/youtube/YouTubeDefault.vue.d.ts +3 -0
  193. package/dist/render/youtube/YouTubeDefault.vue.js +79 -0
  194. package/dist/render/youtube/YouTubeDefault.vue2.js +4 -0
  195. package/dist/render/youtube/index.d.ts +5 -0
  196. package/dist/render/youtube/index.js +5 -0
  197. package/dist/useAudioPlayer.d.ts +22 -0
  198. package/dist/useCallout.d.ts +46 -0
  199. package/dist/useCodeBlock.d.ts +25 -0
  200. package/dist/useGallery.d.ts +44 -0
  201. package/dist/useMedia.d.ts +16 -0
  202. package/dist/useYouTube.d.ts +32 -0
  203. package/package.json +125 -0
  204. package/src/composables/index.ts +16 -0
  205. package/src/composables/useAudioPlayer.ts +84 -0
  206. package/src/composables/useCallout.ts +103 -0
  207. package/src/composables/useCodeBlock.ts +90 -0
  208. package/src/composables/useGallery.ts +143 -0
  209. package/src/composables/useMedia.ts +23 -0
  210. package/src/composables/useYouTube.ts +58 -0
  211. package/src/edit/AlertEdit.vue +9 -0
  212. package/src/edit/AudioPlayerEdit.vue +92 -0
  213. package/src/edit/BadgeEdit.vue +7 -0
  214. package/src/edit/ButtonEdit.vue +10 -0
  215. package/src/edit/CalloutEdit.vue +107 -0
  216. package/src/edit/CardEdit.vue +9 -0
  217. package/src/edit/CodeBlockEdit.vue +76 -0
  218. package/src/edit/GalleryEdit.vue +65 -0
  219. package/src/edit/IconEdit.vue +7 -0
  220. package/src/edit/TooltipEdit.vue +15 -0
  221. package/src/edit/YouTubeEdit.vue +33 -0
  222. package/src/edit/index.ts +32 -0
  223. package/src/index.ts +62 -0
  224. package/src/registry.ts +272 -0
  225. package/src/render/alert/Alert.vue +32 -0
  226. package/src/render/alert/index.ts +2 -0
  227. package/src/render/audioplayer/AudioPlayerDefault.vue +89 -0
  228. package/src/render/audioplayer/index.ts +8 -0
  229. package/src/render/badge/Badge.vue +25 -0
  230. package/src/render/badge/index.ts +2 -0
  231. package/src/render/button/Button.vue +41 -0
  232. package/src/render/button/index.ts +2 -0
  233. package/src/render/callout/CalloutDefault.vue +101 -0
  234. package/src/render/callout/CalloutMinimal.vue +31 -0
  235. package/src/render/callout/index.ts +9 -0
  236. package/src/render/card/Card.vue +15 -0
  237. package/src/render/card/index.ts +2 -0
  238. package/src/render/codeblock/CodeBlockDefault.vue +76 -0
  239. package/src/render/codeblock/index.ts +8 -0
  240. package/src/render/gallery/GalleryGrid.vue +162 -0
  241. package/src/render/gallery/GalleryLightbox.vue +162 -0
  242. package/src/render/gallery/index.ts +9 -0
  243. package/src/render/icon/Icon.vue +22 -0
  244. package/src/render/icon/index.ts +2 -0
  245. package/src/render/index.ts +76 -0
  246. package/src/render/tooltip/Tooltip.vue +35 -0
  247. package/src/render/tooltip/index.ts +2 -0
  248. package/src/render/youtube/YouTubeDefault.vue +72 -0
  249. package/src/render/youtube/index.ts +8 -0
@@ -0,0 +1,1190 @@
1
+ function _arrayLikeToArray(r, a) {
2
+ (null == a || a > r.length) && (a = r.length);
3
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
4
+ return n;
5
+ }
6
+ function _arrayWithHoles(r) {
7
+ if (Array.isArray(r)) return r;
8
+ }
9
+ function _iterableToArrayLimit(r, l) {
10
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
11
+ if (null != t) {
12
+ var e, n, i, u, a = [], f = true, o = false;
13
+ try {
14
+ if (i = (t = t.call(r)).next, 0 === l) ;
15
+ else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = true) ;
16
+ } catch (r2) {
17
+ o = true, n = r2;
18
+ } finally {
19
+ try {
20
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
21
+ } finally {
22
+ if (o) throw n;
23
+ }
24
+ }
25
+ return a;
26
+ }
27
+ }
28
+ function _nonIterableRest() {
29
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
30
+ }
31
+ function _slicedToArray(r, e) {
32
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
33
+ }
34
+ function _unsupportedIterableToArray(r, a) {
35
+ if (r) {
36
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
37
+ var t = {}.toString.call(r).slice(8, -1);
38
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
39
+ }
40
+ }
41
+ const entries = Object.entries, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
42
+ let freeze = Object.freeze, seal = Object.seal, create = Object.create;
43
+ let _ref = typeof Reflect !== "undefined" && Reflect, apply = _ref.apply, construct = _ref.construct;
44
+ if (!freeze) {
45
+ freeze = function freeze2(x) {
46
+ return x;
47
+ };
48
+ }
49
+ if (!seal) {
50
+ seal = function seal2(x) {
51
+ return x;
52
+ };
53
+ }
54
+ if (!apply) {
55
+ apply = function apply2(func, thisArg) {
56
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
57
+ args[_key - 2] = arguments[_key];
58
+ }
59
+ return func.apply(thisArg, args);
60
+ };
61
+ }
62
+ if (!construct) {
63
+ construct = function construct2(Func) {
64
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
65
+ args[_key2 - 1] = arguments[_key2];
66
+ }
67
+ return new Func(...args);
68
+ };
69
+ }
70
+ const arrayForEach = unapply(Array.prototype.forEach);
71
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
72
+ const arrayPop = unapply(Array.prototype.pop);
73
+ const arrayPush = unapply(Array.prototype.push);
74
+ const arraySplice = unapply(Array.prototype.splice);
75
+ const arrayIsArray = Array.isArray;
76
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
77
+ const stringToString = unapply(String.prototype.toString);
78
+ const stringMatch = unapply(String.prototype.match);
79
+ const stringReplace = unapply(String.prototype.replace);
80
+ const stringIndexOf = unapply(String.prototype.indexOf);
81
+ const stringTrim = unapply(String.prototype.trim);
82
+ const numberToString = unapply(Number.prototype.toString);
83
+ const booleanToString = unapply(Boolean.prototype.toString);
84
+ const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
85
+ const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
86
+ const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
87
+ const objectToString = unapply(Object.prototype.toString);
88
+ const regExpTest = unapply(RegExp.prototype.test);
89
+ const typeErrorCreate = unconstruct(TypeError);
90
+ function unapply(func) {
91
+ return function(thisArg) {
92
+ if (thisArg instanceof RegExp) {
93
+ thisArg.lastIndex = 0;
94
+ }
95
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
96
+ args[_key3 - 1] = arguments[_key3];
97
+ }
98
+ return apply(func, thisArg, args);
99
+ };
100
+ }
101
+ function unconstruct(Func) {
102
+ return function() {
103
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
104
+ args[_key4] = arguments[_key4];
105
+ }
106
+ return construct(Func, args);
107
+ };
108
+ }
109
+ function addToSet(set, array) {
110
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
111
+ if (setPrototypeOf) {
112
+ setPrototypeOf(set, null);
113
+ }
114
+ if (!arrayIsArray(array)) {
115
+ return set;
116
+ }
117
+ let l = array.length;
118
+ while (l--) {
119
+ let element = array[l];
120
+ if (typeof element === "string") {
121
+ const lcElement = transformCaseFunc(element);
122
+ if (lcElement !== element) {
123
+ if (!isFrozen(array)) {
124
+ array[l] = lcElement;
125
+ }
126
+ element = lcElement;
127
+ }
128
+ }
129
+ set[element] = true;
130
+ }
131
+ return set;
132
+ }
133
+ function cleanArray(array) {
134
+ for (let index = 0; index < array.length; index++) {
135
+ const isPropertyExist = objectHasOwnProperty(array, index);
136
+ if (!isPropertyExist) {
137
+ array[index] = null;
138
+ }
139
+ }
140
+ return array;
141
+ }
142
+ function clone(object) {
143
+ const newObject = create(null);
144
+ for (const _ref2 of entries(object)) {
145
+ var _ref3 = _slicedToArray(_ref2, 2);
146
+ const property = _ref3[0];
147
+ const value = _ref3[1];
148
+ const isPropertyExist = objectHasOwnProperty(object, property);
149
+ if (isPropertyExist) {
150
+ if (arrayIsArray(value)) {
151
+ newObject[property] = cleanArray(value);
152
+ } else if (value && typeof value === "object" && value.constructor === Object) {
153
+ newObject[property] = clone(value);
154
+ } else {
155
+ newObject[property] = value;
156
+ }
157
+ }
158
+ }
159
+ return newObject;
160
+ }
161
+ function stringifyValue(value) {
162
+ switch (typeof value) {
163
+ case "string": {
164
+ return value;
165
+ }
166
+ case "number": {
167
+ return numberToString(value);
168
+ }
169
+ case "boolean": {
170
+ return booleanToString(value);
171
+ }
172
+ case "bigint": {
173
+ return bigintToString ? bigintToString(value) : "0";
174
+ }
175
+ case "symbol": {
176
+ return symbolToString ? symbolToString(value) : "Symbol()";
177
+ }
178
+ case "undefined": {
179
+ return objectToString(value);
180
+ }
181
+ case "function":
182
+ case "object": {
183
+ if (value === null) {
184
+ return objectToString(value);
185
+ }
186
+ const valueAsRecord = value;
187
+ const valueToString = lookupGetter(valueAsRecord, "toString");
188
+ if (typeof valueToString === "function") {
189
+ const stringified = valueToString(valueAsRecord);
190
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
191
+ }
192
+ return objectToString(value);
193
+ }
194
+ default: {
195
+ return objectToString(value);
196
+ }
197
+ }
198
+ }
199
+ function lookupGetter(object, prop) {
200
+ while (object !== null) {
201
+ const desc = getOwnPropertyDescriptor(object, prop);
202
+ if (desc) {
203
+ if (desc.get) {
204
+ return unapply(desc.get);
205
+ }
206
+ if (typeof desc.value === "function") {
207
+ return unapply(desc.value);
208
+ }
209
+ }
210
+ object = getPrototypeOf(object);
211
+ }
212
+ function fallbackValue() {
213
+ return null;
214
+ }
215
+ return fallbackValue;
216
+ }
217
+ function isRegex(value) {
218
+ try {
219
+ regExpTest(value, "");
220
+ return true;
221
+ } catch (_unused) {
222
+ return false;
223
+ }
224
+ }
225
+ 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", "search", "section", "select", "shadow", "slot", "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"]);
226
+ const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "enterkeyhint", "exportparts", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "inputmode", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "part", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
227
+ 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"]);
228
+ 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"]);
229
+ 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"]);
230
+ const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
231
+ const text = freeze(["#text"]);
232
+ const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "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", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]);
233
+ 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", "mask-type", "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"]);
234
+ const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "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"]);
235
+ const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
236
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
237
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
238
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
239
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
240
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
241
+ const IS_ALLOWED_URI = seal(
242
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
243
+ // eslint-disable-line no-useless-escape
244
+ );
245
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
246
+ const ATTR_WHITESPACE = seal(
247
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
248
+ // eslint-disable-line no-control-regex
249
+ );
250
+ const DOCTYPE_NAME = seal(/^html$/i);
251
+ const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
252
+ const NODE_TYPE = {
253
+ element: 1,
254
+ attribute: 2,
255
+ text: 3,
256
+ cdataSection: 4,
257
+ entityReference: 5,
258
+ // Deprecated
259
+ entityNode: 6,
260
+ // Deprecated
261
+ progressingInstruction: 7,
262
+ comment: 8,
263
+ document: 9,
264
+ documentType: 10,
265
+ documentFragment: 11,
266
+ notation: 12
267
+ // Deprecated
268
+ };
269
+ const getGlobal = function getGlobal2() {
270
+ return typeof window === "undefined" ? null : window;
271
+ };
272
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
273
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
274
+ return null;
275
+ }
276
+ let suffix = null;
277
+ const ATTR_NAME = "data-tt-policy-suffix";
278
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
279
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
280
+ }
281
+ const policyName = "dompurify" + (suffix ? "#" + suffix : "");
282
+ try {
283
+ return trustedTypes.createPolicy(policyName, {
284
+ createHTML(html2) {
285
+ return html2;
286
+ },
287
+ createScriptURL(scriptUrl) {
288
+ return scriptUrl;
289
+ }
290
+ });
291
+ } catch (_) {
292
+ console.warn("TrustedTypes policy " + policyName + " could not be created.");
293
+ return null;
294
+ }
295
+ };
296
+ const _createHooksMap = function _createHooksMap2() {
297
+ return {
298
+ afterSanitizeAttributes: [],
299
+ afterSanitizeElements: [],
300
+ afterSanitizeShadowDOM: [],
301
+ beforeSanitizeAttributes: [],
302
+ beforeSanitizeElements: [],
303
+ beforeSanitizeShadowDOM: [],
304
+ uponSanitizeAttribute: [],
305
+ uponSanitizeElement: [],
306
+ uponSanitizeShadowNode: []
307
+ };
308
+ };
309
+ function createDOMPurify() {
310
+ let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
311
+ const DOMPurify = (root) => createDOMPurify(root);
312
+ DOMPurify.version = "3.4.7";
313
+ DOMPurify.removed = [];
314
+ if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
315
+ DOMPurify.isSupported = false;
316
+ return DOMPurify;
317
+ }
318
+ let document = window2.document;
319
+ const originalDocument = document;
320
+ const currentScript = originalDocument.currentScript;
321
+ window2.DocumentFragment;
322
+ const HTMLTemplateElement = window2.HTMLTemplateElement, Node = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap;
323
+ _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap;
324
+ window2.HTMLFormElement;
325
+ const DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
326
+ const ElementPrototype = Element.prototype;
327
+ const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
328
+ const remove = lookupGetter(ElementPrototype, "remove");
329
+ const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
330
+ const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
331
+ const getParentNode = lookupGetter(ElementPrototype, "parentNode");
332
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
333
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
334
+ const getNodeType = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeType") : null;
335
+ const getNodeName = Node && Node.prototype ? lookupGetter(Node.prototype, "nodeName") : null;
336
+ if (typeof HTMLTemplateElement === "function") {
337
+ const template = document.createElement("template");
338
+ if (template.content && template.content.ownerDocument) {
339
+ document = template.content.ownerDocument;
340
+ }
341
+ }
342
+ let trustedTypesPolicy;
343
+ let emptyHTML = "";
344
+ const _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
345
+ const importNode = originalDocument.importNode;
346
+ let hooks = _createHooksMap();
347
+ DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
348
+ const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
349
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
350
+ let ALLOWED_TAGS = null;
351
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
352
+ let ALLOWED_ATTR = null;
353
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
354
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
355
+ tagNameCheck: {
356
+ writable: true,
357
+ configurable: false,
358
+ enumerable: true,
359
+ value: null
360
+ },
361
+ attributeNameCheck: {
362
+ writable: true,
363
+ configurable: false,
364
+ enumerable: true,
365
+ value: null
366
+ },
367
+ allowCustomizedBuiltInElements: {
368
+ writable: true,
369
+ configurable: false,
370
+ enumerable: true,
371
+ value: false
372
+ }
373
+ }));
374
+ let FORBID_TAGS = null;
375
+ let FORBID_ATTR = null;
376
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
377
+ tagCheck: {
378
+ writable: true,
379
+ configurable: false,
380
+ enumerable: true,
381
+ value: null
382
+ },
383
+ attributeCheck: {
384
+ writable: true,
385
+ configurable: false,
386
+ enumerable: true,
387
+ value: null
388
+ }
389
+ }));
390
+ let ALLOW_ARIA_ATTR = true;
391
+ let ALLOW_DATA_ATTR = true;
392
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
393
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
394
+ let SAFE_FOR_TEMPLATES = false;
395
+ let SAFE_FOR_XML = true;
396
+ let WHOLE_DOCUMENT = false;
397
+ let SET_CONFIG = false;
398
+ let FORCE_BODY = false;
399
+ let RETURN_DOM = false;
400
+ let RETURN_DOM_FRAGMENT = false;
401
+ let RETURN_TRUSTED_TYPE = false;
402
+ let SANITIZE_DOM = true;
403
+ let SANITIZE_NAMED_PROPS = false;
404
+ const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
405
+ let KEEP_CONTENT = true;
406
+ let IN_PLACE = false;
407
+ let USE_PROFILES = {};
408
+ let FORBID_CONTENTS = null;
409
+ 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"]);
410
+ let DATA_URI_TAGS = null;
411
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
412
+ let URI_SAFE_ATTRIBUTES = null;
413
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
414
+ const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
415
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
416
+ const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
417
+ let NAMESPACE = HTML_NAMESPACE;
418
+ let IS_EMPTY_INPUT = false;
419
+ let ALLOWED_NAMESPACES = null;
420
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
421
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
422
+ let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
423
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
424
+ let PARSER_MEDIA_TYPE = null;
425
+ const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
426
+ const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
427
+ let transformCaseFunc = null;
428
+ let CONFIG = null;
429
+ const formElement = document.createElement("form");
430
+ const isRegexOrFunction = function isRegexOrFunction2(testValue) {
431
+ return testValue instanceof RegExp || testValue instanceof Function;
432
+ };
433
+ const _parseConfig = function _parseConfig2() {
434
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
435
+ if (CONFIG && CONFIG === cfg) {
436
+ return;
437
+ }
438
+ if (!cfg || typeof cfg !== "object") {
439
+ cfg = {};
440
+ }
441
+ cfg = clone(cfg);
442
+ PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
443
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
444
+ transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
445
+ ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") && arrayIsArray(cfg.ALLOWED_TAGS) ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
446
+ ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") && arrayIsArray(cfg.ALLOWED_ATTR) ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
447
+ ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") && arrayIsArray(cfg.ALLOWED_NAMESPACES) ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
448
+ URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR) ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
449
+ DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") && arrayIsArray(cfg.ADD_DATA_URI_TAGS) ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
450
+ FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS) ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
451
+ FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") && arrayIsArray(cfg.FORBID_TAGS) ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
452
+ FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") && arrayIsArray(cfg.FORBID_ATTR) ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
453
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
454
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
455
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
456
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
457
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
458
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
459
+ SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
460
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
461
+ RETURN_DOM = cfg.RETURN_DOM || false;
462
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
463
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
464
+ FORCE_BODY = cfg.FORCE_BODY || false;
465
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
466
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
467
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
468
+ IN_PLACE = cfg.IN_PLACE || false;
469
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
470
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
471
+ MATHML_TEXT_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "MATHML_TEXT_INTEGRATION_POINTS") && cfg.MATHML_TEXT_INTEGRATION_POINTS && typeof cfg.MATHML_TEXT_INTEGRATION_POINTS === "object" ? clone(cfg.MATHML_TEXT_INTEGRATION_POINTS) : addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
472
+ HTML_INTEGRATION_POINTS = objectHasOwnProperty(cfg, "HTML_INTEGRATION_POINTS") && cfg.HTML_INTEGRATION_POINTS && typeof cfg.HTML_INTEGRATION_POINTS === "object" ? clone(cfg.HTML_INTEGRATION_POINTS) : addToSet({}, ["annotation-xml"]);
473
+ const customElementHandling = objectHasOwnProperty(cfg, "CUSTOM_ELEMENT_HANDLING") && cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING === "object" ? clone(cfg.CUSTOM_ELEMENT_HANDLING) : create(null);
474
+ CUSTOM_ELEMENT_HANDLING = create(null);
475
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) {
476
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
477
+ }
478
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
479
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
480
+ }
481
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
482
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
483
+ }
484
+ if (SAFE_FOR_TEMPLATES) {
485
+ ALLOW_DATA_ATTR = false;
486
+ }
487
+ if (RETURN_DOM_FRAGMENT) {
488
+ RETURN_DOM = true;
489
+ }
490
+ if (USE_PROFILES) {
491
+ ALLOWED_TAGS = addToSet({}, text);
492
+ ALLOWED_ATTR = create(null);
493
+ if (USE_PROFILES.html === true) {
494
+ addToSet(ALLOWED_TAGS, html$1);
495
+ addToSet(ALLOWED_ATTR, html);
496
+ }
497
+ if (USE_PROFILES.svg === true) {
498
+ addToSet(ALLOWED_TAGS, svg$1);
499
+ addToSet(ALLOWED_ATTR, svg);
500
+ addToSet(ALLOWED_ATTR, xml);
501
+ }
502
+ if (USE_PROFILES.svgFilters === true) {
503
+ addToSet(ALLOWED_TAGS, svgFilters);
504
+ addToSet(ALLOWED_ATTR, svg);
505
+ addToSet(ALLOWED_ATTR, xml);
506
+ }
507
+ if (USE_PROFILES.mathMl === true) {
508
+ addToSet(ALLOWED_TAGS, mathMl$1);
509
+ addToSet(ALLOWED_ATTR, mathMl);
510
+ addToSet(ALLOWED_ATTR, xml);
511
+ }
512
+ }
513
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
514
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
515
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
516
+ if (typeof cfg.ADD_TAGS === "function") {
517
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
518
+ } else if (arrayIsArray(cfg.ADD_TAGS)) {
519
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
520
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
521
+ }
522
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
523
+ }
524
+ }
525
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
526
+ if (typeof cfg.ADD_ATTR === "function") {
527
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
528
+ } else if (arrayIsArray(cfg.ADD_ATTR)) {
529
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
530
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
531
+ }
532
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
533
+ }
534
+ }
535
+ if (objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") && arrayIsArray(cfg.ADD_URI_SAFE_ATTR)) {
536
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
537
+ }
538
+ if (objectHasOwnProperty(cfg, "FORBID_CONTENTS") && arrayIsArray(cfg.FORBID_CONTENTS)) {
539
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
540
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
541
+ }
542
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
543
+ }
544
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
545
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
546
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
547
+ }
548
+ addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
549
+ }
550
+ if (KEEP_CONTENT) {
551
+ ALLOWED_TAGS["#text"] = true;
552
+ }
553
+ if (WHOLE_DOCUMENT) {
554
+ addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
555
+ }
556
+ if (ALLOWED_TAGS.table) {
557
+ addToSet(ALLOWED_TAGS, ["tbody"]);
558
+ delete FORBID_TAGS.tbody;
559
+ }
560
+ if (cfg.TRUSTED_TYPES_POLICY) {
561
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
562
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
563
+ }
564
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
565
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
566
+ }
567
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
568
+ emptyHTML = trustedTypesPolicy.createHTML("");
569
+ } else {
570
+ if (trustedTypesPolicy === void 0) {
571
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
572
+ }
573
+ if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
574
+ emptyHTML = trustedTypesPolicy.createHTML("");
575
+ }
576
+ }
577
+ if ((hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) && ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
578
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
579
+ }
580
+ if (hooks.uponSanitizeAttribute.length > 0 && ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
581
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
582
+ }
583
+ if (freeze) {
584
+ freeze(cfg);
585
+ }
586
+ CONFIG = cfg;
587
+ };
588
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
589
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
590
+ const _checkValidNamespace = function _checkValidNamespace2(element) {
591
+ let parent = getParentNode(element);
592
+ if (!parent || !parent.tagName) {
593
+ parent = {
594
+ namespaceURI: NAMESPACE,
595
+ tagName: "template"
596
+ };
597
+ }
598
+ const tagName = stringToLowerCase(element.tagName);
599
+ const parentTagName = stringToLowerCase(parent.tagName);
600
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
601
+ return false;
602
+ }
603
+ if (element.namespaceURI === SVG_NAMESPACE) {
604
+ if (parent.namespaceURI === HTML_NAMESPACE) {
605
+ return tagName === "svg";
606
+ }
607
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
608
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
609
+ }
610
+ return Boolean(ALL_SVG_TAGS[tagName]);
611
+ }
612
+ if (element.namespaceURI === MATHML_NAMESPACE) {
613
+ if (parent.namespaceURI === HTML_NAMESPACE) {
614
+ return tagName === "math";
615
+ }
616
+ if (parent.namespaceURI === SVG_NAMESPACE) {
617
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
618
+ }
619
+ return Boolean(ALL_MATHML_TAGS[tagName]);
620
+ }
621
+ if (element.namespaceURI === HTML_NAMESPACE) {
622
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
623
+ return false;
624
+ }
625
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
626
+ return false;
627
+ }
628
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
629
+ }
630
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
631
+ return true;
632
+ }
633
+ return false;
634
+ };
635
+ const _forceRemove = function _forceRemove2(node) {
636
+ arrayPush(DOMPurify.removed, {
637
+ element: node
638
+ });
639
+ try {
640
+ getParentNode(node).removeChild(node);
641
+ } catch (_) {
642
+ remove(node);
643
+ }
644
+ };
645
+ const _removeAttribute = function _removeAttribute2(name, element) {
646
+ try {
647
+ arrayPush(DOMPurify.removed, {
648
+ attribute: element.getAttributeNode(name),
649
+ from: element
650
+ });
651
+ } catch (_) {
652
+ arrayPush(DOMPurify.removed, {
653
+ attribute: null,
654
+ from: element
655
+ });
656
+ }
657
+ element.removeAttribute(name);
658
+ if (name === "is") {
659
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
660
+ try {
661
+ _forceRemove(element);
662
+ } catch (_) {
663
+ }
664
+ } else {
665
+ try {
666
+ element.setAttribute(name, "");
667
+ } catch (_) {
668
+ }
669
+ }
670
+ }
671
+ };
672
+ const _initDocument = function _initDocument2(dirty) {
673
+ let doc = null;
674
+ let leadingWhitespace = null;
675
+ if (FORCE_BODY) {
676
+ dirty = "<remove></remove>" + dirty;
677
+ } else {
678
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
679
+ leadingWhitespace = matches && matches[0];
680
+ }
681
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
682
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
683
+ }
684
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
685
+ if (NAMESPACE === HTML_NAMESPACE) {
686
+ try {
687
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
688
+ } catch (_) {
689
+ }
690
+ }
691
+ if (!doc || !doc.documentElement) {
692
+ doc = implementation.createDocument(NAMESPACE, "template", null);
693
+ try {
694
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
695
+ } catch (_) {
696
+ }
697
+ }
698
+ const body = doc.body || doc.documentElement;
699
+ if (dirty && leadingWhitespace) {
700
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
701
+ }
702
+ if (NAMESPACE === HTML_NAMESPACE) {
703
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
704
+ }
705
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
706
+ };
707
+ const _createNodeIterator = function _createNodeIterator2(root) {
708
+ return createNodeIterator.call(
709
+ root.ownerDocument || root,
710
+ root,
711
+ // eslint-disable-next-line no-bitwise
712
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
713
+ null
714
+ );
715
+ };
716
+ const _scrubTemplateExpressions = function _scrubTemplateExpressions2(node) {
717
+ node.normalize();
718
+ const walker = createNodeIterator.call(
719
+ node.ownerDocument || node,
720
+ node,
721
+ // eslint-disable-next-line no-bitwise
722
+ NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION,
723
+ null
724
+ );
725
+ let currentNode = walker.nextNode();
726
+ while (currentNode) {
727
+ let data = currentNode.data;
728
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
729
+ data = stringReplace(data, expr, " ");
730
+ });
731
+ currentNode.data = data;
732
+ currentNode = walker.nextNode();
733
+ }
734
+ };
735
+ const _isClobbered = function _isClobbered2(element) {
736
+ const realTagName = getNodeName ? getNodeName(element) : null;
737
+ if (typeof realTagName !== "string") {
738
+ return false;
739
+ }
740
+ if (transformCaseFunc(realTagName) !== "form") {
741
+ return false;
742
+ }
743
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
744
+ // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
745
+ // makes the direct read diverge from the cached read; a clean form
746
+ // (same-realm OR foreign-realm) has both reads pointing at the same
747
+ // canonical NamedNodeMap.
748
+ element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
749
+ // returns the integer 1 for any Element regardless of realm; direct
750
+ // read on a clobbered form (e.g. <input name="nodeType">) returns
751
+ // the named child element. Cheap addition — nodeType is read from
752
+ // an internal slot, no serialization cost — and removes a residual
753
+ // clobbering surface used by several mXSS / PI / comment branches
754
+ // in _sanitizeElements that compare currentNode.nodeType directly.
755
+ element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
756
+ // "childNodes" shadows the prototype getter. Direct reads of
757
+ // form.childNodes from a clobbered form return the named child
758
+ // instead of the real NodeList, so any walk that reads it directly
759
+ // skips the form's real children. Compare the direct read to the
760
+ // cached Node.prototype getter — when the form's named-property
761
+ // getter intercepts the read, the two values differ and we flag
762
+ // the form. This catches every clobbering child type (input,
763
+ // select, etc.) regardless of whether the named child happens to
764
+ // carry a numeric .length, which a typeof-based probe would miss
765
+ // (e.g. HTMLSelectElement.length is a defined unsigned-long).
766
+ element.childNodes !== getChildNodes(element);
767
+ };
768
+ const _isDocumentFragment = function _isDocumentFragment2(value) {
769
+ if (!getNodeType || typeof value !== "object" || value === null) {
770
+ return false;
771
+ }
772
+ try {
773
+ return getNodeType(value) === NODE_TYPE.documentFragment;
774
+ } catch (_) {
775
+ return false;
776
+ }
777
+ };
778
+ const _isNode = function _isNode2(value) {
779
+ if (!getNodeType || typeof value !== "object" || value === null) {
780
+ return false;
781
+ }
782
+ try {
783
+ return typeof getNodeType(value) === "number";
784
+ } catch (_) {
785
+ return false;
786
+ }
787
+ };
788
+ function _executeHooks(hooks2, currentNode, data) {
789
+ arrayForEach(hooks2, (hook) => {
790
+ hook.call(DOMPurify, currentNode, data, CONFIG);
791
+ });
792
+ }
793
+ const _sanitizeElements = function _sanitizeElements2(currentNode) {
794
+ let content = null;
795
+ _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
796
+ if (_isClobbered(currentNode)) {
797
+ _forceRemove(currentNode);
798
+ return true;
799
+ }
800
+ const tagName = transformCaseFunc(currentNode.nodeName);
801
+ _executeHooks(hooks.uponSanitizeElement, currentNode, {
802
+ tagName,
803
+ allowedTags: ALLOWED_TAGS
804
+ });
805
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
806
+ _forceRemove(currentNode);
807
+ return true;
808
+ }
809
+ if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && tagName === "style" && _isNode(currentNode.firstElementChild)) {
810
+ _forceRemove(currentNode);
811
+ return true;
812
+ }
813
+ if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
814
+ _forceRemove(currentNode);
815
+ return true;
816
+ }
817
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
818
+ _forceRemove(currentNode);
819
+ return true;
820
+ }
821
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
822
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
823
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
824
+ return false;
825
+ }
826
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
827
+ return false;
828
+ }
829
+ }
830
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
831
+ const parentNode = getParentNode(currentNode);
832
+ const childNodes = getChildNodes(currentNode);
833
+ if (childNodes && parentNode) {
834
+ const childCount = childNodes.length;
835
+ for (let i = childCount - 1; i >= 0; --i) {
836
+ const childClone = cloneNode(childNodes[i], true);
837
+ parentNode.insertBefore(childClone, getNextSibling(currentNode));
838
+ }
839
+ }
840
+ }
841
+ _forceRemove(currentNode);
842
+ return true;
843
+ }
844
+ const nt = getNodeType ? getNodeType(currentNode) : currentNode.nodeType;
845
+ if (nt === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
846
+ _forceRemove(currentNode);
847
+ return true;
848
+ }
849
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
850
+ _forceRemove(currentNode);
851
+ return true;
852
+ }
853
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
854
+ content = currentNode.textContent;
855
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
856
+ content = stringReplace(content, expr, " ");
857
+ });
858
+ if (currentNode.textContent !== content) {
859
+ arrayPush(DOMPurify.removed, {
860
+ element: currentNode.cloneNode()
861
+ });
862
+ currentNode.textContent = content;
863
+ }
864
+ }
865
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
866
+ return false;
867
+ };
868
+ const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
869
+ if (FORBID_ATTR[lcName]) {
870
+ return false;
871
+ }
872
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document || value in formElement)) {
873
+ return false;
874
+ }
875
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
876
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ;
877
+ else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ;
878
+ else if (!nameIsPermitted || FORBID_ATTR[lcName]) {
879
+ if (
880
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
881
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
882
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
883
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || // Alternative, second condition checks if it's an `is`-attribute, AND
884
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
885
+ 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))
886
+ ) ;
887
+ else {
888
+ return false;
889
+ }
890
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ;
891
+ else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
892
+ else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
893
+ else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) ;
894
+ else if (value) {
895
+ return false;
896
+ } else ;
897
+ return true;
898
+ };
899
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]);
900
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
901
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
902
+ };
903
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
904
+ _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
905
+ const attributes = currentNode.attributes;
906
+ if (!attributes || _isClobbered(currentNode)) {
907
+ return;
908
+ }
909
+ const hookEvent = {
910
+ attrName: "",
911
+ attrValue: "",
912
+ keepAttr: true,
913
+ allowedAttributes: ALLOWED_ATTR,
914
+ forceKeepAttr: void 0
915
+ };
916
+ let l = attributes.length;
917
+ while (l--) {
918
+ const attr = attributes[l];
919
+ const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
920
+ const lcName = transformCaseFunc(name);
921
+ const initValue = attrValue;
922
+ let value = name === "value" ? initValue : stringTrim(initValue);
923
+ hookEvent.attrName = lcName;
924
+ hookEvent.attrValue = value;
925
+ hookEvent.keepAttr = true;
926
+ hookEvent.forceKeepAttr = void 0;
927
+ _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
928
+ value = hookEvent.attrValue;
929
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
930
+ _removeAttribute(name, currentNode);
931
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
932
+ }
933
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) {
934
+ _removeAttribute(name, currentNode);
935
+ continue;
936
+ }
937
+ if (lcName === "attributename" && stringMatch(value, "href")) {
938
+ _removeAttribute(name, currentNode);
939
+ continue;
940
+ }
941
+ if (hookEvent.forceKeepAttr) {
942
+ continue;
943
+ }
944
+ if (!hookEvent.keepAttr) {
945
+ _removeAttribute(name, currentNode);
946
+ continue;
947
+ }
948
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
949
+ _removeAttribute(name, currentNode);
950
+ continue;
951
+ }
952
+ if (SAFE_FOR_TEMPLATES) {
953
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
954
+ value = stringReplace(value, expr, " ");
955
+ });
956
+ }
957
+ const lcTag = transformCaseFunc(currentNode.nodeName);
958
+ if (!_isValidAttribute(lcTag, lcName, value)) {
959
+ _removeAttribute(name, currentNode);
960
+ continue;
961
+ }
962
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
963
+ if (namespaceURI) ;
964
+ else {
965
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
966
+ case "TrustedHTML": {
967
+ value = trustedTypesPolicy.createHTML(value);
968
+ break;
969
+ }
970
+ case "TrustedScriptURL": {
971
+ value = trustedTypesPolicy.createScriptURL(value);
972
+ break;
973
+ }
974
+ }
975
+ }
976
+ }
977
+ if (value !== initValue) {
978
+ try {
979
+ if (namespaceURI) {
980
+ currentNode.setAttributeNS(namespaceURI, name, value);
981
+ } else {
982
+ currentNode.setAttribute(name, value);
983
+ }
984
+ if (_isClobbered(currentNode)) {
985
+ _forceRemove(currentNode);
986
+ } else {
987
+ arrayPop(DOMPurify.removed);
988
+ }
989
+ } catch (_) {
990
+ _removeAttribute(name, currentNode);
991
+ }
992
+ }
993
+ }
994
+ _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
995
+ };
996
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
997
+ let shadowNode = null;
998
+ const shadowIterator = _createNodeIterator(fragment);
999
+ _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
1000
+ while (shadowNode = shadowIterator.nextNode()) {
1001
+ _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
1002
+ _sanitizeElements(shadowNode);
1003
+ _sanitizeAttributes(shadowNode);
1004
+ if (_isDocumentFragment(shadowNode.content)) {
1005
+ _sanitizeShadowDOM2(shadowNode.content);
1006
+ }
1007
+ const shadowNodeType = getNodeType ? getNodeType(shadowNode) : shadowNode.nodeType;
1008
+ if (shadowNodeType === NODE_TYPE.element) {
1009
+ const innerSr = getShadowRoot ? getShadowRoot(shadowNode) : shadowNode.shadowRoot;
1010
+ if (_isDocumentFragment(innerSr)) {
1011
+ _sanitizeAttachedShadowRoots2(innerSr);
1012
+ _sanitizeShadowDOM2(innerSr);
1013
+ }
1014
+ }
1015
+ }
1016
+ _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
1017
+ };
1018
+ const _sanitizeAttachedShadowRoots2 = function _sanitizeAttachedShadowRoots(root) {
1019
+ const nodeType = getNodeType ? getNodeType(root) : root.nodeType;
1020
+ if (nodeType === NODE_TYPE.element) {
1021
+ const sr = getShadowRoot ? getShadowRoot(root) : root.shadowRoot;
1022
+ if (_isDocumentFragment(sr)) {
1023
+ _sanitizeAttachedShadowRoots2(sr);
1024
+ _sanitizeShadowDOM2(sr);
1025
+ }
1026
+ }
1027
+ const childNodes = getChildNodes ? getChildNodes(root) : root.childNodes;
1028
+ if (!childNodes) {
1029
+ return;
1030
+ }
1031
+ const snapshot = [];
1032
+ arrayForEach(childNodes, (child) => {
1033
+ arrayPush(snapshot, child);
1034
+ });
1035
+ for (const child of snapshot) {
1036
+ _sanitizeAttachedShadowRoots2(child);
1037
+ }
1038
+ if (nodeType === NODE_TYPE.element) {
1039
+ const rootName = getNodeName ? getNodeName(root) : null;
1040
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
1041
+ const content = root.content;
1042
+ if (_isDocumentFragment(content)) {
1043
+ _sanitizeAttachedShadowRoots2(content);
1044
+ }
1045
+ }
1046
+ }
1047
+ };
1048
+ DOMPurify.sanitize = function(dirty) {
1049
+ let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1050
+ let body = null;
1051
+ let importedNode = null;
1052
+ let currentNode = null;
1053
+ let returnNode = null;
1054
+ IS_EMPTY_INPUT = !dirty;
1055
+ if (IS_EMPTY_INPUT) {
1056
+ dirty = "<!-->";
1057
+ }
1058
+ if (typeof dirty !== "string" && !_isNode(dirty)) {
1059
+ dirty = stringifyValue(dirty);
1060
+ if (typeof dirty !== "string") {
1061
+ throw typeErrorCreate("dirty is not a string, aborting");
1062
+ }
1063
+ }
1064
+ if (!DOMPurify.isSupported) {
1065
+ return dirty;
1066
+ }
1067
+ if (!SET_CONFIG) {
1068
+ _parseConfig(cfg);
1069
+ }
1070
+ DOMPurify.removed = [];
1071
+ if (typeof dirty === "string") {
1072
+ IN_PLACE = false;
1073
+ }
1074
+ if (IN_PLACE) {
1075
+ const nn = getNodeName ? getNodeName(dirty) : dirty.nodeName;
1076
+ if (typeof nn === "string") {
1077
+ const tagName = transformCaseFunc(nn);
1078
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1079
+ throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
1080
+ }
1081
+ }
1082
+ if (_isClobbered(dirty)) {
1083
+ throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
1084
+ }
1085
+ _sanitizeAttachedShadowRoots2(dirty);
1086
+ } else if (_isNode(dirty)) {
1087
+ body = _initDocument("<!---->");
1088
+ importedNode = body.ownerDocument.importNode(dirty, true);
1089
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
1090
+ body = importedNode;
1091
+ } else if (importedNode.nodeName === "HTML") {
1092
+ body = importedNode;
1093
+ } else {
1094
+ body.appendChild(importedNode);
1095
+ }
1096
+ _sanitizeAttachedShadowRoots2(importedNode);
1097
+ } else {
1098
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
1099
+ dirty.indexOf("<") === -1) {
1100
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1101
+ }
1102
+ body = _initDocument(dirty);
1103
+ if (!body) {
1104
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
1105
+ }
1106
+ }
1107
+ if (body && FORCE_BODY) {
1108
+ _forceRemove(body.firstChild);
1109
+ }
1110
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1111
+ while (currentNode = nodeIterator.nextNode()) {
1112
+ _sanitizeElements(currentNode);
1113
+ _sanitizeAttributes(currentNode);
1114
+ if (_isDocumentFragment(currentNode.content)) {
1115
+ _sanitizeShadowDOM2(currentNode.content);
1116
+ }
1117
+ }
1118
+ if (IN_PLACE) {
1119
+ if (SAFE_FOR_TEMPLATES) {
1120
+ _scrubTemplateExpressions(dirty);
1121
+ }
1122
+ return dirty;
1123
+ }
1124
+ if (RETURN_DOM) {
1125
+ if (SAFE_FOR_TEMPLATES) {
1126
+ _scrubTemplateExpressions(body);
1127
+ }
1128
+ if (RETURN_DOM_FRAGMENT) {
1129
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1130
+ while (body.firstChild) {
1131
+ returnNode.appendChild(body.firstChild);
1132
+ }
1133
+ } else {
1134
+ returnNode = body;
1135
+ }
1136
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1137
+ returnNode = importNode.call(originalDocument, returnNode, true);
1138
+ }
1139
+ return returnNode;
1140
+ }
1141
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1142
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1143
+ serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
1144
+ }
1145
+ if (SAFE_FOR_TEMPLATES) {
1146
+ arrayForEach([MUSTACHE_EXPR$1, ERB_EXPR$1, TMPLIT_EXPR$1], (expr) => {
1147
+ serializedHTML = stringReplace(serializedHTML, expr, " ");
1148
+ });
1149
+ }
1150
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1151
+ };
1152
+ DOMPurify.setConfig = function() {
1153
+ let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1154
+ _parseConfig(cfg);
1155
+ SET_CONFIG = true;
1156
+ };
1157
+ DOMPurify.clearConfig = function() {
1158
+ CONFIG = null;
1159
+ SET_CONFIG = false;
1160
+ };
1161
+ DOMPurify.isValidAttribute = function(tag, attr, value) {
1162
+ if (!CONFIG) {
1163
+ _parseConfig({});
1164
+ }
1165
+ const lcTag = transformCaseFunc(tag);
1166
+ const lcName = transformCaseFunc(attr);
1167
+ return _isValidAttribute(lcTag, lcName, value);
1168
+ };
1169
+ DOMPurify.addHook = function(entryPoint, hookFunction) {
1170
+ if (typeof hookFunction !== "function") {
1171
+ return;
1172
+ }
1173
+ arrayPush(hooks[entryPoint], hookFunction);
1174
+ };
1175
+ DOMPurify.removeHook = function(entryPoint, hookFunction) {
1176
+ if (hookFunction !== void 0) {
1177
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
1178
+ return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
1179
+ }
1180
+ return arrayPop(hooks[entryPoint]);
1181
+ };
1182
+ DOMPurify.removeHooks = function(entryPoint) {
1183
+ hooks[entryPoint] = [];
1184
+ };
1185
+ DOMPurify.removeAllHooks = function() {
1186
+ hooks = _createHooksMap();
1187
+ };
1188
+ return DOMPurify;
1189
+ }
1190
+ createDOMPurify();