@eclass/ui-kit 1.64.3 → 1.64.5

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.
@@ -1,6 +1,6 @@
1
- import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text as Text$1, HStack, Heading, List, ListItem, Link, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, MenuButton, MenuGroup, Menu, MenuList, MenuItem, Divider, IconButton } from "@chakra-ui/react";
1
+ import { extendTheme, Box, CircularProgress, Icon, Button, useMediaQuery, Tooltip, Flex, Stack, Center, Image, Text as Text$1, HStack, Heading, List, ListItem, Modal as Modal$1, ModalContent as ModalContent$1, ModalHeader, ModalCloseButton, ModalBody, ModalFooter, ModalOverlay, useDisclosure, LinkBox, LinkOverlay, Link, MenuButton, MenuGroup, Menu, MenuList, MenuItem, Divider, IconButton } from "@chakra-ui/react";
2
2
  import * as React$1 from "react";
3
- import React__default, { useEffect, useState, useCallback, useRef } from "react";
3
+ import React__default, { useState, useEffect, useCallback, useRef } from "react";
4
4
  const main = {
5
5
  deepSkyBlue: "#0189FF",
6
6
  azureRadiance: "#017BE5",
@@ -1849,6 +1849,7 @@ function BtnLink({
1849
1849
  isDisable = false,
1850
1850
  m: m2 = "0",
1851
1851
  onClick,
1852
+ p: p2,
1852
1853
  role = "link",
1853
1854
  tabIndex,
1854
1855
  target = "_blank",
@@ -1876,6 +1877,7 @@ function BtnLink({
1876
1877
  id,
1877
1878
  onClick: isDisable ? void 0 : onClick,
1878
1879
  opacity: isDisable ? 0.5 : 1,
1880
+ padding: p2 != null ? p2 : ".25em",
1879
1881
  role,
1880
1882
  tabIndex,
1881
1883
  textDecorationLine: textDecorationLine ? "underline" : "none",
@@ -1895,7 +1897,6 @@ const stylesBtnLink = {
1895
1897
  fontStyle: "normal",
1896
1898
  fontWeight: "500",
1897
1899
  lineHeight: "1rem",
1898
- padding: ".25em",
1899
1900
  textDecorationLine: "underline",
1900
1901
  width: "fit-content",
1901
1902
  _hover: {
@@ -2238,20 +2239,104 @@ function Header$1() {
2238
2239
  });
2239
2240
  }
2240
2241
  Header$1.displayName = "Header";
2241
- function DateStatus({
2242
- date
2243
- }) {
2244
- if (date == null || date.length === 0) {
2245
- return null;
2242
+ const AVATAR_COLORS = ["#0076ba", "#229f9c", "#2cb26b", "#30baed", "#95569e", "#9bc03a", "#d84315", "#f5a623", "#f6712f", "#ff6363"];
2243
+ const getColorIndex = (fullName) => {
2244
+ var _a;
2245
+ const trimmedNameLength = (_a = fullName == null ? void 0 : fullName.trim().length) != null ? _a : 0;
2246
+ return trimmedNameLength % 10;
2247
+ };
2248
+ const getAvatarColor = (fullName) => {
2249
+ const position = getColorIndex(fullName);
2250
+ return AVATAR_COLORS[position];
2251
+ };
2252
+ const getInitials = (fullName) => fullName.split(" ").map((word) => word[0]).slice(0, 2).join("").toUpperCase();
2253
+ const Avatar = ({
2254
+ fullName,
2255
+ picture,
2256
+ size = 50,
2257
+ fontSize = 14,
2258
+ alt = "Avatar",
2259
+ id,
2260
+ borderDecoration = false
2261
+ }) => {
2262
+ const [bgColor, setBgColor] = useState("");
2263
+ const [imageValid, setImageValid] = useState(false);
2264
+ useEffect(() => {
2265
+ setBgColor(getAvatarColor(fullName));
2266
+ }, [fullName]);
2267
+ const wrapperStyle = {
2268
+ alignItems: "center",
2269
+ backgroundColor: (fullName == null ? void 0 : fullName.length) === 0 ? "#fff" : bgColor,
2270
+ border: borderDecoration ? `3px solid #0189FF` : "none",
2271
+ borderRadius: "50%",
2272
+ display: "flex",
2273
+ flexShrink: 0,
2274
+ height: `${size}px`,
2275
+ justifyContent: "center",
2276
+ margin: 0,
2277
+ overflow: "hidden",
2278
+ width: `${size}px`,
2279
+ boxSizing: "border-box"
2280
+ };
2281
+ const initialsStyle = {
2282
+ color: "#fff",
2283
+ fontFamily: "Roboto, sans-serif",
2284
+ fontSize: `${fontSize}px`,
2285
+ fontWeight: "bold",
2286
+ lineHeight: "30px",
2287
+ textTransform: "uppercase"
2288
+ };
2289
+ const imgStyle = {
2290
+ height: "100%",
2291
+ width: "100%",
2292
+ objectFit: "cover",
2293
+ display: "block"
2294
+ };
2295
+ if (!fullName || fullName.length === 0) {
2296
+ return /* @__PURE__ */ jsx("figure", {
2297
+ style: wrapperStyle,
2298
+ "data-testid": "Avatar",
2299
+ "aria-hidden": "true",
2300
+ id
2301
+ });
2246
2302
  }
2247
- return /* @__PURE__ */ jsx(Text$1, {
2248
- fontSize: ".75rem",
2249
- color: vars("colors-neutral-darkCharcoal"),
2250
- m: "0",
2251
- children: date
2303
+ if (picture) {
2304
+ return /* @__PURE__ */ jsxs("figure", {
2305
+ style: wrapperStyle,
2306
+ "data-testid": "Avatar",
2307
+ role: "presentation",
2308
+ children: [!imageValid && /* @__PURE__ */ jsx("span", {
2309
+ style: initialsStyle,
2310
+ id,
2311
+ "aria-hidden": "true",
2312
+ children: getInitials(fullName)
2313
+ }), /* @__PURE__ */ jsx("img", {
2314
+ src: picture,
2315
+ alt,
2316
+ id: imageValid ? id : void 0,
2317
+ role: "presentation",
2318
+ style: {
2319
+ ...imgStyle,
2320
+ display: imageValid ? "block" : "none"
2321
+ },
2322
+ onLoad: () => setImageValid(true),
2323
+ onError: () => setImageValid(false)
2324
+ })]
2325
+ });
2326
+ }
2327
+ return /* @__PURE__ */ jsx("figure", {
2328
+ style: wrapperStyle,
2329
+ "data-testid": "Avatar",
2330
+ role: "presentation",
2331
+ children: bgColor ? /* @__PURE__ */ jsx("span", {
2332
+ style: initialsStyle,
2333
+ id,
2334
+ "aria-hidden": "true",
2335
+ children: getInitials(fullName)
2336
+ }) : null
2252
2337
  });
2253
- }
2254
- DateStatus.displayName = "DateStatus";
2338
+ };
2339
+ Avatar.displayName = "Avatar";
2255
2340
  function IconSelection({
2256
2341
  type,
2257
2342
  progressValue = 0
@@ -2300,6 +2385,20 @@ function CourseStatus({
2300
2385
  })]
2301
2386
  });
2302
2387
  }
2388
+ function DateStatus({
2389
+ date
2390
+ }) {
2391
+ if (date == null || date.length === 0) {
2392
+ return null;
2393
+ }
2394
+ return /* @__PURE__ */ jsx(Text$1, {
2395
+ fontSize: ".75rem",
2396
+ color: vars("colors-neutral-darkCharcoal"),
2397
+ m: "0",
2398
+ children: date
2399
+ });
2400
+ }
2401
+ DateStatus.displayName = "DateStatus";
2303
2402
  function Section() {
2304
2403
  const {
2305
2404
  name,
@@ -2360,13 +2459,10 @@ function Section() {
2360
2459
  }), /* @__PURE__ */ jsx(Box, {
2361
2460
  display: "inline-block",
2362
2461
  ml: ".625rem",
2363
- children: item.href !== void 0 && ((_a = item.href) == null ? void 0 : _a.length) > 0 ? /* @__PURE__ */ jsx(Link, {
2364
- isExternal: true,
2462
+ children: item.href !== void 0 && ((_a = item.href) == null ? void 0 : _a.length) > 0 ? /* @__PURE__ */ jsx(BtnLink, {
2365
2463
  href: item.href,
2366
- color: vars("colors-main-deepSkyBlue"),
2367
- textDecor: "underline",
2368
- fontWeight: "500",
2369
- fontSize: ".75rem",
2464
+ p: "0",
2465
+ target: "_self",
2370
2466
  children: item.text
2371
2467
  }) : /* @__PURE__ */ jsx(Text$1, {
2372
2468
  m: "0",
@@ -3731,96 +3827,143 @@ function CourseList({
3731
3827
  });
3732
3828
  }
3733
3829
  CourseList.displayName = "CourseList";
3734
- /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
3735
- const {
3736
- entries,
3737
- setPrototypeOf,
3738
- isFrozen,
3739
- getPrototypeOf,
3740
- getOwnPropertyDescriptor
3741
- } = Object;
3742
- let {
3743
- freeze,
3744
- seal,
3745
- create
3746
- } = Object;
3747
- let {
3748
- apply,
3749
- construct
3750
- } = typeof Reflect !== "undefined" && Reflect;
3751
- if (!freeze) {
3830
+ /*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */
3831
+ function _arrayLikeToArray(r, a2) {
3832
+ (null == a2 || a2 > r.length) && (a2 = r.length);
3833
+ for (var e2 = 0, n2 = Array(a2); e2 < a2; e2++)
3834
+ n2[e2] = r[e2];
3835
+ return n2;
3836
+ }
3837
+ function _arrayWithHoles(r) {
3838
+ if (Array.isArray(r))
3839
+ return r;
3840
+ }
3841
+ function _iterableToArrayLimit(r, l2) {
3842
+ var t2 = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
3843
+ if (null != t2) {
3844
+ var e2, n2, i2, u2, a2 = [], f2 = true, o2 = false;
3845
+ try {
3846
+ if (i2 = (t2 = t2.call(r)).next, 0 === l2) {
3847
+ if (Object(t2) !== t2)
3848
+ return;
3849
+ f2 = false;
3850
+ } else
3851
+ for (; !(f2 = (e2 = i2.call(t2)).done) && (a2.push(e2.value), a2.length !== l2); f2 = true)
3852
+ ;
3853
+ } catch (r2) {
3854
+ o2 = true, n2 = r2;
3855
+ } finally {
3856
+ try {
3857
+ if (!f2 && null != t2.return && (u2 = t2.return(), Object(u2) !== u2))
3858
+ return;
3859
+ } finally {
3860
+ if (o2)
3861
+ throw n2;
3862
+ }
3863
+ }
3864
+ return a2;
3865
+ }
3866
+ }
3867
+ function _nonIterableRest() {
3868
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
3869
+ }
3870
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3871
+ function _slicedToArray(r, e2) {
3872
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e2) || _unsupportedIterableToArray(r, e2) || _nonIterableRest();
3873
+ }
3874
+ function _unsupportedIterableToArray(r, a2) {
3875
+ if (r) {
3876
+ if ("string" == typeof r)
3877
+ return _arrayLikeToArray(r, a2);
3878
+ var t2 = {}.toString.call(r).slice(8, -1);
3879
+ return "Object" === t2 && r.constructor && (t2 = r.constructor.name), "Map" === t2 || "Set" === t2 ? Array.from(r) : "Arguments" === t2 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t2) ? _arrayLikeToArray(r, a2) : void 0;
3880
+ }
3881
+ }
3882
+ const entries = Object.entries;
3883
+ const setPrototypeOf = Object.setPrototypeOf;
3884
+ const isFrozen = Object.isFrozen;
3885
+ const getPrototypeOf = Object.getPrototypeOf;
3886
+ const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
3887
+ let freeze = Object.freeze;
3888
+ let seal = Object.seal;
3889
+ let create = Object.create;
3890
+ let _ref = typeof Reflect !== "undefined" && Reflect;
3891
+ let apply = _ref.apply;
3892
+ let construct = _ref.construct;
3893
+ if (!freeze)
3752
3894
  freeze = function freeze2(x) {
3753
3895
  return x;
3754
3896
  };
3755
- }
3756
- if (!seal) {
3897
+ if (!seal)
3757
3898
  seal = function seal2(x) {
3758
3899
  return x;
3759
3900
  };
3760
- }
3761
- if (!apply) {
3901
+ if (!apply)
3762
3902
  apply = function apply2(func, thisArg) {
3763
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
3903
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++)
3764
3904
  args[_key - 2] = arguments[_key];
3765
- }
3766
3905
  return func.apply(thisArg, args);
3767
3906
  };
3768
- }
3769
- if (!construct) {
3907
+ if (!construct)
3770
3908
  construct = function construct2(Func) {
3771
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3909
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++)
3772
3910
  args[_key2 - 1] = arguments[_key2];
3773
- }
3774
3911
  return new Func(...args);
3775
3912
  };
3776
- }
3777
3913
  const arrayForEach = unapply(Array.prototype.forEach);
3778
3914
  const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
3779
3915
  const arrayPop = unapply(Array.prototype.pop);
3780
3916
  const arrayPush = unapply(Array.prototype.push);
3917
+ const arraySlice = unapply(Array.prototype.slice);
3781
3918
  const arraySplice = unapply(Array.prototype.splice);
3919
+ const arrayIsArray = Array.isArray;
3920
+ const setCreate = unconstruct(Set);
3921
+ const setAdd = unapply(Set.prototype.add);
3922
+ const setHas = unapply(Set.prototype.has);
3782
3923
  const stringToLowerCase = unapply(String.prototype.toLowerCase);
3783
3924
  const stringToString = unapply(String.prototype.toString);
3784
3925
  const stringMatch = unapply(String.prototype.match);
3785
3926
  const stringReplace = unapply(String.prototype.replace);
3786
3927
  const stringIndexOf = unapply(String.prototype.indexOf);
3787
3928
  const stringTrim = unapply(String.prototype.trim);
3929
+ const numberToString = unapply(Number.prototype.toString);
3930
+ const booleanToString = unapply(Boolean.prototype.toString);
3931
+ const bigintToString = typeof BigInt === "undefined" ? null : unapply(BigInt.prototype.toString);
3932
+ const symbolToString = typeof Symbol === "undefined" ? null : unapply(Symbol.prototype.toString);
3788
3933
  const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
3934
+ const objectToString = unapply(Object.prototype.toString);
3789
3935
  const regExpTest = unapply(RegExp.prototype.test);
3790
3936
  const typeErrorCreate = unconstruct(TypeError);
3791
3937
  function unapply(func) {
3792
3938
  return function(thisArg) {
3793
- if (thisArg instanceof RegExp) {
3939
+ if (thisArg instanceof RegExp)
3794
3940
  thisArg.lastIndex = 0;
3795
- }
3796
- for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
3941
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++)
3797
3942
  args[_key3 - 1] = arguments[_key3];
3798
- }
3799
3943
  return apply(func, thisArg, args);
3800
3944
  };
3801
3945
  }
3802
3946
  function unconstruct(Func) {
3803
3947
  return function() {
3804
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
3948
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)
3805
3949
  args[_key4] = arguments[_key4];
3806
- }
3807
3950
  return construct(Func, args);
3808
3951
  };
3809
3952
  }
3810
3953
  function addToSet(set, array) {
3811
3954
  let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
3812
- if (setPrototypeOf) {
3955
+ if (setPrototypeOf)
3813
3956
  setPrototypeOf(set, null);
3814
- }
3957
+ if (!arrayIsArray(array))
3958
+ return set;
3815
3959
  let l2 = array.length;
3816
3960
  while (l2--) {
3817
3961
  let element = array[l2];
3818
3962
  if (typeof element === "string") {
3819
3963
  const lcElement = transformCaseFunc(element);
3820
3964
  if (lcElement !== element) {
3821
- if (!isFrozen(array)) {
3965
+ if (!isFrozen(array))
3822
3966
  array[l2] = lcElement;
3823
- }
3824
3967
  element = lcElement;
3825
3968
  }
3826
3969
  }
@@ -3829,40 +3972,66 @@ function addToSet(set, array) {
3829
3972
  return set;
3830
3973
  }
3831
3974
  function cleanArray(array) {
3832
- for (let index2 = 0; index2 < array.length; index2++) {
3833
- const isPropertyExist = objectHasOwnProperty(array, index2);
3834
- if (!isPropertyExist) {
3975
+ for (let index2 = 0; index2 < array.length; index2++)
3976
+ if (!objectHasOwnProperty(array, index2))
3835
3977
  array[index2] = null;
3836
- }
3837
- }
3838
3978
  return array;
3839
3979
  }
3840
3980
  function clone(object) {
3841
3981
  const newObject = create(null);
3842
- for (const [property, value] of entries(object)) {
3843
- const isPropertyExist = objectHasOwnProperty(object, property);
3844
- if (isPropertyExist) {
3845
- if (Array.isArray(value)) {
3982
+ for (const _ref2 of entries(object)) {
3983
+ var _ref3 = _slicedToArray(_ref2, 2);
3984
+ const property = _ref3[0];
3985
+ const value = _ref3[1];
3986
+ if (objectHasOwnProperty(object, property)) {
3987
+ if (arrayIsArray(value))
3846
3988
  newObject[property] = cleanArray(value);
3847
- } else if (value && typeof value === "object" && value.constructor === Object) {
3989
+ else if (value && typeof value === "object" && value.constructor === Object)
3848
3990
  newObject[property] = clone(value);
3849
- } else {
3991
+ else
3850
3992
  newObject[property] = value;
3851
- }
3852
3993
  }
3853
3994
  }
3854
3995
  return newObject;
3855
3996
  }
3997
+ function stringifyValue(value) {
3998
+ switch (typeof value) {
3999
+ case "string":
4000
+ return value;
4001
+ case "number":
4002
+ return numberToString(value);
4003
+ case "boolean":
4004
+ return booleanToString(value);
4005
+ case "bigint":
4006
+ return bigintToString ? bigintToString(value) : "0";
4007
+ case "symbol":
4008
+ return symbolToString ? symbolToString(value) : "Symbol()";
4009
+ case "undefined":
4010
+ return objectToString(value);
4011
+ case "function":
4012
+ case "object": {
4013
+ if (value === null)
4014
+ return objectToString(value);
4015
+ const valueAsRecord = value;
4016
+ const valueToString = lookupGetter(valueAsRecord, "toString");
4017
+ if (typeof valueToString === "function") {
4018
+ const stringified = valueToString(valueAsRecord);
4019
+ return typeof stringified === "string" ? stringified : objectToString(stringified);
4020
+ }
4021
+ return objectToString(value);
4022
+ }
4023
+ default:
4024
+ return objectToString(value);
4025
+ }
4026
+ }
3856
4027
  function lookupGetter(object, prop) {
3857
4028
  while (object !== null) {
3858
4029
  const desc = getOwnPropertyDescriptor(object, prop);
3859
4030
  if (desc) {
3860
- if (desc.get) {
4031
+ if (desc.get)
3861
4032
  return unapply(desc.get);
3862
- }
3863
- if (typeof desc.value === "function") {
4033
+ if (typeof desc.value === "function")
3864
4034
  return unapply(desc.value);
3865
- }
3866
4035
  }
3867
4036
  object = getPrototypeOf(object);
3868
4037
  }
@@ -3871,44 +4040,685 @@ function lookupGetter(object, prop) {
3871
4040
  }
3872
4041
  return fallbackValue;
3873
4042
  }
3874
- 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"]);
3875
- 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"]);
3876
- 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"]);
3877
- 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"]);
3878
- 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"]);
3879
- const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
4043
+ function lookupAccessor(object, prop) {
4044
+ while (object !== null) {
4045
+ const desc = getOwnPropertyDescriptor(object, prop);
4046
+ if (desc)
4047
+ return desc.get ? unapply(desc.get) : null;
4048
+ object = getPrototypeOf(object);
4049
+ }
4050
+ return null;
4051
+ }
4052
+ function isRegex(value) {
4053
+ try {
4054
+ regExpTest(value, "");
4055
+ return true;
4056
+ } catch (_unused) {
4057
+ return false;
4058
+ }
4059
+ }
4060
+ const html$1 = freeze([
4061
+ "a",
4062
+ "abbr",
4063
+ "acronym",
4064
+ "address",
4065
+ "area",
4066
+ "article",
4067
+ "aside",
4068
+ "audio",
4069
+ "b",
4070
+ "bdi",
4071
+ "bdo",
4072
+ "big",
4073
+ "blink",
4074
+ "blockquote",
4075
+ "body",
4076
+ "br",
4077
+ "button",
4078
+ "canvas",
4079
+ "caption",
4080
+ "center",
4081
+ "cite",
4082
+ "code",
4083
+ "col",
4084
+ "colgroup",
4085
+ "content",
4086
+ "data",
4087
+ "datalist",
4088
+ "dd",
4089
+ "decorator",
4090
+ "del",
4091
+ "details",
4092
+ "dfn",
4093
+ "dialog",
4094
+ "dir",
4095
+ "div",
4096
+ "dl",
4097
+ "dt",
4098
+ "element",
4099
+ "em",
4100
+ "fieldset",
4101
+ "figcaption",
4102
+ "figure",
4103
+ "font",
4104
+ "footer",
4105
+ "form",
4106
+ "h1",
4107
+ "h2",
4108
+ "h3",
4109
+ "h4",
4110
+ "h5",
4111
+ "h6",
4112
+ "head",
4113
+ "header",
4114
+ "hgroup",
4115
+ "hr",
4116
+ "html",
4117
+ "i",
4118
+ "img",
4119
+ "input",
4120
+ "ins",
4121
+ "kbd",
4122
+ "label",
4123
+ "legend",
4124
+ "li",
4125
+ "main",
4126
+ "map",
4127
+ "mark",
4128
+ "marquee",
4129
+ "menu",
4130
+ "menuitem",
4131
+ "meter",
4132
+ "nav",
4133
+ "nobr",
4134
+ "ol",
4135
+ "optgroup",
4136
+ "option",
4137
+ "output",
4138
+ "p",
4139
+ "picture",
4140
+ "pre",
4141
+ "progress",
4142
+ "q",
4143
+ "rp",
4144
+ "rt",
4145
+ "ruby",
4146
+ "s",
4147
+ "samp",
4148
+ "search",
4149
+ "section",
4150
+ "select",
4151
+ "shadow",
4152
+ "slot",
4153
+ "small",
4154
+ "source",
4155
+ "spacer",
4156
+ "span",
4157
+ "strike",
4158
+ "strong",
4159
+ "style",
4160
+ "sub",
4161
+ "summary",
4162
+ "sup",
4163
+ "table",
4164
+ "tbody",
4165
+ "td",
4166
+ "template",
4167
+ "textarea",
4168
+ "tfoot",
4169
+ "th",
4170
+ "thead",
4171
+ "time",
4172
+ "tr",
4173
+ "track",
4174
+ "tt",
4175
+ "u",
4176
+ "ul",
4177
+ "var",
4178
+ "video",
4179
+ "wbr"
4180
+ ]);
4181
+ const svg$1 = freeze([
4182
+ "svg",
4183
+ "a",
4184
+ "altglyph",
4185
+ "altglyphdef",
4186
+ "altglyphitem",
4187
+ "animatecolor",
4188
+ "animatemotion",
4189
+ "animatetransform",
4190
+ "circle",
4191
+ "clippath",
4192
+ "defs",
4193
+ "desc",
4194
+ "ellipse",
4195
+ "enterkeyhint",
4196
+ "exportparts",
4197
+ "filter",
4198
+ "font",
4199
+ "g",
4200
+ "glyph",
4201
+ "glyphref",
4202
+ "hkern",
4203
+ "image",
4204
+ "inputmode",
4205
+ "line",
4206
+ "lineargradient",
4207
+ "marker",
4208
+ "mask",
4209
+ "metadata",
4210
+ "mpath",
4211
+ "part",
4212
+ "path",
4213
+ "pattern",
4214
+ "polygon",
4215
+ "polyline",
4216
+ "radialgradient",
4217
+ "rect",
4218
+ "stop",
4219
+ "style",
4220
+ "switch",
4221
+ "symbol",
4222
+ "text",
4223
+ "textpath",
4224
+ "title",
4225
+ "tref",
4226
+ "tspan",
4227
+ "view",
4228
+ "vkern"
4229
+ ]);
4230
+ const svgFilters = freeze([
4231
+ "feBlend",
4232
+ "feColorMatrix",
4233
+ "feComponentTransfer",
4234
+ "feComposite",
4235
+ "feConvolveMatrix",
4236
+ "feDiffuseLighting",
4237
+ "feDisplacementMap",
4238
+ "feDistantLight",
4239
+ "feDropShadow",
4240
+ "feFlood",
4241
+ "feFuncA",
4242
+ "feFuncB",
4243
+ "feFuncG",
4244
+ "feFuncR",
4245
+ "feGaussianBlur",
4246
+ "feImage",
4247
+ "feMerge",
4248
+ "feMergeNode",
4249
+ "feMorphology",
4250
+ "feOffset",
4251
+ "fePointLight",
4252
+ "feSpecularLighting",
4253
+ "feSpotLight",
4254
+ "feTile",
4255
+ "feTurbulence"
4256
+ ]);
4257
+ const svgDisallowed = freeze([
4258
+ "animate",
4259
+ "color-profile",
4260
+ "cursor",
4261
+ "discard",
4262
+ "font-face",
4263
+ "font-face-format",
4264
+ "font-face-name",
4265
+ "font-face-src",
4266
+ "font-face-uri",
4267
+ "foreignobject",
4268
+ "hatch",
4269
+ "hatchpath",
4270
+ "mesh",
4271
+ "meshgradient",
4272
+ "meshpatch",
4273
+ "meshrow",
4274
+ "missing-glyph",
4275
+ "script",
4276
+ "set",
4277
+ "solidcolor",
4278
+ "unknown",
4279
+ "use"
4280
+ ]);
4281
+ const mathMl$1 = freeze([
4282
+ "math",
4283
+ "menclose",
4284
+ "merror",
4285
+ "mfenced",
4286
+ "mfrac",
4287
+ "mglyph",
4288
+ "mi",
4289
+ "mlabeledtr",
4290
+ "mmultiscripts",
4291
+ "mn",
4292
+ "mo",
4293
+ "mover",
4294
+ "mpadded",
4295
+ "mphantom",
4296
+ "mroot",
4297
+ "mrow",
4298
+ "ms",
4299
+ "mspace",
4300
+ "msqrt",
4301
+ "mstyle",
4302
+ "msub",
4303
+ "msup",
4304
+ "msubsup",
4305
+ "mtable",
4306
+ "mtd",
4307
+ "mtext",
4308
+ "mtr",
4309
+ "munder",
4310
+ "munderover",
4311
+ "mprescripts"
4312
+ ]);
4313
+ const mathMlDisallowed = freeze([
4314
+ "maction",
4315
+ "maligngroup",
4316
+ "malignmark",
4317
+ "mlongdiv",
4318
+ "mscarries",
4319
+ "mscarry",
4320
+ "msgroup",
4321
+ "mstack",
4322
+ "msline",
4323
+ "msrow",
4324
+ "semantics",
4325
+ "annotation",
4326
+ "annotation-xml",
4327
+ "mprescripts",
4328
+ "none"
4329
+ ]);
3880
4330
  const text = freeze(["#text"]);
3881
- 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", "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", "slot"]);
3882
- 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"]);
3883
- 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"]);
3884
- const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
3885
- const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
3886
- const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
3887
- const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
4331
+ const html = freeze([
4332
+ "accept",
4333
+ "action",
4334
+ "align",
4335
+ "alt",
4336
+ "autocapitalize",
4337
+ "autocomplete",
4338
+ "autopictureinpicture",
4339
+ "autoplay",
4340
+ "background",
4341
+ "bgcolor",
4342
+ "border",
4343
+ "capture",
4344
+ "cellpadding",
4345
+ "cellspacing",
4346
+ "checked",
4347
+ "cite",
4348
+ "class",
4349
+ "clear",
4350
+ "color",
4351
+ "cols",
4352
+ "colspan",
4353
+ "command",
4354
+ "commandfor",
4355
+ "controls",
4356
+ "controlslist",
4357
+ "coords",
4358
+ "crossorigin",
4359
+ "datetime",
4360
+ "decoding",
4361
+ "default",
4362
+ "dir",
4363
+ "disabled",
4364
+ "disablepictureinpicture",
4365
+ "disableremoteplayback",
4366
+ "download",
4367
+ "draggable",
4368
+ "enctype",
4369
+ "enterkeyhint",
4370
+ "exportparts",
4371
+ "face",
4372
+ "for",
4373
+ "headers",
4374
+ "height",
4375
+ "hidden",
4376
+ "high",
4377
+ "href",
4378
+ "hreflang",
4379
+ "id",
4380
+ "inert",
4381
+ "inputmode",
4382
+ "integrity",
4383
+ "ismap",
4384
+ "kind",
4385
+ "label",
4386
+ "lang",
4387
+ "list",
4388
+ "loading",
4389
+ "loop",
4390
+ "low",
4391
+ "max",
4392
+ "maxlength",
4393
+ "media",
4394
+ "method",
4395
+ "min",
4396
+ "minlength",
4397
+ "multiple",
4398
+ "muted",
4399
+ "name",
4400
+ "nonce",
4401
+ "noshade",
4402
+ "novalidate",
4403
+ "nowrap",
4404
+ "open",
4405
+ "optimum",
4406
+ "part",
4407
+ "pattern",
4408
+ "placeholder",
4409
+ "playsinline",
4410
+ "popover",
4411
+ "popovertarget",
4412
+ "popovertargetaction",
4413
+ "poster",
4414
+ "preload",
4415
+ "pubdate",
4416
+ "radiogroup",
4417
+ "readonly",
4418
+ "rel",
4419
+ "required",
4420
+ "rev",
4421
+ "reversed",
4422
+ "role",
4423
+ "rows",
4424
+ "rowspan",
4425
+ "spellcheck",
4426
+ "scope",
4427
+ "selected",
4428
+ "shape",
4429
+ "size",
4430
+ "sizes",
4431
+ "slot",
4432
+ "span",
4433
+ "srclang",
4434
+ "start",
4435
+ "src",
4436
+ "srcset",
4437
+ "step",
4438
+ "style",
4439
+ "summary",
4440
+ "tabindex",
4441
+ "title",
4442
+ "translate",
4443
+ "type",
4444
+ "usemap",
4445
+ "valign",
4446
+ "value",
4447
+ "width",
4448
+ "wrap",
4449
+ "xmlns"
4450
+ ]);
4451
+ const svg = freeze([
4452
+ "accent-height",
4453
+ "accumulate",
4454
+ "additive",
4455
+ "alignment-baseline",
4456
+ "amplitude",
4457
+ "ascent",
4458
+ "attributename",
4459
+ "attributetype",
4460
+ "azimuth",
4461
+ "basefrequency",
4462
+ "baseline-shift",
4463
+ "begin",
4464
+ "bias",
4465
+ "by",
4466
+ "class",
4467
+ "clip",
4468
+ "clippathunits",
4469
+ "clip-path",
4470
+ "clip-rule",
4471
+ "color",
4472
+ "color-interpolation",
4473
+ "color-interpolation-filters",
4474
+ "color-profile",
4475
+ "color-rendering",
4476
+ "cx",
4477
+ "cy",
4478
+ "d",
4479
+ "dx",
4480
+ "dy",
4481
+ "diffuseconstant",
4482
+ "direction",
4483
+ "display",
4484
+ "divisor",
4485
+ "dominant-baseline",
4486
+ "dur",
4487
+ "edgemode",
4488
+ "elevation",
4489
+ "end",
4490
+ "exponent",
4491
+ "fill",
4492
+ "fill-opacity",
4493
+ "fill-rule",
4494
+ "filter",
4495
+ "filterunits",
4496
+ "flood-color",
4497
+ "flood-opacity",
4498
+ "font-family",
4499
+ "font-size",
4500
+ "font-size-adjust",
4501
+ "font-stretch",
4502
+ "font-style",
4503
+ "font-variant",
4504
+ "font-weight",
4505
+ "fx",
4506
+ "fy",
4507
+ "g1",
4508
+ "g2",
4509
+ "glyph-name",
4510
+ "glyphref",
4511
+ "gradientunits",
4512
+ "gradienttransform",
4513
+ "height",
4514
+ "href",
4515
+ "id",
4516
+ "image-rendering",
4517
+ "in",
4518
+ "in2",
4519
+ "intercept",
4520
+ "k",
4521
+ "k1",
4522
+ "k2",
4523
+ "k3",
4524
+ "k4",
4525
+ "kerning",
4526
+ "keypoints",
4527
+ "keysplines",
4528
+ "keytimes",
4529
+ "lang",
4530
+ "lengthadjust",
4531
+ "letter-spacing",
4532
+ "kernelmatrix",
4533
+ "kernelunitlength",
4534
+ "lighting-color",
4535
+ "local",
4536
+ "marker-end",
4537
+ "marker-mid",
4538
+ "marker-start",
4539
+ "markerheight",
4540
+ "markerunits",
4541
+ "markerwidth",
4542
+ "maskcontentunits",
4543
+ "maskunits",
4544
+ "max",
4545
+ "mask",
4546
+ "mask-type",
4547
+ "media",
4548
+ "method",
4549
+ "mode",
4550
+ "min",
4551
+ "name",
4552
+ "numoctaves",
4553
+ "offset",
4554
+ "operator",
4555
+ "opacity",
4556
+ "order",
4557
+ "orient",
4558
+ "orientation",
4559
+ "origin",
4560
+ "overflow",
4561
+ "paint-order",
4562
+ "path",
4563
+ "pathlength",
4564
+ "patterncontentunits",
4565
+ "patterntransform",
4566
+ "patternunits",
4567
+ "pointer-events",
4568
+ "points",
4569
+ "preservealpha",
4570
+ "preserveaspectratio",
4571
+ "primitiveunits",
4572
+ "r",
4573
+ "rx",
4574
+ "ry",
4575
+ "radius",
4576
+ "refx",
4577
+ "refy",
4578
+ "repeatcount",
4579
+ "repeatdur",
4580
+ "restart",
4581
+ "result",
4582
+ "rotate",
4583
+ "scale",
4584
+ "seed",
4585
+ "shape-rendering",
4586
+ "slope",
4587
+ "specularconstant",
4588
+ "specularexponent",
4589
+ "spreadmethod",
4590
+ "startoffset",
4591
+ "stddeviation",
4592
+ "stitchtiles",
4593
+ "stop-color",
4594
+ "stop-opacity",
4595
+ "stroke-dasharray",
4596
+ "stroke-dashoffset",
4597
+ "stroke-linecap",
4598
+ "stroke-linejoin",
4599
+ "stroke-miterlimit",
4600
+ "stroke-opacity",
4601
+ "stroke",
4602
+ "stroke-width",
4603
+ "style",
4604
+ "surfacescale",
4605
+ "systemlanguage",
4606
+ "tabindex",
4607
+ "tablevalues",
4608
+ "targetx",
4609
+ "targety",
4610
+ "transform",
4611
+ "transform-origin",
4612
+ "text-anchor",
4613
+ "text-decoration",
4614
+ "text-orientation",
4615
+ "text-rendering",
4616
+ "textlength",
4617
+ "type",
4618
+ "u1",
4619
+ "u2",
4620
+ "unicode",
4621
+ "values",
4622
+ "vector-effect",
4623
+ "viewbox",
4624
+ "visibility",
4625
+ "version",
4626
+ "vert-adv-y",
4627
+ "vert-origin-x",
4628
+ "vert-origin-y",
4629
+ "width",
4630
+ "word-spacing",
4631
+ "wrap",
4632
+ "writing-mode",
4633
+ "xchannelselector",
4634
+ "ychannelselector",
4635
+ "x",
4636
+ "x1",
4637
+ "x2",
4638
+ "xmlns",
4639
+ "y",
4640
+ "y1",
4641
+ "y2",
4642
+ "z",
4643
+ "zoomandpan"
4644
+ ]);
4645
+ const mathMl = freeze([
4646
+ "accent",
4647
+ "accentunder",
4648
+ "align",
4649
+ "bevelled",
4650
+ "close",
4651
+ "columnalign",
4652
+ "columnlines",
4653
+ "columnspacing",
4654
+ "columnspan",
4655
+ "denomalign",
4656
+ "depth",
4657
+ "dir",
4658
+ "display",
4659
+ "displaystyle",
4660
+ "encoding",
4661
+ "fence",
4662
+ "frame",
4663
+ "height",
4664
+ "href",
4665
+ "id",
4666
+ "largeop",
4667
+ "length",
4668
+ "linethickness",
4669
+ "lquote",
4670
+ "lspace",
4671
+ "mathbackground",
4672
+ "mathcolor",
4673
+ "mathsize",
4674
+ "mathvariant",
4675
+ "maxsize",
4676
+ "minsize",
4677
+ "movablelimits",
4678
+ "notation",
4679
+ "numalign",
4680
+ "open",
4681
+ "rowalign",
4682
+ "rowlines",
4683
+ "rowspacing",
4684
+ "rowspan",
4685
+ "rspace",
4686
+ "rquote",
4687
+ "scriptlevel",
4688
+ "scriptminsize",
4689
+ "scriptsizemultiplier",
4690
+ "selection",
4691
+ "separator",
4692
+ "separators",
4693
+ "stretchy",
4694
+ "subscriptshift",
4695
+ "supscriptshift",
4696
+ "symmetric",
4697
+ "voffset",
4698
+ "width",
4699
+ "xmlns"
4700
+ ]);
4701
+ const xml = freeze([
4702
+ "xlink:href",
4703
+ "xml:id",
4704
+ "xlink:title",
4705
+ "xml:space",
4706
+ "xmlns:xlink"
4707
+ ]);
4708
+ const MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
4709
+ const ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
4710
+ const TMPLIT_EXPR = seal(/\${[\w\W]*/g);
3888
4711
  const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
3889
4712
  const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
3890
- const IS_ALLOWED_URI = seal(
3891
- /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
3892
- );
4713
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
3893
4714
  const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
3894
- const ATTR_WHITESPACE = seal(
3895
- /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
3896
- );
4715
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
3897
4716
  const DOCTYPE_NAME = seal(/^html$/i);
3898
4717
  const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
3899
- var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
3900
- __proto__: null,
3901
- ARIA_ATTR,
3902
- ATTR_WHITESPACE,
3903
- CUSTOM_ELEMENT,
3904
- DATA_ATTR,
3905
- DOCTYPE_NAME,
3906
- ERB_EXPR,
3907
- IS_ALLOWED_URI,
3908
- IS_SCRIPT_OR_DATA,
3909
- MUSTACHE_EXPR,
3910
- TMPLIT_EXPR
3911
- });
4718
+ const ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
4719
+ const COMMENT_MARKUP_PROBE = seal(/<[/\w]/g);
4720
+ const FALLBACK_TAG_CLOSE = seal(/<\/no(script|embed|frames)/i);
4721
+ const SELF_CLOSING_TAG = seal(/\/>/i);
3912
4722
  const NODE_TYPE = {
3913
4723
  element: 1,
3914
4724
  attribute: 2,
@@ -3916,25 +4726,33 @@ const NODE_TYPE = {
3916
4726
  cdataSection: 4,
3917
4727
  entityReference: 5,
3918
4728
  entityNode: 6,
3919
- progressingInstruction: 7,
4729
+ processingInstruction: 7,
3920
4730
  comment: 8,
3921
4731
  document: 9,
3922
4732
  documentType: 10,
3923
4733
  documentFragment: 11,
3924
4734
  notation: 12
3925
4735
  };
4736
+ const LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, [
4737
+ "style",
4738
+ "script",
4739
+ "xmp",
4740
+ "iframe",
4741
+ "noembed",
4742
+ "noframes",
4743
+ "plaintext",
4744
+ "noscript"
4745
+ ]));
3926
4746
  const getGlobal = function getGlobal2() {
3927
4747
  return typeof window === "undefined" ? null : window;
3928
4748
  };
3929
4749
  const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
3930
- if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
4750
+ if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function")
3931
4751
  return null;
3932
- }
3933
4752
  let suffix = null;
3934
4753
  const ATTR_NAME = "data-tt-policy-suffix";
3935
- if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
4754
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME))
3936
4755
  suffix = purifyHostElement.getAttribute(ATTR_NAME);
3937
- }
3938
4756
  const policyName = "dompurify" + (suffix ? "#" + suffix : "");
3939
4757
  try {
3940
4758
  return trustedTypes.createPolicy(policyName, {
@@ -3963,73 +4781,112 @@ const _createHooksMap = function _createHooksMap2() {
3963
4781
  uponSanitizeShadowNode: []
3964
4782
  };
3965
4783
  };
4784
+ const _resolveSetOption = function _resolveSetOption2(cfg, key, fallback, options) {
4785
+ return objectHasOwnProperty(cfg, key) && arrayIsArray(cfg[key]) ? addToSet(options.base ? clone(options.base) : {}, cfg[key], options.transform) : fallback;
4786
+ };
4787
+ const _resolveObjectOption = function _resolveObjectOption2(cfg, key, makeFallback) {
4788
+ const value = objectHasOwnProperty(cfg, key) ? cfg[key] : void 0;
4789
+ return value && typeof value === "object" ? clone(value) : makeFallback();
4790
+ };
3966
4791
  function createDOMPurify() {
3967
4792
  let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
3968
4793
  const DOMPurify = (root) => createDOMPurify(root);
3969
- DOMPurify.version = "3.3.1";
4794
+ DOMPurify.version = "3.4.17";
3970
4795
  DOMPurify.removed = [];
3971
4796
  if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
3972
4797
  DOMPurify.isSupported = false;
3973
4798
  return DOMPurify;
3974
4799
  }
3975
- let {
3976
- document: document2
3977
- } = window2;
4800
+ let document2 = window2.document;
3978
4801
  const originalDocument = document2;
3979
4802
  const currentScript = originalDocument.currentScript;
3980
- const {
3981
- DocumentFragment,
3982
- HTMLTemplateElement,
3983
- Node: Node2,
3984
- Element: Element2,
3985
- NodeFilter,
3986
- NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
3987
- HTMLFormElement,
3988
- DOMParser: DOMParser2,
3989
- trustedTypes
3990
- } = window2;
4803
+ window2.DocumentFragment;
4804
+ const HTMLTemplateElement = window2.HTMLTemplateElement, Node2 = window2.Node, Element2 = window2.Element, NodeFilter = window2.NodeFilter;
4805
+ window2.NamedNodeMap === void 0 && (window2.NamedNodeMap || window2.MozNamedAttrMap);
4806
+ window2.HTMLFormElement;
4807
+ const DOMParser2 = window2.DOMParser, trustedTypes = window2.trustedTypes;
3991
4808
  const ElementPrototype = Element2.prototype;
3992
4809
  const cloneNode2 = lookupGetter(ElementPrototype, "cloneNode");
3993
4810
  const remove = lookupGetter(ElementPrototype, "remove");
4811
+ const removeAttributeNode = lookupGetter(ElementPrototype, "removeAttributeNode");
3994
4812
  const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
3995
4813
  const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
3996
4814
  const getParentNode = lookupGetter(ElementPrototype, "parentNode");
4815
+ const getShadowRoot = lookupGetter(ElementPrototype, "shadowRoot");
4816
+ const getAttributes = lookupGetter(ElementPrototype, "attributes");
4817
+ const getNodeType = Node2 && Node2.prototype ? lookupGetter(Node2.prototype, "nodeType") : null;
4818
+ const getNodeName = Node2 && Node2.prototype ? lookupGetter(Node2.prototype, "nodeName") : null;
4819
+ const getOwnerDocument = Node2 && Node2.prototype ? lookupGetter(Node2.prototype, "ownerDocument") : null;
4820
+ const _readNodeType = function _readNodeType2(node2) {
4821
+ return getNodeType ? getNodeType(node2) : node2.nodeType;
4822
+ };
4823
+ const _readNodeName = function _readNodeName2(node2) {
4824
+ return getNodeName ? getNodeName(node2) : node2.nodeName;
4825
+ };
4826
+ const getNamespaceURI = lookupAccessor(ElementPrototype, "namespaceURI");
4827
+ const _readNamespaceURI = function _readNamespaceURI2(element) {
4828
+ return getNamespaceURI ? getNamespaceURI(element) : element.namespaceURI;
4829
+ };
3997
4830
  if (typeof HTMLTemplateElement === "function") {
3998
4831
  const template2 = document2.createElement("template");
3999
- if (template2.content && template2.content.ownerDocument) {
4832
+ if (template2.content && template2.content.ownerDocument)
4000
4833
  document2 = template2.content.ownerDocument;
4001
- }
4002
4834
  }
4003
4835
  let trustedTypesPolicy;
4004
4836
  let emptyHTML = "";
4005
- const {
4006
- implementation,
4007
- createNodeIterator,
4008
- createDocumentFragment,
4009
- getElementsByTagName
4010
- } = document2;
4011
- const {
4012
- importNode
4013
- } = originalDocument;
4837
+ let defaultTrustedTypesPolicy;
4838
+ let defaultTrustedTypesPolicyResolved = false;
4839
+ let IN_TRUSTED_TYPES_POLICY = 0;
4840
+ const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
4841
+ if (IN_TRUSTED_TYPES_POLICY > 0)
4842
+ throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
4843
+ };
4844
+ const _createTrustedHTML = function _createTrustedHTML2(html2) {
4845
+ _assertNotInTrustedTypesPolicy();
4846
+ IN_TRUSTED_TYPES_POLICY++;
4847
+ try {
4848
+ return trustedTypesPolicy.createHTML(html2);
4849
+ } finally {
4850
+ IN_TRUSTED_TYPES_POLICY--;
4851
+ }
4852
+ };
4853
+ const _createTrustedScriptURL = function _createTrustedScriptURL2(scriptUrl) {
4854
+ _assertNotInTrustedTypesPolicy();
4855
+ IN_TRUSTED_TYPES_POLICY++;
4856
+ try {
4857
+ return trustedTypesPolicy.createScriptURL(scriptUrl);
4858
+ } finally {
4859
+ IN_TRUSTED_TYPES_POLICY--;
4860
+ }
4861
+ };
4862
+ const _getDefaultTrustedTypesPolicy = function _getDefaultTrustedTypesPolicy2() {
4863
+ if (!defaultTrustedTypesPolicyResolved) {
4864
+ defaultTrustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
4865
+ defaultTrustedTypesPolicyResolved = true;
4866
+ }
4867
+ return defaultTrustedTypesPolicy;
4868
+ };
4869
+ const _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
4870
+ const importNode = originalDocument.importNode;
4014
4871
  let hooks = _createHooksMap();
4015
4872
  DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
4016
- const {
4017
- MUSTACHE_EXPR: MUSTACHE_EXPR2,
4018
- ERB_EXPR: ERB_EXPR2,
4019
- TMPLIT_EXPR: TMPLIT_EXPR2,
4020
- DATA_ATTR: DATA_ATTR2,
4021
- ARIA_ATTR: ARIA_ATTR2,
4022
- IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
4023
- ATTR_WHITESPACE: ATTR_WHITESPACE2,
4024
- CUSTOM_ELEMENT: CUSTOM_ELEMENT2
4025
- } = EXPRESSIONS;
4026
- let {
4027
- IS_ALLOWED_URI: IS_ALLOWED_URI$1
4028
- } = EXPRESSIONS;
4873
+ 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;
4874
+ let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
4029
4875
  let ALLOWED_TAGS = null;
4030
- const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
4876
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [
4877
+ ...html$1,
4878
+ ...svg$1,
4879
+ ...svgFilters,
4880
+ ...mathMl$1,
4881
+ ...text
4882
+ ]);
4031
4883
  let ALLOWED_ATTR = null;
4032
- const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
4884
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [
4885
+ ...html,
4886
+ ...svg,
4887
+ ...mathMl,
4888
+ ...xml
4889
+ ]);
4033
4890
  let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
4034
4891
  tagNameCheck: {
4035
4892
  writable: true,
@@ -4074,6 +4931,8 @@ function createDOMPurify() {
4074
4931
  let SAFE_FOR_XML = true;
4075
4932
  let WHOLE_DOCUMENT = false;
4076
4933
  let SET_CONFIG = false;
4934
+ let SET_CONFIG_ALLOWED_TAGS = null;
4935
+ let SET_CONFIG_ALLOWED_ATTR = null;
4077
4936
  let FORCE_BODY = false;
4078
4937
  let RETURN_DOM = false;
4079
4938
  let RETURN_DOM_FRAGMENT = false;
@@ -4083,23 +4942,91 @@ function createDOMPurify() {
4083
4942
  const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
4084
4943
  let KEEP_CONTENT = true;
4085
4944
  let IN_PLACE = false;
4945
+ let IN_PLACE_VISITED = null;
4086
4946
  let USE_PROFILES = {};
4087
4947
  let FORBID_CONTENTS = null;
4088
- 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"]);
4948
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, [
4949
+ "annotation-xml",
4950
+ "audio",
4951
+ "colgroup",
4952
+ "desc",
4953
+ "foreignobject",
4954
+ "head",
4955
+ "iframe",
4956
+ "math",
4957
+ "mi",
4958
+ "mn",
4959
+ "mo",
4960
+ "ms",
4961
+ "mtext",
4962
+ "noembed",
4963
+ "noframes",
4964
+ "noscript",
4965
+ "plaintext",
4966
+ "script",
4967
+ "selectedcontent",
4968
+ "style",
4969
+ "svg",
4970
+ "template",
4971
+ "thead",
4972
+ "title",
4973
+ "video",
4974
+ "xmp"
4975
+ ]);
4089
4976
  let DATA_URI_TAGS = null;
4090
- const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
4977
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, [
4978
+ "audio",
4979
+ "video",
4980
+ "img",
4981
+ "source",
4982
+ "image",
4983
+ "track"
4984
+ ]);
4091
4985
  let URI_SAFE_ATTRIBUTES = null;
4092
- const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
4986
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
4987
+ "alt",
4988
+ "class",
4989
+ "for",
4990
+ "id",
4991
+ "label",
4992
+ "name",
4993
+ "pattern",
4994
+ "placeholder",
4995
+ "role",
4996
+ "summary",
4997
+ "title",
4998
+ "value",
4999
+ "style",
5000
+ "xmlns"
5001
+ ]);
4093
5002
  const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
4094
5003
  const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
4095
5004
  const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
4096
5005
  let NAMESPACE = HTML_NAMESPACE;
4097
5006
  let IS_EMPTY_INPUT = false;
4098
5007
  let ALLOWED_NAMESPACES = null;
4099
- const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
4100
- let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
4101
- let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
4102
- const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
5008
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
5009
+ MATHML_NAMESPACE,
5010
+ SVG_NAMESPACE,
5011
+ HTML_NAMESPACE
5012
+ ], stringToString);
5013
+ const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
5014
+ "mi",
5015
+ "mo",
5016
+ "mn",
5017
+ "ms",
5018
+ "mtext"
5019
+ ]);
5020
+ let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
5021
+ const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
5022
+ let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
5023
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
5024
+ "title",
5025
+ "style",
5026
+ "font",
5027
+ "a",
5028
+ "script"
5029
+ ]);
4103
5030
  let PARSER_MEDIA_TYPE = null;
4104
5031
  const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
4105
5032
  const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
@@ -4111,24 +5038,28 @@ function createDOMPurify() {
4111
5038
  };
4112
5039
  const _parseConfig = function _parseConfig2() {
4113
5040
  let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
4114
- if (CONFIG && CONFIG === cfg) {
5041
+ if (CONFIG && CONFIG === cfg)
4115
5042
  return;
4116
- }
4117
- if (!cfg || typeof cfg !== "object") {
5043
+ if (!cfg || typeof cfg !== "object")
4118
5044
  cfg = {};
4119
- }
4120
5045
  cfg = clone(cfg);
4121
5046
  PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
4122
5047
  transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
4123
- ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
4124
- ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
4125
- ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
4126
- 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;
4127
- 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;
4128
- FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
4129
- FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
4130
- FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
4131
- USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
5048
+ ALLOWED_TAGS = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
5049
+ ALLOWED_ATTR = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
5050
+ ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
5051
+ URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
5052
+ transform: transformCaseFunc,
5053
+ base: DEFAULT_URI_SAFE_ATTRIBUTES
5054
+ });
5055
+ DATA_URI_TAGS = _resolveSetOption(cfg, "ADD_DATA_URI_TAGS", DEFAULT_DATA_URI_TAGS, {
5056
+ transform: transformCaseFunc,
5057
+ base: DEFAULT_DATA_URI_TAGS
5058
+ });
5059
+ FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
5060
+ FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
5061
+ FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
5062
+ USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
4132
5063
  ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
4133
5064
  ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
4134
5065
  ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
@@ -4144,29 +5075,26 @@ function createDOMPurify() {
4144
5075
  SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
4145
5076
  KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
4146
5077
  IN_PLACE = cfg.IN_PLACE || false;
4147
- IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
4148
- NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
4149
- MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
4150
- HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
4151
- CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
4152
- if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
4153
- CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
4154
- }
4155
- if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
4156
- CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
4157
- }
4158
- if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
4159
- CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
4160
- }
4161
- if (SAFE_FOR_TEMPLATES) {
5078
+ IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
5079
+ NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
5080
+ MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
5081
+ HTML_INTEGRATION_POINTS = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
5082
+ const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
5083
+ CUSTOM_ELEMENT_HANDLING = create(null);
5084
+ if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck))
5085
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
5086
+ if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck))
5087
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
5088
+ if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean")
5089
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
5090
+ seal(CUSTOM_ELEMENT_HANDLING);
5091
+ if (SAFE_FOR_TEMPLATES)
4162
5092
  ALLOW_DATA_ATTR = false;
4163
- }
4164
- if (RETURN_DOM_FRAGMENT) {
5093
+ if (RETURN_DOM_FRAGMENT)
4165
5094
  RETURN_DOM = true;
4166
- }
4167
5095
  if (USE_PROFILES) {
4168
5096
  ALLOWED_TAGS = addToSet({}, text);
4169
- ALLOWED_ATTR = [];
5097
+ ALLOWED_ATTR = create(null);
4170
5098
  if (USE_PROFILES.html === true) {
4171
5099
  addToSet(ALLOWED_TAGS, html$1);
4172
5100
  addToSet(ALLOWED_ATTR, html);
@@ -4187,176 +5115,360 @@ function createDOMPurify() {
4187
5115
  addToSet(ALLOWED_ATTR, xml);
4188
5116
  }
4189
5117
  }
4190
- if (cfg.ADD_TAGS) {
4191
- if (typeof cfg.ADD_TAGS === "function") {
5118
+ EXTRA_ELEMENT_HANDLING.tagCheck = null;
5119
+ EXTRA_ELEMENT_HANDLING.attributeCheck = null;
5120
+ if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
5121
+ if (typeof cfg.ADD_TAGS === "function")
4192
5122
  EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
4193
- } else {
4194
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
5123
+ else if (arrayIsArray(cfg.ADD_TAGS)) {
5124
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS)
4195
5125
  ALLOWED_TAGS = clone(ALLOWED_TAGS);
4196
- }
4197
5126
  addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
4198
5127
  }
4199
5128
  }
4200
- if (cfg.ADD_ATTR) {
4201
- if (typeof cfg.ADD_ATTR === "function") {
5129
+ if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
5130
+ if (typeof cfg.ADD_ATTR === "function")
4202
5131
  EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
4203
- } else {
4204
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
5132
+ else if (arrayIsArray(cfg.ADD_ATTR)) {
5133
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR)
4205
5134
  ALLOWED_ATTR = clone(ALLOWED_ATTR);
4206
- }
4207
5135
  addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
4208
5136
  }
4209
5137
  }
4210
- if (cfg.ADD_URI_SAFE_ATTR) {
4211
- addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
4212
- }
4213
- if (cfg.FORBID_CONTENTS) {
4214
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
5138
+ if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
5139
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS)
4215
5140
  FORBID_CONTENTS = clone(FORBID_CONTENTS);
4216
- }
4217
- addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
4218
- }
4219
- if (cfg.ADD_FORBID_CONTENTS) {
4220
- if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
4221
- FORBID_CONTENTS = clone(FORBID_CONTENTS);
4222
- }
4223
5141
  addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
4224
5142
  }
4225
- if (KEEP_CONTENT) {
5143
+ if (KEEP_CONTENT)
4226
5144
  ALLOWED_TAGS["#text"] = true;
4227
- }
4228
- if (WHOLE_DOCUMENT) {
4229
- addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
4230
- }
5145
+ if (WHOLE_DOCUMENT)
5146
+ addToSet(ALLOWED_TAGS, [
5147
+ "html",
5148
+ "head",
5149
+ "body"
5150
+ ]);
4231
5151
  if (ALLOWED_TAGS.table) {
4232
5152
  addToSet(ALLOWED_TAGS, ["tbody"]);
4233
5153
  delete FORBID_TAGS.tbody;
4234
5154
  }
4235
5155
  if (cfg.TRUSTED_TYPES_POLICY) {
4236
- if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
5156
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function")
4237
5157
  throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
4238
- }
4239
- if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
5158
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function")
4240
5159
  throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
4241
- }
5160
+ const previousTrustedTypesPolicy = trustedTypesPolicy;
4242
5161
  trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
4243
- emptyHTML = trustedTypesPolicy.createHTML("");
4244
- } else {
4245
- if (trustedTypesPolicy === void 0) {
4246
- trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
4247
- }
4248
- if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
4249
- emptyHTML = trustedTypesPolicy.createHTML("");
5162
+ try {
5163
+ emptyHTML = _createTrustedHTML("");
5164
+ } catch (error) {
5165
+ trustedTypesPolicy = previousTrustedTypesPolicy;
5166
+ throw error;
4250
5167
  }
5168
+ } else if (cfg.TRUSTED_TYPES_POLICY === null) {
5169
+ trustedTypesPolicy = void 0;
5170
+ emptyHTML = "";
5171
+ } else {
5172
+ if (trustedTypesPolicy === void 0)
5173
+ trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
5174
+ if (trustedTypesPolicy && typeof emptyHTML === "string")
5175
+ emptyHTML = _createTrustedHTML("");
4251
5176
  }
4252
- if (freeze) {
5177
+ if (freeze)
4253
5178
  freeze(cfg);
4254
- }
4255
5179
  CONFIG = cfg;
4256
5180
  };
4257
- const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
5181
+ const ALL_SVG_TAGS = addToSet({}, [
5182
+ ...svg$1,
5183
+ ...svgFilters,
5184
+ ...svgDisallowed
5185
+ ]);
4258
5186
  const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
5187
+ const _checkSvgNamespace = function _checkSvgNamespace2(tagName, parent, parentTagName) {
5188
+ if (parent.namespaceURI === HTML_NAMESPACE)
5189
+ return tagName === "svg";
5190
+ if (parent.namespaceURI === MATHML_NAMESPACE)
5191
+ return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
5192
+ return Boolean(ALL_SVG_TAGS[tagName]);
5193
+ };
5194
+ const _checkMathMlNamespace = function _checkMathMlNamespace2(tagName, parent, parentTagName) {
5195
+ if (parent.namespaceURI === HTML_NAMESPACE)
5196
+ return tagName === "math";
5197
+ if (parent.namespaceURI === SVG_NAMESPACE)
5198
+ return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
5199
+ return Boolean(ALL_MATHML_TAGS[tagName]);
5200
+ };
5201
+ const _checkHtmlNamespace = function _checkHtmlNamespace2(tagName, parent, parentTagName) {
5202
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName])
5203
+ return false;
5204
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName])
5205
+ return false;
5206
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
5207
+ };
4259
5208
  const _checkValidNamespace = function _checkValidNamespace2(element) {
4260
- let parent = getParentNode(element);
4261
- if (!parent || !parent.tagName) {
4262
- parent = {
4263
- namespaceURI: NAMESPACE,
4264
- tagName: "template"
4265
- };
5209
+ const elementNamespace = _readNamespaceURI(element);
5210
+ const tagName = stringToLowerCase(_readNodeName(element));
5211
+ const parentNode = getParentNode(element);
5212
+ let parent;
5213
+ let parentTagName;
5214
+ if (parentNode && _readNodeType(parentNode) === NODE_TYPE.element) {
5215
+ parent = { namespaceURI: _readNamespaceURI(parentNode) };
5216
+ parentTagName = stringToLowerCase(_readNodeName(parentNode));
5217
+ } else {
5218
+ parent = { namespaceURI: NAMESPACE };
5219
+ parentTagName = "template";
4266
5220
  }
4267
- const tagName = stringToLowerCase(element.tagName);
4268
- const parentTagName = stringToLowerCase(parent.tagName);
4269
- if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
5221
+ if (!ALLOWED_NAMESPACES[elementNamespace])
4270
5222
  return false;
4271
- }
4272
- if (element.namespaceURI === SVG_NAMESPACE) {
4273
- if (parent.namespaceURI === HTML_NAMESPACE) {
4274
- return tagName === "svg";
4275
- }
4276
- if (parent.namespaceURI === MATHML_NAMESPACE) {
4277
- return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
4278
- }
4279
- return Boolean(ALL_SVG_TAGS[tagName]);
4280
- }
4281
- if (element.namespaceURI === MATHML_NAMESPACE) {
4282
- if (parent.namespaceURI === HTML_NAMESPACE) {
4283
- return tagName === "math";
4284
- }
4285
- if (parent.namespaceURI === SVG_NAMESPACE) {
4286
- return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
4287
- }
4288
- return Boolean(ALL_MATHML_TAGS[tagName]);
4289
- }
4290
- if (element.namespaceURI === HTML_NAMESPACE) {
4291
- if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
4292
- return false;
4293
- }
4294
- if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
4295
- return false;
4296
- }
4297
- return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
4298
- }
4299
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
5223
+ if (elementNamespace === SVG_NAMESPACE)
5224
+ return _checkSvgNamespace(tagName, parent, parentTagName);
5225
+ if (elementNamespace === MATHML_NAMESPACE)
5226
+ return _checkMathMlNamespace(tagName, parent, parentTagName);
5227
+ if (elementNamespace === HTML_NAMESPACE)
5228
+ return _checkHtmlNamespace(tagName, parent, parentTagName);
5229
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[elementNamespace])
4300
5230
  return true;
4301
- }
4302
5231
  return false;
4303
5232
  };
4304
5233
  const _forceRemove = function _forceRemove2(node2) {
4305
- arrayPush(DOMPurify.removed, {
4306
- element: node2
4307
- });
5234
+ arrayPush(DOMPurify.removed, { element: node2 });
4308
5235
  try {
4309
5236
  getParentNode(node2).removeChild(node2);
4310
5237
  } catch (_2) {
4311
5238
  remove(node2);
5239
+ if (!getParentNode(node2))
5240
+ throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
4312
5241
  }
4313
5242
  };
4314
- const _removeAttribute = function _removeAttribute2(name, element) {
5243
+ const _stripAttributeNode = function _stripAttributeNode2(element, attribute, name) {
4315
5244
  try {
4316
- arrayPush(DOMPurify.removed, {
4317
- attribute: element.getAttributeNode(name),
4318
- from: element
4319
- });
5245
+ removeAttributeNode(element, attribute);
4320
5246
  } catch (_2) {
4321
- arrayPush(DOMPurify.removed, {
4322
- attribute: null,
4323
- from: element
5247
+ try {
5248
+ element.removeAttribute(name);
5249
+ } catch (_3) {
5250
+ }
5251
+ }
5252
+ };
5253
+ const _neutralizeRoot = function _neutralizeRoot2(root) {
5254
+ _neutralizeSubtree(root);
5255
+ const childNodes = getChildNodes(root);
5256
+ if (childNodes)
5257
+ arrayForEach(arraySlice(childNodes), (child) => {
5258
+ try {
5259
+ remove(child);
5260
+ } catch (_2) {
5261
+ }
4324
5262
  });
5263
+ const attributes = _readNodeType(root) === NODE_TYPE.element ? getAttributes(root) : null;
5264
+ if (attributes)
5265
+ for (let i2 = attributes.length - 1; i2 >= 0; --i2) {
5266
+ const attribute = attributes[i2];
5267
+ const name = attribute && attribute.name;
5268
+ if (typeof name === "string")
5269
+ _stripAttributeNode(root, attribute, name);
5270
+ }
5271
+ };
5272
+ const _removeAttribute = function _removeAttribute2(name, element, attr) {
5273
+ if (!attr)
5274
+ try {
5275
+ attr = element.getAttributeNode(name);
5276
+ } catch (_2) {
5277
+ attr = null;
5278
+ }
5279
+ arrayPush(DOMPurify.removed, {
5280
+ attribute: attr || null,
5281
+ from: element
5282
+ });
5283
+ try {
5284
+ if (attr)
5285
+ removeAttributeNode(element, attr);
5286
+ else
5287
+ element.removeAttribute(name);
5288
+ } catch (_2) {
5289
+ try {
5290
+ element.removeAttribute(name);
5291
+ } catch (_3) {
5292
+ }
4325
5293
  }
4326
- element.removeAttribute(name);
4327
5294
  if (name === "is") {
4328
- if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
5295
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT)
4329
5296
  try {
4330
5297
  _forceRemove(element);
4331
5298
  } catch (_2) {
4332
5299
  }
4333
- } else {
5300
+ else
4334
5301
  try {
4335
5302
  element.setAttribute(name, "");
4336
5303
  } catch (_2) {
4337
5304
  }
5305
+ }
5306
+ };
5307
+ const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
5308
+ const attributes = getAttributes(element);
5309
+ if (!attributes)
5310
+ return;
5311
+ for (let i2 = attributes.length - 1; i2 >= 0; --i2) {
5312
+ const attribute = attributes[i2];
5313
+ const name = attribute && attribute.name;
5314
+ if (typeof name !== "string" || ALLOWED_ATTR[transformCaseFunc(name)])
5315
+ continue;
5316
+ _stripAttributeNode(element, attribute, name);
5317
+ }
5318
+ };
5319
+ const _walkTree = function _walkTree2(root, visit) {
5320
+ let intoShadow = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
5321
+ const stack = [root];
5322
+ while (stack.length > 0) {
5323
+ const node2 = stack.pop();
5324
+ if (visit(node2) === false)
5325
+ continue;
5326
+ if (intoShadow && _readNodeType(node2) === NODE_TYPE.element) {
5327
+ const shadowRoot = getShadowRoot(node2);
5328
+ if (_isDocumentFragment(shadowRoot))
5329
+ stack.push(shadowRoot);
4338
5330
  }
5331
+ const childNodes = getChildNodes(node2);
5332
+ if (childNodes)
5333
+ for (let i2 = childNodes.length - 1; i2 >= 0; --i2)
5334
+ stack.push(childNodes[i2]);
4339
5335
  }
4340
5336
  };
5337
+ const _neutralizeSubtree = function _neutralizeSubtree2(root) {
5338
+ _walkTree(root, (node2) => {
5339
+ if (_readNodeType(node2) === NODE_TYPE.element)
5340
+ _stripDisallowedAttributes(node2);
5341
+ });
5342
+ };
5343
+ const _collectLiveNodes = function _collectLiveNodes2(root) {
5344
+ const nodes = [];
5345
+ _walkTree(root, (node2) => {
5346
+ nodes.push(node2);
5347
+ }, true);
5348
+ return nodes;
5349
+ };
5350
+ const _neutralizeEscapedElements = function _neutralizeEscapedElements2(root, before) {
5351
+ const reachable = setCreate();
5352
+ arrayForEach(_collectLiveNodes(root), (node2) => {
5353
+ if (_readNodeType(node2) === NODE_TYPE.element)
5354
+ setAdd(reachable, node2);
5355
+ });
5356
+ arrayForEach(before, (node2) => {
5357
+ if (_readNodeType(node2) === NODE_TYPE.element && !setHas(reachable, node2))
5358
+ _stripDisallowedAttributes(node2);
5359
+ });
5360
+ };
5361
+ const _neutralizeDiscarded = function _neutralizeDiscarded2(root, before) {
5362
+ let rootRemoved = false;
5363
+ arrayForEach(DOMPurify.removed, (entry) => {
5364
+ if (entry.element) {
5365
+ rootRemoved = rootRemoved || entry.element === root;
5366
+ _neutralizeSubtree(entry.element);
5367
+ }
5368
+ });
5369
+ _neutralizeEscapedElements(root, before);
5370
+ return rootRemoved;
5371
+ };
5372
+ const MAX_UNVISITED_ROUNDS = 8;
5373
+ const _sanitizeUnvisitedNodes = function _sanitizeUnvisitedNodes2(root, before) {
5374
+ const visited = IN_PLACE_VISITED;
5375
+ let original = null;
5376
+ const getOriginal = () => {
5377
+ if (!original) {
5378
+ original = setCreate();
5379
+ arrayForEach(before, (beforeNode) => {
5380
+ setAdd(original, beforeNode);
5381
+ });
5382
+ }
5383
+ return original;
5384
+ };
5385
+ for (let round = 0; ; round++) {
5386
+ const live = _collectLiveNodes(root);
5387
+ const containers = [root];
5388
+ let pending = false;
5389
+ arrayForEach(live, (node2) => {
5390
+ if (_readNodeType(node2) === NODE_TYPE.documentFragment)
5391
+ arrayPush(containers, node2);
5392
+ else if (!pending && !setHas(visited, node2))
5393
+ pending = setHas(getOriginal(), node2);
5394
+ });
5395
+ if (!pending)
5396
+ return;
5397
+ if (round >= MAX_UNVISITED_ROUNDS)
5398
+ throw typeErrorCreate("the tree kept changing during in-place sanitization; refusing to return it");
5399
+ arrayForEach(containers, (container, index2) => {
5400
+ _sanitizeUnvisitedIn(container, index2 > 0, root, getOriginal());
5401
+ });
5402
+ }
5403
+ };
5404
+ const _sanitizeUnvisitedIn = function _sanitizeUnvisitedIn2(container, inShadow, root, original) {
5405
+ const iterator = _createNodeIterator(container);
5406
+ let node2;
5407
+ while (node2 = iterator.nextNode()) {
5408
+ if (!setHas(original, node2) || setHas(IN_PLACE_VISITED, node2))
5409
+ continue;
5410
+ if (inShadow)
5411
+ _executeHooks(hooks.uponSanitizeShadowNode, node2, null);
5412
+ _sanitizeElements(node2, root);
5413
+ _sanitizeAttributes(node2, root);
5414
+ if (_isDocumentFragment(node2.content))
5415
+ _sanitizeShadowDOM2(node2.content);
5416
+ }
5417
+ };
5418
+ const _markVisited = function _markVisited2(node2) {
5419
+ if (IN_PLACE_VISITED)
5420
+ setAdd(IN_PLACE_VISITED, node2);
5421
+ };
5422
+ const _isPatchLinkageAttribute = function _isPatchLinkageAttribute2(lcName, lcTag) {
5423
+ if (!SAFE_FOR_XML)
5424
+ return false;
5425
+ if (lcName === "patchsrc")
5426
+ return true;
5427
+ return lcName === "for" && lcTag !== "label" && lcTag !== "output";
5428
+ };
5429
+ const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
5430
+ if (!SAFE_FOR_XML)
5431
+ return;
5432
+ _walkTree(root, (node2) => {
5433
+ const nodeType = _readNodeType(node2);
5434
+ if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node2.data)) {
5435
+ try {
5436
+ remove(node2);
5437
+ } catch (_2) {
5438
+ }
5439
+ return false;
5440
+ }
5441
+ if (nodeType === NODE_TYPE.element) {
5442
+ const element = node2;
5443
+ const lcTag = transformCaseFunc(_readNodeName(node2));
5444
+ try {
5445
+ if (element.hasAttribute && element.hasAttribute("patchsrc"))
5446
+ element.removeAttribute("patchsrc");
5447
+ if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag))
5448
+ element.removeAttribute("for");
5449
+ } catch (_2) {
5450
+ }
5451
+ }
5452
+ return true;
5453
+ });
5454
+ };
4341
5455
  const _initDocument = function _initDocument2(dirty) {
4342
5456
  let doc = null;
4343
5457
  let leadingWhitespace = null;
4344
- if (FORCE_BODY) {
5458
+ if (FORCE_BODY)
4345
5459
  dirty = "<remove></remove>" + dirty;
4346
- } else {
5460
+ else {
4347
5461
  const matches = stringMatch(dirty, /^[\r\n\t ]+/);
4348
5462
  leadingWhitespace = matches && matches[0];
4349
5463
  }
4350
- if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
5464
+ if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE)
4351
5465
  dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
4352
- }
4353
- const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
4354
- if (NAMESPACE === HTML_NAMESPACE) {
5466
+ const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
5467
+ if (NAMESPACE === HTML_NAMESPACE)
4355
5468
  try {
4356
5469
  doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
4357
5470
  } catch (_2) {
4358
5471
  }
4359
- }
4360
5472
  if (!doc || !doc.documentElement) {
4361
5473
  doc = implementation.createDocument(NAMESPACE, "template", null);
4362
5474
  try {
@@ -4365,145 +5477,249 @@ function createDOMPurify() {
4365
5477
  }
4366
5478
  }
4367
5479
  const body = doc.body || doc.documentElement;
4368
- if (dirty && leadingWhitespace) {
5480
+ if (dirty && leadingWhitespace)
4369
5481
  body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
4370
- }
4371
- if (NAMESPACE === HTML_NAMESPACE) {
5482
+ if (NAMESPACE === HTML_NAMESPACE)
4372
5483
  return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
4373
- }
4374
5484
  return WHOLE_DOCUMENT ? doc.documentElement : body;
4375
5485
  };
4376
5486
  const _createNodeIterator = function _createNodeIterator2(root) {
4377
- return createNodeIterator.call(
4378
- root.ownerDocument || root,
4379
- root,
4380
- NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
4381
- null
4382
- );
5487
+ const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
5488
+ return createNodeIterator.call(doc || root, root, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
5489
+ };
5490
+ const _stripTemplateExpressions = function _stripTemplateExpressions2(value) {
5491
+ value = stringReplace(value, MUSTACHE_EXPR$1, " ");
5492
+ value = stringReplace(value, ERB_EXPR$1, " ");
5493
+ value = stringReplace(value, TMPLIT_EXPR$1, " ");
5494
+ return value;
5495
+ };
5496
+ const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node2) {
5497
+ var _node$querySelectorAl;
5498
+ _scrubOwnCharacterData(node2);
5499
+ const templates = (_node$querySelectorAl = node2.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node2, "template");
5500
+ if (templates)
5501
+ arrayForEach(templates, (tmpl) => {
5502
+ if (_isDocumentFragment(tmpl.content))
5503
+ _scrubTemplateExpressions2(tmpl.content);
5504
+ });
5505
+ };
5506
+ const _scrubOwnCharacterData = function _scrubOwnCharacterData2(node2) {
5507
+ node2.normalize();
5508
+ const doc = getOwnerDocument ? getOwnerDocument(node2) : node2.ownerDocument;
5509
+ const walker = createNodeIterator.call(doc || node2, node2, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
5510
+ let currentNode = walker.nextNode();
5511
+ while (currentNode) {
5512
+ currentNode.data = _stripTemplateExpressions(currentNode.data);
5513
+ currentNode = walker.nextNode();
5514
+ }
4383
5515
  };
4384
5516
  const _isClobbered = function _isClobbered2(element) {
4385
- 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");
5517
+ const realTagName = getNodeName ? getNodeName(element) : null;
5518
+ if (typeof realTagName !== "string")
5519
+ return false;
5520
+ if (transformCaseFunc(realTagName) !== "form")
5521
+ return false;
5522
+ return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.removeAttributeNode !== "function" || typeof element.getAttributeNode !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
5523
+ };
5524
+ const _isDocumentFragment = function _isDocumentFragment2(value) {
5525
+ if (!getNodeType || typeof value !== "object" || value === null)
5526
+ return false;
5527
+ try {
5528
+ return getNodeType(value) === NODE_TYPE.documentFragment;
5529
+ } catch (_2) {
5530
+ return false;
5531
+ }
4386
5532
  };
4387
5533
  const _isNode = function _isNode2(value) {
4388
- return typeof Node2 === "function" && value instanceof Node2;
5534
+ if (!getNodeType || typeof value !== "object" || value === null)
5535
+ return false;
5536
+ try {
5537
+ return typeof getNodeType(value) === "number";
5538
+ } catch (_2) {
5539
+ return false;
5540
+ }
4389
5541
  };
4390
5542
  function _executeHooks(hooks2, currentNode, data) {
5543
+ if (hooks2.length === 0)
5544
+ return;
4391
5545
  arrayForEach(hooks2, (hook) => {
4392
5546
  hook.call(DOMPurify, currentNode, data, CONFIG);
4393
5547
  });
4394
5548
  }
4395
- const _sanitizeElements = function _sanitizeElements2(currentNode) {
4396
- let content = null;
5549
+ const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
5550
+ if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML))
5551
+ return true;
5552
+ if (SAFE_FOR_XML && LITERAL_TEXT_ELEMENTS[tagName] && _readNodeType(currentNode) === NODE_TYPE.element && _readNamespaceURI(currentNode) === HTML_NAMESPACE && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent)))
5553
+ return true;
5554
+ if (currentNode.nodeType === NODE_TYPE.processingInstruction)
5555
+ return true;
5556
+ if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data))
5557
+ return true;
5558
+ return false;
5559
+ };
5560
+ const _matchesNameCheck = function _matchesNameCheck2(check, name) {
5561
+ if (check instanceof RegExp)
5562
+ return regExpTest(check, name);
5563
+ if (check instanceof Function) {
5564
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++)
5565
+ args[_key - 2] = arguments[_key];
5566
+ return Boolean(check(name, ...args));
5567
+ }
5568
+ return false;
5569
+ };
5570
+ const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
5571
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
5572
+ return false;
5573
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && !FORBID_CONTENTS[stringToLowerCase(tagName)]) {
5574
+ const parentNode = getParentNode(currentNode);
5575
+ const childNodes = getChildNodes(currentNode);
5576
+ if (childNodes && parentNode) {
5577
+ const childCount = childNodes.length;
5578
+ for (let i2 = childCount - 1; i2 >= 0; --i2) {
5579
+ const hoisted = currentNode === root ? cloneNode2(childNodes[i2], true) : childNodes[i2];
5580
+ parentNode.insertBefore(hoisted, getNextSibling(currentNode));
5581
+ }
5582
+ }
5583
+ }
5584
+ _forceRemove(currentNode);
5585
+ return true;
5586
+ };
5587
+ const _forkSharedAllowlist = function _forkSharedAllowlist2(hookList, set, defaultSet, setConfigSet) {
5588
+ if (hookList.length === 0)
5589
+ return set;
5590
+ return set === defaultSet || set === setConfigSet ? clone(set) : set;
5591
+ };
5592
+ const _handleHookDetachedNode = function _handleHookDetachedNode2(currentNode, root) {
5593
+ if (currentNode === root || getParentNode(currentNode) !== null)
5594
+ return false;
5595
+ if (IN_PLACE)
5596
+ _neutralizeSubtree(currentNode);
5597
+ return true;
5598
+ };
5599
+ const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
5600
+ _markVisited(currentNode);
4397
5601
  _executeHooks(hooks.beforeSanitizeElements, currentNode, null);
5602
+ if (_handleHookDetachedNode(currentNode, root))
5603
+ return true;
4398
5604
  if (_isClobbered(currentNode)) {
4399
5605
  _forceRemove(currentNode);
4400
5606
  return true;
4401
5607
  }
4402
- const tagName = transformCaseFunc(currentNode.nodeName);
5608
+ const tagName = transformCaseFunc(_readNodeName(currentNode));
5609
+ ALLOWED_TAGS = _forkSharedAllowlist(hooks.uponSanitizeElement, ALLOWED_TAGS, DEFAULT_ALLOWED_TAGS, SET_CONFIG_ALLOWED_TAGS);
4403
5610
  _executeHooks(hooks.uponSanitizeElement, currentNode, {
4404
5611
  tagName,
4405
5612
  allowedTags: ALLOWED_TAGS
4406
5613
  });
4407
- if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
4408
- _forceRemove(currentNode);
4409
- return true;
4410
- }
4411
- if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
4412
- _forceRemove(currentNode);
5614
+ if (_handleHookDetachedNode(currentNode, root))
4413
5615
  return true;
4414
- }
4415
- if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
5616
+ if (_isUnsafeNode(currentNode, tagName)) {
4416
5617
  _forceRemove(currentNode);
4417
5618
  return true;
4418
5619
  }
4419
- if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
4420
- if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
4421
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
4422
- return false;
4423
- }
4424
- if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
4425
- return false;
4426
- }
4427
- }
4428
- if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
4429
- const parentNode = getParentNode(currentNode) || currentNode.parentNode;
4430
- const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
4431
- if (childNodes && parentNode) {
4432
- const childCount = childNodes.length;
4433
- for (let i2 = childCount - 1; i2 >= 0; --i2) {
4434
- const childClone = cloneNode2(childNodes[i2], true);
4435
- childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
4436
- parentNode.insertBefore(childClone, getNextSibling(currentNode));
4437
- }
4438
- }
5620
+ if (FORBID_TAGS[tagName] || !(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && !ALLOWED_TAGS[tagName]) {
5621
+ const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
5622
+ if (removed === false) {
5623
+ _executeHooks(hooks.afterSanitizeElements, currentNode, null);
5624
+ if (_handleHookDetachedNode(currentNode, root))
5625
+ return true;
4439
5626
  }
4440
- _forceRemove(currentNode);
4441
- return true;
5627
+ return removed;
4442
5628
  }
4443
- if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
5629
+ if (_readNodeType(currentNode) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
4444
5630
  _forceRemove(currentNode);
4445
5631
  return true;
4446
5632
  }
4447
- if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
5633
+ if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(FALLBACK_TAG_CLOSE, currentNode.innerHTML)) {
4448
5634
  _forceRemove(currentNode);
4449
5635
  return true;
4450
5636
  }
