/** * Minified by jsDelivr using Terser v5.48.0. * Original file: /npm/dompurify@3.4.17/dist/purify.es.mjs * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ /*! @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 */ function _OverloadYield(e,t){this.v=e,this.k=t}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n2?n-2:0),o=2;o1?t-1:0),r=1;r1?n-1:0),o=1;o2&&void 0!==arguments[2]?arguments[2]:stringToLowerCase;if(setPrototypeOf&&setPrototypeOf(e,null),!arrayIsArray(t))return e;let r=t.length;for(;r--;){let o=t[r];if("string"==typeof o){const e=n(o);e!==o&&(isFrozen(t)||(t[r]=e),o=e)}e[o]=!0}return e}function cleanArray(e){for(let t=0;t/g),TMPLIT_EXPR=seal(/\${[\w\W]*/g),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i),ELEMENT_MARKUP_PROBE=seal(/<[/\w!]/g),COMMENT_MARKUP_PROBE=seal(/<[/\w]/g),FALLBACK_TAG_CLOSE=seal(/<\/no(script|embed|frames)/i),SELF_CLOSING_TAG=seal(/\/>/i),NODE_TYPE={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},LITERAL_TEXT_ELEMENTS=freeze(addToSet({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),getGlobal=function(){return"undefined"==typeof window?null:window},_createTrustedTypesPolicy=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}},_createHooksMap=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},_resolveSetOption=function(e,t,n,r){return objectHasOwnProperty(e,t)&&arrayIsArray(e[t])?addToSet(r.base?clone(r.base):{},e[t],r.transform):n},_resolveObjectOption=function(e,t,n){const r=objectHasOwnProperty(e,t)?e[t]:void 0;return r&&"object"==typeof r?clone(r):n()};function createDOMPurify(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:getGlobal();const t=e=>createDOMPurify(e);if(t.version="3.4.17",t.removed=[],!e||!e.document||e.document.nodeType!==NODE_TYPE.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,o=r.currentScript;e.DocumentFragment;const a=e.HTMLTemplateElement,i=e.Node,l=e.Element,s=e.NodeFilter;void 0===e.NamedNodeMap&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const c=e.DOMParser,u=e.trustedTypes,p=l.prototype,f=lookupGetter(p,"cloneNode"),d=lookupGetter(p,"remove"),m=lookupGetter(p,"removeAttributeNode"),y=lookupGetter(p,"nextSibling"),g=lookupGetter(p,"childNodes"),h=lookupGetter(p,"parentNode"),T=lookupGetter(p,"shadowRoot"),E=lookupGetter(p,"attributes"),b=i&&i.prototype?lookupGetter(i.prototype,"nodeType"):null,S=i&&i.prototype?lookupGetter(i.prototype,"nodeName"):null,_=i&&i.prototype?lookupGetter(i.prototype,"ownerDocument"):null,A=function(e){return b?b(e):e.nodeType},O=function(e){return S?S(e):e.nodeName},v=lookupAccessor(p,"namespaceURI"),w=function(e){return v?v(e):e.namespaceURI};if("function"==typeof a){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,P,N="",R=!1,D=0;const C=function(){if(D>0)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.')},k=function(e){C(),D++;try{return x.createHTML(e)}finally{D--}},L=n,I=L.implementation,M=L.createNodeIterator,z=L.createDocumentFragment,F=L.getElementsByTagName,H=r.importNode;let U=_createHooksMap();t.isSupported="function"==typeof entries&&"function"==typeof h&&I&&void 0!==I.createHTMLDocument;const j=MUSTACHE_EXPR,Y=ERB_EXPR,G=TMPLIT_EXPR,B=DATA_ATTR,W=ARIA_ATTR,$=IS_SCRIPT_OR_DATA,K=ATTR_WHITESPACE,X=CUSTOM_ELEMENT;let q=IS_ALLOWED_URI,V=null;const Z=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let J=null;const Q=addToSet({},[...html,...svg,...mathMl,...xml]);let ee=Object.seal(create(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}})),te=null,ne=null;const re=Object.seal(create(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let oe=!0,ae=!0,ie=!1,le=!0,se=!1,ce=!0,ue=!1,pe=!1,fe=null,de=null,me=!1,ye=!1,ge=!1,he=!1,Te=!0,Ee=!1;const be="user-content-";let Se=!0,_e=!1,Ae=null,Oe={},ve=null;const we=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let xe=null;const Pe=addToSet({},["audio","video","img","source","image","track"]);let Ne=null;const Re=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),De="http://www.w3.org/1998/Math/MathML",Ce="http://www.w3.org/2000/svg",ke="http://www.w3.org/1999/xhtml";let Le=ke,Ie=!1,Me=null;const ze=addToSet({},[De,Ce,ke],stringToString),Fe=freeze(["mi","mo","mn","ms","mtext"]);let He=addToSet({},Fe);const Ue=freeze(["annotation-xml"]);let je=addToSet({},Ue);const Ye=addToSet({},["title","style","font","a","script"]);let Ge=null;const Be=["application/xhtml+xml","text/html"];let We=null,$e=null;const Ke=n.createElement("form"),Xe=function(e){return e instanceof RegExp||e instanceof Function},qe=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if($e&&$e===e)return;e&&"object"==typeof e||(e={}),e=clone(e),Ge=-1===Be.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,We="application/xhtml+xml"===Ge?stringToString:stringToLowerCase,V=_resolveSetOption(e,"ALLOWED_TAGS",Z,{transform:We}),J=_resolveSetOption(e,"ALLOWED_ATTR",Q,{transform:We}),Me=_resolveSetOption(e,"ALLOWED_NAMESPACES",ze,{transform:stringToString}),Ne=_resolveSetOption(e,"ADD_URI_SAFE_ATTR",Re,{transform:We,base:Re}),xe=_resolveSetOption(e,"ADD_DATA_URI_TAGS",Pe,{transform:We,base:Pe}),ve=_resolveSetOption(e,"FORBID_CONTENTS",we,{transform:We}),te=_resolveSetOption(e,"FORBID_TAGS",clone({}),{transform:We}),ne=_resolveSetOption(e,"FORBID_ATTR",clone({}),{transform:We}),Oe=!!objectHasOwnProperty(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?clone(e.USE_PROFILES):e.USE_PROFILES),oe=!1!==e.ALLOW_ARIA_ATTR,ae=!1!==e.ALLOW_DATA_ATTR,ie=e.ALLOW_UNKNOWN_PROTOCOLS||!1,le=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,se=e.SAFE_FOR_TEMPLATES||!1,ce=!1!==e.SAFE_FOR_XML,ue=e.WHOLE_DOCUMENT||!1,ye=e.RETURN_DOM||!1,ge=e.RETURN_DOM_FRAGMENT||!1,he=e.RETURN_TRUSTED_TYPE||!1,me=e.FORCE_BODY||!1,Te=!1!==e.SANITIZE_DOM,Ee=e.SANITIZE_NAMED_PROPS||!1,Se=!1!==e.KEEP_CONTENT,_e=e.IN_PLACE||!1,q=isRegex(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:IS_ALLOWED_URI,Le="string"==typeof e.NAMESPACE?e.NAMESPACE:ke,He=_resolveObjectOption(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>addToSet({},Fe)),je=_resolveObjectOption(e,"HTML_INTEGRATION_POINTS",()=>addToSet({},Ue));const t=_resolveObjectOption(e,"CUSTOM_ELEMENT_HANDLING",()=>create(null));if(ee=create(null),objectHasOwnProperty(t,"tagNameCheck")&&Xe(t.tagNameCheck)&&(ee.tagNameCheck=t.tagNameCheck),objectHasOwnProperty(t,"attributeNameCheck")&&Xe(t.attributeNameCheck)&&(ee.attributeNameCheck=t.attributeNameCheck),objectHasOwnProperty(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(ee.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),seal(ee),se&&(ae=!1),ge&&(ye=!0),Oe&&(V=addToSet({},text),J=create(null),!0===Oe.html&&(addToSet(V,html$1),addToSet(J,html)),!0===Oe.svg&&(addToSet(V,svg$1),addToSet(J,svg),addToSet(J,xml)),!0===Oe.svgFilters&&(addToSet(V,svgFilters),addToSet(J,svg),addToSet(J,xml)),!0===Oe.mathMl&&(addToSet(V,mathMl$1),addToSet(J,mathMl),addToSet(J,xml))),re.tagCheck=null,re.attributeCheck=null,objectHasOwnProperty(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?re.tagCheck=e.ADD_TAGS:arrayIsArray(e.ADD_TAGS)&&(V===Z&&(V=clone(V)),addToSet(V,e.ADD_TAGS,We))),objectHasOwnProperty(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?re.attributeCheck=e.ADD_ATTR:arrayIsArray(e.ADD_ATTR)&&(J===Q&&(J=clone(J)),addToSet(J,e.ADD_ATTR,We))),objectHasOwnProperty(e,"ADD_FORBID_CONTENTS")&&arrayIsArray(e.ADD_FORBID_CONTENTS)&&(ve===we&&(ve=clone(ve)),addToSet(ve,e.ADD_FORBID_CONTENTS,We)),Se&&(V["#text"]=!0),ue&&addToSet(V,["html","head","body"]),V.table&&(addToSet(V,["tbody"]),delete te.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=x;x=e.TRUSTED_TYPES_POLICY;try{N=k("")}catch(e){throw x=t,e}}else null===e.TRUSTED_TYPES_POLICY?(x=void 0,N=""):(void 0===x&&(R||(P=_createTrustedTypesPolicy(u,o),R=!0),x=P),x&&"string"==typeof N&&(N=k("")));freeze&&freeze(e),$e=e},Ve=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),Ze=addToSet({},[...mathMl$1,...mathMlDisallowed]),Je=function(e){const t=w(e),n=stringToLowerCase(O(e)),r=h(e);let o,a;return r&&A(r)===NODE_TYPE.element?(o={namespaceURI:w(r)},a=stringToLowerCase(O(r))):(o={namespaceURI:Le},a="template"),!!Me[t]&&(t===Ce?function(e,t,n){return t.namespaceURI===ke?"svg"===e:t.namespaceURI===De?"svg"===e&&("annotation-xml"===n||He[n]):Boolean(Ve[e])}(n,o,a):t===De?function(e,t,n){return t.namespaceURI===ke?"math"===e:t.namespaceURI===Ce?"math"===e&&je[n]:Boolean(Ze[e])}(n,o,a):t===ke?function(e,t,n){return!(t.namespaceURI===Ce&&!je[n])&&!(t.namespaceURI===De&&!He[n])&&!Ze[e]&&(Ye[e]||!Ve[e])}(n,o,a):!("application/xhtml+xml"!==Ge||!Me[t]))},Qe=function(e){arrayPush(t.removed,{element:e});try{h(e).removeChild(e)}catch(t){if(d(e),!h(e))throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},et=function(e,t,n){try{m(e,t)}catch(t){try{e.removeAttribute(n)}catch(e){}}},tt=function(e){at(e);const t=g(e);t&&arrayForEach(arraySlice(t),e=>{try{d(e)}catch(e){}});const n=A(e)===NODE_TYPE.element?E(e):null;if(n)for(let t=n.length-1;t>=0;--t){const r=n[t],o=r&&r.name;"string"==typeof o&&et(e,r,o)}},nt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch(e){r=null}arrayPush(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch(t){try{n.removeAttribute(e)}catch(e){}}if("is"===e)if(ye||ge)try{Qe(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},rt=function(e){const t=E(e);if(t)for(let n=t.length-1;n>=0;--n){const r=t[n],o=r&&r.name;"string"!=typeof o||J[We(o)]||et(e,r,o)}},ot=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=[e];for(;r.length>0;){const e=r.pop();if(!1===t(e))continue;if(n&&A(e)===NODE_TYPE.element){const t=T(e);gt(t)&&r.push(t)}const o=g(e);if(o)for(let e=o.length-1;e>=0;--e)r.push(o[e])}},at=function(e){ot(e,e=>{A(e)===NODE_TYPE.element&&rt(e)})},it=function(e){const t=[];return ot(e,e=>{t.push(e)},!0),t},lt=function(e,n){let r=!1;return arrayForEach(t.removed,t=>{t.element&&(r=r||t.element===e,at(t.element))}),function(e,t){const n=setCreate();arrayForEach(it(e),e=>{A(e)===NODE_TYPE.element&&setAdd(n,e)}),arrayForEach(t,e=>{A(e)!==NODE_TYPE.element||setHas(n,e)||rt(e)})}(e,n),r},st=function(e,t,n,r){const o=pt(e);let a;for(;a=o.nextNode();)setHas(r,a)&&!setHas(Ae,a)&&(t&&Tt(U.uponSanitizeShadowNode,a,null),_t(a,n),Nt(a,n),gt(a.content)&&Rt(a.content))},ct=function(e,t){return!!ce&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},ut=function(e){let t=null,r=null;if(me)e=""+e;else{const t=stringMatch(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===Ge&&Le===ke&&(e=''+e+"");const o=x?k(e):e;if(Le===ke)try{t=(new c).parseFromString(o,Ge)}catch(e){}if(!t||!t.documentElement){t=I.createDocument(Le,"template",null);try{t.documentElement.innerHTML=Ie?N:o}catch(e){}}const a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Le===ke?F.call(t,ue?"html":"body")[0]:ue?t.documentElement:a},pt=function(e){const t=_?_(e):e.ownerDocument;return M.call(t||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT|s.SHOW_PROCESSING_INSTRUCTION|s.SHOW_CDATA_SECTION,null)},ft=function(e){return e=stringReplace(e,j," "),e=stringReplace(e,Y," "),e=stringReplace(e,G," ")},dt=function(e){var t;mt(e);const n=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");n&&arrayForEach(n,e=>{gt(e.content)&&dt(e.content)})},mt=function(e){e.normalize();const t=_?_(e):e.ownerDocument,n=M.call(t||e,e,s.SHOW_TEXT|s.SHOW_COMMENT|s.SHOW_CDATA_SECTION|s.SHOW_PROCESSING_INSTRUCTION,null);let r=n.nextNode();for(;r;)r.data=ft(r.data),r=n.nextNode()},yt=function(e){const t=S?S(e):null;return"string"==typeof t&&("form"===We(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==E(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.removeAttributeNode||"function"!=typeof e.getAttributeNode||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==b(e)||e.childNodes!==g(e)))},gt=function(e){if(!b||"object"!=typeof e||null===e)return!1;try{return b(e)===NODE_TYPE.documentFragment}catch(e){return!1}},ht=function(e){if(!b||"object"!=typeof e||null===e)return!1;try{return"number"==typeof b(e)}catch(e){return!1}};function Tt(e,n,r){0!==e.length&&arrayForEach(e,e=>{e.call(t,n,r,$e)})}const Et=function(e,t){if(e instanceof RegExp)return regExpTest(e,t);if(e instanceof Function){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o=0;--o){const a=e===n?f(r[o],!0):r[o];t.insertBefore(a,y(e))}}return Qe(e),!0}(e,o,n);return!(!1!==t||(Tt(U.afterSanitizeElements,e,null),!St(e,n)))||t}if(A(e)===NODE_TYPE.element&&!Je(e))return Qe(e),!0;if(("noscript"===o||"noembed"===o||"noframes"===o)&®ExpTest(FALLBACK_TAG_CLOSE,e.innerHTML))return Qe(e),!0;if(se&&e.nodeType===NODE_TYPE.text){const n=ft(e.textContent);e.textContent!==n&&(arrayPush(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Tt(U.afterSanitizeElements,e,null),St(e,n)},At=function(e,t,r){if(ne[t])return!1;if(ct(t,e))return!1;if(Te&&("id"===t||"name"===t)&&(r in n||r in Ke))return!1;const o=J[t]||re.attributeCheck instanceof Function&&re.attributeCheck(t,e);return!(!ae||!regExpTest(B,t))||(!(!oe||!regExpTest(W,t))||(o?!!Ne[t]||(!!regExpTest(q,stringReplace(r,K,""))||(!("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==stringIndexOf(r,"data:")||!xe[e])||(!(!ie||regExpTest($,stringReplace(r,K,"")))||!r))):vt(e)&&Et(ee.tagNameCheck,e)&&Et(ee.attributeNameCheck,t,e)||"is"===t&&ee.allowCustomizedBuiltInElements&&Et(ee.tagNameCheck,r)))},Ot=addToSet({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),vt=function(e){return!Ot[stringToLowerCase(e)]&®ExpTest(X,e)},wt=function(e,t,n,r){if(x&&"object"==typeof u&&"function"==typeof u.getAttributeType&&!n)switch(u.getAttributeType(e,t)){case"TrustedHTML":return k(r);case"TrustedScriptURL":return function(e){C(),D++;try{return x.createScriptURL(e)}finally{D--}}(r)}return r},xt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!yt(e)||(Qe(e),!1)}catch(n){return nt(t,e),!1}},Pt=function(e,t){return!(!ce||!regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t))||"attributename"===stringToLowerCase(e)&&null!==stringMatch(t,"href")},Nt=function(e,n){if(Tt(U.beforeSanitizeAttributes,e,null),St(e,n))return;const r=e.attributes;if(!r||yt(e))return;J=bt(U.uponSanitizeAttribute,J,Q,de);const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let a=r.length;const i=We(e.nodeName);for(;a--;){const n=r[a],l=n.name,s=n.namespaceURI,c=n.value,u=We(l),p=c;let f="value"===l?p:stringTrim(p),d=!1;o.attrName=u,o.attrValue=f,o.keepAttr=!0,o.forceKeepAttr=void 0,Tt(U.uponSanitizeAttribute,e,o),f=o.attrValue,!Ee||"id"!==u&&"name"!==u||0===stringIndexOf(f,be)||(nt(l,e,n),f=be+f,d=!0),Pt(l,f)?nt(l,e,n):o.forceKeepAttr||(o.keepAttr&&(le||!regExpTest(SELF_CLOSING_TAG,f))?(se&&(f=ft(f)),At(i,u,f)?(f=wt(i,u,s,f),f!==p&&xt(e,l,s,f)&&d&&arrayPop(t.removed)):nt(l,e,n)):nt(l,e,n))}Tt(U.afterSanitizeAttributes,e,null),St(e,n)},Rt=function(e){let t=null;const n=pt(e);for(Tt(U.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Tt(U.uponSanitizeShadowNode,t,null),_t(t,e),Nt(t,e),gt(t.content)&&Rt(t.content),A(t)===NODE_TYPE.element){const e=T(t);gt(e)&&(Dt(e),Rt(e))}se&&mt(e),Tt(U.afterSanitizeShadowDOM,e,null)},Dt=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){Rt(e.shadow);continue}const n=e.node,r=A(n)===NODE_TYPE.element,o=g(n);if(o)for(let e=o.length-1;e>=0;--e)t.push({node:o[e],shadow:null});if(r){const e=S?S(n):null;if("string"==typeof e&&"template"===We(e)){const e=n.content;gt(e)&&t.push({node:e,shadow:null})}}if(r){const e=T(n);gt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=null,a=null,i=null,l=null;if(Ie=!e,Ie&&(e="\x3c!--\x3e"),"string"!=typeof e&&!ht(e)&&"string"!=typeof(e=stringifyValue(e)))throw typeErrorCreate("dirty is not a string, aborting");if(!t.isSupported)return e;pe?(V=fe,J=de):qe(n),(U.uponSanitizeElement.length>0||U.uponSanitizeAttribute.length>0)&&(V=clone(V)),U.uponSanitizeAttribute.length>0&&(J=clone(J)),t.removed=[];const s=_e&&"string"!=typeof e&&ht(e);let c=[];const u=Ae;if(s){p=e,ce&&ot(p,e=>{const t=A(e);if(t===NODE_TYPE.processingInstruction||t===NODE_TYPE.comment&®ExpTest(COMMENT_MARKUP_PROBE,e.data)){try{d(e)}catch(e){}return!1}if(t===NODE_TYPE.element){const t=e,n=We(O(e));try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&ct("for",n)&&t.removeAttribute("for")}catch(e){}}return!0});const t=O(e);if("string"==typeof t){const n=We(t);if(!V[n]||te[n])throw tt(e),typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}if(yt(e))throw tt(e),typeErrorCreate("root node is clobbered and cannot be sanitized in-place");c=it(e),Ae=setCreate()}else if(ht(e))o=ut("\x3c!----\x3e"),a=o.ownerDocument.importNode(e,!0),a.nodeType===NODE_TYPE.element&&"BODY"===a.nodeName||"HTML"===a.nodeName?o=a:o.appendChild(a),Dt(o);else{if(!ye&&!se&&!ue&&-1===e.indexOf("<"))return x&&he?k(e):e;if(o=ut(e),!o)return ye?null:he?N:""}var p;o&&me&&Qe(o.firstChild);const f=s?e:o;try{s&&Dt(e);const t=pt(f);for(;i=t.nextNode();)_t(i,f),Nt(i,f),gt(i.content)&&Rt(i.content);s&&function(e,t){const n=Ae;let r=null;const o=()=>(r||(r=setCreate(),arrayForEach(t,e=>{setAdd(r,e)})),r);for(let t=0;;t++){const r=it(e),a=[e];let i=!1;if(arrayForEach(r,e=>{A(e)===NODE_TYPE.documentFragment?arrayPush(a,e):i||setHas(n,e)||(i=setHas(o(),e))}),!i)return;if(t>=8)throw typeErrorCreate("the tree kept changing during in-place sanitization; refusing to return it");arrayForEach(a,(t,n)=>{st(t,n>0,e,o())})}}(e,c)}catch(t){throw s&&(tt(e),lt(e,c)),t}finally{Ae=u}if(s){if(lt(e,c))throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");return se&&dt(e),e}if(ye){if(se&&dt(o),ge)for(l=z.call(o.ownerDocument);o.firstChild;)l.appendChild(o.firstChild);else l=o;return(J.shadowroot||J.shadowrootmode)&&(l=H.call(r,l,!0)),l}let m=ue?o.outerHTML:o.innerHTML;return ue&&V["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&®ExpTest(DOCTYPE_NAME,o.ownerDocument.doctype.name)&&(m="\n"+m),se&&(m=ft(m)),x&&he?k(m):m},t.setConfig=function(){qe(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),pe=!0,fe=V,de=J},t.clearConfig=function(){$e=null,pe=!1,fe=null,de=null,x=P,N=""},t.isValidAttribute=function(e,t,n){$e||qe({});const r=We(e),o=We(t);return("string"!=typeof n||!(Pt(t,n)||!le&®ExpTest(SELF_CLOSING_TAG,n)))&&At(r,o,n)},t.addHook=function(e,t){"function"==typeof t&&objectHasOwnProperty(U,e)&&arrayPush(U[e],t)},t.removeHook=function(e,t){if(objectHasOwnProperty(U,e)){if(void 0!==t){const n=arrayLastIndexOf(U[e],t);return-1===n?void 0:arraySplice(U[e],n,1)[0]}return arrayPop(U[e])}},t.removeHooks=function(e){objectHasOwnProperty(U,e)&&(U[e]=[])},t.removeAllHooks=function(){U=_createHooksMap()},t}var purify_default=createDOMPurify();export{purify_default as default};