var{entries:e,setPrototypeOf:t,isFrozen:n,getPrototypeOf:r,getOwnPropertyDescriptor:i}=Object,{freeze:a,seal:o,create:s}=Object,{apply:c,construct:l}=typeof Reflect<`u`&&Reflect;a||=function(e){return e},o||=function(e){return e},c||=function(e,t,n){return e.apply(t,n)},l||=function(e,t){return new e(...t)};var u=v(Array.prototype.forEach),d=v(Array.prototype.lastIndexOf),ee=v(Array.prototype.pop),f=v(Array.prototype.push),te=v(Array.prototype.splice),p=v(String.prototype.toLowerCase),ne=v(String.prototype.toString),re=v(String.prototype.match),m=v(String.prototype.replace),ie=v(String.prototype.indexOf),ae=v(String.prototype.trim),h=v(Object.prototype.hasOwnProperty),g=v(RegExp.prototype.test),_=oe(TypeError);function v(e){return function(t){var n=[...arguments].slice(1);return c(e,t,n)}}function oe(e){return function(){return l(e,[...arguments])}}function y(e,r){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p;t&&t(e,null);let a=r.length;for(;a--;){let t=r[a];if(typeof t==`string`){let e=i(t);e!==t&&(n(r)||(r[a]=e),t=e)}e[t]=!0}return e}function b(e){for(let t=0;t/gm),be=o(/\$\{[\w\W]*/gm),C=o(/^data-[\-\w.\u00B7-\uFFFF]+$/),w=o(/^aria-[\-\w]+$/),xe=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Se=o(/^(?:\w+script|data):/i),Ce=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),we=o(/^html$/i),Te=o(/^[a-z][.\w]*(-[.\w]+)+$/i),Ee=Object.freeze({__proto__:null,ARIA_ATTR:w,ATTR_WHITESPACE:Ce,CUSTOM_ELEMENT:Te,DATA_ATTR:C,DOCTYPE_NAME:we,ERB_EXPR:ye,IS_ALLOWED_URI:xe,IS_SCRIPT_OR_DATA:Se,MUSTACHE_EXPR:ve,TMPLIT_EXPR:be}),T={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},De=function(){return typeof window>`u`?null:window},Oe=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ke=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ae(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:De(),n=e=>Ae(e);if(n.version=`3.2.4`,n.removed=[],!t||!t.document||t.document.nodeType!==T.document||!t.Element)return n.isSupported=!1,n;let{document:r}=t,i=r,o=i.currentScript,{DocumentFragment:c,HTMLTemplateElement:l,Node:v,Element:oe,NodeFilter:b,NamedNodeMap:ve=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:ye,DOMParser:be,trustedTypes:C}=t,w=oe.prototype,Se=S(w,`cloneNode`),Ce=S(w,`remove`),Te=S(w,`nextSibling`),je=S(w,`childNodes`),E=S(w,`parentNode`);if(typeof l==`function`){let e=r.createElement(`template`);e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let D,O=``,{implementation:Me,createNodeIterator:Ne,createDocumentFragment:Pe,getElementsByTagName:Fe}=r,{importNode:Ie}=i,k=ke();n.isSupported=typeof e==`function`&&typeof E==`function`&&Me&&Me.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Le,ERB_EXPR:Re,TMPLIT_EXPR:ze,DATA_ATTR:Be,ARIA_ATTR:Ve,IS_SCRIPT_OR_DATA:He,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:We}=Ee,{IS_ALLOWED_URI:Ge}=Ee,A=null,Ke=y({},[...se,...ce,...le,...de,...pe]),j=null,qe=y({},[...me,...he,...ge,..._e]),M=Object.seal(s(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}})),N=null,Je=null,Ye=!0,Xe=!0,Ze=!1,Qe=!0,P=!1,$e=!0,F=!1,et=!1,tt=!1,I=!1,L=!1,R=!1,nt=!0,rt=!1,it=!0,z=!1,B={},V=null,at=y({},[`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`]),ot=null,st=y({},[`audio`,`video`,`img`,`source`,`image`,`track`]),ct=null,lt=y({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),H=`http://www.w3.org/1998/Math/MathML`,U=`http://www.w3.org/2000/svg`,W=`http://www.w3.org/1999/xhtml`,G=W,ut=!1,dt=null,ft=y({},[H,U,W],ne),K=y({},[`mi`,`mo`,`mn`,`ms`,`mtext`]),q=y({},[`annotation-xml`]),pt=y({},[`title`,`style`,`font`,`a`,`script`]),J=null,mt=[`application/xhtml+xml`,`text/html`],Y=null,X=null,ht=r.createElement(`form`),gt=function(e){return e instanceof RegExp||e instanceof Function},_t=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(X&&X===e)){if((!e||typeof e!=`object`)&&(e={}),e=x(e),J=mt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=J===`application/xhtml+xml`?ne:p,A=h(e,`ALLOWED_TAGS`)?y({},e.ALLOWED_TAGS,Y):Ke,j=h(e,`ALLOWED_ATTR`)?y({},e.ALLOWED_ATTR,Y):qe,dt=h(e,`ALLOWED_NAMESPACES`)?y({},e.ALLOWED_NAMESPACES,ne):ft,ct=h(e,`ADD_URI_SAFE_ATTR`)?y(x(lt),e.ADD_URI_SAFE_ATTR,Y):lt,ot=h(e,`ADD_DATA_URI_TAGS`)?y(x(st),e.ADD_DATA_URI_TAGS,Y):st,V=h(e,`FORBID_CONTENTS`)?y({},e.FORBID_CONTENTS,Y):at,N=h(e,`FORBID_TAGS`)?y({},e.FORBID_TAGS,Y):{},Je=h(e,`FORBID_ATTR`)?y({},e.FORBID_ATTR,Y):{},B=h(e,`USE_PROFILES`)?e.USE_PROFILES:!1,Ye=e.ALLOW_ARIA_ATTR!==!1,Xe=e.ALLOW_DATA_ATTR!==!1,Ze=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Qe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=e.SAFE_FOR_TEMPLATES||!1,$e=e.SAFE_FOR_XML!==!1,F=e.WHOLE_DOCUMENT||!1,I=e.RETURN_DOM||!1,L=e.RETURN_DOM_FRAGMENT||!1,R=e.RETURN_TRUSTED_TYPE||!1,tt=e.FORCE_BODY||!1,nt=e.SANITIZE_DOM!==!1,rt=e.SANITIZE_NAMED_PROPS||!1,it=e.KEEP_CONTENT!==!1,z=e.IN_PLACE||!1,Ge=e.ALLOWED_URI_REGEXP||xe,G=e.NAMESPACE||W,K=e.MATHML_TEXT_INTEGRATION_POINTS||K,q=e.HTML_INTEGRATION_POINTS||q,M=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&>(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(M.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&>(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(M.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements==`boolean`&&(M.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(Xe=!1),L&&(I=!0),B&&(A=y({},pe),j=[],B.html===!0&&(y(A,se),y(j,me)),B.svg===!0&&(y(A,ce),y(j,he),y(j,_e)),B.svgFilters===!0&&(y(A,le),y(j,he),y(j,_e)),B.mathMl===!0&&(y(A,de),y(j,ge),y(j,_e))),e.ADD_TAGS&&(A===Ke&&(A=x(A)),y(A,e.ADD_TAGS,Y)),e.ADD_ATTR&&(j===qe&&(j=x(j)),y(j,e.ADD_ATTR,Y)),e.ADD_URI_SAFE_ATTR&&y(ct,e.ADD_URI_SAFE_ATTR,Y),e.FORBID_CONTENTS&&(V===at&&(V=x(V)),y(V,e.FORBID_CONTENTS,Y)),it&&(A[`#text`]=!0),F&&y(A,[`html`,`head`,`body`]),A.table&&(y(A,[`tbody`]),delete N.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw _(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw _(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);D=e.TRUSTED_TYPES_POLICY,O=D.createHTML(``)}else D===void 0&&(D=Oe(C,o)),D!==null&&typeof O==`string`&&(O=D.createHTML(``));a&&a(e),X=e}},vt=y({},[...ce,...le,...ue]),yt=y({},[...de,...fe]),bt=function(e){let t=E(e);(!t||!t.tagName)&&(t={namespaceURI:G,tagName:`template`});let n=p(e.tagName),r=p(t.tagName);return dt[e.namespaceURI]?e.namespaceURI===U?t.namespaceURI===W?n===`svg`:t.namespaceURI===H?n===`svg`&&(r===`annotation-xml`||K[r]):!!vt[n]:e.namespaceURI===H?t.namespaceURI===W?n===`math`:t.namespaceURI===U?n===`math`&&q[r]:!!yt[n]:e.namespaceURI===W?t.namespaceURI===U&&!q[r]||t.namespaceURI===H&&!K[r]?!1:!yt[n]&&(pt[n]||!vt[n]):!!(J===`application/xhtml+xml`&&dt[e.namespaceURI]):!1},Z=function(e){f(n.removed,{element:e});try{E(e).removeChild(e)}catch{Ce(e)}},Q=function(e,t){try{f(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{f(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e===`is`)if(I||L)try{Z(t)}catch{}else try{t.setAttribute(e,``)}catch{}},xt=function(e){let t=null,n=null;if(tt)e=``+e;else{let t=re(e,/^[\r\n\t ]+/);n=t&&t[0]}J===`application/xhtml+xml`&&G===W&&(e=``+e+``);let i=D?D.createHTML(e):e;if(G===W)try{t=new be().parseFromString(i,J)}catch{}if(!t||!t.documentElement){t=Me.createDocument(G,`template`,null);try{t.documentElement.innerHTML=ut?O:i}catch{}}let a=t.body||t.documentElement;return e&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),G===W?Fe.call(t,F?`html`:`body`)[0]:F?t.documentElement:a},St=function(e){return Ne.call(e.ownerDocument||e,e,b.SHOW_ELEMENT|b.SHOW_COMMENT|b.SHOW_TEXT|b.SHOW_PROCESSING_INSTRUCTION|b.SHOW_CDATA_SECTION,null)},Ct=function(e){return e instanceof ye&&(typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||!(e.attributes instanceof ve)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`)},wt=function(e){return typeof v==`function`&&e instanceof v};function $(e,t,r){u(e,e=>{e.call(n,t,r,X)})}let Tt=function(e){let t=null;if($(k.beforeSanitizeElements,e,null),Ct(e))return Z(e),!0;let r=Y(e.nodeName);if($(k.uponSanitizeElement,e,{tagName:r,allowedTags:A}),e.hasChildNodes()&&!wt(e.firstElementChild)&&g(/<[/\w]/g,e.innerHTML)&&g(/<[/\w]/g,e.textContent)||e.nodeType===T.progressingInstruction||$e&&e.nodeType===T.comment&&g(/<[/\w]/g,e.data))return Z(e),!0;if(!A[r]||N[r]){if(!N[r]&&Dt(r)&&(M.tagNameCheck instanceof RegExp&&g(M.tagNameCheck,r)||M.tagNameCheck instanceof Function&&M.tagNameCheck(r)))return!1;if(it&&!V[r]){let t=E(e)||e.parentNode,n=je(e)||e.childNodes;if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Se(n[i],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,Te(e))}}}return Z(e),!0}return e instanceof oe&&!bt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&g(/<\/no(script|embed|frames)/i,e.innerHTML)?(Z(e),!0):(P&&e.nodeType===T.text&&(t=e.textContent,u([Le,Re,ze],e=>{t=m(t,e,` `)}),e.textContent!==t&&(f(n.removed,{element:e.cloneNode()}),e.textContent=t)),$(k.afterSanitizeElements,e,null),!1)},Et=function(e,t,n){if(nt&&(t===`id`||t===`name`)&&(n in r||n in ht))return!1;if(!(Xe&&!Je[t]&&g(Be,t))&&!(Ye&&g(Ve,t))){if(!j[t]||Je[t]){if(!(Dt(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))||t===`is`&&M.allowCustomizedBuiltInElements&&(M.tagNameCheck instanceof RegExp&&g(M.tagNameCheck,n)||M.tagNameCheck instanceof Function&&M.tagNameCheck(n))))return!1}else if(!ct[t]&&!g(Ge,m(n,Ue,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&ie(n,`data:`)===0&&ot[e])&&!(Ze&&!g(He,m(n,Ue,``)))&&n)return!1}return!0},Dt=function(e){return e!==`annotation-xml`&&re(e,We)},Ot=function(e){$(k.beforeSanitizeAttributes,e,null);let{attributes:t}=e;if(!t||Ct(e))return;let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},i=t.length;for(;i--;){let{name:a,namespaceURI:o,value:s}=t[i],c=Y(a),l=a===`value`?s:ae(s);if(r.attrName=c,r.attrValue=l,r.keepAttr=!0,r.forceKeepAttr=void 0,$(k.uponSanitizeAttribute,e,r),l=r.attrValue,rt&&(c===`id`||c===`name`)&&(Q(a,e),l=`user-content-`+l),$e&&g(/((--!?|])>)|<\/(style|title)/i,l)){Q(a,e);continue}if(r.forceKeepAttr||(Q(a,e),!r.keepAttr))continue;if(!Qe&&g(/\/>/i,l)){Q(a,e);continue}P&&u([Le,Re,ze],e=>{l=m(l,e,` `)});let d=Y(e.nodeName);if(Et(d,c,l)){if(D&&typeof C==`object`&&typeof C.getAttributeType==`function`&&!o)switch(C.getAttributeType(d,c)){case`TrustedHTML`:l=D.createHTML(l);break;case`TrustedScriptURL`:l=D.createScriptURL(l);break}try{o?e.setAttributeNS(o,a,l):e.setAttribute(a,l),Ct(e)?Z(e):ee(n.removed)}catch{}}}$(k.afterSanitizeAttributes,e,null)},kt=function e(t){let n=null,r=St(t);for($(k.beforeSanitizeShadowDOM,t,null);n=r.nextNode();)$(k.uponSanitizeShadowNode,n,null),Tt(n),Ot(n),n.content instanceof c&&e(n.content);$(k.afterSanitizeShadowDOM,t,null)};return n.sanitize=function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,o=null,s=null;if(ut=!e,ut&&(e=``),typeof e!=`string`&&!wt(e))if(typeof e.toString==`function`){if(e=e.toString(),typeof e!=`string`)throw _(`dirty is not a string, aborting`)}else throw _(`toString is not a function`);if(!n.isSupported)return e;if(et||_t(t),n.removed=[],typeof e==`string`&&(z=!1),z){if(e.nodeName){let t=Y(e.nodeName);if(!A[t]||N[t])throw _(`root node is forbidden and cannot be sanitized in-place`)}}else if(e instanceof v)r=xt(``),a=r.ownerDocument.importNode(e,!0),a.nodeType===T.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?r=a:r.appendChild(a);else{if(!I&&!P&&!F&&e.indexOf(`<`)===-1)return D&&R?D.createHTML(e):e;if(r=xt(e),!r)return I?null:R?O:``}r&&tt&&Z(r.firstChild);let l=St(z?e:r);for(;o=l.nextNode();)Tt(o),Ot(o),o.content instanceof c&&kt(o.content);if(z)return e;if(I){if(L)for(s=Pe.call(r.ownerDocument);r.firstChild;)s.appendChild(r.firstChild);else s=r;return(j.shadowroot||j.shadowrootmode)&&(s=Ie.call(i,s,!0)),s}let d=F?r.outerHTML:r.innerHTML;return F&&A[`!doctype`]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&g(we,r.ownerDocument.doctype.name)&&(d=` `+d),P&&u([Le,Re,ze],e=>{d=m(d,e,` `)}),D&&R?D.createHTML(d):d},n.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_t(e),et=!0},n.clearConfig=function(){X=null,et=!1},n.isValidAttribute=function(e,t,n){X||_t({});let r=Y(e),i=Y(t);return Et(r,i,n)},n.addHook=function(e,t){typeof t==`function`&&f(k[e],t)},n.removeHook=function(e,t){if(t!==void 0){let n=d(k[e],t);return n===-1?void 0:te(k[e],n,1)[0]}return ee(k[e])},n.removeHooks=function(e){k[e]=[]},n.removeAllHooks=function(){k=ke()},n}var je=Ae();function E(e){return new DOMParser().parseFromString(e,`text/html`).documentElement.textContent||``}function D(e,t){return t?je.sanitize(e,t):je.sanitize(e,{USE_PROFILES:{html:!0}})}export{D as n,E as t};