4451
5637
  if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
4452
- content = currentNode.textContent;
4453
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
4454
- content = stringReplace(content, expr, " ");
4455
- });
5638
+ const content = _stripTemplateExpressions(currentNode.textContent);
4456
5639
  if (currentNode.textContent !== content) {
4457
- arrayPush(DOMPurify.removed, {
4458
- element: currentNode.cloneNode()
4459
- });
5640
+ arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
4460
5641
  currentNode.textContent = content;
4461
5642
  }
4462
5643
  }
4463
5644
  _executeHooks(hooks.afterSanitizeElements, currentNode, null);
4464
- return false;
5645
+ return _handleHookDetachedNode(currentNode, root);
4465
5646
  };
4466
5647
  const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
4467
- if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
5648
+ if (FORBID_ATTR[lcName])
4468
5649
  return false;
4469
- }
4470
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName))
4471
- ;
4472
- else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName))
4473
- ;
4474
- else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag))
4475
- ;
4476
- else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
4477
- if (_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)))
4478
- ;
4479
- else {
5650
+ if (_isPatchLinkageAttribute(lcName, lcTag))
5651
+ return false;
5652
+ if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement))
5653
+ return false;
5654
+ const nameIsPermitted = ALLOWED_ATTR[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
5655
+ if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName))
5656
+ return true;
5657
+ if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName))
5658
+ return true;
5659
+ if (!nameIsPermitted)
5660
+ return _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value);
5661
+ if (URI_SAFE_ATTRIBUTES[lcName])
5662
+ return true;
5663
+ if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, "")))
5664
+ return true;
5665
+ if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
5666
+ return true;
5667
+ if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, "")))
5668
+ return true;
5669
+ return !value;
5670
+ };
5671
+ const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
5672
+ "annotation-xml",
5673
+ "color-profile",
5674
+ "font-face",
5675
+ "font-face-format",
5676
+ "font-face-name",
5677
+ "font-face-src",
5678
+ "font-face-uri",
5679
+ "missing-glyph"
5680
+ ]);
5681
+ const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
5682
+ return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
5683
+ };
5684
+ const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute2(lcTag, lcName, namespaceURI, value) {
5685
+ if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI)
5686
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
5687
+ case "TrustedHTML":
5688
+ return _createTrustedHTML(value);
5689
+ case "TrustedScriptURL":
5690
+ return _createTrustedScriptURL(value);
5691
+ }
5692
+ return value;
5693
+ };
5694
+ const _setAttributeValue = function _setAttributeValue2(currentNode, name, namespaceURI, value) {
5695
+ try {
5696
+ if (namespaceURI)
5697
+ currentNode.setAttributeNS(namespaceURI, name, value);
5698
+ else
5699
+ currentNode.setAttribute(name, value);
5700
+ if (_isClobbered(currentNode)) {
5701
+ _forceRemove(currentNode);
4480
5702
  return false;
4481
5703
  }
4482
- } else if (URI_SAFE_ATTRIBUTES[lcName])
4483
- ;
4484
- else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, "")))
4485
- ;
4486
- else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
4487
- ;
4488
- else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, "")))
4489
- ;
4490
- else if (value) {
5704
+ return true;
5705
+ } catch (_2) {
5706
+ _removeAttribute(name, currentNode);
4491
5707
  return false;
4492
- } else
4493
- ;
4494
- return true;
5708
+ }
4495
5709
  };
4496
- const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
4497
- return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
5710
+ const _isUnsafeAttributeValue = function _isUnsafeAttributeValue2(name, value) {
5711
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value))
5712
+ return true;
5713
+ return stringToLowerCase(name) === "attributename" && stringMatch(value, "href") !== null;
4498
5714
  };
4499
- const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
5715
+ const _sanitizeAttributes = function _sanitizeAttributes2(currentNode, root) {
4500
5716
  _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
4501
- const {
4502
- attributes
4503
- } = currentNode;
4504
- if (!attributes || _isClobbered(currentNode)) {
5717
+ if (_handleHookDetachedNode(currentNode, root))
4505
5718
  return;
4506
- }
5719
+ const attributes = currentNode.attributes;
5720
+ if (!attributes || _isClobbered(currentNode))
5721
+ return;
5722
+ ALLOWED_ATTR = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
4507
5723
  const hookEvent = {
4508
5724
  attrName: "",
4509
5725
  attrValue: "",
@@ -4512,104 +5728,120 @@ function createDOMPurify() {
4512
5728
  forceKeepAttr: void 0
4513
5729
  };
4514
5730
  let l2 = attributes.length;
5731
+ const lcTag = transformCaseFunc(currentNode.nodeName);
4515
5732
  while (l2--) {
4516
5733
  const attr = attributes[l2];
4517
- const {
4518
- name,
4519
- namespaceURI,
4520
- value: attrValue
4521
- } = attr;
5734
+ const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
4522
5735
  const lcName = transformCaseFunc(name);
4523
5736
  const initValue = attrValue;
4524
5737
  let value = name === "value" ? initValue : stringTrim(initValue);
5738
+ let recreatedNamedProp = false;
4525
5739
  hookEvent.attrName = lcName;
4526
5740
  hookEvent.attrValue = value;
4527
5741
  hookEvent.keepAttr = true;
4528
5742
  hookEvent.forceKeepAttr = void 0;
4529
5743
  _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
4530
5744
  value = hookEvent.attrValue;
4531
- if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
4532
- _removeAttribute(name, currentNode);
5745
+ if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name") && stringIndexOf(value, SANITIZE_NAMED_PROPS_PREFIX) !== 0) {
5746
+ _removeAttribute(name, currentNode, attr);
4533
5747
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
5748
+ recreatedNamedProp = true;
4534
5749
  }
4535
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
4536
- _removeAttribute(name, currentNode);
4537
- continue;
4538
- }
4539
- if (lcName === "attributename" && stringMatch(value, "href")) {
4540
- _removeAttribute(name, currentNode);
5750
+ if (_isUnsafeAttributeValue(name, value)) {
5751
+ _removeAttribute(name, currentNode, attr);
4541
5752
  continue;
4542
5753
  }
4543
- if (hookEvent.forceKeepAttr) {
5754
+ if (hookEvent.forceKeepAttr)
4544
5755
  continue;
4545
- }
4546
5756
  if (!hookEvent.keepAttr) {
4547
- _removeAttribute(name, currentNode);
5757
+ _removeAttribute(name, currentNode, attr);
4548
5758
  continue;
4549
5759
  }
4550
- if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
4551
- _removeAttribute(name, currentNode);
5760
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)) {
5761
+ _removeAttribute(name, currentNode, attr);
4552
5762
  continue;
4553
5763
  }
4554
- if (SAFE_FOR_TEMPLATES) {
4555
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
4556
- value = stringReplace(value, expr, " ");
4557
- });
4558
- }
4559
- const lcTag = transformCaseFunc(currentNode.nodeName);
5764
+ if (SAFE_FOR_TEMPLATES)
5765
+ value = _stripTemplateExpressions(value);
4560
5766
  if (!_isValidAttribute(lcTag, lcName, value)) {
4561
- _removeAttribute(name, currentNode);
5767
+ _removeAttribute(name, currentNode, attr);
4562
5768
  continue;
4563
5769
  }
4564
- if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
4565
- if (namespaceURI)
4566
- ;
4567
- else {
4568
- switch (trustedTypes.getAttributeType(lcTag, lcName)) {
4569
- case "TrustedHTML": {
4570
- value = trustedTypesPolicy.createHTML(value);
4571
- break;
4572
- }
4573
- case "TrustedScriptURL": {
4574
- value = trustedTypesPolicy.createScriptURL(value);
4575
- break;
4576
- }
4577
- }
4578
- }
4579
- }
5770
+ value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
4580
5771
  if (value !== initValue) {
4581
- try {
4582
- if (namespaceURI) {
4583
- currentNode.setAttributeNS(namespaceURI, name, value);
4584
- } else {
4585
- currentNode.setAttribute(name, value);
4586
- }
4587
- if (_isClobbered(currentNode)) {
4588
- _forceRemove(currentNode);
4589
- } else {
4590
- arrayPop(DOMPurify.removed);
4591
- }
4592
- } catch (_2) {
4593
- _removeAttribute(name, currentNode);
4594
- }
5772
+ if (_setAttributeValue(currentNode, name, namespaceURI, value) && recreatedNamedProp)
5773
+ arrayPop(DOMPurify.removed);
4595
5774
  }
4596
5775
  }
4597
5776
  _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
5777
+ _handleHookDetachedNode(currentNode, root);
4598
5778
  };
4599
- const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
5779
+ const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
4600
5780
  let shadowNode = null;
4601
5781
  const shadowIterator = _createNodeIterator(fragment);
4602
5782
  _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
4603
5783
  while (shadowNode = shadowIterator.nextNode()) {
4604
5784
  _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
4605
- _sanitizeElements(shadowNode);
4606
- _sanitizeAttributes(shadowNode);
4607
- if (shadowNode.content instanceof DocumentFragment) {
5785
+ _sanitizeElements(shadowNode, fragment);
5786
+ _sanitizeAttributes(shadowNode, fragment);
5787
+ if (_isDocumentFragment(shadowNode.content))
4608
5788
  _sanitizeShadowDOM2(shadowNode.content);
5789
+ if (_readNodeType(shadowNode) === NODE_TYPE.element) {
5790
+ const innerSr = getShadowRoot(shadowNode);
5791
+ if (_isDocumentFragment(innerSr)) {
5792
+ _sanitizeAttachedShadowRoots(innerSr);
5793
+ _sanitizeShadowDOM2(innerSr);
5794
+ }
4609
5795
  }
4610
5796
  }
5797
+ if (SAFE_FOR_TEMPLATES)
5798
+ _scrubOwnCharacterData(fragment);
4611
5799
  _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
4612
5800
  };
5801
+ const _sanitizeAttachedShadowRoots = function _sanitizeAttachedShadowRoots2(root) {
5802
+ const stack = [{
5803
+ node: root,
5804
+ shadow: null
5805
+ }];
5806
+ while (stack.length > 0) {
5807
+ const item = stack.pop();
5808
+ if (item.shadow) {
5809
+ _sanitizeShadowDOM2(item.shadow);
5810
+ continue;
5811
+ }
5812
+ const node2 = item.node;
5813
+ const isElement = _readNodeType(node2) === NODE_TYPE.element;
5814
+ const childNodes = getChildNodes(node2);
5815
+ if (childNodes)
5816
+ for (let i2 = childNodes.length - 1; i2 >= 0; --i2)
5817
+ stack.push({
5818
+ node: childNodes[i2],
5819
+ shadow: null
5820
+ });
5821
+ if (isElement) {
5822
+ const rootName = getNodeName ? getNodeName(node2) : null;
5823
+ if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
5824
+ const content = node2.content;
5825
+ if (_isDocumentFragment(content))
5826
+ stack.push({
5827
+ node: content,
5828
+ shadow: null
5829
+ });
5830
+ }
5831
+ }
5832
+ if (isElement) {
5833
+ const sr = getShadowRoot(node2);
5834
+ if (_isDocumentFragment(sr))
5835
+ stack.push({
5836
+ node: null,
5837
+ shadow: sr
5838
+ }, {
5839
+ node: sr,
5840
+ shadow: null
5841
+ });
5842
+ }
5843
+ }
5844
+ };
4613
5845
  DOMPurify.sanitize = function(dirty) {
4614
5846
  let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4615
5847
  let body = null;
@@ -4617,118 +5849,146 @@ function createDOMPurify() {
4617
5849
  let currentNode = null;
4618
5850
  let returnNode = null;
4619
5851
  IS_EMPTY_INPUT = !dirty;
4620
- if (IS_EMPTY_INPUT) {
5852
+ if (IS_EMPTY_INPUT)
4621
5853
  dirty = "<!-->";
4622
- }
4623
5854
  if (typeof dirty !== "string" && !_isNode(dirty)) {
4624
- if (typeof dirty.toString === "function") {
4625
- dirty = dirty.toString();
4626
- if (typeof dirty !== "string") {
4627
- throw typeErrorCreate("dirty is not a string, aborting");
4628
- }
4629
- } else {
4630
- throw typeErrorCreate("toString is not a function");
4631
- }
5855
+ dirty = stringifyValue(dirty);
5856
+ if (typeof dirty !== "string")
5857
+ throw typeErrorCreate("dirty is not a string, aborting");
4632
5858
  }
4633
- if (!DOMPurify.isSupported) {
5859
+ if (!DOMPurify.isSupported)
4634
5860
  return dirty;
4635
- }
4636
- if (!SET_CONFIG) {
5861
+ if (SET_CONFIG) {
5862
+ ALLOWED_TAGS = SET_CONFIG_ALLOWED_TAGS;
5863
+ ALLOWED_ATTR = SET_CONFIG_ALLOWED_ATTR;
5864
+ } else
4637
5865
  _parseConfig(cfg);
4638
- }
5866
+ if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0)
5867
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
5868
+ if (hooks.uponSanitizeAttribute.length > 0)
5869
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
4639
5870
  DOMPurify.removed = [];
4640
- if (typeof dirty === "string") {
4641
- IN_PLACE = false;
4642
- }
4643
- if (IN_PLACE) {
4644
- if (dirty.nodeName) {
4645
- const tagName = transformCaseFunc(dirty.nodeName);
5871
+ const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
5872
+ let inPlaceNodes = [];
5873
+ const outerVisited = IN_PLACE_VISITED;
5874
+ if (inPlace) {
5875
+ _neutralizePatchLinkage(dirty);
5876
+ const nn = _readNodeName(dirty);
5877
+ if (typeof nn === "string") {
5878
+ const tagName = transformCaseFunc(nn);
4646
5879
  if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
5880
+ _neutralizeRoot(dirty);
4647
5881
  throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
4648
5882
  }
4649
5883
  }
4650
- } else if (dirty instanceof Node2) {
5884
+ if (_isClobbered(dirty)) {
5885
+ _neutralizeRoot(dirty);
5886
+ throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
5887
+ }
5888
+ inPlaceNodes = _collectLiveNodes(dirty);
5889
+ IN_PLACE_VISITED = setCreate();
5890
+ } else if (_isNode(dirty)) {
4651
5891
  body = _initDocument("<!---->");
4652
5892
  importedNode = body.ownerDocument.importNode(dirty, true);
4653
- if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
5893
+ if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY")
4654
5894
  body = importedNode;
4655
- } else if (importedNode.nodeName === "HTML") {
5895
+ else if (importedNode.nodeName === "HTML")
4656
5896
  body = importedNode;
4657
- } else {
5897
+ else
4658
5898
  body.appendChild(importedNode);
4659
- }
5899
+ _sanitizeAttachedShadowRoots(body);
4660
5900
  } else {
4661
- if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) {
4662
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
4663
- }
5901
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1)
5902
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
4664
5903
  body = _initDocument(dirty);
4665
- if (!body) {
5904
+ if (!body)
4666
5905
  return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
4667
- }
4668
5906
  }
4669
- if (body && FORCE_BODY) {
5907
+ if (body && FORCE_BODY)
4670
5908
  _forceRemove(body.firstChild);
4671
- }
4672
- const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
4673
- while (currentNode = nodeIterator.nextNode()) {
4674
- _sanitizeElements(currentNode);
4675
- _sanitizeAttributes(currentNode);
4676
- if (currentNode.content instanceof DocumentFragment) {
4677
- _sanitizeShadowDOM(currentNode.content);
5909
+ const walkRoot = inPlace ? dirty : body;
5910
+ try {
5911
+ if (inPlace)
5912
+ _sanitizeAttachedShadowRoots(dirty);
5913
+ const nodeIterator = _createNodeIterator(walkRoot);
5914
+ while (currentNode = nodeIterator.nextNode()) {
5915
+ _sanitizeElements(currentNode, walkRoot);
5916
+ _sanitizeAttributes(currentNode, walkRoot);
5917
+ if (_isDocumentFragment(currentNode.content))
5918
+ _sanitizeShadowDOM2(currentNode.content);
4678
5919
  }
4679
- }
4680
- if (IN_PLACE) {
5920
+ if (inPlace)
5921
+ _sanitizeUnvisitedNodes(dirty, inPlaceNodes);
5922
+ } catch (error) {
5923
+ if (inPlace) {
5924
+ _neutralizeRoot(dirty);
5925
+ _neutralizeDiscarded(dirty, inPlaceNodes);
5926
+ }
5927
+ throw error;
5928
+ } finally {
5929
+ IN_PLACE_VISITED = outerVisited;
5930
+ }
5931
+ if (inPlace) {
5932
+ if (_neutralizeDiscarded(dirty, inPlaceNodes))
5933
+ throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
5934
+ if (SAFE_FOR_TEMPLATES)
5935
+ _scrubTemplateExpressions2(dirty);
4681
5936
  return dirty;
4682
5937
  }
4683
5938
  if (RETURN_DOM) {
5939
+ if (SAFE_FOR_TEMPLATES)
5940
+ _scrubTemplateExpressions2(body);
4684
5941
  if (RETURN_DOM_FRAGMENT) {
4685
5942
  returnNode = createDocumentFragment.call(body.ownerDocument);
4686
- while (body.firstChild) {
5943
+ while (body.firstChild)
4687
5944
  returnNode.appendChild(body.firstChild);
4688
- }
4689
- } else {
5945
+ } else
4690
5946
  returnNode = body;
4691
- }
4692
- if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
5947
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode)
4693
5948
  returnNode = importNode.call(originalDocument, returnNode, true);
4694
- }
4695
5949
  return returnNode;
