Skip to content

Instantly share code, notes, and snippets.

@bundle-js
Created October 31, 2023 18:52
Show Gist options
  • Save bundle-js/29b606478927a3bba23bd2d8fc901b74 to your computer and use it in GitHub Desktop.
Save bundle-js/29b606478927a3bba23bd2d8fc901b74 to your computer and use it in GitHub Desktop.
var fn=Object.create;var Ue=Object.defineProperty;var un=Object.getOwnPropertyDescriptor;var mn=Object.getOwnPropertyNames;var pn=Object.getPrototypeOf,dn=Object.prototype.hasOwnProperty;var Tn=(u,c)=>()=>(c||u((c={exports:{}}).exports,c),c.exports),_n=(u,c)=>{for(var L in c)Ue(u,L,{get:c[L],enumerable:!0})},ve=(u,c,L,J)=>{if(c&&typeof c=="object"||typeof c=="function")for(let M of mn(c))!dn.call(u,M)&&M!==L&&Ue(u,M,{get:()=>c[M],enumerable:!(J=un(c,M))||J.enumerable});return u},fe=(u,c,L)=>(ve(u,c,"default"),L&&ve(L,c,"default")),Lt=(u,c,L)=>(L=u!=null?fn(pn(u)):{},ve(c||!u||!u.__esModule?Ue(L,"default",{value:u,enumerable:!0}):L,u));var ze=Tn((Fe,He)=>{(function(u,c){typeof Fe=="object"&&typeof He<"u"?He.exports=c():typeof define=="function"&&define.amd?define(c):(u=typeof globalThis<"u"?globalThis:u||self,u.DOMPurify=c())})(Fe,function(){"use strict";let{entries:u,setPrototypeOf:c,isFrozen:L,getPrototypeOf:J,getOwnPropertyDescriptor:M}=Object,{freeze:h,seal:y,create:Ge}=Object,{apply:ue,construct:me}=typeof Reflect<"u"&&Reflect;h||(h=function(i){return i}),y||(y=function(i){return i}),ue||(ue=function(i,s,r){return i.apply(s,r)}),me||(me=function(i,s){return new i(...s)});let Q=D(Array.prototype.forEach),We=D(Array.prototype.pop),Y=D(Array.prototype.push),ee=D(String.prototype.toLowerCase),pe=D(String.prototype.toString),Dt=D(String.prototype.match),X=D(String.prototype.replace),yt=D(String.prototype.indexOf),Ot=D(String.prototype.trim),N=D(RegExp.prototype.test),V=bt(TypeError);function D(l){return function(i){for(var s=arguments.length,r=new Array(s>1?s-1:0),E=1;E<s;E++)r[E-1]=arguments[E];return ue(l,i,r)}}function bt(l){return function(){for(var i=arguments.length,s=new Array(i),r=0;r<i;r++)s[r]=arguments[r];return me(l,s)}}function a(l,i){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ee;c&&c(l,null);let r=i.length;for(;r--;){let E=i[r];if(typeof E=="string"){let b=s(E);b!==E&&(L(i)||(i[r]=b),E=b)}l[E]=!0}return l}function v(l){let i=Ge(null);for(let[s,r]of u(l))M(l,s)!==void 0&&(i[s]=r);return i}function te(l,i){for(;l!==null;){let r=M(l,i);if(r){if(r.get)return D(r.get);if(typeof r.value=="function")return D(r.value)}l=J(l)}function s(r){return console.warn("fallback value for",r),null}return s}let Be=h(["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","section","select","shadow","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"]),de=h(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Te=h(["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"]),It=h(["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"]),_e=h(["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"]),Ct=h(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ye=h(["#text"]),Xe=h(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),ge=h(["accent-height","accumulate","additive","alignment-baseline","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","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","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","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","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","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"]),Ve=h(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ne=h(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Mt=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wt=y(/<%[\w\W]*|[\w\W]*%>/gm),xt=y(/\${[\w\W]*}/gm),Pt=y(/^data-[\-\w.\u00B7-\uFFFF]/),kt=y(/^aria-[\-\w]+$/),je=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vt=y(/^(?:\w+script|data):/i),Ut=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qe=y(/^html$/i);var $e=Object.freeze({__proto__:null,MUSTACHE_EXPR:Mt,ERB_EXPR:wt,TMPLIT_EXPR:xt,DATA_ATTR:Pt,ARIA_ATTR:kt,IS_ALLOWED_URI:je,IS_SCRIPT_OR_DATA:vt,ATTR_WHITESPACE:Ut,DOCTYPE_NAME:qe});let Ft=function(){return typeof window>"u"?null:window},Ht=function(i,s){if(typeof i!="object"||typeof i.createPolicy!="function")return null;let r=null,E="data-tt-policy-suffix";s&&s.hasAttribute(E)&&(r=s.getAttribute(E));let b="dompurify"+(r?"#"+r:"");try{return i.createPolicy(b,{createHTML(U){return U},createScriptURL(U){return U}})}catch{return console.warn("TrustedTypes policy "+b+" could not be created."),null}};function Ke(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ft(),i=o=>Ke(o);if(i.version="3.0.6",i.removed=[],!l||!l.document||l.document.nodeType!==9)return i.isSupported=!1,i;let{document:s}=l,r=s,E=r.currentScript,{DocumentFragment:b,HTMLTemplateElement:U,Node:he,Element:Ze,NodeFilter:Ee,NamedNodeMap:Gt=l.NamedNodeMap||l.MozNamedAttrMap,HTMLFormElement:Wt,DOMParser:Bt,trustedTypes:oe}=l,ie=Ze.prototype,Yt=te(ie,"cloneNode"),Xt=te(ie,"nextSibling"),Vt=te(ie,"childNodes"),Ae=te(ie,"parentNode");if(typeof U=="function"){let o=s.createElement("template");o.content&&o.content.ownerDocument&&(s=o.content.ownerDocument)}let A,j="",{implementation:Se,createNodeIterator:jt,createDocumentFragment:qt,getElementsByTagName:$t}=s,{importNode:Kt}=r,O={};i.isSupported=typeof u=="function"&&typeof Ae=="function"&&Se&&Se.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Re,ERB_EXPR:Le,TMPLIT_EXPR:Ne,DATA_ATTR:Zt,ARIA_ATTR:Jt,IS_SCRIPT_OR_DATA:Qt,ATTR_WHITESPACE:Je}=$e,{IS_ALLOWED_URI:Qe}=$e,p=null,et=a({},[...Be,...de,...Te,..._e,...Ye]),d=null,tt=a({},[...Xe,...ge,...Ve,...ne]),m=Object.seal(Ge(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}})),q=null,De=null,nt=!0,ye=!0,ot=!1,it=!0,F=!1,w=!1,Oe=!1,be=!1,H=!1,ae=!1,re=!1,at=!0,rt=!1,en="user-content-",Ie=!0,$=!1,z={},G=null,lt=a({},["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"]),st=null,ct=a({},["audio","video","img","source","image","track"]),Ce=null,ft=a({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),le="http://www.w3.org/1998/Math/MathML",se="http://www.w3.org/2000/svg",I="http://www.w3.org/1999/xhtml",W=I,Me=!1,we=null,tn=a({},[le,se,I],pe),x=null,nn=["application/xhtml+xml","text/html"],on="text/html",T=null,B=null,an=s.createElement("form"),ut=function(e){return e instanceof RegExp||e instanceof Function},xe=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(B&&B===e)){if((!e||typeof e!="object")&&(e={}),e=v(e),x=nn.indexOf(e.PARSER_MEDIA_TYPE)===-1?x=on:x=e.PARSER_MEDIA_TYPE,T=x==="application/xhtml+xml"?pe:ee,p="ALLOWED_TAGS"in e?a({},e.ALLOWED_TAGS,T):et,d="ALLOWED_ATTR"in e?a({},e.ALLOWED_ATTR,T):tt,we="ALLOWED_NAMESPACES"in e?a({},e.ALLOWED_NAMESPACES,pe):tn,Ce="ADD_URI_SAFE_ATTR"in e?a(v(ft),e.ADD_URI_SAFE_ATTR,T):ft,st="ADD_DATA_URI_TAGS"in e?a(v(ct),e.ADD_DATA_URI_TAGS,T):ct,G="FORBID_CONTENTS"in e?a({},e.FORBID_CONTENTS,T):lt,q="FORBID_TAGS"in e?a({},e.FORBID_TAGS,T):{},De="FORBID_ATTR"in e?a({},e.FORBID_ATTR,T):{},z="USE_PROFILES"in e?e.USE_PROFILES:!1,nt=e.ALLOW_ARIA_ATTR!==!1,ye=e.ALLOW_DATA_ATTR!==!1,ot=e.ALLOW_UNKNOWN_PROTOCOLS||!1,it=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,F=e.SAFE_FOR_TEMPLATES||!1,w=e.WHOLE_DOCUMENT||!1,H=e.RETURN_DOM||!1,ae=e.RETURN_DOM_FRAGMENT||!1,re=e.RETURN_TRUSTED_TYPE||!1,be=e.FORCE_BODY||!1,at=e.SANITIZE_DOM!==!1,rt=e.SANITIZE_NAMED_PROPS||!1,Ie=e.KEEP_CONTENT!==!1,$=e.IN_PLACE||!1,Qe=e.ALLOWED_URI_REGEXP||je,W=e.NAMESPACE||I,m=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&ut(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(m.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&ut(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),F&&(ye=!1),ae&&(H=!0),z&&(p=a({},[...Ye]),d=[],z.html===!0&&(a(p,Be),a(d,Xe)),z.svg===!0&&(a(p,de),a(d,ge),a(d,ne)),z.svgFilters===!0&&(a(p,Te),a(d,ge),a(d,ne)),z.mathMl===!0&&(a(p,_e),a(d,Ve),a(d,ne))),e.ADD_TAGS&&(p===et&&(p=v(p)),a(p,e.ADD_TAGS,T)),e.ADD_ATTR&&(d===tt&&(d=v(d)),a(d,e.ADD_ATTR,T)),e.ADD_URI_SAFE_ATTR&&a(Ce,e.ADD_URI_SAFE_ATTR,T),e.FORBID_CONTENTS&&(G===lt&&(G=v(G)),a(G,e.FORBID_CONTENTS,T)),Ie&&(p["#text"]=!0),w&&a(p,["html","head","body"]),p.table&&(a(p,["tbody"]),delete q.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw V('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=e.TRUSTED_TYPES_POLICY,j=A.createHTML("")}else A===void 0&&(A=Ht(oe,E)),A!==null&&typeof j=="string"&&(j=A.createHTML(""));h&&h(e),B=e}},mt=a({},["mi","mo","mn","ms","mtext"]),pt=a({},["foreignobject","desc","title","annotation-xml"]),rn=a({},["title","style","font","a","script"]),ce=a({},de);a(ce,Te),a(ce,It);let Pe=a({},_e);a(Pe,Ct);let ln=function(e){let t=Ae(e);(!t||!t.tagName)&&(t={namespaceURI:W,tagName:"template"});let n=ee(e.tagName),f=ee(t.tagName);return we[e.namespaceURI]?e.namespaceURI===se?t.namespaceURI===I?n==="svg":t.namespaceURI===le?n==="svg"&&(f==="annotation-xml"||mt[f]):!!ce[n]:e.namespaceURI===le?t.namespaceURI===I?n==="math":t.namespaceURI===se?n==="math"&&pt[f]:!!Pe[n]:e.namespaceURI===I?t.namespaceURI===se&&!pt[f]||t.namespaceURI===le&&!mt[f]?!1:!Pe[n]&&(rn[n]||!ce[n]):!!(x==="application/xhtml+xml"&&we[e.namespaceURI]):!1},P=function(e){Y(i.removed,{element:e});try{e.parentNode.removeChild(e)}catch{e.remove()}},ke=function(e,t){try{Y(i.removed,{attribute:t.getAttributeNode(e),from:t})}catch{Y(i.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is"&&!d[e])if(H||ae)try{P(t)}catch{}else try{t.setAttribute(e,"")}catch{}},dt=function(e){let t=null,n=null;if(be)e="<remove></remove>"+e;else{let g=Dt(e,/^[\r\n\t ]+/);n=g&&g[0]}x==="application/xhtml+xml"&&W===I&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let f=A?A.createHTML(e):e;if(W===I)try{t=new Bt().parseFromString(f,x)}catch{}if(!t||!t.documentElement){t=Se.createDocument(W,"template",null);try{t.documentElement.innerHTML=Me?j:f}catch{}}let _=t.body||t.documentElement;return e&&n&&_.insertBefore(s.createTextNode(n),_.childNodes[0]||null),W===I?$t.call(t,w?"html":"body")[0]:w?t.documentElement:_},Tt=function(e){return jt.call(e.ownerDocument||e,e,Ee.SHOW_ELEMENT|Ee.SHOW_COMMENT|Ee.SHOW_TEXT,null)},sn=function(e){return e instanceof Wt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Gt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},_t=function(e){return typeof he=="function"&&e instanceof he},C=function(e,t,n){O[e]&&Q(O[e],f=>{f.call(i,t,n,B)})},gt=function(e){let t=null;if(C("beforeSanitizeElements",e,null),sn(e))return P(e),!0;let n=T(e.nodeName);if(C("uponSanitizeElement",e,{tagName:n,allowedTags:p}),e.hasChildNodes()&&!_t(e.firstElementChild)&&N(/<[/\w]/g,e.innerHTML)&&N(/<[/\w]/g,e.textContent))return P(e),!0;if(!p[n]||q[n]){if(!q[n]&&Et(n)&&(m.tagNameCheck instanceof RegExp&&N(m.tagNameCheck,n)||m.tagNameCheck instanceof Function&&m.tagNameCheck(n)))return!1;if(Ie&&!G[n]){let f=Ae(e)||e.parentNode,_=Vt(e)||e.childNodes;if(_&&f){let g=_.length;for(let S=g-1;S>=0;--S)f.insertBefore(Yt(_[S],!0),Xt(e))}}return P(e),!0}return e instanceof Ze&&!ln(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&N(/<\/no(script|embed|frames)/i,e.innerHTML)?(P(e),!0):(F&&e.nodeType===3&&(t=e.textContent,Q([Re,Le,Ne],f=>{t=X(t,f," ")}),e.textContent!==t&&(Y(i.removed,{element:e.cloneNode()}),e.textContent=t)),C("afterSanitizeElements",e,null),!1)},ht=function(e,t,n){if(at&&(t==="id"||t==="name")&&(n in s||n in an))return!1;if(!(ye&&!De[t]&&N(Zt,t))){if(!(nt&&N(Jt,t))){if(!d[t]||De[t]){if(!(Et(e)&&(m.tagNameCheck instanceof RegExp&&N(m.tagNameCheck,e)||m.tagNameCheck instanceof Function&&m.tagNameCheck(e))&&(m.attributeNameCheck instanceof RegExp&&N(m.attributeNameCheck,t)||m.attributeNameCheck instanceof Function&&m.attributeNameCheck(t))||t==="is"&&m.allowCustomizedBuiltInElements&&(m.tagNameCheck instanceof RegExp&&N(m.tagNameCheck,n)||m.tagNameCheck instanceof Function&&m.tagNameCheck(n))))return!1}else if(!Ce[t]){if(!N(Qe,X(n,Je,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&yt(n,"data:")===0&&st[e])){if(!(ot&&!N(Qt,X(n,Je,"")))){if(n)return!1}}}}}}return!0},Et=function(e){return e.indexOf("-")>0},At=function(e){C("beforeSanitizeAttributes",e,null);let{attributes:t}=e;if(!t)return;let n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:d},f=t.length;for(;f--;){let _=t[f],{name:g,namespaceURI:S,value:k}=_,K=T(g),R=g==="value"?k:Ot(k);if(n.attrName=K,n.attrValue=R,n.keepAttr=!0,n.forceKeepAttr=void 0,C("uponSanitizeAttribute",e,n),R=n.attrValue,n.forceKeepAttr||(ke(g,e),!n.keepAttr))continue;if(!it&&N(/\/>/i,R)){ke(g,e);continue}F&&Q([Re,Le,Ne],Rt=>{R=X(R,Rt," ")});let St=T(e.nodeName);if(ht(St,K,R)){if(rt&&(K==="id"||K==="name")&&(ke(g,e),R=en+R),A&&typeof oe=="object"&&typeof oe.getAttributeType=="function"&&!S)switch(oe.getAttributeType(St,K)){case"TrustedHTML":{R=A.createHTML(R);break}case"TrustedScriptURL":{R=A.createScriptURL(R);break}}try{S?e.setAttributeNS(S,g,R):e.setAttribute(g,R),We(i.removed)}catch{}}}C("afterSanitizeAttributes",e,null)},cn=function o(e){let t=null,n=Tt(e);for(C("beforeSanitizeShadowDOM",e,null);t=n.nextNode();)C("uponSanitizeShadowNode",t,null),!gt(t)&&(t.content instanceof b&&o(t.content),At(t));C("afterSanitizeShadowDOM",e,null)};return i.sanitize=function(o){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,f=null,_=null;if(Me=!o,Me&&(o="<!-->"),typeof o!="string"&&!_t(o))if(typeof o.toString=="function"){if(o=o.toString(),typeof o!="string")throw V("dirty is not a string, aborting")}else throw V("toString is not a function");if(!i.isSupported)return o;if(Oe||xe(e),i.removed=[],typeof o=="string"&&($=!1),$){if(o.nodeName){let k=T(o.nodeName);if(!p[k]||q[k])throw V("root node is forbidden and cannot be sanitized in-place")}}else if(o instanceof he)t=dt("<!---->"),n=t.ownerDocument.importNode(o,!0),n.nodeType===1&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!H&&!F&&!w&&o.indexOf("<")===-1)return A&&re?A.createHTML(o):o;if(t=dt(o),!t)return H?null:re?j:""}t&&be&&P(t.firstChild);let g=Tt($?o:t);for(;f=g.nextNode();)gt(f)||(f.content instanceof b&&cn(f.content),At(f));if($)return o;if(H){if(ae)for(_=qt.call(t.ownerDocument);t.firstChild;)_.appendChild(t.firstChild);else _=t;return(d.shadowroot||d.shadowrootmode)&&(_=Kt.call(r,_,!0)),_}let S=w?t.outerHTML:t.innerHTML;return w&&p["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&N(qe,t.ownerDocument.doctype.name)&&(S="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
`+S),F&&Q([Re,Le,Ne],k=>{S=X(S,k," ")}),A&&re?A.createHTML(S):S},i.setConfig=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xe(o),Oe=!0},i.clearConfig=function(){B=null,Oe=!1},i.isValidAttribute=function(o,e,t){B||xe({});let n=T(o),f=T(e);return ht(n,f,t)},i.addHook=function(o,e){typeof e=="function"&&(O[o]=O[o]||[],Y(O[o],e))},i.removeHook=function(o){if(O[o])return We(O[o])},i.removeHooks=function(o){O[o]&&(O[o]=[])},i.removeAllHooks=function(){O={}},i}var zt=Ke();return zt})});var Z={};_n(Z,{default:()=>Nt.default});fe(Z,Lt(ze()));var Nt=Lt(ze());var export_default=Nt.default;export{export_default as default};
/*! @license DOMPurify 3.0.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.6/LICENSE */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment