/*! @license DOMPurify 3.4.2 | (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.2/LICENSE */
const {
  entries: yt,
  setPrototypeOf: mt,
  isFrozen: Kt,
  getPrototypeOf: Zt,
  getOwnPropertyDescriptor: Jt
} = Object;
let {
  freeze: y,
  seal: N,
  create: X
} = Object, {
  apply: Fe,
  construct: He
} = typeof Reflect < "u" && Reflect;
y || (y = function(n) {
  return n;
});
N || (N = function(n) {
  return n;
});
Fe || (Fe = function(n, l) {
  for (var a = arguments.length, f = new Array(a > 2 ? a - 2 : 0), b = 2; b < a; b++)
    f[b - 2] = arguments[b];
  return n.apply(l, f);
});
He || (He = function(n) {
  for (var l = arguments.length, a = new Array(l > 1 ? l - 1 : 0), f = 1; f < l; f++)
    a[f - 1] = arguments[f];
  return new n(...a);
});
const ee = T(Array.prototype.forEach), Qt = T(Array.prototype.lastIndexOf), pt = T(Array.prototype.pop), te = T(Array.prototype.push), en = T(Array.prototype.splice), O = Array.isArray, ie = T(String.prototype.toLowerCase), Pe = T(String.prototype.toString), Tt = T(String.prototype.match), Y = T(String.prototype.replace), dt = T(String.prototype.indexOf), tn = T(String.prototype.trim), nn = T(Number.prototype.toString), on = T(Boolean.prototype.toString), _t = typeof BigInt > "u" ? null : T(BigInt.prototype.toString), Et = typeof Symbol > "u" ? null : T(Symbol.prototype.toString), u = T(Object.prototype.hasOwnProperty), ne = T(Object.prototype.toString), g = T(RegExp.prototype.test), de = rn(TypeError);
function T(i) {
  return function(n) {
    n instanceof RegExp && (n.lastIndex = 0);
    for (var l = arguments.length, a = new Array(l > 1 ? l - 1 : 0), f = 1; f < l; f++)
      a[f - 1] = arguments[f];
    return Fe(i, n, a);
  };
}
function rn(i) {
  return function() {
    for (var n = arguments.length, l = new Array(n), a = 0; a < n; a++)
      l[a] = arguments[a];
    return He(i, l);
  };
}
function s(i, n) {
  let l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ie;
  if (mt && mt(i, null), !O(n))
    return i;
  let a = n.length;
  for (; a--; ) {
    let f = n[a];
    if (typeof f == "string") {
      const b = l(f);
      b !== f && (Kt(n) || (n[a] = b), f = b);
    }
    i[f] = !0;
  }
  return i;
}
function an(i) {
  for (let n = 0; n < i.length; n++)
    u(i, n) || (i[n] = null);
  return i;
}
function I(i) {
  const n = X(null);
  for (const [l, a] of yt(i))
    u(i, l) && (O(a) ? n[l] = an(a) : a && typeof a == "object" && a.constructor === Object ? n[l] = I(a) : n[l] = a);
  return n;
}
function sn(i) {
  switch (typeof i) {
    case "string":
      return i;
    case "number":
      return nn(i);
    case "boolean":
      return on(i);
    case "bigint":
      return _t ? _t(i) : "0";
    case "symbol":
      return Et ? Et(i) : "Symbol()";
    case "undefined":
      return ne(i);
    case "function":
    case "object": {
      if (i === null)
        return ne(i);
      const n = i, l = j(n, "toString");
      if (typeof l == "function") {
        const a = l(n);
        return typeof a == "string" ? a : ne(a);
      }
      return ne(i);
    }
    default:
      return ne(i);
  }
}
function j(i, n) {
  for (; i !== null; ) {
    const a = Jt(i, n);
    if (a) {
      if (a.get)
        return T(a.get);
      if (typeof a.value == "function")
        return T(a.value);
    }
    i = Zt(i);
  }
  function l() {
    return null;
  }
  return l;
}
function ln(i) {
  try {
    return g(i, ""), !0;
  } catch {
    return !1;
  }
}
const At = y(["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"]), xe = y(["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"]), ke = y(["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"]), cn = y(["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"]), Ue = y(["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"]), fn = y(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), gt = y(["#text"]), ht = y(["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"]), ve = y(["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"]), St = y(["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"]), _e = y(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), un = N(/\{\{[\w\W]*|[\w\W]*\}\}/gm), mn = N(/<%[\w\W]*|[\w\W]*%>/gm), pn = N(/\$\{[\w\W]*/gm), Tn = N(/^data-[\-\w.\u00B7-\uFFFF]+$/), dn = N(/^aria-[\-\w]+$/), bt = N(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), _n = N(/^(?:\w+script|data):/i), En = N(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), Dt = N(/^html$/i), An = N(/^[a-z][.\w]*(-[.\w]+)+$/i);
var Rt = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ARIA_ATTR: dn,
  ATTR_WHITESPACE: En,
  CUSTOM_ELEMENT: An,
  DATA_ATTR: Tn,
  DOCTYPE_NAME: Dt,
  ERB_EXPR: mn,
  IS_ALLOWED_URI: bt,
  IS_SCRIPT_OR_DATA: _n,
  MUSTACHE_EXPR: un,
  TMPLIT_EXPR: pn
});
const oe = {
  element: 1,
  text: 3,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9
}, gn = function() {
  return typeof window > "u" ? null : window;
}, hn = function(n, l) {
  if (typeof n != "object" || typeof n.createPolicy != "function")
    return null;
  let a = null;
  const f = "data-tt-policy-suffix";
  l && l.hasAttribute(f) && (a = l.getAttribute(f));
  const b = "dompurify" + (a ? "#" + a : "");
  try {
    return n.createPolicy(b, {
      createHTML(H) {
        return H;
      },
      createScriptURL(H) {
        return H;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + b + " could not be created."), null;
  }
}, Ot = function() {
  return {
    afterSanitizeAttributes: [],
    afterSanitizeElements: [],
    afterSanitizeShadowDOM: [],
    beforeSanitizeAttributes: [],
    beforeSanitizeElements: [],
    beforeSanitizeShadowDOM: [],
    uponSanitizeAttribute: [],
    uponSanitizeElement: [],
    uponSanitizeShadowNode: []
  };
};
function It() {
  let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : gn();
  const n = (r) => It(r);
  if (n.version = "3.4.2", n.removed = [], !i || !i.document || i.document.nodeType !== oe.document || !i.Element)
    return n.isSupported = !1, n;
  let {
    document: l
  } = i;
  const a = l, f = a.currentScript, {
    DocumentFragment: b,
    HTMLTemplateElement: H,
    Node: Ee,
    Element: ze,
    NodeFilter: V,
    NamedNodeMap: Lt = i.NamedNodeMap || i.MozNamedAttrMap,
    HTMLFormElement: Nt,
    DOMParser: Ct,
    trustedTypes: re
  } = i, $ = ze.prototype, Mt = j($, "cloneNode"), wt = j($, "remove"), Pt = j($, "nextSibling"), xt = j($, "childNodes"), ae = j($, "parentNode");
  if (typeof H == "function") {
    const r = l.createElement("template");
    r.content && r.content.ownerDocument && (l = r.content.ownerDocument);
  }
  let S, q = "";
  const {
    implementation: Ae,
    createNodeIterator: kt,
    createDocumentFragment: Ut,
    getElementsByTagName: vt
  } = l, {
    importNode: Ft
  } = a;
  let R = Ot();
  n.isSupported = typeof yt == "function" && typeof ae == "function" && Ae && Ae.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: se,
    ERB_EXPR: le,
    TMPLIT_EXPR: ce,
    DATA_ATTR: Ht,
    ARIA_ATTR: zt,
    IS_SCRIPT_OR_DATA: Gt,
    ATTR_WHITESPACE: Ge,
    CUSTOM_ELEMENT: Bt
  } = Rt;
  let {
    IS_ALLOWED_URI: Be
  } = Rt, _ = null;
  const We = s({}, [...At, ...xe, ...ke, ...Ue, ...gt]);
  let A = null;
  const Ye = s({}, [...ht, ...ve, ...St, ..._e]);
  let m = Object.seal(X(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
    }
  })), K = null, fe = null;
  const k = Object.seal(X(null, {
    tagCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    }
  }));
  let Xe = !0, ge = !0, je = !1, Ve = !0, U = !1, Z = !0, v = !1, he = !1, Se = !1, z = !1, ue = !1, me = !1, $e = !0, qe = !1;
  const Ke = "user-content-";
  let Re = !0, J = !1, G = {}, w = null;
  const Oe = s({}, ["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 Ze = null;
  const Je = s({}, ["audio", "video", "img", "source", "image", "track"]);
  let ye = null;
  const Qe = s({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), pe = "http://www.w3.org/1998/Math/MathML", Te = "http://www.w3.org/2000/svg", P = "http://www.w3.org/1999/xhtml";
  let B = P, be = !1, De = null;
  const Wt = s({}, [pe, Te, P], Pe);
  let Ie = s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = s({}, ["annotation-xml"]);
  const Yt = s({}, ["title", "style", "font", "a", "script"]);
  let Q = null;
  const Xt = ["application/xhtml+xml", "text/html"], jt = "text/html";
  let d = null, W = null;
  const Vt = l.createElement("form"), et = function(e) {
    return e instanceof RegExp || e instanceof Function;
  }, Ne = function() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (W && W === e)
      return;
    (!e || typeof e != "object") && (e = {}), e = I(e), Q = // eslint-disable-next-line unicorn/prefer-includes
    Xt.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? jt : e.PARSER_MEDIA_TYPE, d = Q === "application/xhtml+xml" ? Pe : ie, _ = u(e, "ALLOWED_TAGS") && O(e.ALLOWED_TAGS) ? s({}, e.ALLOWED_TAGS, d) : We, A = u(e, "ALLOWED_ATTR") && O(e.ALLOWED_ATTR) ? s({}, e.ALLOWED_ATTR, d) : Ye, De = u(e, "ALLOWED_NAMESPACES") && O(e.ALLOWED_NAMESPACES) ? s({}, e.ALLOWED_NAMESPACES, Pe) : Wt, ye = u(e, "ADD_URI_SAFE_ATTR") && O(e.ADD_URI_SAFE_ATTR) ? s(I(Qe), e.ADD_URI_SAFE_ATTR, d) : Qe, Ze = u(e, "ADD_DATA_URI_TAGS") && O(e.ADD_DATA_URI_TAGS) ? s(I(Je), e.ADD_DATA_URI_TAGS, d) : Je, w = u(e, "FORBID_CONTENTS") && O(e.FORBID_CONTENTS) ? s({}, e.FORBID_CONTENTS, d) : Oe, K = u(e, "FORBID_TAGS") && O(e.FORBID_TAGS) ? s({}, e.FORBID_TAGS, d) : I({}), fe = u(e, "FORBID_ATTR") && O(e.FORBID_ATTR) ? s({}, e.FORBID_ATTR, d) : I({}), G = u(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? I(e.USE_PROFILES) : e.USE_PROFILES : !1, Xe = e.ALLOW_ARIA_ATTR !== !1, ge = e.ALLOW_DATA_ATTR !== !1, je = e.ALLOW_UNKNOWN_PROTOCOLS || !1, Ve = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, U = e.SAFE_FOR_TEMPLATES || !1, Z = e.SAFE_FOR_XML !== !1, v = e.WHOLE_DOCUMENT || !1, z = e.RETURN_DOM || !1, ue = e.RETURN_DOM_FRAGMENT || !1, me = e.RETURN_TRUSTED_TYPE || !1, Se = e.FORCE_BODY || !1, $e = e.SANITIZE_DOM !== !1, qe = e.SANITIZE_NAMED_PROPS || !1, Re = e.KEEP_CONTENT !== !1, J = e.IN_PLACE || !1, Be = ln(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : bt, B = typeof e.NAMESPACE == "string" ? e.NAMESPACE : P, Ie = u(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? I(e.MATHML_TEXT_INTEGRATION_POINTS) : s({}, ["mi", "mo", "mn", "ms", "mtext"]), Le = u(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? I(e.HTML_INTEGRATION_POINTS) : s({}, ["annotation-xml"]);
    const t = u(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? I(e.CUSTOM_ELEMENT_HANDLING) : X(null);
    if (m = X(null), u(t, "tagNameCheck") && et(t.tagNameCheck) && (m.tagNameCheck = t.tagNameCheck), u(t, "attributeNameCheck") && et(t.attributeNameCheck) && (m.attributeNameCheck = t.attributeNameCheck), u(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (m.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), U && (ge = !1), ue && (z = !0), G && (_ = s({}, gt), A = X(null), G.html === !0 && (s(_, At), s(A, ht)), G.svg === !0 && (s(_, xe), s(A, ve), s(A, _e)), G.svgFilters === !0 && (s(_, ke), s(A, ve), s(A, _e)), G.mathMl === !0 && (s(_, Ue), s(A, St), s(A, _e))), k.tagCheck = null, k.attributeCheck = null, u(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? k.tagCheck = e.ADD_TAGS : O(e.ADD_TAGS) && (_ === We && (_ = I(_)), s(_, e.ADD_TAGS, d))), u(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? k.attributeCheck = e.ADD_ATTR : O(e.ADD_ATTR) && (A === Ye && (A = I(A)), s(A, e.ADD_ATTR, d))), u(e, "ADD_URI_SAFE_ATTR") && O(e.ADD_URI_SAFE_ATTR) && s(ye, e.ADD_URI_SAFE_ATTR, d), u(e, "FORBID_CONTENTS") && O(e.FORBID_CONTENTS) && (w === Oe && (w = I(w)), s(w, e.FORBID_CONTENTS, d)), u(e, "ADD_FORBID_CONTENTS") && O(e.ADD_FORBID_CONTENTS) && (w === Oe && (w = I(w)), s(w, e.ADD_FORBID_CONTENTS, d)), Re && (_["#text"] = !0), v && s(_, ["html", "head", "body"]), _.table && (s(_, ["tbody"]), delete K.tbody), e.TRUSTED_TYPES_POLICY) {
      if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function")
        throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
      if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function")
        throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
      S = e.TRUSTED_TYPES_POLICY, q = S.createHTML("");
    } else
      S === void 0 && (S = hn(re, f)), S !== null && typeof q == "string" && (q = S.createHTML(""));
    y && y(e), W = e;
  }, tt = s({}, [...xe, ...ke, ...cn]), nt = s({}, [...Ue, ...fn]), $t = function(e) {
    let t = ae(e);
    (!t || !t.tagName) && (t = {
      namespaceURI: B,
      tagName: "template"
    });
    const o = ie(e.tagName), c = ie(t.tagName);
    return De[e.namespaceURI] ? e.namespaceURI === Te ? t.namespaceURI === P ? o === "svg" : t.namespaceURI === pe ? o === "svg" && (c === "annotation-xml" || Ie[c]) : !!tt[o] : e.namespaceURI === pe ? t.namespaceURI === P ? o === "math" : t.namespaceURI === Te ? o === "math" && Le[c] : !!nt[o] : e.namespaceURI === P ? t.namespaceURI === Te && !Le[c] || t.namespaceURI === pe && !Ie[c] ? !1 : !nt[o] && (Yt[o] || !tt[o]) : !!(Q === "application/xhtml+xml" && De[e.namespaceURI]) : !1;
  }, C = function(e) {
    te(n.removed, {
      element: e
    });
    try {
      ae(e).removeChild(e);
    } catch {
      wt(e);
    }
  }, F = function(e, t) {
    try {
      te(n.removed, {
        attribute: t.getAttributeNode(e),
        from: t
      });
    } catch {
      te(n.removed, {
        attribute: null,
        from: t
      });
    }
    if (t.removeAttribute(e), e === "is")
      if (z || ue)
        try {
          C(t);
        } catch {
        }
      else
        try {
          t.setAttribute(e, "");
        } catch {
        }
  }, ot = function(e) {
    let t = null, o = null;
    if (Se)
      e = "<remove></remove>" + e;
    else {
      const p = Tt(e, /^[\r\n\t ]+/);
      o = p && p[0];
    }
    Q === "application/xhtml+xml" && B === P && (e = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + e + "</body></html>");
    const c = S ? S.createHTML(e) : e;
    if (B === P)
      try {
        t = new Ct().parseFromString(c, Q);
      } catch {
      }
    if (!t || !t.documentElement) {
      t = Ae.createDocument(B, "template", null);
      try {
        t.documentElement.innerHTML = be ? q : c;
      } catch {
      }
    }
    const h = t.body || t.documentElement;
    return e && o && h.insertBefore(l.createTextNode(o), h.childNodes[0] || null), B === P ? vt.call(t, v ? "html" : "body")[0] : v ? t.documentElement : h;
  }, it = function(e) {
    return kt.call(
      e.ownerDocument || e,
      e,
      // eslint-disable-next-line no-bitwise
      V.SHOW_ELEMENT | V.SHOW_COMMENT | V.SHOW_TEXT | V.SHOW_PROCESSING_INSTRUCTION | V.SHOW_CDATA_SECTION,
      null
    );
  }, Ce = function(e) {
    return e instanceof Nt && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof Lt) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
  }, Me = function(e) {
    return typeof Ee == "function" && e instanceof Ee;
  };
  function x(r, e, t) {
    ee(r, (o) => {
      o.call(n, e, t, W);
    });
  }
  const rt = function(e) {
    let t = null;
    if (x(R.beforeSanitizeElements, e, null), Ce(e))
      return C(e), !0;
    const o = d(e.nodeName);
    if (x(R.uponSanitizeElement, e, {
      tagName: o,
      allowedTags: _
    }), Z && e.hasChildNodes() && !Me(e.firstElementChild) && g(/<[/\w!]/g, e.innerHTML) && g(/<[/\w!]/g, e.textContent) || Z && e.namespaceURI === P && o === "style" && Me(e.firstElementChild) || e.nodeType === oe.progressingInstruction || Z && e.nodeType === oe.comment && g(/<[/\w]/g, e.data))
      return C(e), !0;
    if (K[o] || !(k.tagCheck instanceof Function && k.tagCheck(o)) && !_[o]) {
      if (!K[o] && st(o) && (m.tagNameCheck instanceof RegExp && g(m.tagNameCheck, o) || m.tagNameCheck instanceof Function && m.tagNameCheck(o)))
        return !1;
      if (Re && !w[o]) {
        const c = ae(e) || e.parentNode, h = xt(e) || e.childNodes;
        if (h && c) {
          const p = h.length;
          for (let D = p - 1; D >= 0; --D) {
            const L = Mt(h[D], !0);
            c.insertBefore(L, Pt(e));
          }
        }
      }
      return C(e), !0;
    }
    return e instanceof ze && !$t(e) || (o === "noscript" || o === "noembed" || o === "noframes") && g(/<\/no(script|embed|frames)/i, e.innerHTML) ? (C(e), !0) : (U && e.nodeType === oe.text && (t = e.textContent, ee([se, le, ce], (c) => {
      t = Y(t, c, " ");
    }), e.textContent !== t && (te(n.removed, {
      element: e.cloneNode()
    }), e.textContent = t)), x(R.afterSanitizeElements, e, null), !1);
  }, at = function(e, t, o) {
    if (fe[t] || $e && (t === "id" || t === "name") && (o in l || o in Vt))
      return !1;
    const c = A[t] || k.attributeCheck instanceof Function && k.attributeCheck(t, e);
    if (!(ge && !fe[t] && g(Ht, t))) {
      if (!(Xe && g(zt, t))) {
        if (!c || fe[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
            !(st(e) && (m.tagNameCheck instanceof RegExp && g(m.tagNameCheck, e) || m.tagNameCheck instanceof Function && m.tagNameCheck(e)) && (m.attributeNameCheck instanceof RegExp && g(m.attributeNameCheck, t) || m.attributeNameCheck instanceof Function && m.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" && m.allowCustomizedBuiltInElements && (m.tagNameCheck instanceof RegExp && g(m.tagNameCheck, o) || m.tagNameCheck instanceof Function && m.tagNameCheck(o)))
          ) return !1;
        } else if (!ye[t]) {
          if (!g(Be, Y(o, Ge, ""))) {
            if (!((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && dt(o, "data:") === 0 && Ze[e])) {
              if (!(je && !g(Gt, Y(o, Ge, "")))) {
                if (o)
                  return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, qt = s({}, ["annotation-xml", "color-profile", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "missing-glyph"]), st = function(e) {
    return !qt[ie(e)] && g(Bt, e);
  }, lt = function(e) {
    x(R.beforeSanitizeAttributes, e, null);
    const {
      attributes: t
    } = e;
    if (!t || Ce(e))
      return;
    const o = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: A,
      forceKeepAttr: void 0
    };
    let c = t.length;
    for (; c--; ) {
      const h = t[c], {
        name: p,
        namespaceURI: D,
        value: L
      } = h, M = d(p), we = L;
      let E = p === "value" ? we : tn(we);
      if (o.attrName = M, o.attrValue = E, o.keepAttr = !0, o.forceKeepAttr = void 0, x(R.uponSanitizeAttribute, e, o), E = o.attrValue, qe && (M === "id" || M === "name") && dt(E, Ke) !== 0 && (F(p, e), E = Ke + E), Z && g(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, E)) {
        F(p, e);
        continue;
      }
      if (M === "attributename" && Tt(E, "href")) {
        F(p, e);
        continue;
      }
      if (o.forceKeepAttr)
        continue;
      if (!o.keepAttr) {
        F(p, e);
        continue;
      }
      if (!Ve && g(/\/>/i, E)) {
        F(p, e);
        continue;
      }
      U && ee([se, le, ce], (ut) => {
        E = Y(E, ut, " ");
      });
      const ft = d(e.nodeName);
      if (!at(ft, M, E)) {
        F(p, e);
        continue;
      }
      if (S && typeof re == "object" && typeof re.getAttributeType == "function" && !D)
        switch (re.getAttributeType(ft, M)) {
          case "TrustedHTML": {
            E = S.createHTML(E);
            break;
          }
          case "TrustedScriptURL": {
            E = S.createScriptURL(E);
            break;
          }
        }
      if (E !== we)
        try {
          D ? e.setAttributeNS(D, p, E) : e.setAttribute(p, E), Ce(e) ? C(e) : pt(n.removed);
        } catch {
          F(p, e);
        }
    }
    x(R.afterSanitizeAttributes, e, null);
  }, ct = function(e) {
    let t = null;
    const o = it(e);
    for (x(R.beforeSanitizeShadowDOM, e, null); t = o.nextNode(); )
      x(R.uponSanitizeShadowNode, t, null), rt(t), lt(t), t.content instanceof b && ct(t.content);
    x(R.afterSanitizeShadowDOM, e, null);
  };
  return n.sanitize = function(r) {
    let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = null, o = null, c = null, h = null;
    if (be = !r, be && (r = "<!-->"), typeof r != "string" && !Me(r) && (r = sn(r), typeof r != "string"))
      throw de("dirty is not a string, aborting");
    if (!n.isSupported)
      return r;
    if (he || Ne(e), n.removed = [], typeof r == "string" && (J = !1), J) {
      const L = r.nodeName;
      if (typeof L == "string") {
        const M = d(L);
        if (!_[M] || K[M])
          throw de("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (r instanceof Ee)
      t = ot("<!---->"), o = t.ownerDocument.importNode(r, !0), o.nodeType === oe.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? t = o : t.appendChild(o);
    else {
      if (!z && !U && !v && // eslint-disable-next-line unicorn/prefer-includes
      r.indexOf("<") === -1)
        return S && me ? S.createHTML(r) : r;
      if (t = ot(r), !t)
        return z ? null : me ? q : "";
    }
    t && Se && C(t.firstChild);
    const p = it(J ? r : t);
    for (; c = p.nextNode(); )
      rt(c), lt(c), c.content instanceof b && ct(c.content);
    if (J)
      return r;
    if (z) {
      if (U) {
        t.normalize();
        let L = t.innerHTML;
        ee([se, le, ce], (M) => {
          L = Y(L, M, " ");
        }), t.innerHTML = L;
      }
      if (ue)
        for (h = Ut.call(t.ownerDocument); t.firstChild; )
          h.appendChild(t.firstChild);
      else
        h = t;
      return (A.shadowroot || A.shadowrootmode) && (h = Ft.call(a, h, !0)), h;
    }
    let D = v ? t.outerHTML : t.innerHTML;
    return v && _["!doctype"] && t.ownerDocument && t.ownerDocument.doctype && t.ownerDocument.doctype.name && g(Dt, t.ownerDocument.doctype.name) && (D = "<!DOCTYPE " + t.ownerDocument.doctype.name + `>
` + D), U && ee([se, le, ce], (L) => {
      D = Y(D, L, " ");
    }), S && me ? S.createHTML(D) : D;
  }, n.setConfig = function() {
    let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    Ne(r), he = !0;
  }, n.clearConfig = function() {
    W = null, he = !1;
  }, n.isValidAttribute = function(r, e, t) {
    W || Ne({});
    const o = d(r), c = d(e);
    return at(o, c, t);
  }, n.addHook = function(r, e) {
    typeof e == "function" && te(R[r], e);
  }, n.removeHook = function(r, e) {
    if (e !== void 0) {
      const t = Qt(R[r], e);
      return t === -1 ? void 0 : en(R[r], t, 1)[0];
    }
    return pt(R[r]);
  }, n.removeHooks = function(r) {
    R[r] = [];
  }, n.removeAllHooks = function() {
    R = Ot();
  }, n;
}
var Sn = It();
export {
  Sn as default
};