4696
5950
  }
4697
5951
  let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
4698
- if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
5952
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name))
4699
5953
  serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
4700
- }
4701
- if (SAFE_FOR_TEMPLATES) {
4702
- arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
4703
- serializedHTML = stringReplace(serializedHTML, expr, " ");
4704
- });
4705
- }
4706
- return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
5954
+ if (SAFE_FOR_TEMPLATES)
5955
+ serializedHTML = _stripTemplateExpressions(serializedHTML);
5956
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
4707
5957
  };
4708
5958
  DOMPurify.setConfig = function() {
4709
5959
  let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
4710
5960
  _parseConfig(cfg);
4711
5961
  SET_CONFIG = true;
5962
+ SET_CONFIG_ALLOWED_TAGS = ALLOWED_TAGS;
5963
+ SET_CONFIG_ALLOWED_ATTR = ALLOWED_ATTR;
4712
5964
  };
4713
5965
  DOMPurify.clearConfig = function() {
4714
5966
  CONFIG = null;
4715
5967
  SET_CONFIG = false;
5968
+ SET_CONFIG_ALLOWED_TAGS = null;
5969
+ SET_CONFIG_ALLOWED_ATTR = null;
5970
+ trustedTypesPolicy = defaultTrustedTypesPolicy;
5971
+ emptyHTML = "";
4716
5972
  };
4717
5973
  DOMPurify.isValidAttribute = function(tag, attr, value) {
4718
- if (!CONFIG) {
5974
+ if (!CONFIG)
4719
5975
  _parseConfig({});
4720
- }
4721
5976
  const lcTag = transformCaseFunc(tag);
4722
5977
  const lcName = transformCaseFunc(attr);
5978
+ if (typeof value === "string" && (_isUnsafeAttributeValue(attr, value) || !ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value)))
5979
+ return false;
4723
5980
  return _isValidAttribute(lcTag, lcName, value);
4724
5981
  };
4725
5982
  DOMPurify.addHook = function(entryPoint, hookFunction) {
4726
- if (typeof hookFunction !== "function") {
5983
+ if (typeof hookFunction !== "function")
5984
+ return;
5985
+ if (!objectHasOwnProperty(hooks, entryPoint))
4727
5986
  return;
4728
- }
4729
5987
  arrayPush(hooks[entryPoint], hookFunction);
4730
5988
  };
4731
5989
  DOMPurify.removeHook = function(entryPoint, hookFunction) {
5990
+ if (!objectHasOwnProperty(hooks, entryPoint))
5991
+ return;
4732
5992
  if (hookFunction !== void 0) {
4733
5993
  const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
4734
5994
  return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
@@ -4736,6 +5996,8 @@ function createDOMPurify() {
4736
5996
  return arrayPop(hooks[entryPoint]);
4737
5997
  };
4738
5998
  DOMPurify.removeHooks = function(entryPoint) {
5999
+ if (!objectHasOwnProperty(hooks, entryPoint))
6000
+ return;
4739
6001
  hooks[entryPoint] = [];
4740
6002
  };
4741
6003
  DOMPurify.removeAllHooks = function() {
@@ -4743,7 +6005,7 @@ function createDOMPurify() {
4743
6005
  };
4744
6006
  return DOMPurify;
4745
6007
  }
4746
- var purify = createDOMPurify();
6008
+ var purify_default = createDOMPurify();
4747
6009
  var lib$3 = {};
4748
6010
  var htmlToDom = {};
4749
6011
  var domparser$1 = {};
@@ -5352,11 +6614,12 @@ var constants = {};
5352
6614
  }, {});
5353
6615
  exports.CARRIAGE_RETURN = "\r";
5354
6616
  exports.CARRIAGE_RETURN_REGEX = new RegExp(exports.CARRIAGE_RETURN, "g");
5355
- exports.CARRIAGE_RETURN_PLACEHOLDER = "__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(), "__");
6617
+ exports.CARRIAGE_RETURN_PLACEHOLDER = "__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now().toString(), "__");
5356
6618
  exports.CARRIAGE_RETURN_PLACEHOLDER_REGEX = new RegExp(exports.CARRIAGE_RETURN_PLACEHOLDER, "g");
5357
6619
  })(constants);
5358
6620
  Object.defineProperty(utilities$2, "__esModule", { value: true });
5359
6621
  utilities$2.formatAttributes = formatAttributes;
6622
+ utilities$2.hasOpenTag = hasOpenTag;
5360
6623
  utilities$2.escapeSpecialCharacters = escapeSpecialCharacters;
5361
6624
  utilities$2.revertEscapedCharacters = revertEscapedCharacters;
5362
6625
  utilities$2.formatDOM = formatDOM;
@@ -5383,6 +6646,15 @@ function formatTagName(tagName) {
5383
6646
  }
5384
6647
  return tagName;
5385
6648
  }
6649
+ function hasOpenTag(html2, tagName) {
6650
+ var openTag = "<" + tagName;
6651
+ var index2 = html2.toLowerCase().indexOf(openTag);
6652
+ if (index2 === -1) {
6653
+ return false;
6654
+ }
6655
+ var char = html2[index2 + openTag.length];
6656
+ return char === ">" || char === " " || char === " " || char === "\n" || char === "\r" || char === "/";
6657
+ }
5386
6658
  function escapeSpecialCharacters(html2) {
5387
6659
  return html2.replace(constants_1.CARRIAGE_RETURN_REGEX, constants_1.CARRIAGE_RETURN_PLACEHOLDER);
5388
6660
  }
@@ -5390,6 +6662,7 @@ function revertEscapedCharacters(text2) {
5390
6662
  return text2.replace(constants_1.CARRIAGE_RETURN_PLACEHOLDER_REGEX, constants_1.CARRIAGE_RETURN);
5391
6663
  }
5392
6664
  function formatDOM(nodes, parent, directive) {
6665
+ var _a, _b, _c, _d;
5393
6666
  if (parent === void 0) {
5394
6667
  parent = null;
5395
6668
  }
@@ -5410,15 +6683,15 @@ function formatDOM(nodes, parent, directive) {
5410
6683
  break;
5411
6684
  }
5412
6685
  case 3:
5413
- current = new domhandler_1.Text(revertEscapedCharacters(node2.nodeValue));
6686
+ current = new domhandler_1.Text(revertEscapedCharacters((_a = node2.nodeValue) !== null && _a !== void 0 ? _a : ""));
5414
6687
  break;
5415
6688
  case 8:
5416
- current = new domhandler_1.Comment(node2.nodeValue);
6689
+ current = new domhandler_1.Comment((_b = node2.nodeValue) !== null && _b !== void 0 ? _b : "");
5417
6690
  break;
5418
6691
  default:
5419
6692
  continue;
5420
6693
  }
5421
- var prev = domNodes[index2 - 1] || null;
6694
+ var prev = (_c = domNodes[index2 - 1]) !== null && _c !== void 0 ? _c : null;
5422
6695
  if (prev) {
5423
6696
  prev.next = current;
5424
6697
  }
@@ -5429,7 +6702,7 @@ function formatDOM(nodes, parent, directive) {
5429
6702
  }
