/*! @license DOMPurify 3.4.7 | (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.7/LICENSE */
function yt(n, o) {
  (o == null || o > n.length) && (o = n.length);
  for (var a = 0, s = Array(o); a < o; a++)
    s[a] = n[a];
  return s;
}
function nn(n) {
  if (Array.isArray(n))
    return n;
}
function on(n, o) {
  var a = n == null ? null : typeof Symbol != "undefined" && n[Symbol.iterator] || n["@@iterator"];
  if (a != null) {
    var s, f, p, b, te = [], I = !0, ne = !1;
    try {
      if (p = (a = a.call(n)).next, o !== 0)
        for (; !(I = (s = p.call(a)).done) && (te.push(s.value), te.length !== o); I = !0)
          ;
    } catch (Le) {
      ne = !0, f = Le;
    } finally {
      try {
        if (!I && a.return != null && (b = a.return(), Object(b) !== b))
          return;
      } finally {
        if (ne)
          throw f;
      }
    }
    return te;
  }
}
function rn() {
  throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function an(n, o) {
  return nn(n) || on(n, o) || sn(n, o) || rn();
}
function sn(n, o) {
  if (n) {
    if (typeof n == "string")
      return yt(n, o);
    var a = {}.toString.call(n).slice(8, -1);
    return a === "Object" && n.constructor && (a = n.constructor.name), a === "Map" || a === "Set" ? Array.from(n) : a === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a) ? yt(n, o) : void 0;
  }
}
const kt = Object.entries, bt = Object.setPrototypeOf, ln = Object.isFrozen, cn = Object.getPrototypeOf, fn = Object.getOwnPropertyDescriptor;
let D = Object.freeze, C = Object.seal, ee = Object.create, Ft = typeof Reflect != "undefined" && Reflect, Ke = Ft.apply, Ze = Ft.construct;
D || (D = function(o) {
  return o;
});
C || (C = function(o) {
  return o;
});
Ke || (Ke = function(o, a) {
  for (var s = arguments.length, f = new Array(s > 2 ? s - 2 : 0), p = 2; p < s; p++)
    f[p - 2] = arguments[p];
  return o.apply(a, f);
});
Ze || (Ze = function(o) {
  for (var a = arguments.length, s = new Array(a > 1 ? a - 1 : 0), f = 1; f < a; f++)
    s[f - 1] = arguments[f];
  return new o(...s);
});
const Z = A(Array.prototype.forEach), un = A(Array.prototype.lastIndexOf), Rt = A(Array.prototype.pop), J = A(Array.prototype.push), mn = A(Array.prototype.splice), N = Array.isArray, ue = A(String.prototype.toLowerCase), Ye = A(String.prototype.toString), Ot = A(String.prototype.match), Q = A(String.prototype.replace), Nt = A(String.prototype.indexOf), pn = A(String.prototype.trim), dn = A(Number.prototype.toString), Tn = A(Boolean.prototype.toString), Dt = typeof BigInt == "undefined" ? null : A(BigInt.prototype.toString), It = typeof Symbol == "undefined" ? null : A(Symbol.prototype.toString), d = A(Object.prototype.hasOwnProperty), ce = A(Object.prototype.toString), y = A(RegExp.prototype.test), fe = gn(TypeError);
function A(n) {
  return function(o) {
    o instanceof RegExp && (o.lastIndex = 0);
    for (var a = arguments.length, s = new Array(a > 1 ? a - 1 : 0), f = 1; f < a; f++)
      s[f - 1] = arguments[f];
    return Ke(n, o, s);
  };
}
function gn(n) {
  return function() {
    for (var o = arguments.length, a = new Array(o), s = 0; s < o; s++)
      a[s] = arguments[s];
    return Ze(n, a);
  };
}
function l(n, o) {
  let a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ue;
  if (bt && bt(n, null), !N(o))
    return n;
  let s = o.length;
  for (; s--; ) {
    let f = o[s];
    if (typeof f == "string") {
      const p = a(f);
      p !== f && (ln(o) || (o[s] = p), f = p);
    }
    n[f] = !0;
  }
  return n;
}
function _n(n) {
  for (let o = 0; o < n.length; o++)
    d(n, o) || (n[o] = null);
  return n;
}
function R(n) {
  const o = ee(null);
  for (const s of kt(n)) {
    var a = an(s, 2);
    const f = a[0], p = a[1];
    d(n, f) && (N(p) ? o[f] = _n(p) : p && typeof p == "object" && p.constructor === Object ? o[f] = R(p) : o[f] = p);
  }
  return o;
}
function hn(n) {
  switch (typeof n) {
    case "string":
      return n;
    case "number":
      return dn(n);
    case "boolean":
      return Tn(n);
    case "bigint":
      return Dt ? Dt(n) : "0";
    case "symbol":
      return It ? It(n) : "Symbol()";
    case "undefined":
      return ce(n);
    case "function":
    case "object": {
      if (n === null)
        return ce(n);
      const o = n, a = U(o, "toString");
      if (typeof a == "function") {
        const s = a(o);
        return typeof s == "string" ? s : ce(s);
      }
      return ce(n);
    }
    default:
      return ce(n);
  }
}
function U(n, o) {
  for (; n !== null; ) {
    const s = fn(n, o);
    if (s) {
      if (s.get)
        return A(s.get);
      if (typeof s.value == "function")
        return A(s.value);
    }
    n = cn(n);
  }
  function a() {
    return null;
  }
  return a;
}
function An(n) {
  try {
    return y(n, ""), !0;
  } catch (o) {
    return !1;
  }
}
const Lt = D(["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"]), $e = D(["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"]), Xe = D(["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"]), En = D(["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"]), Ve = D(["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"]), Sn = D(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Ct = D(["#text"]), wt = D(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "command", "commandfor", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "exportparts", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inert", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "part", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "slot", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns"]), qe = D(["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"]), Mt = D(["accent", "accentunder", "align", "bevelled", "close", "columnalign", "columnlines", "columnspacing", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lquote", "lspace", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Ie = D(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), yn = C(/{{[\w\W]*|^[\w\W]*}}/g), bn = C(/<%[\w\W]*|^[\w\W]*%>/g), Rn = C(/\${[\w\W]*/g), On = C(/^data-[\-\w.\u00B7-\uFFFF]+$/), Nn = C(/^aria-[\-\w]+$/), xt = C(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), Dn = C(/^(?:\w+script|data):/i), In = C(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), Ln = C(/^html$/i), Cn = C(/^[a-z][.\w]*(-[.\w]+)+$/i), v = {
  element: 1,
  attribute: 2,
  text: 3,
  cdataSection: 4,
  entityReference: 5,
  // Deprecated
  entityNode: 6,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9,
  documentType: 10,
  documentFragment: 11,
  notation: 12
  // Deprecated
}, wn = function() {
  return typeof window == "undefined" ? null : window;
}, Mn = function(o, a) {
  if (typeof o != "object" || typeof o.createPolicy != "function")
    return null;
  let s = null;
  const f = "data-tt-policy-suffix";
  a && a.hasAttribute(f) && (s = a.getAttribute(f));
  const p = "dompurify" + (s ? "#" + s : "");
  try {
    return o.createPolicy(p, {
      createHTML(b) {
        return b;
      },
      createScriptURL(b) {
        return b;
      }
    });
  } catch (b) {
    return console.warn("TrustedTypes policy " + p + " could not be created."), null;
  }
}, Pt = function() {
  return {
    afterSanitizeAttributes: [],
    afterSanitizeElements: [],
    afterSanitizeShadowDOM: [],
    beforeSanitizeAttributes: [],
    beforeSanitizeElements: [],
    beforeSanitizeShadowDOM: [],
    uponSanitizeAttribute: [],
    uponSanitizeElement: [],
    uponSanitizeShadowNode: []
  };
};
function vt() {
  let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : wn();
  const o = (i) => vt(i);
  if (o.version = "3.4.7", o.removed = [], !n || !n.document || n.document.nodeType !== v.document || !n.Element)
    return o.isSupported = !1, o;
  let a = n.document;
  const s = a, f = s.currentScript;
  n.DocumentFragment;
  const p = n.HTMLTemplateElement, b = n.Node, te = n.Element, I = n.NodeFilter, ne = n.NamedNodeMap;
  ne === void 0 && (n.NamedNodeMap || n.MozNamedAttrMap), n.HTMLFormElement;
  const Le = n.DOMParser, me = n.trustedTypes, W = te.prototype, Ut = U(W, "cloneNode"), Ht = U(W, "remove"), zt = U(W, "nextSibling"), pe = U(W, "childNodes"), de = U(W, "parentNode"), Te = U(W, "shadowRoot"), Gt = U(W, "attributes"), w = b && b.prototype ? U(b.prototype, "nodeType") : null, Y = b && b.prototype ? U(b.prototype, "nodeName") : null;
  if (typeof p == "function") {
    const i = a.createElement("template");
    i.content && i.content.ownerDocument && (a = i.content.ownerDocument);
  }
  let O, oe = "";
  const ge = a, Ce = ge.implementation, Je = ge.createNodeIterator, Wt = ge.createDocumentFragment, Bt = ge.getElementsByTagName, jt = s.importNode;
  let E = Pt();
  o.isSupported = typeof kt == "function" && typeof de == "function" && Ce && Ce.createHTMLDocument !== void 0;
  const _e = yn, he = bn, Ae = Rn, Yt = On, $t = Nn, Xt = Dn, Qe = In, Vt = Cn;
  let et = xt, T = null;
  const we = l({}, [...Lt, ...$e, ...Xe, ...Ve, ...Ct]);
  let h = null;
  const Me = l({}, [...wt, ...qe, ...Mt, ...Ie]);
  let g = Object.seal(ee(null, {
    tagNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    allowCustomizedBuiltInElements: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: !1
    }
  })), re = null, Ee = null;
  const z = Object.seal(ee(null, {
    tagCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    }
  }));
  let tt = !0, xe = !0, nt = !1, ot = !0, G = !1, ie = !0, B = !1, Pe = !1, ke = !1, $ = !1, Se = !1, ye = !1, rt = !0, it = !1;
  const at = "user-content-";
  let Fe = !0, ae = !1, X = {}, P = null;
  const ve = l({}, ["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"]);
  let st = null;
  const lt = l({}, ["audio", "video", "img", "source", "image", "track"]);
  let Ue = null;
  const ct = l({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), be = "http://www.w3.org/1998/Math/MathML", Re = "http://www.w3.org/2000/svg", k = "http://www.w3.org/1999/xhtml";
  let V = k, He = !1, ze = null;
  const qt = l({}, [be, Re, k], Ye);
  let Ge = l({}, ["mi", "mo", "mn", "ms", "mtext"]), We = l({}, ["annotation-xml"]);
  const Kt = l({}, ["title", "style", "font", "a", "script"]);
  let se = null;
  const Zt = ["application/xhtml+xml", "text/html"], Jt = "text/html";
  let _ = null, q = null;
  const Qt = a.createElement("form"), ft = function(e) {
    return e instanceof RegExp || e instanceof Function;
  }, Be = function() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (q && q === e)
      return;
    (!e || typeof e != "object") && (e = {}), e = R(e), se = // eslint-disable-next-line unicorn/prefer-includes
    Zt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? Jt : e.PARSER_MEDIA_TYPE, _ = se === "application/xhtml+xml" ? Ye : ue, T = d(e, "ALLOWED_TAGS") && N(e.ALLOWED_TAGS) ? l({}, e.ALLOWED_TAGS, _) : we, h = d(e, "ALLOWED_ATTR") && N(e.ALLOWED_ATTR) ? l({}, e.ALLOWED_ATTR, _) : Me, ze = d(e, "ALLOWED_NAMESPACES") && N(e.ALLOWED_NAMESPACES) ? l({}, e.ALLOWED_NAMESPACES, Ye) : qt, Ue = d(e, "ADD_URI_SAFE_ATTR") && N(e.ADD_URI_SAFE_ATTR) ? l(R(ct), e.ADD_URI_SAFE_ATTR, _) : ct, st = d(e, "ADD_DATA_URI_TAGS") && N(e.ADD_DATA_URI_TAGS) ? l(R(lt), e.ADD_DATA_URI_TAGS, _) : lt, P = d(e, "FORBID_CONTENTS") && N(e.FORBID_CONTENTS) ? l({}, e.FORBID_CONTENTS, _) : ve, re = d(e, "FORBID_TAGS") && N(e.FORBID_TAGS) ? l({}, e.FORBID_TAGS, _) : R({}), Ee = d(e, "FORBID_ATTR") && N(e.FORBID_ATTR) ? l({}, e.FORBID_ATTR, _) : R({}), X = d(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? R(e.USE_PROFILES) : e.USE_PROFILES : !1, tt = e.ALLOW_ARIA_ATTR !== !1, xe = e.ALLOW_DATA_ATTR !== !1, nt = e.ALLOW_UNKNOWN_PROTOCOLS || !1, ot = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, G = e.SAFE_FOR_TEMPLATES || !1, ie = e.SAFE_FOR_XML !== !1, B = e.WHOLE_DOCUMENT || !1, $ = e.RETURN_DOM || !1, Se = e.RETURN_DOM_FRAGMENT || !1, ye = e.RETURN_TRUSTED_TYPE || !1, ke = e.FORCE_BODY || !1, rt = e.SANITIZE_DOM !== !1, it = e.SANITIZE_NAMED_PROPS || !1, Fe = e.KEEP_CONTENT !== !1, ae = e.IN_PLACE || !1, et = An(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : xt, V = typeof e.NAMESPACE == "string" ? e.NAMESPACE : k, Ge = d(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? R(e.MATHML_TEXT_INTEGRATION_POINTS) : l({}, ["mi", "mo", "mn", "ms", "mtext"]), We = d(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? R(e.HTML_INTEGRATION_POINTS) : l({}, ["annotation-xml"]);
    const t = d(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? R(e.CUSTOM_ELEMENT_HANDLING) : ee(null);
    if (g = ee(null), d(t, "tagNameCheck") && ft(t.tagNameCheck) && (g.tagNameCheck = t.tagNameCheck), d(t, "attributeNameCheck") && ft(t.attributeNameCheck) && (g.attributeNameCheck = t.attributeNameCheck), d(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (g.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), G && (xe = !1), Se && ($ = !0), X && (T = l({}, Ct), h = ee(null), X.html === !0 && (l(T, Lt), l(h, wt)), X.svg === !0 && (l(T, $e), l(h, qe), l(h, Ie)), X.svgFilters === !0 && (l(T, Xe), l(h, qe), l(h, Ie)), X.mathMl === !0 && (l(T, Ve), l(h, Mt), l(h, Ie))), z.tagCheck = null, z.attributeCheck = null, d(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? z.tagCheck = e.ADD_TAGS : N(e.ADD_TAGS) && (T === we && (T = R(T)), l(T, e.ADD_TAGS, _))), d(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? z.attributeCheck = e.ADD_ATTR : N(e.ADD_ATTR) && (h === Me && (h = R(h)), l(h, e.ADD_ATTR, _))), d(e, "ADD_URI_SAFE_ATTR") && N(e.ADD_URI_SAFE_ATTR) && l(Ue, e.ADD_URI_SAFE_ATTR, _), d(e, "FORBID_CONTENTS") && N(e.FORBID_CONTENTS) && (P === ve && (P = R(P)), l(P, e.FORBID_CONTENTS, _)), d(e, "ADD_FORBID_CONTENTS") && N(e.ADD_FORBID_CONTENTS) && (P === ve && (P = R(P)), l(P, e.ADD_FORBID_CONTENTS, _)), Fe && (T["#text"] = !0), B && l(T, ["html", "head", "body"]), T.table && (l(T, ["tbody"]), delete re.tbody), e.TRUSTED_TYPES_POLICY) {
      if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
        throw fe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
      if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
        throw fe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
      O = e.TRUSTED_TYPES_POLICY, oe = O.createHTML("");
    } else
      O === void 0 && (O = Mn(me, f)), O !== null && typeof oe == "string" && (oe = O.createHTML(""));
    (E.uponSanitizeElement.length > 0 || E.uponSanitizeAttribute.length > 0) && T === we && (T = R(T)), E.uponSanitizeAttribute.length > 0 && h === Me && (h = R(h)), D && D(e), q = e;
  }, ut = l({}, [...$e, ...Xe, ...En]), mt = l({}, [...Ve, ...Sn]), en = function(e) {
    let t = de(e);
    (!t || !t.tagName) && (t = {
      namespaceURI: V,
      tagName: "template"
    });
    const r = ue(e.tagName), u = ue(t.tagName);
    return ze[e.namespaceURI] ? e.namespaceURI === Re ? t.namespaceURI === k ? r === "svg" : t.namespaceURI === be ? r === "svg" && (u === "annotation-xml" || Ge[u]) : !!ut[r] : e.namespaceURI === be ? t.namespaceURI === k ? r === "math" : t.namespaceURI === Re ? r === "math" && We[u] : !!mt[r] : e.namespaceURI === k ? t.namespaceURI === Re && !We[u] || t.namespaceURI === be && !Ge[u] ? !1 : !mt[r] && (Kt[r] || !ut[r]) : !!(se === "application/xhtml+xml" && ze[e.namespaceURI]) : !1;
  }, M = function(e) {
    J(o.removed, {
      element: e
    });
    try {
      de(e).removeChild(e);
    } catch (t) {
      Ht(e);
    }
  }, j = function(e, t) {
    try {
      J(o.removed, {
        attribute: t.getAttributeNode(e),
        from: t
      });
    } catch (r) {
      J(o.removed, {
        attribute: null,
        from: t
      });
    }
    if (t.removeAttribute(e), e === "is")
      if ($ || Se)
        try {
          M(t);
        } catch (r) {
        }
      else
        try {
          t.setAttribute(e, "");
        } catch (r) {
        }
  }, pt = function(e) {
    let t = null, r = null;
    if (ke)
      e = "<remove></remove>" + e;
    else {
      const m = Ot(e, /^[\r\n\t ]+/);
      r = m && m[0];
    }
    se === "application/xhtml+xml" && V === k && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
    const u = O ? O.createHTML(e) : e;
    if (V === k)
      try {
        t = new Le().parseFromString(u, se);
      } catch (m) {
      }
    if (!t || !t.documentElement) {
      t = Ce.createDocument(V, "template", null);
      try {
        t.documentElement.innerHTML = He ? oe : u;
      } catch (m) {
      }
    }
    const c = t.body || t.documentElement;
    return e && r && c.insertBefore(a.createTextNode(r), c.childNodes[0] || null), V === k ? Bt.call(t, B ? "html" : "body")[0] : B ? t.documentElement : c;
  }, dt = function(e) {
    return Je.call(
      e.ownerDocument || e,
      e,
      // eslint-disable-next-line no-bitwise
      I.SHOW_ELEMENT | I.SHOW_COMMENT | I.SHOW_TEXT | I.SHOW_PROCESSING_INSTRUCTION | I.SHOW_CDATA_SECTION,
      null
    );
  }, Tt = function(e) {
    e.normalize();
    const t = Je.call(
      e.ownerDocument || e,
      e,
      // eslint-disable-next-line no-bitwise
      I.SHOW_TEXT | I.SHOW_COMMENT | I.SHOW_CDATA_SECTION | I.SHOW_PROCESSING_INSTRUCTION,
      null
    );
    let r = t.nextNode();
    for (; r; ) {
      let u = r.data;
      Z([_e, he, Ae], (c) => {
        u = Q(u, c, " ");
      }), r.data = u, r = t.nextNode();
    }
  }, Oe = function(e) {
    const t = Y ? Y(e) : null;
    return typeof t != "string" || _(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || // Realm-safe NamedNodeMap detection: equality against the cached
    // prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
    // makes the direct read diverge from the cached read; a clean form
    // (same-realm OR foreign-realm) has both reads pointing at the same
    // canonical NamedNodeMap.
    e.attributes !== Gt(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
    // returns the integer 1 for any Element regardless of realm; direct
    // read on a clobbered form (e.g. <input name="nodeType">) returns
    // the named child element. Cheap addition — nodeType is read from
    // an internal slot, no serialization cost — and removes a residual
    // clobbering surface used by several mXSS / PI / comment branches
    // in _sanitizeElements that compare currentNode.nodeType directly.
    e.nodeType !== w(e) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
    // "childNodes" shadows the prototype getter. Direct reads of
    // form.childNodes from a clobbered form return the named child
    // instead of the real NodeList, so any walk that reads it directly
    // skips the form's real children. Compare the direct read to the
    // cached Node.prototype getter — when the form's named-property
    // getter intercepts the read, the two values differ and we flag
    // the form. This catches every clobbering child type (input,
    // select, etc.) regardless of whether the named child happens to
    // carry a numeric .length, which a typeof-based probe would miss
    // (e.g. HTMLSelectElement.length is a defined unsigned-long).
    e.childNodes !== pe(e);
  }, le = function(e) {
    if (!w || typeof e != "object" || e === null)
      return !1;
    try {
      return w(e) === v.documentFragment;
    } catch (t) {
      return !1;
    }
  }, Ne = function(e) {
    if (!w || typeof e != "object" || e === null)
      return !1;
    try {
      return typeof w(e) == "number";
    } catch (t) {
      return !1;
    }
  };
  function H(i, e, t) {
    Z(i, (r) => {
      r.call(o, e, t, q);
    });
  }
  const gt = function(e) {
    let t = null;
    if (H(E.beforeSanitizeElements, e, null), Oe(e))
      return M(e), !0;
    const r = _(e.nodeName);
    if (H(E.uponSanitizeElement, e, {
      tagName: r,
      allowedTags: T
    }), ie && e.hasChildNodes() && !Ne(e.firstElementChild) && y(/<[/\w!]/g, e.innerHTML) && y(/<[/\w!]/g, e.textContent) || ie && e.namespaceURI === k && r === "style" && Ne(e.firstElementChild) || e.nodeType === v.progressingInstruction || ie && e.nodeType === v.comment && y(/<[/\w]/g, e.data))
      return M(e), !0;
    if (re[r] || !(z.tagCheck instanceof Function && z.tagCheck(r)) && !T[r]) {
      if (!re[r] && ht(r) && (g.tagNameCheck instanceof RegExp && y(g.tagNameCheck, r) || g.tagNameCheck instanceof Function && g.tagNameCheck(r)))
        return !1;
      if (Fe && !P[r]) {
        const c = de(e), m = pe(e);
        if (m && c) {
          const L = m.length;
          for (let F = L - 1; F >= 0; --F) {
            const x = Ut(m[F], !0);
            c.insertBefore(x, zt(e));
          }
        }
      }
      return M(e), !0;
    }
    return (w ? w(e) : e.nodeType) === v.element && !en(e) || (r === "noscript" || r === "noembed" || r === "noframes") && y(/<\/no(script|embed|frames)/i, e.innerHTML) ? (M(e), !0) : (G && e.nodeType === v.text && (t = e.textContent, Z([_e, he, Ae], (c) => {
      t = Q(t, c, " ");
    }), e.textContent !== t && (J(o.removed, {
      element: e.cloneNode()
    }), e.textContent = t)), H(E.afterSanitizeElements, e, null), !1);
  }, _t = function(e, t, r) {
    if (Ee[t] || rt && (t === "id" || t === "name") && (r in a || r in Qt))
      return !1;
    const u = h[t] || z.attributeCheck instanceof Function && z.attributeCheck(t, e);
    if (!(xe && !Ee[t] && y(Yt, t))) {
      if (!(tt && y($t, t))) {
        if (!u || Ee[t]) {
          if (
            // First condition does a very basic check if a) it's basically a valid custom element tagname AND
            // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
            !(ht(e) && (g.tagNameCheck instanceof RegExp && y(g.tagNameCheck, e) || g.tagNameCheck instanceof Function && g.tagNameCheck(e)) && (g.attributeNameCheck instanceof RegExp && y(g.attributeNameCheck, t) || g.attributeNameCheck instanceof Function && g.attributeNameCheck(t, e)) || // Alternative, second condition checks if it's an `is`-attribute, AND
            // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            t === "is" && g.allowCustomizedBuiltInElements && (g.tagNameCheck instanceof RegExp && y(g.tagNameCheck, r) || g.tagNameCheck instanceof Function && g.tagNameCheck(r)))
          )
            return !1;
        } else if (!Ue[t]) {
          if (!y(et, Q(r, Qe, ""))) {
            if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Nt(r, "data:") === 0 && st[e])) {
              if (!(nt && !y(Xt, Q(r, Qe, "")))) {
                if (r)
                  return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, tn = l({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), ht = function(e) {
    return !tn[ue(e)] && y(Vt, e);
  }, At = function(e) {
    H(E.beforeSanitizeAttributes, e, null);
    const t = e.attributes;
    if (!t || Oe(e))
      return;
    const r = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: h,
      forceKeepAttr: void 0
    };
    let u = t.length;
    for (; u--; ) {
      const c = t[u], m = c.name, L = c.namespaceURI, F = c.value, x = _(m), je = F;
      let S = m === "value" ? je : pn(je);
      if (r.attrName = x, r.attrValue = S, r.keepAttr = !0, r.forceKeepAttr = void 0, H(E.uponSanitizeAttribute, e, r), S = r.attrValue, it && (x === "id" || x === "name") && Nt(S, at) !== 0 && (j(m, e), S = at + S), ie && y(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, S)) {
        j(m, e);
        continue;
      }
      if (x === "attributename" && Ot(S, "href")) {
        j(m, e);
        continue;
      }
      if (r.forceKeepAttr)
        continue;
      if (!r.keepAttr) {
        j(m, e);
        continue;
      }
      if (!ot && y(/\/>/i, S)) {
        j(m, e);
        continue;
      }
      G && Z([_e, he, Ae], (St) => {
        S = Q(S, St, " ");
      });
      const Et = _(e.nodeName);
      if (!_t(Et, x, S)) {
        j(m, e);
        continue;
      }
      if (O && typeof me == "object" && typeof me.getAttributeType == "function" && !L)
        switch (me.getAttributeType(Et, x)) {
          case "TrustedHTML": {
            S = O.createHTML(S);
            break;
          }
          case "TrustedScriptURL": {
            S = O.createScriptURL(S);
            break;
          }
        }
      if (S !== je)
        try {
          L ? e.setAttributeNS(L, m, S) : e.setAttribute(m, S), Oe(e) ? M(e) : Rt(o.removed);
        } catch (St) {
          j(m, e);
        }
    }
    H(E.afterSanitizeAttributes, e, null);
  }, De = function(e) {
    let t = null;
    const r = dt(e);
    for (H(E.beforeSanitizeShadowDOM, e, null); t = r.nextNode(); )
      if (H(E.uponSanitizeShadowNode, t, null), gt(t), At(t), le(t.content) && De(t.content), (w ? w(t) : t.nodeType) === v.element) {
        const c = Te ? Te(t) : t.shadowRoot;
        le(c) && (K(c), De(c));
      }
    H(E.afterSanitizeShadowDOM, e, null);
  }, K = function(e) {
    const t = w ? w(e) : e.nodeType;
    if (t === v.element) {
      const c = Te ? Te(e) : e.shadowRoot;
      le(c) && (K(c), De(c));
    }
    const r = pe ? pe(e) : e.childNodes;
    if (!r)
      return;
    const u = [];
    Z(r, (c) => {
      J(u, c);
    });
    for (const c of u)
      K(c);
    if (t === v.element) {
      const c = Y ? Y(e) : null;
      if (typeof c == "string" && _(c) === "template") {
        const m = e.content;
        le(m) && K(m);
      }
    }
  };
  return o.sanitize = function(i) {
    let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, r = null, u = null, c = null;
    if (He = !i, He && (i = "<!-->"), typeof i != "string" && !Ne(i) && (i = hn(i), typeof i != "string"))
      throw fe("dirty is not a string, aborting");
    if (!o.isSupported)
      return i;
    if (Pe || Be(e), o.removed = [], typeof i == "string" && (ae = !1), ae) {
      const F = Y ? Y(i) : i.nodeName;
      if (typeof F == "string") {
        const x = _(F);
        if (!T[x] || re[x])
          throw fe("root node is forbidden and cannot be sanitized in-place");
      }
      if (Oe(i))
        throw fe("root node is clobbered and cannot be sanitized in-place");
      K(i);
    } else if (Ne(i))
      t = pt("<!---->"), r = t.ownerDocument.importNode(i, !0), r.nodeType === v.element && r.nodeName === "BODY" || r.nodeName === "HTML" ? t = r : t.appendChild(r), K(r);
    else {
      if (!$ && !G && !B && // eslint-disable-next-line unicorn/prefer-includes
      i.indexOf("<") === -1)
        return O && ye ? O.createHTML(i) : i;
      if (t = pt(i), !t)
        return $ ? null : ye ? oe : "";
    }
    t && ke && M(t.firstChild);
    const m = dt(ae ? i : t);
    for (; u = m.nextNode(); )
      gt(u), At(u), le(u.content) && De(u.content);
    if (ae)
      return G && Tt(i), i;
    if ($) {
      if (G && Tt(t), Se)
        for (c = Wt.call(t.ownerDocument); t.firstChild; )
          c.appendChild(t.firstChild);
      else
        c = t;
      return (h.shadowroot || h.shadowrootmode) && (c = jt.call(s, c, !0)), c;
    }
    let L = B ? t.outerHTML : t.innerHTML;
    return B && T["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && y(Ln, t.ownerDocument.doctype.name) && (L = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
` + L), G && Z([_e, he, Ae], (F) => {
      L = Q(L, F, " ");
    }), O && ye ? O.createHTML(L) : L;
  }, o.setConfig = function() {
    let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    Be(i), Pe = !0;
  }, o.clearConfig = function() {
    q = null, Pe = !1;
  }, o.isValidAttribute = function(i, e, t) {
    q || Be({});
    const r = _(i), u = _(e);
    return _t(r, u, t);
  }, o.addHook = function(i, e) {
    typeof e == "function" && J(E[i], e);
  }, o.removeHook = function(i, e) {
    if (e !== void 0) {
      const t = un(E[i], e);
      return t === -1 ? void 0 : mn(E[i], t, 1)[0];
    }
    return Rt(E[i]);
  }, o.removeHooks = function(i) {
    E[i] = [];
  }, o.removeAllHooks = function() {
    E = Pt();
  }, o;
}
var xn = vt();
export {
  xn as default
};