5430
6703
  if (directive) {
5431
6704
  current = new domhandler_1.ProcessingInstruction(directive.substring(0, directive.indexOf(" ")).toLowerCase(), directive);
5432
- current.next = domNodes[0] || null;
6705
+ current.next = (_d = domNodes[0]) !== null && _d !== void 0 ? _d : null;
5433
6706
  current.parent = parent;
5434
6707
  domNodes.unshift(current);
5435
6708
  if (domNodes[1]) {
@@ -5445,8 +6718,6 @@ var HTML = "html";
5445
6718
  var HEAD = "head";
5446
6719
  var BODY = "body";
5447
6720
  var FIRST_TAG_REGEX = /<([a-zA-Z]+[0-9]?)/;
5448
- var HEAD_TAG_REGEX = /<head[^]*>/i;
5449
- var BODY_TAG_REGEX = /<body[^]*>/i;
5450
6721
  var parseFromDocument = function(html2, tagName) {
5451
6722
  throw new Error("This browser does not support `document.implementation.createHTMLDocument`");
5452
6723
  };
@@ -5487,29 +6758,32 @@ if (template && template.content) {
5487
6758
  return template.content.childNodes;
5488
6759
  };
5489
6760
  }
6761
+ var createNodeList = function() {
6762
+ return document.createDocumentFragment().childNodes;
6763
+ };
5490
6764
  function domparser(html2) {
5491
- var _a, _b;
6765
+ var _a, _b, _c, _d, _e, _f;
5492
6766
  html2 = (0, utilities_1$4.escapeSpecialCharacters)(html2);
5493
- var match = html2.match(FIRST_TAG_REGEX);
5494
- var firstTagName = match && match[1] ? match[1].toLowerCase() : "";
6767
+ var match = FIRST_TAG_REGEX.exec(html2);
6768
+ var firstTagName = (_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
5495
6769
  switch (firstTagName) {
5496
6770
  case HTML: {
5497
6771
  var doc = parseFromString(html2);
5498
- if (!HEAD_TAG_REGEX.test(html2)) {
6772
+ if (!(0, utilities_1$4.hasOpenTag)(html2, HEAD)) {
5499
6773
  var element = doc.querySelector(HEAD);
5500
- (_a = element === null || element === void 0 ? void 0 : element.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(element);
6774
+ (_b = element === null || element === void 0 ? void 0 : element.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element);
5501
6775
  }
5502
- if (!BODY_TAG_REGEX.test(html2)) {
6776
+ if (!(0, utilities_1$4.hasOpenTag)(html2, BODY)) {
5503
6777
  var element = doc.querySelector(BODY);
5504
- (_b = element === null || element === void 0 ? void 0 : element.parentNode) === null || _b === void 0 ? void 0 : _b.removeChild(element);
6778
+ (_c = element === null || element === void 0 ? void 0 : element.parentNode) === null || _c === void 0 ? void 0 : _c.removeChild(element);
5505
6779
  }
5506
6780
  return doc.querySelectorAll(HTML);
5507
6781
  }
5508
6782
  case HEAD:
5509
6783
  case BODY: {
5510
6784
  var elements = parseFromDocument(html2).querySelectorAll(firstTagName);
5511
- if (BODY_TAG_REGEX.test(html2) && HEAD_TAG_REGEX.test(html2)) {
5512
- return elements[0].parentNode.childNodes;
6785
+ if ((0, utilities_1$4.hasOpenTag)(html2, BODY) && (0, utilities_1$4.hasOpenTag)(html2, HEAD)) {
6786
+ return (_e = (_d = elements[0].parentNode) === null || _d === void 0 ? void 0 : _d.childNodes) !== null && _e !== void 0 ? _e : createNodeList();
5513
6787
  }
5514
6788
  return elements;
5515
6789
  }
@@ -5518,7 +6792,7 @@ function domparser(html2) {
5518
6792
  return parseFromTemplate(html2);
5519
6793
  }
5520
6794
  var element = parseFromDocument(html2, BODY).querySelector(BODY);
5521
- return element.childNodes;
6795
+ return (_f = element === null || element === void 0 ? void 0 : element.childNodes) !== null && _f !== void 0 ? _f : createNodeList();
5522
6796
  }
5523
6797
  }
5524
6798
  }
@@ -5537,7 +6811,7 @@ function HTMLDOMParser(html2) {
5537
6811
  if (!html2) {
5538
6812
  return [];
5539
6813
  }
5540
- var match = html2.match(DIRECTIVE_REGEX);
6814
+ var match = DIRECTIVE_REGEX.exec(html2);
5541
6815
  var directive = match ? match[1] : void 0;
5542
6816
  return (0, utilities_1$3.formatDOM)((0, domparser_1.default)(html2), null, directive);
5543
6817
  }
@@ -6715,7 +7989,7 @@ function attributesToProps(attributes, nodeName) {
6715
7989
  propName = getPropName("default" + attributeNameLowerCased);
6716
7990
  }
6717
7991
  props[propName] = attributeValue;
6718
- switch (propertyInfo && propertyInfo.type) {
7992
+ switch (propertyInfo === null || propertyInfo === void 0 ? void 0 : propertyInfo.type) {
6719
7993
  case react_property_1.BOOLEAN:
6720
7994
  props[propName] = true;
6721
7995
  break;
@@ -6752,22 +8026,23 @@ var React = {
6752
8026
  isValidElement: react_1.isValidElement
6753
8027
  };
6754
8028
  function domToReact(nodes, options) {
8029
+ var _a, _b, _c, _d, _e;
6755
8030
  if (options === void 0) {
6756
8031
  options = {};
6757
8032
  }
6758
8033
  var reactElements = [];
6759
8034
  var hasReplace = typeof options.replace === "function";
6760
- var transform = options.transform || utilities_1.returnFirstArg;
6761
- var _a = options.library || React, cloneElement = _a.cloneElement, createElement = _a.createElement, isValidElement = _a.isValidElement;
8035
+ var transform = (_a = options.transform) !== null && _a !== void 0 ? _a : utilities_1.returnFirstArg;
8036
+ var _f = (_b = options.library) !== null && _b !== void 0 ? _b : React, cloneElement = _f.cloneElement, createElement = _f.createElement, isValidElement = _f.isValidElement;
6762
8037
  var nodesLength = nodes.length;
6763
8038
  for (var index2 = 0; index2 < nodesLength; index2++) {
6764
8039
  var node2 = nodes[index2];
6765
8040
  if (hasReplace) {
6766
- var replaceElement = options.replace(node2, index2);
8041
+ var replaceElement = (_c = options.replace) === null || _c === void 0 ? void 0 : _c.call(options, node2, index2);
6767
8042
  if (isValidElement(replaceElement)) {
6768
8043
  if (nodesLength > 1) {
6769
8044
  replaceElement = cloneElement(replaceElement, {
6770
- key: replaceElement.key || index2
8045
+ key: (_d = replaceElement.key) !== null && _d !== void 0 ? _d : index2
6771
8046
  });
6772
8047
  }
6773
8048
  reactElements.push(transform(replaceElement, node2, index2));
@@ -6806,7 +8081,7 @@ function domToReact(nodes, options) {
6806
8081
  case "tag":
6807
8082
  if (node2.name === "textarea" && node2.children[0]) {
6808
8083
  props.defaultValue = node2.children[0].data;
6809
- } else if (node2.children && node2.children.length) {
8084
+ } else if ((_e = node2.children) === null || _e === void 0 ? void 0 : _e.length) {
6810
8085
  children = domToReact(node2.children, options);
6811
8086
  }
6812
8087
  break;
@@ -6851,115 +8126,18 @@ function skipAttributesToProps(node2) {
6851
8126
  } });
6852
8127
  var domParserOptions = { lowerCaseAttributeNames: false };
6853
8128
  function HTMLReactParser2(html2, options) {
8129
+ var _a;
6854
8130
  if (typeof html2 !== "string") {
6855
8131
  throw new TypeError("First argument must be a string");
6856
8132
  }
6857
8133
  if (!html2) {
6858
8134
  return [];
6859
8135
  }
6860
- return (0, dom_to_react_1.default)((0, html_dom_parser_1.default)(html2, (options === null || options === void 0 ? void 0 : options.htmlparser2) || domParserOptions), options);
8136
+ return (0, dom_to_react_1.default)((0, html_dom_parser_1.default)(html2, (_a = options === null || options === void 0 ? void 0 : options.htmlparser2) !== null && _a !== void 0 ? _a : domParserOptions), options);
6861
8137
  }
6862
8138
  })(lib$3);
6863
8139
  var HTMLReactParser = /* @__PURE__ */ getDefaultExportFromCjs(lib$3);
6864
8140
  var ReactParser = HTMLReactParser.default || HTMLReactParser;
6865
- const AVATAR_COLORS = ["#0076ba", "#229f9c", "#2cb26b", "#30baed", "#95569e", "#9bc03a", "#d84315", "#f5a623", "#f6712f", "#ff6363"];
6866
- const getColorIndex = (fullName) => {
6867
- var _a;
6868
- const trimmedNameLength = (_a = fullName == null ? void 0 : fullName.trim().length) != null ? _a : 0;
6869
- return trimmedNameLength % 10;
6870
- };
6871
- const getAvatarColor = (fullName) => {
6872
- const position = getColorIndex(fullName);
6873
- return AVATAR_COLORS[position];
6874
- };
6875
- const getInitials = (fullName) => fullName.split(" ").map((word) => word[0]).slice(0, 2).join("").toUpperCase();
6876
- const Avatar = ({
6877
- fullName,
6878
- picture,
6879
- size = 50,
6880
- fontSize = 14,
6881
- alt = "Avatar",
6882
- id,
6883
- borderDecoration = false
6884
- }) => {
6885
- const [bgColor, setBgColor] = useState("");
6886
- const [imageValid, setImageValid] = useState(false);
6887
- useEffect(() => {
6888
- setBgColor(getAvatarColor(fullName));
6889
- }, [fullName]);
6890
- const wrapperStyle = {
6891
- alignItems: "center",
6892
- backgroundColor: (fullName == null ? void 0 : fullName.length) === 0 ? "#fff" : bgColor,
6893
- border: borderDecoration ? `3px solid #0189FF` : "none",
6894
- borderRadius: "50%",
6895
- display: "flex",
6896
- flexShrink: 0,
6897
- height: `${size}px`,
6898
- justifyContent: "center",
6899
- margin: 0,
6900
- overflow: "hidden",
6901
- width: `${size}px`,
6902
- boxSizing: "border-box"
6903
- };
6904
- const initialsStyle = {
6905
- color: "#fff",
6906
- fontFamily: "Roboto, sans-serif",
6907
- fontSize: `${fontSize}px`,
6908
- fontWeight: "bold",
6909
- lineHeight: "30px",
6910
- textTransform: "uppercase"
6911
- };
6912
- const imgStyle = {
6913
- height: "100%",
6914
- width: "100%",
6915
- objectFit: "cover",
6916
- display: "block"
6917
- };
6918
- if (!fullName || fullName.length === 0) {
6919
- return /* @__PURE__ */ jsx("figure", {
6920
- style: wrapperStyle,
6921
- "data-testid": "Avatar",
6922
- "aria-hidden": "true",
6923
- id
6924
- });
6925
- }
6926
- if (picture) {
6927
- return /* @__PURE__ */ jsxs("figure", {
6928
- style: wrapperStyle,
6929
- "data-testid": "Avatar",
6930
- role: "presentation",
6931
- children: [!imageValid && /* @__PURE__ */ jsx("span", {
6932
- style: initialsStyle,
6933
- id,
6934
- "aria-hidden": "true",
6935
- children: getInitials(fullName)
6936
- }), /* @__PURE__ */ jsx("img", {
6937
- src: picture,
6938
- alt,
6939
- id: imageValid ? id : void 0,
6940
- role: "presentation",
6941
- style: {
6942
- ...imgStyle,
6943
- display: imageValid ? "block" : "none"
6944
- },
6945
- onLoad: () => setImageValid(true),
6946
- onError: () => setImageValid(false)
6947
- })]
6948
- });
6949
- }
6950
- return /* @__PURE__ */ jsx("figure", {
6951
- style: wrapperStyle,
6952
- "data-testid": "Avatar",
6953
- role: "presentation",
6954
- children: bgColor ? /* @__PURE__ */ jsx("span", {
6955
- style: initialsStyle,
6956
- id,
6957
- "aria-hidden": "true",
6958
- children: getInitials(fullName)
6959
- }) : null
6960
- });
6961
- };
6962
- Avatar.displayName = "Avatar";
6963
8141
  const alertStates = {
6964
8142
  success: {
6965
8143
  icon: /* @__PURE__ */ jsx(SuccessWhite, {}),
@@ -7029,7 +8207,7 @@ function Alert({
7029
8207
  if (buttonText) {
7030
8208
  buttonType = buttonLink ? "link" : "normal";
7031
8209
  }
7032
- const content = typeof children === "string" ? ReactParser(purify.sanitize(children)) : children;
8210
+ const content = typeof children === "string" ? ReactParser(purify_default.sanitize(children)) : children;
7033
8211
  return /* @__PURE__ */ jsxs(Box, {
7034
8212
  className: isFlash ? "flashNotification" : "e_alert",
7035
8213
  alignItems: !isMobile ? "center" : "unset",
@@ -7115,23 +8293,29 @@ function Alert({
7115
8293
  })]
7116
8294
  });
7117
8295
  }
7118
- let e = { data: "" }, t = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a = /\/\*[^]*?\*\/| +/g, n$1 = /\n+/g, o = (e2, t2) => {
7119
- let r = "", l2 = "", a2 = "";
8296
+ let e = { data: "" }, t = (t2) => {
8297
+ if ("object" == typeof window) {
8298
+ let e2 = (t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign(document.createElement("style"), { innerHTML: " ", id: "_goober" });
8299
+ return e2.nonce = window.__nonce__, e2.parentNode || (t2 || document.head).appendChild(e2), e2.firstChild;
8300
+ }
8301
+ return t2 || e;
8302
+ }, a = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, l = /\/\*[^]*?\*\/| +/g, n$1 = /\n+/g, o = (e2, t2) => {
8303
+ let r = "", a2 = "", l2 = "";
7120
8304
  for (let n2 in e2) {
7121
8305
  let c2 = e2[n2];
7122
- "@" == n2[0] ? "i" == n2[1] ? r = n2 + " " + c2 + ";" : l2 += "f" == n2[1] ? o(c2, n2) : n2 + "{" + o(c2, "k" == n2[1] ? "" : t2) + "}" : "object" == typeof c2 ? l2 += o(c2, t2 ? t2.replace(/([^,])+/g, (e3) => n2.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : n2) : null != c2 && (n2 = /^--/.test(n2) ? n2 : n2.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += o.p ? o.p(n2, c2) : n2 + ":" + c2 + ";");
8306
+ "@" == n2[0] ? "i" == n2[1] ? r = n2 + " " + c2 + ";" : a2 += "f" == n2[1] ? o(c2, n2) : n2 + "{" + o(c2, "k" == n2[1] ? "" : t2) + "}" : "object" == typeof c2 ? a2 += o(c2, t2 ? t2.replace(/([^,])+/g, (e3) => n2.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : n2) : null != c2 && (n2 = "-" == n2[1] ? n2 : n2.replace(/[A-Z]/g, "-$&").toLowerCase(), l2 += o.p ? o.p(n2, c2) : n2 + ":" + c2 + ";");
7123
8307
  }
7124
- return r + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
7125
- }, c = {}, s = (e2) => {
8308
+ return r + (t2 && l2 ? t2 + "{" + l2 + "}" : l2) + a2;
8309
+ }, c = {}, i = (e2) => {
7126
8310
  if ("object" == typeof e2) {
7127
8311
  let t2 = "";
7128
8312
  for (let r in e2)
7129
- t2 += r + s(e2[r]);
8313
+ t2 += r + i(e2[r]);
7130
8314
  return t2;
7131
8315
  }
7132
8316
  return e2;
7133
- }, i = (e2, t2, r, i2, p2) => {
7134
- let u2 = s(e2), d2 = c[u2] || (c[u2] = ((e3) => {
8317
+ }, s = (e2, t2, r, s2, p2) => {
8318
+ let u2 = i(e2), d2 = c[u2] || (c[u2] = ((e3) => {
7135
8319
  let t3 = 0, r2 = 11;
7136
8320
  for (; t3 < e3.length; )
7137
8321
  r2 = 101 * r2 + e3.charCodeAt(t3++) >>> 0;
@@ -7140,45 +8324,45 @@ let e = { data: "" }, t = (t2) => "object" == typeof window ? ((t2 ? t2.querySel
7140
8324
  if (!c[d2]) {
7141
8325
  let t3 = u2 !== e2 ? e2 : ((e3) => {
7142
8326
  let t4, r2, o2 = [{}];
7143
- for (; t4 = l.exec(e3.replace(a, "")); )
8327
+ for (; t4 = a.exec(e3.replace(l, "")); )
7144
8328
  t4[4] ? o2.shift() : t4[3] ? (r2 = t4[3].replace(n$1, " ").trim(), o2.unshift(o2[0][r2] = o2[0][r2] || {})) : o2[0][t4[1]] = t4[2].replace(n$1, " ").trim();
7145
8329
  return o2[0];
7146
8330
  })(e2);
7147
8331
  c[d2] = o(p2 ? { ["@keyframes " + d2]: t3 } : t3, r ? "" : "." + d2);
7148
8332
  }
7149
- let f2 = r && c.g ? c.g : null;
7150
- return r && (c.g = c[d2]), ((e3, t3, r2, l2) => {
7151
- l2 ? t3.data = t3.data.replace(l2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r2 ? e3 + t3.data : t3.data + e3);
7152
- })(c[d2], t2, i2, f2), d2;
7153
- }, p = (e2, t2, r) => e2.reduce((e3, l2, a2) => {
7154
- let n2 = t2[a2];
8333
+ let f2 = r && c.g;
8334
+ return r && (c.g = c[d2]), ((e3, t3, r2, a2) => {
8335
+ a2 ? t3.data = t3.data.replace(a2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r2 ? e3 + t3.data : t3.data + e3);
8336
+ })(c[d2], t2, s2, f2), d2;
8337
+ }, p = (e2, t2, r) => e2.reduce((e3, a2, l2) => {
8338
+ let n2 = t2[l2];
7155
8339
  if (n2 && n2.call) {
7156
8340
  let e4 = n2(r), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
7157
8341
  n2 = t3 ? "." + t3 : e4 && "object" == typeof e4 ? e4.props ? "" : o(e4, "") : false === e4 ? "" : e4;
7158
8342
  }
7159
- return e3 + l2 + (null == n2 ? "" : n2);
8343
+ return e3 + a2 + (null == n2 ? "" : n2);
7160
8344
  }, "");
7161
8345
  function u$1(e2) {
7162
- let r = this || {}, l2 = e2.call ? e2(r.p) : e2;
7163
- return i(l2.unshift ? l2.raw ? p(l2, [].slice.call(arguments, 1), r.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r.p) : t2), {}) : l2, t(r.target), r.g, r.o, r.k);
8346
+ let r = this || {}, a2 = e2.call ? e2(r.p) : e2;
8347
+ return s(a2.unshift ? a2.raw ? p(a2, [].slice.call(arguments, 1), r.p) : a2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r.p) : t2), {}) : a2, t(r.target), r.g, r.o, r.k);
7164
8348
  }
7165
8349
  let d, f, g;
7166
8350
  u$1.bind({ g: 1 });
7167
8351
  let h$1 = u$1.bind({ k: 1 });
7168
- function m(e2, t2, r, l2) {
7169
- o.p = t2, d = e2, f = r, g = l2;
8352
+ function m(e2, t2, r, a2) {
8353
+ o.p = t2, d = e2, f = r, g = a2;
7170
8354
  }
7171
- function j(e2, t2) {
8355
+ function w$1(e2, t2) {
7172
8356
  let r = this || {};
7173
8357
  return function() {
7174
- let l2 = arguments;
7175
- function a2(n2, o2) {
7176
- let c2 = Object.assign({}, n2), s2 = c2.className || a2.className;
7177
- r.p = Object.assign({ theme: f && f() }, c2), r.o = / *go\d+/.test(s2), c2.className = u$1.apply(r, l2) + (s2 ? " " + s2 : ""), t2 && (c2.ref = o2);
7178
- let i2 = e2;
7179
- return e2[0] && (i2 = c2.as || e2, delete c2.as), g && i2[0] && g(c2), d(i2, c2);
7180
- }
7181
- return t2 ? t2(a2) : a2;
8358
+ let a2 = arguments;
8359
+ function l2(n2, o2) {
8360
+ let c2 = Object.assign({}, n2), i2 = c2.className || l2.className;
8361
+ r.p = Object.assign({ theme: f && f() }, c2), r.o = /go\d/.test(i2), c2.className = u$1.apply(r, a2) + (i2 ? " " + i2 : ""), t2 && (c2.ref = o2);
8362
+ let s2 = e2;
8363
+ return e2[0] && (s2 = c2.as || e2, delete c2.as), g && s2[0] && g(c2), d(s2, c2);
8364
+ }
8365
+ return t2 ? t2(l2) : l2;
7182
8366
  };
7183
8367
  }
7184
8368
  var W = (e2) => typeof e2 == "function", T = (e2, t2) => W(e2) ? e2(t2) : e2;
@@ -7317,7 +8501,7 @@ from {
7317
8501
  to {
7318
8502
  transform: scale(1) rotate(90deg);
7319
8503
  opacity: 1;
7320
- }`, _ = j("div")`
8504
+ }`, _ = w$1("div")`
7321
8505
  width: 20px;
7322
8506
  opacity: 0;
7323
8507
  height: 20px;
@@ -7358,7 +8542,7 @@ var ne = h$1`
7358
8542
  to {
7359
8543
  transform: rotate(360deg);
7360
8544
  }
7361
- `, V = j("div")`
8545
+ `, V = w$1("div")`
7362
8546
  width: 12px;
7363
8547
  height: 12px;
7364
8548
  box-sizing: border-box;
@@ -7390,7 +8574,7 @@ to {
7390
8574
  100% {
7391
8575
  opacity: 1;
7392
8576
  height: 10px;
7393
- }`, w = j("div")`
8577
+ }`, w = w$1("div")`
7394
8578
  width: 20px;
7395
8579
  opacity: 0;
7396
8580
  height: 20px;
@@ -7418,9 +8602,9 @@ to {
7418
8602
  width: 6px;
7419
8603
  }
7420
8604
  `;
7421
- var ue = j("div")`
8605
+ var ue = w$1("div")`
7422
8606
  position: absolute;
7423
- `, le = j("div")`
8607
+ `, le = w$1("div")`
7424
8608
  position: relative;
7425
8609
  display: flex;
7426
8610
  justify-content: center;
@@ -7435,7 +8619,7 @@ from {
7435
8619
  to {
7436
8620
  transform: scale(1);
7437
8621
  opacity: 1;
7438
- }`, fe = j("div")`
8622
+ }`, fe = w$1("div")`
7439
8623
  position: relative;
7440
8624
  transform: scale(0.6);
7441
8625
  opacity: 0.4;
@@ -7452,7 +8636,7 @@ var ye = (e2) => `
7452
8636
  `, ge = (e2) => `
7453
8637
  0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
7454
8638
  100% {transform: translate3d(0,${e2 * -150}%,-1px) scale(.6); opacity:0;}
7455
- `, he = "0%{opacity:0;} 100%{opacity:1;}", xe = "0%{opacity:1;} 100%{opacity:0;}", be = j("div")`
8639
+ `, he = "0%{opacity:0;} 100%{opacity:1;}", xe = "0%{opacity:1;} 100%{opacity:0;}", be = w$1("div")`
7456
8640
  display: flex;
7457
8641
  align-items: center;
7458
8642
  background: #fff;
@@ -7464,7 +8648,7 @@ var ye = (e2) => `
7464
8648
  pointer-events: auto;
7465
8649
  padding: 8px 10px;
7466
8650
  border-radius: 8px;
7467
- `, Se = j("div")`
8651
+ `, Se = w$1("div")`
7468
8652
  display: flex;
7469
8653
  justify-content: center;
7470
8654
  margin: 4px 10px;
@@ -7967,7 +9151,7 @@ const Loading$1 = ({
7967
9151
  });
7968
9152
  };
7969
9153
  const sanitizeModalDescription = (description) => {
7970
- const sanitizedDescription = purify.sanitize(description, {
9154
+ const sanitizedDescription = purify_default.sanitize(description, {
7971
9155
  ADD_ATTR: ["target", "rel"]
7972
9156
  });
7973
9157
  const parsedDocument = new window.DOMParser().parseFromString(sanitizedDescription, "text/html");