url-sanitizer 4.2.1 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  function en(n,t){(t==null||t>n.length)&&(t=n.length);for(var r=0,s=Array(t);r<t;r++)s[r]=n[r];return s}function mr(n){if(Array.isArray(n))return n}function dr(n,t){var r=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var s,a,c,f,h=[],p=!0,T=!1;try{if(c=(r=r.call(n)).next,t!==0)for(;!(p=(s=c.call(r)).done)&&(h.push(s.value),h.length!==t);p=!0);}catch(x){T=!0,a=x}finally{try{if(!p&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(T)throw a}}return h}}function hr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gr(n,t){return mr(n)||dr(n,t)||Tr(n,t)||hr()}function Tr(n,t){if(n){if(typeof n=="string")return en(n,t);var r={}.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?en(n,t):void 0}}var gn=Object.entries,tn=Object.setPrototypeOf,Er=Object.isFrozen,_r=Object.getPrototypeOf,yr=Object.getOwnPropertyDescriptor,I=Object.freeze,C=Object.seal,_e=Object.create,Tn=typeof Reflect<"u"&&Reflect,Et=Tn.apply,_t=Tn.construct;I||(I=function(t){return t});C||(C=function(t){return t});Et||(Et=function(t,r){for(var s=arguments.length,a=new Array(s>2?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];return t.apply(r,a)});_t||(_t=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return new t(...s)});var Te=L(Array.prototype.forEach),br=L(Array.prototype.lastIndexOf),nn=L(Array.prototype.pop),Ee=L(Array.prototype.push),Ar=L(Array.prototype.splice),oe=Array.isArray,Le=L(String.prototype.toLowerCase),mt=L(String.prototype.toString),rn=L(String.prototype.match),we=L(String.prototype.replace),on=L(String.prototype.indexOf),Rr=L(String.prototype.trim),Sr=L(Number.prototype.toString),wr=L(Boolean.prototype.toString),sn=typeof BigInt>"u"?null:L(BigInt.prototype.toString),an=typeof Symbol>"u"?null:L(Symbol.prototype.toString),N=L(Object.prototype.hasOwnProperty),xe=L(Object.prototype.toString),O=L(RegExp.prototype.test),ce=xr(TypeError);function L(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return Et(n,t,s)}}function xr(n){return function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return _t(n,r)}}function g(n,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Le;if(tn&&tn(n,null),!oe(t))return n;let s=t.length;for(;s--;){let a=t[s];if(typeof a=="string"){let c=r(a);c!==a&&(Er(t)||(t[s]=c),a=c)}n[a]=!0}return n}function Lr(n){for(let t=0;t<n.length;t++)N(n,t)||(n[t]=null);return n}function P(n){let t=_e(null);for(let s of gn(n)){var r=gr(s,2);let a=r[0],c=r[1];N(n,a)&&(oe(c)?t[a]=Lr(c):c&&typeof c=="object"&&c.constructor===Object?t[a]=P(c):t[a]=c)}return t}function Or(n){switch(typeof n){case"string":return n;case"number":return Sr(n);case"boolean":return wr(n);case"bigint":return sn?sn(n):"0";case"symbol":return an?an(n):"Symbol()";case"undefined":return xe(n);case"function":case"object":{if(n===null)return xe(n);let t=n,r=q(t,"toString");if(typeof r=="function"){let s=r(t);return typeof s=="string"?s:xe(s)}return xe(n)}default:return xe(n)}}function q(n,t){for(;n!==null;){let s=yr(n,t);if(s){if(s.get)return L(s.get);if(typeof s.value=="function")return L(s.value)}n=_r(n)}function r(){return null}return r}function Nr(n){try{return O(n,""),!0}catch{return!1}}var ln=I(["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"]),dt=I(["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"]),ht=I(["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"]),Ir=I(["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"]),gt=I(["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"]),Cr=I(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cn=I(["#text"]),un=I(["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"]),Tt=I(["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","dominant-baseline","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-orientation","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"]),fn=I(["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"]),Fe=I(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Dr=C(/{{[\w\W]*|^[\w\W]*}}/g),Ur=C(/<%[\w\W]*|^[\w\W]*%>/g),Mr=C(/\${[\w\W]*/g),vr=C(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pr=C(/^aria-[\-\w]+$/),pn=C(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kr=C(/^(?:\w+script|data):/i),zr=C(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Fr=C(/^html$/i),Hr=C(/^[a-z][.\w]*(-[.\w]+)+$/i),mn=C(/<[/\w!]/g),dn=C(/<[/\w]/g),Gr=C(/<\/no(script|embed|frames)/i),$r=C(/\/>/i),G={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Br=function(){return typeof window>"u"?null:window},jr=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(s=r.getAttribute(a));let c="dompurify"+(s?"#"+s:"");try{return t.createPolicy(c,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},hn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},re=function(t,r,s,a){return N(t,r)&&oe(t[r])?g(a.base?P(a.base):{},t[r],a.transform):s};function En(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Br(),t=l=>En(l);if(t.version="3.4.12",t.removed=[],!n||!n.document||n.document.nodeType!==G.document||!n.Element)return t.isSupported=!1,t;let r=n.document,s=r,a=s.currentScript;n.DocumentFragment;let c=n.HTMLTemplateElement,f=n.Node,h=n.Element,p=n.NodeFilter,T=n.NamedNodeMap;T===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let x=n.DOMParser,y=n.trustedTypes,E=h.prototype,k=q(E,"cloneNode"),Z=q(E,"remove"),Ne=q(E,"nextSibling"),H=q(E,"childNodes"),j=q(E,"parentNode"),wt=q(E,"shadowRoot"),Xe=q(E,"attributes"),M=f&&f.prototype?q(f.prototype,"nodeType"):null,W=f&&f.prototype?q(f.prototype,"nodeName"):null;if(typeof c=="function"){let l=r.createElement("template");l.content&&l.content.ownerDocument&&(r=l.content.ownerDocument)}let z,ie="",Ve,xt=!1,be=0,Lt=function(){if(be>0)throw ce('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.')},fe=function(e){Lt(),be++;try{return z.createHTML(e)}finally{be--}},Fn=function(e){Lt(),be++;try{return z.createScriptURL(e)}finally{be--}},Hn=function(){return xt||(Ve=jr(y,a),xt=!0),Ve},Ie=r,qe=Ie.implementation,Ot=Ie.createNodeIterator,Gn=Ie.createDocumentFragment,$n=Ie.getElementsByTagName,Bn=s.importNode,b=hn();t.isSupported=typeof gn=="function"&&typeof j=="function"&&qe&&qe.createHTMLDocument!==void 0;let jn=Dr,Wn=Ur,Yn=Mr,Xn=vr,Vn=Pr,qn=kr,Nt=zr,Kn=Hr,It=pn,A=null,Ct=g({},[...ln,...dt,...ht,...gt,...cn]),R=null,Dt=g({},[...un,...Tt,...fn,...Fe]),S=Object.seal(_e(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}})),Ae=null,Ut=null,J=Object.seal(_e(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Mt=!0,Ke=!0,vt=!1,Pt=!0,ee=!1,te=!0,ae=!1,Ze=!1,Qe=null,Je=null,et=!1,pe=!1,Ce=!1,De=!1,kt=!0,zt=!1,Ft="user-content-",tt=!0,nt=!1,me={},Y=null,rt=g({},["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"]),Ht=null,Gt=g({},["audio","video","img","source","image","track"]),ot=null,$t=g({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ue="http://www.w3.org/1998/Math/MathML",Me="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",de=X,st=!1,it=null,Zn=g({},[Ue,Me,X],mt),Bt=I(["mi","mo","mn","ms","mtext"]),at=g({},Bt),jt=I(["annotation-xml"]),lt=g({},jt),Qn=g({},["title","style","font","a","script"]),Re=null,Jn=["application/xhtml+xml","text/html"],er="text/html",_=null,he=null,tr=r.createElement("form"),Wt=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(he&&he===e)return;(!e||typeof e!="object")&&(e={}),e=P(e),Re=Jn.indexOf(e.PARSER_MEDIA_TYPE)===-1?er:e.PARSER_MEDIA_TYPE,_=Re==="application/xhtml+xml"?mt:Le,A=re(e,"ALLOWED_TAGS",Ct,{transform:_}),R=re(e,"ALLOWED_ATTR",Dt,{transform:_}),it=re(e,"ALLOWED_NAMESPACES",Zn,{transform:mt}),ot=re(e,"ADD_URI_SAFE_ATTR",$t,{transform:_,base:$t}),Ht=re(e,"ADD_DATA_URI_TAGS",Gt,{transform:_,base:Gt}),Y=re(e,"FORBID_CONTENTS",rt,{transform:_}),Ae=re(e,"FORBID_TAGS",P({}),{transform:_}),Ut=re(e,"FORBID_ATTR",P({}),{transform:_}),me=N(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?P(e.USE_PROFILES):e.USE_PROFILES:!1,Mt=e.ALLOW_ARIA_ATTR!==!1,Ke=e.ALLOW_DATA_ATTR!==!1,vt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ee=e.SAFE_FOR_TEMPLATES||!1,te=e.SAFE_FOR_XML!==!1,ae=e.WHOLE_DOCUMENT||!1,pe=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,De=e.RETURN_TRUSTED_TYPE||!1,et=e.FORCE_BODY||!1,kt=e.SANITIZE_DOM!==!1,zt=e.SANITIZE_NAMED_PROPS||!1,tt=e.KEEP_CONTENT!==!1,nt=e.IN_PLACE||!1,It=Nr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:pn,de=typeof e.NAMESPACE=="string"?e.NAMESPACE:X,at=N(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?P(e.MATHML_TEXT_INTEGRATION_POINTS):g({},Bt),lt=N(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?P(e.HTML_INTEGRATION_POINTS):g({},jt);let o=N(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?P(e.CUSTOM_ELEMENT_HANDLING):_e(null);if(S=_e(null),N(o,"tagNameCheck")&&Wt(o.tagNameCheck)&&(S.tagNameCheck=o.tagNameCheck),N(o,"attributeNameCheck")&&Wt(o.attributeNameCheck)&&(S.attributeNameCheck=o.attributeNameCheck),N(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(S.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),C(S),ee&&(Ke=!1),Ce&&(pe=!0),me&&(A=g({},cn),R=_e(null),me.html===!0&&(g(A,ln),g(R,un)),me.svg===!0&&(g(A,dt),g(R,Tt),g(R,Fe)),me.svgFilters===!0&&(g(A,ht),g(R,Tt),g(R,Fe)),me.mathMl===!0&&(g(A,gt),g(R,fn),g(R,Fe))),J.tagCheck=null,J.attributeCheck=null,N(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?J.tagCheck=e.ADD_TAGS:oe(e.ADD_TAGS)&&(A===Ct&&(A=P(A)),g(A,e.ADD_TAGS,_))),N(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?J.attributeCheck=e.ADD_ATTR:oe(e.ADD_ATTR)&&(R===Dt&&(R=P(R)),g(R,e.ADD_ATTR,_))),N(e,"ADD_URI_SAFE_ATTR")&&oe(e.ADD_URI_SAFE_ATTR)&&g(ot,e.ADD_URI_SAFE_ATTR,_),N(e,"FORBID_CONTENTS")&&oe(e.FORBID_CONTENTS)&&(Y===rt&&(Y=P(Y)),g(Y,e.FORBID_CONTENTS,_)),N(e,"ADD_FORBID_CONTENTS")&&oe(e.ADD_FORBID_CONTENTS)&&(Y===rt&&(Y=P(Y)),g(Y,e.ADD_FORBID_CONTENTS,_)),tt&&(A["#text"]=!0),ae&&g(A,["html","head","body"]),A.table&&(g(A,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let i=z;z=e.TRUSTED_TYPES_POLICY;try{ie=fe("")}catch(u){throw z=i,u}}else e.TRUSTED_TYPES_POLICY===null?(z=void 0,ie=""):(z===void 0&&(z=Hn()),z&&typeof ie=="string"&&(ie=fe("")));I&&I(e),he=e},Yt=g({},[...dt,...ht,...Ir]),Xt=g({},[...gt,...Cr]),nr=function(e,o,i){return o.namespaceURI===X?e==="svg":o.namespaceURI===Ue?e==="svg"&&(i==="annotation-xml"||at[i]):!!Yt[e]},rr=function(e,o,i){return o.namespaceURI===X?e==="math":o.namespaceURI===Me?e==="math"&&lt[i]:!!Xt[e]},or=function(e,o,i){return o.namespaceURI===Me&&!lt[i]||o.namespaceURI===Ue&&!at[i]?!1:!Xt[e]&&(Qn[e]||!Yt[e])},sr=function(e){let o=j(e);(!o||!o.tagName)&&(o={namespaceURI:de,tagName:"template"});let i=Le(e.tagName),u=Le(o.tagName);return it[e.namespaceURI]?e.namespaceURI===Me?nr(i,o,u):e.namespaceURI===Ue?rr(i,o,u):e.namespaceURI===X?or(i,o,u):!!(Re==="application/xhtml+xml"&&it[e.namespaceURI]):!1},ne=function(e){Ee(t.removed,{element:e});try{j(e).removeChild(e)}catch{if(Z(e),!j(e))throw ce("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ve=function(e){ut(e);let o=H(e);if(o){let u=[];Te(o,m=>{Ee(u,m)}),Te(u,m=>{try{Z(m)}catch{}})}let i=Xe(e);if(i)for(let u=i.length-1;u>=0;--u){let m=i[u],d=m&&m.name;if(typeof d=="string")try{e.removeAttribute(d)}catch{}}},le=function(e,o){try{Ee(t.removed,{attribute:o.getAttributeNode(e),from:o})}catch{Ee(t.removed,{attribute:null,from:o})}if(o.removeAttribute(e),e==="is")if(pe||Ce)try{ne(o)}catch{}else try{o.setAttribute(e,"")}catch{}},ir=function(e){let o=Xe(e);if(o)for(let i=o.length-1;i>=0;--i){let u=o[i],m=u&&u.name;if(!(typeof m!="string"||R[_(m)]))try{e.removeAttribute(m)}catch{}}},ut=function(e){let o=[e];for(;o.length>0;){let i=o.pop();(M?M(i):i.nodeType)===G.element&&ir(i);let m=H(i);if(m)for(let d=m.length-1;d>=0;--d)o.push(m[d])}},ar=function(e){if(!te)return;let o=[e];for(;o.length>0;){let i=o.pop(),u=M?M(i):i.nodeType;if(u===G.processingInstruction||u===G.comment&&O(dn,i.data)){try{Z(i)}catch{}continue}if(u===G.element){let d=i,w=_(W?W(i):i.nodeName);try{d.hasAttribute&&d.hasAttribute("patchsrc")&&d.removeAttribute("patchsrc"),d.hasAttribute&&d.hasAttribute("for")&&w!=="label"&&w!=="output"&&d.removeAttribute("for")}catch{}}let m=H(i);if(m)for(let d=m.length-1;d>=0;--d)o.push(m[d])}},Vt=function(e){let o=null,i=null;if(et)e="<remove></remove>"+e;else{let d=rn(e,/^[\r\n\t ]+/);i=d&&d[0]}Re==="application/xhtml+xml"&&de===X&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let u=z?fe(e):e;if(de===X)try{o=new x().parseFromString(u,Re)}catch{}if(!o||!o.documentElement){o=qe.createDocument(de,"template",null);try{o.documentElement.innerHTML=st?ie:u}catch{}}let m=o.body||o.documentElement;return e&&i&&m.insertBefore(r.createTextNode(i),m.childNodes[0]||null),de===X?$n.call(o,ae?"html":"body")[0]:ae?o.documentElement:m},qt=function(e){return Ot.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Pe=function(e){return e=we(e,jn," "),e=we(e,Wn," "),e=we(e,Yn," "),e},ft=function(e){var o;e.normalize();let i=Ot.call(e.ownerDocument||e,e,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null),u=i.nextNode();for(;u;)u.data=Pe(u.data),u=i.nextNode();let m=(o=e.querySelectorAll)===null||o===void 0?void 0:o.call(e,"template");m&&Te(m,d=>{ge(d.content)&&ft(d.content)})},ke=function(e){let o=W?W(e):null;return typeof o!="string"||_(o)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Xe(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==M(e)||e.childNodes!==H(e)},ge=function(e){if(!M||typeof e!="object"||e===null)return!1;try{return M(e)===G.documentFragment}catch{return!1}},Se=function(e){if(!M||typeof e!="object"||e===null)return!1;try{return typeof M(e)=="number"}catch{return!1}};function V(l,e,o){l.length!==0&&Te(l,i=>{i.call(t,e,o,he)})}let lr=function(e,o){return!!(te&&e.hasChildNodes()&&!Se(e.firstElementChild)&&O(mn,e.textContent)&&O(mn,e.innerHTML)||te&&e.namespaceURI===X&&o==="style"&&Se(e.firstElementChild)||e.nodeType===G.processingInstruction||te&&e.nodeType===G.comment&&O(dn,e.data))},cr=function(e,o){if(!Ae[o]&&Qt(o)&&(S.tagNameCheck instanceof RegExp&&O(S.tagNameCheck,o)||S.tagNameCheck instanceof Function&&S.tagNameCheck(o)))return!1;if(tt&&!Y[o]){let i=j(e),u=H(e);if(u&&i){let m=u.length;for(let d=m-1;d>=0;--d){let w=nt?u[d]:k(u[d],!0);i.insertBefore(w,Ne(e))}}}return ne(e),!0},Kt=function(e,o){if(V(b.beforeSanitizeElements,e,null),e!==o&&j(e)===null)return!0;if(ke(e))return ne(e),!0;let i=_(W?W(e):e.nodeName);if(V(b.uponSanitizeElement,e,{tagName:i,allowedTags:A}),e!==o&&j(e)===null)return!0;if(lr(e,i))return ne(e),!0;if(Ae[i]||!(J.tagCheck instanceof Function&&J.tagCheck(i))&&!A[i]){let m=cr(e,i);return m===!1&&V(b.afterSanitizeElements,e,null),m}if((M?M(e):e.nodeType)===G.element&&!sr(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&O(Gr,e.innerHTML))return ne(e),!0;if(ee&&e.nodeType===G.text){let m=Pe(e.textContent);e.textContent!==m&&(Ee(t.removed,{element:e.cloneNode()}),e.textContent=m)}return V(b.afterSanitizeElements,e,null),!1},Zt=function(e,o,i){if(Ut[o]||te&&o==="patchsrc"||te&&o==="for"&&e!=="label"&&e!=="output"||kt&&(o==="id"||o==="name")&&(i in r||i in tr))return!1;let u=R[o]||J.attributeCheck instanceof Function&&J.attributeCheck(o,e);if(!(Ke&&O(Xn,o))){if(!(Mt&&O(Vn,o))){if(u){if(!ot[o]){if(!O(It,we(i,Nt,""))){if(!((o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&on(i,"data:")===0&&Ht[e])){if(!(vt&&!O(qn,we(i,Nt,"")))){if(i)return!1}}}}}else if(!(Qt(e)&&(S.tagNameCheck instanceof RegExp&&O(S.tagNameCheck,e)||S.tagNameCheck instanceof Function&&S.tagNameCheck(e))&&(S.attributeNameCheck instanceof RegExp&&O(S.attributeNameCheck,o)||S.attributeNameCheck instanceof Function&&S.attributeNameCheck(o,e))||o==="is"&&S.allowCustomizedBuiltInElements&&(S.tagNameCheck instanceof RegExp&&O(S.tagNameCheck,i)||S.tagNameCheck instanceof Function&&S.tagNameCheck(i))))return!1}}return!0},ur=g({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Qt=function(e){return!ur[Le(e)]&&O(Kn,e)},fr=function(e,o,i,u){if(z&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!i)switch(y.getAttributeType(e,o)){case"TrustedHTML":return fe(u);case"TrustedScriptURL":return Fn(u)}return u},pr=function(e,o,i,u){try{i?e.setAttributeNS(i,o,u):e.setAttribute(o,u),ke(e)?ne(e):nn(t.removed)}catch{le(o,e)}},Jt=function(e){V(b.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||ke(e))return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},u=o.length,m=_(e.nodeName);for(;u--;){let d=o[u],w=d.name,D=d.namespaceURI,$=d.value,F=_(w),B=$,v=w==="value"?B:Rr(B);if(i.attrName=F,i.attrValue=v,i.keepAttr=!0,i.forceKeepAttr=void 0,V(b.uponSanitizeAttribute,e,i),v=i.attrValue,zt&&(F==="id"||F==="name")&&on(v,Ft)!==0&&(le(w,e),v=Ft+v),te&&O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,v)){le(w,e);continue}if(F==="attributename"&&rn(v,"href")){le(w,e);continue}if(!i.forceKeepAttr){if(!i.keepAttr){le(w,e);continue}if(!Pt&&O($r,v)){le(w,e);continue}if(ee&&(v=Pe(v)),!Zt(m,F,v)){le(w,e);continue}v=fr(m,F,D,v),v!==B&&pr(e,w,D,v)}}V(b.afterSanitizeAttributes,e,null)},ze=function(e){let o=null,i=qt(e);for(V(b.beforeSanitizeShadowDOM,e,null);o=i.nextNode();)if(V(b.uponSanitizeShadowNode,o,null),Kt(o,e),Jt(o),ge(o.content)&&ze(o.content),(M?M(o):o.nodeType)===G.element){let m=wt(o);ge(m)&&(pt(m),ze(m))}V(b.afterSanitizeShadowDOM,e,null)},pt=function(e){let o=[{node:e,shadow:null}];for(;o.length>0;){let i=o.pop();if(i.shadow){ze(i.shadow);continue}let u=i.node,d=(M?M(u):u.nodeType)===G.element,w=H(u);if(w)for(let D=w.length-1;D>=0;--D)o.push({node:w[D],shadow:null});if(d){let D=W?W(u):null;if(typeof D=="string"&&_(D)==="template"){let $=u.content;ge($)&&o.push({node:$,shadow:null})}}if(d){let D=wt(u);ge(D)&&o.push({node:null,shadow:D},{node:D,shadow:null})}}};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,i=null,u=null,m=null;if(st=!l,st&&(l="<!-->"),typeof l!="string"&&!Se(l)&&(l=Or(l),typeof l!="string"))throw ce("dirty is not a string, aborting");if(!t.isSupported)return l;Ze?(A=Qe,R=Je):ct(e),(b.uponSanitizeElement.length>0||b.uponSanitizeAttribute.length>0)&&(A=P(A)),b.uponSanitizeAttribute.length>0&&(R=P(R)),t.removed=[];let d=nt&&typeof l!="string"&&Se(l);if(d){ar(l);let F=W?W(l):l.nodeName;if(typeof F=="string"){let B=_(F);if(!A[B]||Ae[B])throw ve(l),ce("root node is forbidden and cannot be sanitized in-place")}if(ke(l))throw ve(l),ce("root node is clobbered and cannot be sanitized in-place");try{pt(l)}catch(B){throw ve(l),B}}else if(Se(l))o=Vt("<!---->"),i=o.ownerDocument.importNode(l,!0),i.nodeType===G.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?o=i:o.appendChild(i),pt(i);else{if(!pe&&!ee&&!ae&&l.indexOf("<")===-1)return z&&De?fe(l):l;if(o=Vt(l),!o)return pe?null:De?ie:""}o&&et&&ne(o.firstChild);let w=d?l:o,D=qt(w);try{for(;u=D.nextNode();)Kt(u,w),Jt(u),ge(u.content)&&ze(u.content)}catch(F){throw d&&(ve(l),Te(t.removed,B=>{B.element&&ut(B.element)})),F}if(d)return Te(t.removed,F=>{F.element&&ut(F.element)}),ee&&ft(l),l;if(pe){if(ee&&ft(o),Ce)for(m=Gn.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(R.shadowroot||R.shadowrootmode)&&(m=Bn.call(s,m,!0)),m}let $=ae?o.outerHTML:o.innerHTML;return ae&&A["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&O(Fr,o.ownerDocument.doctype.name)&&($="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
3
- `+$),ee&&($=Pe($)),z&&De?fe($):$},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(l),Ze=!0,Qe=A,Je=R},t.clearConfig=function(){he=null,Ze=!1,Qe=null,Je=null,z=Ve,ie=""},t.isValidAttribute=function(l,e,o){he||ct({});let i=_(l),u=_(e);return Zt(i,u,o)},t.addHook=function(l,e){typeof e=="function"&&N(b,l)&&Ee(b[l],e)},t.removeHook=function(l,e){if(N(b,l)){if(e!==void 0){let o=br(b[l],e);return o===-1?void 0:Ar(b[l],o,1)[0]}return nn(b[l])}},t.removeHooks=function(l){N(b,l)&&(b[l]=[])},t.removeAllHooks=function(){b=hn()},t}var _n=En();var He=_n(globalThis.window);var ue=n=>Object.prototype.toString.call(n).slice(8,-1),U=n=>typeof n=="string"||n instanceof String;var yn=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","afp","afs","agtp","aim","amss","android","appdata","apt","ar","ari","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cttps","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","ez","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gtalk","h323","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","iotdisco","ipfs","ipn","ipns","ipp","ipps","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","mdoc","mdoc-openid4vp","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","musik","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","nostr","notes","npamp","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","sarif","secondlife","secret-token","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","sss","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","tttps","turn","turns","tv","udp","unreal","upn","urn","ust","ut2004","uuaid","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s","ztdnaid"];var bn=/(?:#|%23)$/,An=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var Rn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,Sn=/^((?:[^#%]|%(?!23))*)(?:\?|%3F)$/i,yt=/^[a-z][\da-z+.-]*$/,wn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,Oe=/^(?:java|vb)script$/i,bt=/^(?:(?:java|vb)script|blob)$/i,Ge=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,xn=/^%[\dA-F]{2}$/i,At=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i,Ln=/(?:%[\dA-F]{2})+/gi,On=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Nn=[9,10,13,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var Rt=new Set(Nn),$e=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),qr=()=>{let n=new Map;for(let t=0;t<256;t++)!Rt.has(t)&&!$e.has(t)&&n.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return n},Be=qr();var[ye,Zr,Qr,Jr,eo,to]=["&","#","<",">",'"',"'"].map(n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`),no={[ye]:`${ye}amp;`,[Qr]:`${ye}lt;`,[Jr]:`${ye}gt;`,[eo]:`${ye}quot;`,[to]:`${ye}${Zr}39;`},ko=Array.from({length:256},(n,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),Cn=globalThis.process?.versions?.node!==void 0,ro=new RegExp(`[${[...Be.values()].join("")}]`),oo=new RegExp(`[${[...Be.values()].join("")}]`,"g"),zo=new TextEncoder,so=new TextDecoder("utf-8",{fatal:!0}),We=class{#e=new Set(yn);get(){return[...this.#e]}has(t){return this.#e.has(t)}verify(t,r=this.#e){if(!U(t))return!1;let s=t.normalize("NFKC"),a=URL.parse(s);if(!a)return!1;let c=a.protocol.replace(/:$/,""),f=c.split("+");return f.some(p=>Oe.test(p))?!1:wn.test(c)||f.every(p=>r.has(p))}};var Dn=n=>{if(!U(n))return n;let t=xn.test(n)?n.toUpperCase():n;return no[t]??n},Un=n=>{if(!U(n))throw new TypeError(`Expected String but got ${ue(n)}.`);let t=n.replace(/\s/g,""),r;try{r=atob(t)}catch{throw new Error(`Invalid base64 data: ${n}`)}let s;if(Cn&&globalThis.Buffer)s=globalThis.Buffer.from(r,"latin1");else{let a=r.length;s=new Uint8Array(a);for(let c=0;c<a;c++)s[c]=r.charCodeAt(c)}try{let a=so.decode(s);return ro.test(a)?t:a}catch{return t}},io=(n,t)=>{let r=/x/i.test(t[0])?parseInt(t.substring(1),16):parseInt(t,10);if(Number.isInteger(r)){if(Rt.has(r))return String.fromCharCode(r);if($e.has(r)){let s=$e.get(r);return String.fromCodePoint(s)}else if(Be.has(r))return""}return n},Mn=n=>U(n)?n.replace(bn,"").replace(Sn,"$1"):n,vn=(n,t=0)=>{if(!U(n))throw new TypeError(`Expected String but got ${ue(n)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${ue(t)}.`);let r;try{r=decodeURIComponent(n)}catch{r=n.replace(Ln,a=>{try{return decodeURIComponent(a)}catch{return a}})}r=r.replace(oo,"");let s=0;for(;s+t<=16;s++){let a=r;if(r=r.replace(/&amp;/gi,"&").replace(Rn,io),r===a)break}if(s+t>16&&/&#/.test(r))throw new Error("Character references nested too deeply.");return r},ao=async n=>{let t=n.type?`${n.type};base64`:"base64",r=await n.arrayBuffer(),s=globalThis.Buffer.from(r).toString("base64");return`data:${t},${s}`},lo=n=>new Promise((t,r)=>{let s=new globalThis.FileReader;s.addEventListener("error",()=>r(s.error)),s.addEventListener("abort",()=>t(null)),s.addEventListener("load",()=>t(s.result)),s.readAsDataURL(n)}),co=async n=>{let t=n.type?`${n.type};base64`:"base64",r=await n.arrayBuffer(),s=new Uint8Array(r),a=[];for(let c=0;c<s.length;c+=8192)a.push(String.fromCharCode(...s.subarray(c,c+8192)));return`data:${t},${btoa(a.join(""))}`},Pn=async(n,t=16777216)=>{if(Number.isInteger(n?.size)){if(Number.isInteger(t)&&n.size>t){let r=`Blob size (${n.size} bytes) exceeds max (${t} bytes).`;throw new DOMException(r,"NotReadableError")}}else return null;return Cn&&globalThis.Buffer?ao(n):globalThis.FileReader?lo(n):co(n)};var uo=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),fo=Object.freeze({RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,RETURN_TRUSTED_TYPE:!1}),K=(n,t,r)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,r)},St=class n extends We{#e;static#t=null;static#n=null;static#s(t,r){if(!r.attrValue||!/^\s*data:/i.test(r.attrValue))return;let s=n.#t,a=n.#n;if(!s||!a)return;let c=URL.parse(r.attrValue);if(c&&c.protocol==="data:"){let f=r.attrValue;if(a.recurse||(a.recurse=new Set),a.recurse.has(f)){let h=`Circular Data URL detected and skipped: ${f}`;K(a.debug,h),r.attrValue="";return}a.nest++,a.recurse.add(f);try{let h=s.#o(f,{allow:["data"],deny:[],only:[],allowRelative:!1},a);r.attrValue=h||""}finally{a.nest--,a.recurse.delete(f)}}}static{He.setConfig(fo),He.addHook("uponSanitizeAttribute",n.#s)}constructor(){super(),this.#e=new Set(super.get())}#r(t,r,s,a,c){if(bt.test(t))return!1;if(t.split("+").some(p=>Oe.test(p))||!yt.test(t)){let p=`Failed to add scheme '${t}' in '${r}' list.`;return K(c.debug,p),!1}return a.set(t,!0),s.add(t),!0}#i(t,r){let s=t;try{s=decodeURIComponent(t)}catch{}let a=n.#t,c=n.#n;n.#t=this,n.#n=r;let f;try{f=r.domPurify.sanitize(s)}finally{n.#t=a,n.#n=c}f=Mn(f);try{return encodeURI(f)}catch{return f}}#o(t,r,s){if(s.nest>16)throw new Error("Data URLs nested too deeply.");let{allowedSchemes:a,restrictScheme:c,schemeMap:f}=this.#a(r,s),{isDataUrl:h,isRelative:p,isVerified:T,scheme:x,schemeParts:y,urlObj:E,urlToSanitize:k}=this.#l(t,r.allowRelative,a,s);return!T||!this.#c(x,y,c,f,p)?null:h?this.#u(E,x,s):this.#f(k)}#a({allow:t,deny:r,only:s},a){let c=this.#e,f=!1,h=new Map(a.schemeMap);if(s.length){c=new Set;for(let p of s)U(p)&&this.#r(p.trim(),"only",c,h,a)&&!f&&(f=!0)}else{if(t.length){c=new Set(this.#e);for(let p of t)U(p)&&this.#r(p.trim(),"allow",c,h,a)}if(r.length)for(let p of r)U(p)&&(p=p.trim(),p&&h.set(p,!1))}return{allowedSchemes:c,restrictScheme:f,schemeMap:h}}#l(t,r,s,a){let c=super.verify(t,s),f=!1,h="";if(!c&&r&&!On.test(t)){let y=t.normalize("NFKC"),E=URL.parse(t,"http://dummy.local"),k=URL.parse(y,"http://dummy.local");E&&k?E.protocol==="http:"&&E.hostname==="dummy.local"&&k.protocol==="http:"&&(c=!0,f=!0,h=`${E.pathname}${E.search}${E.hash}`):K(a.debug,"Failed to parse relative URL.")}if(!c)return{isVerified:!1};if(f)return{isRelative:f,isVerified:c,isDataUrl:!1,scheme:"",schemeParts:[],urlToSanitize:h};let p=URL.parse(t),T=p.protocol.replace(/:$/,"").normalize("NFKC"),x=T.split("+");return{isRelative:f,isVerified:c,scheme:T,schemeParts:x,urlObj:p,isDataUrl:x.includes("data"),urlToSanitize:p.href}}#c(t,r,s,a,c){if(c)return!0;if(s)return r.every(f=>a.get(f));for(let[f,h]of a.entries())if(!(h||t!==f&&r.every(T=>T!==f)))return!1;return!0}#u(t,r,s){let[a,...c]=t.pathname.split(","),f=`${c.join(",")}${t.search}${t.hash}`,h=a.split(";"),p=h[h.length-1]==="base64",T=f;if(p)try{T=Un(f)}catch(x){return K(s.debug,"Failed to parse base64 data.",x),null}try{let y=vn(T).trim().normalize("NFKC"),k=URL.parse(y,"http://dummy.local");if(!k)return K(s.debug,"Failed to parse inner data URL protocol."),null;if(k.protocol.replace(/:$/,"").split("+").some(H=>bt.test(H)))return null}catch(x){return K(s.debug,"Failed to parse inner data URL protocol.",x),null}return(!a||An.test(a))&&(T=this.#i(T,s)),T?(p&&T!==f&&h.pop(),`${r}:${h.join(";")},${T}`):null}#f(t){let r=t;if(Ge.test(r)){let{index:s}=Ge.exec(r);r=r.substring(0,s).replace(/[?&]$/,"")}if(At.test(r)){let{index:s}=At.exec(r);r=r.substring(0,s).replace(/[?&]$/,"")}return r}sanitize(t,r){if(!t||!U(t))return null;let s=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0;if(s&&t.length>s){let h=`URL length ${t.length} exceeds maxLength ${s}.`;throw new RangeError(h)}if(!(r&&(Array.isArray(r.deny)&&r.deny.length>0||Array.isArray(r.only)&&r.only.length>0||r.allowRelative))&&(t.startsWith("https://")||t.startsWith("http://"))&&!Ge.test(t)&&!t.includes("data:")){let h=URL.parse(t);return h?h.href.replace(/%26/g,Dn):(K(r?.debug,"Failed to parse URL."),null)}let c={allow:Array.isArray(r?.allow)?r.allow:[],deny:Array.isArray(r?.deny)?r.deny:[],only:Array.isArray(r?.only)?r.only:[],allowRelative:!!r?.allowRelative},f={debug:!!r?.debug,domPurify:He,nest:0,recurse:null,schemeMap:new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]])};return this.#o(t,c,f)}inspect(t,r){if(!U(t))throw new TypeError(`Expected String but got ${ue(t)}.`);let s={input:t,valid:!1},a,c=null,f=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0,h=t.length;if(f&&h>f)c=`URL length ${h} exceeds maxLength ${f}.`;else if(this.verify(t)){let{protocol:p}=new URL(t);if(p==="blob:")a=t;else try{a=this.sanitize(t,r??{allow:["data"]}),a||(c="Sanitization failed (blocked by allowed schemes or rules).")}catch(T){c=T.message}}else c="Invalid URI syntax or scheme is not registered.";if(a){let p=new URL(a),{pathname:T,protocol:x}=p,E=x.replace(/:$/,"").split("+").includes("data");if(s.valid=!0,E){let[k,...Z]=T.split(","),Ne=`${Z.join(",")}${p.search}${p.hash}`,H=k.split(";"),j=H[H.length-1]==="base64";j&&H.pop(),s.data={mime:H.join(";"),base64:j,data:Ne}}else s.data=null;for(let k of uo){let Z=p[k];U(Z)&&(s[k]=Z)}}else s.valid=!1,c&&(s.reason=c);return s}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(U(t))t=t.trim();else throw new TypeError(`Expected String but got ${ue(t)}.`);if(t.split("+").some(a=>Oe.test(a))||!yt.test(t))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}reset(){this.#e=new Set(super.get())}verify(t,r=this.#e){return super.verify(t,r)}};var se=new St,po=async(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216})=>{let r=!!t?.debug,s=Number.isInteger(t?.maxBlobSize)&&t.maxBlobSize>0?t.maxBlobSize:16777216,a;if(n&&U(n)){let c,f=URL.parse(n);if(f?c=f.protocol.replace(/:$/,""):K(r,`Invalid URL input format: ${n}`),c==="blob"){let{allow:h,deny:p,only:T}=t;if(Array.isArray(h)&&h.includes("blob")&&!(Array.isArray(p)&&p.includes("blob"))||Array.isArray(T)&&T.includes("blob")){let x;try{x=await fetch(n).then(y=>y.blob()).then(y=>Pn(y,s))}catch(y){let E=`Failed to fetch and convert blob URL: ${n}`;K(r,E,y)}if(x){let y={...t};Array.isArray(t.only)?y.only=t.only.includes("data")?t.only:[...t.only,"data"]:Array.isArray(t.allow)&&(y.allow=t.allow.includes("data")?t.allow:[...t.allow,"data"],Array.isArray(t.deny)&&(y.deny=t.deny.filter(E=>E!=="data"))),a=se.sanitize(x,y)}}t?.revokeObjectURL&&URL.revokeObjectURL(n)}else(c||t.allowRelative)&&(a=se.sanitize(n,t))}return a||null},mo=(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1})=>{let r=!!t?.debug,s;if(n&&U(n)){let a,c=URL.parse(n);if(c?a=c.protocol.replace(/:$/,""):K(r,`Invalid URL input format: ${n}`),a==="blob")return t?.revokeObjectURL&&URL.revokeObjectURL(n),null;(a||t.allowRelative)&&(s=se.sanitize(n,t))}return s||null},kn=async n=>se.inspect(n),ho=async n=>kn(n),zn=n=>se.inspect(n),go=n=>zn(n),To=async n=>se.verify(n),Eo=n=>se.verify(n),_o=se;export{_o as default,kn as inspectURL,zn as inspectURLSync,To as isURI,Eo as isURISync,ho as parseURL,go as parseURLSync,po as sanitizeURL,mo as sanitizeURLSync};
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gr(n,t){return mr(n)||dr(n,t)||Tr(n,t)||hr()}function Tr(n,t){if(n){if(typeof n=="string")return en(n,t);var r={}.toString.call(n).slice(8,-1);return r==="Object"&&n.constructor&&(r=n.constructor.name),r==="Map"||r==="Set"?Array.from(n):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?en(n,t):void 0}}var gn=Object.entries,tn=Object.setPrototypeOf,Er=Object.isFrozen,_r=Object.getPrototypeOf,yr=Object.getOwnPropertyDescriptor,I=Object.freeze,D=Object.seal,_e=Object.create,Tn=typeof Reflect<"u"&&Reflect,Et=Tn.apply,_t=Tn.construct;I||(I=function(t){return t});D||(D=function(t){return t});Et||(Et=function(t,r){for(var s=arguments.length,a=new Array(s>2?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];return t.apply(r,a)});_t||(_t=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return new t(...s)});var Te=L(Array.prototype.forEach),br=L(Array.prototype.lastIndexOf),nn=L(Array.prototype.pop),Ee=L(Array.prototype.push),Ar=L(Array.prototype.splice),oe=Array.isArray,Le=L(String.prototype.toLowerCase),mt=L(String.prototype.toString),rn=L(String.prototype.match),we=L(String.prototype.replace),on=L(String.prototype.indexOf),Rr=L(String.prototype.trim),Sr=L(Number.prototype.toString),wr=L(Boolean.prototype.toString),sn=typeof BigInt>"u"?null:L(BigInt.prototype.toString),an=typeof Symbol>"u"?null:L(Symbol.prototype.toString),C=L(Object.prototype.hasOwnProperty),xe=L(Object.prototype.toString),N=L(RegExp.prototype.test),ce=xr(TypeError);function L(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,s=new Array(r>1?r-1:0),a=1;a<r;a++)s[a-1]=arguments[a];return Et(n,t,s)}}function xr(n){return function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return _t(n,r)}}function g(n,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Le;if(tn&&tn(n,null),!oe(t))return n;let s=t.length;for(;s--;){let a=t[s];if(typeof a=="string"){let c=r(a);c!==a&&(Er(t)||(t[s]=c),a=c)}n[a]=!0}return n}function Lr(n){for(let t=0;t<n.length;t++)C(n,t)||(n[t]=null);return n}function P(n){let t=_e(null);for(let s of gn(n)){var r=gr(s,2);let a=r[0],c=r[1];C(n,a)&&(oe(c)?t[a]=Lr(c):c&&typeof c=="object"&&c.constructor===Object?t[a]=P(c):t[a]=c)}return t}function Or(n){switch(typeof n){case"string":return n;case"number":return Sr(n);case"boolean":return wr(n);case"bigint":return sn?sn(n):"0";case"symbol":return an?an(n):"Symbol()";case"undefined":return xe(n);case"function":case"object":{if(n===null)return xe(n);let t=n,r=q(t,"toString");if(typeof r=="function"){let s=r(t);return typeof s=="string"?s:xe(s)}return xe(n)}default:return xe(n)}}function q(n,t){for(;n!==null;){let s=yr(n,t);if(s){if(s.get)return L(s.get);if(typeof s.value=="function")return L(s.value)}n=_r(n)}function r(){return null}return r}function Nr(n){try{return N(n,""),!0}catch{return!1}}var ln=I(["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"]),dt=I(["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"]),ht=I(["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"]),Cr=I(["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"]),gt=I(["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"]),Ir=I(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cn=I(["#text"]),un=I(["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"]),Tt=I(["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","dominant-baseline","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-orientation","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"]),fn=I(["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"]),Fe=I(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Dr=D(/{{[\w\W]*|^[\w\W]*}}/g),Ur=D(/<%[\w\W]*|^[\w\W]*%>/g),Mr=D(/\${[\w\W]*/g),vr=D(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pr=D(/^aria-[\-\w]+$/),pn=D(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),kr=D(/^(?:\w+script|data):/i),zr=D(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Fr=D(/^html$/i),Hr=D(/^[a-z][.\w]*(-[.\w]+)+$/i),mn=D(/<[/\w!]/g),dn=D(/<[/\w]/g),Gr=D(/<\/no(script|embed|frames)/i),$r=D(/\/>/i),G={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Br=function(){return typeof window>"u"?null:window},jr=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(s=r.getAttribute(a));let c="dompurify"+(s?"#"+s:"");try{return t.createPolicy(c,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},hn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},re=function(t,r,s,a){return C(t,r)&&oe(t[r])?g(a.base?P(a.base):{},t[r],a.transform):s};function En(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Br(),t=l=>En(l);if(t.version="3.4.12",t.removed=[],!n||!n.document||n.document.nodeType!==G.document||!n.Element)return t.isSupported=!1,t;let r=n.document,s=r,a=s.currentScript;n.DocumentFragment;let c=n.HTMLTemplateElement,f=n.Node,h=n.Element,p=n.NodeFilter,T=n.NamedNodeMap;T===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let x=n.DOMParser,y=n.trustedTypes,E=h.prototype,k=q(E,"cloneNode"),Z=q(E,"remove"),Ne=q(E,"nextSibling"),H=q(E,"childNodes"),j=q(E,"parentNode"),wt=q(E,"shadowRoot"),Xe=q(E,"attributes"),M=f&&f.prototype?q(f.prototype,"nodeType"):null,W=f&&f.prototype?q(f.prototype,"nodeName"):null;if(typeof c=="function"){let l=r.createElement("template");l.content&&l.content.ownerDocument&&(r=l.content.ownerDocument)}let z,ie="",Ve,xt=!1,be=0,Lt=function(){if(be>0)throw ce('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.')},fe=function(e){Lt(),be++;try{return z.createHTML(e)}finally{be--}},Fn=function(e){Lt(),be++;try{return z.createScriptURL(e)}finally{be--}},Hn=function(){return xt||(Ve=jr(y,a),xt=!0),Ve},Ce=r,qe=Ce.implementation,Ot=Ce.createNodeIterator,Gn=Ce.createDocumentFragment,$n=Ce.getElementsByTagName,Bn=s.importNode,b=hn();t.isSupported=typeof gn=="function"&&typeof j=="function"&&qe&&qe.createHTMLDocument!==void 0;let jn=Dr,Wn=Ur,Yn=Mr,Xn=vr,Vn=Pr,qn=kr,Nt=zr,Kn=Hr,Ct=pn,A=null,It=g({},[...ln,...dt,...ht,...gt,...cn]),R=null,Dt=g({},[...un,...Tt,...fn,...Fe]),S=Object.seal(_e(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}})),Ae=null,Ut=null,J=Object.seal(_e(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Mt=!0,Ke=!0,vt=!1,Pt=!0,ee=!1,te=!0,ae=!1,Ze=!1,Qe=null,Je=null,et=!1,pe=!1,Ie=!1,De=!1,kt=!0,zt=!1,Ft="user-content-",tt=!0,nt=!1,me={},Y=null,rt=g({},["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"]),Ht=null,Gt=g({},["audio","video","img","source","image","track"]),ot=null,$t=g({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ue="http://www.w3.org/1998/Math/MathML",Me="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",de=X,st=!1,it=null,Zn=g({},[Ue,Me,X],mt),Bt=I(["mi","mo","mn","ms","mtext"]),at=g({},Bt),jt=I(["annotation-xml"]),lt=g({},jt),Qn=g({},["title","style","font","a","script"]),Re=null,Jn=["application/xhtml+xml","text/html"],er="text/html",_=null,he=null,tr=r.createElement("form"),Wt=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(he&&he===e)return;(!e||typeof e!="object")&&(e={}),e=P(e),Re=Jn.indexOf(e.PARSER_MEDIA_TYPE)===-1?er:e.PARSER_MEDIA_TYPE,_=Re==="application/xhtml+xml"?mt:Le,A=re(e,"ALLOWED_TAGS",It,{transform:_}),R=re(e,"ALLOWED_ATTR",Dt,{transform:_}),it=re(e,"ALLOWED_NAMESPACES",Zn,{transform:mt}),ot=re(e,"ADD_URI_SAFE_ATTR",$t,{transform:_,base:$t}),Ht=re(e,"ADD_DATA_URI_TAGS",Gt,{transform:_,base:Gt}),Y=re(e,"FORBID_CONTENTS",rt,{transform:_}),Ae=re(e,"FORBID_TAGS",P({}),{transform:_}),Ut=re(e,"FORBID_ATTR",P({}),{transform:_}),me=C(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?P(e.USE_PROFILES):e.USE_PROFILES:!1,Mt=e.ALLOW_ARIA_ATTR!==!1,Ke=e.ALLOW_DATA_ATTR!==!1,vt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ee=e.SAFE_FOR_TEMPLATES||!1,te=e.SAFE_FOR_XML!==!1,ae=e.WHOLE_DOCUMENT||!1,pe=e.RETURN_DOM||!1,Ie=e.RETURN_DOM_FRAGMENT||!1,De=e.RETURN_TRUSTED_TYPE||!1,et=e.FORCE_BODY||!1,kt=e.SANITIZE_DOM!==!1,zt=e.SANITIZE_NAMED_PROPS||!1,tt=e.KEEP_CONTENT!==!1,nt=e.IN_PLACE||!1,Ct=Nr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:pn,de=typeof e.NAMESPACE=="string"?e.NAMESPACE:X,at=C(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?P(e.MATHML_TEXT_INTEGRATION_POINTS):g({},Bt),lt=C(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?P(e.HTML_INTEGRATION_POINTS):g({},jt);let o=C(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?P(e.CUSTOM_ELEMENT_HANDLING):_e(null);if(S=_e(null),C(o,"tagNameCheck")&&Wt(o.tagNameCheck)&&(S.tagNameCheck=o.tagNameCheck),C(o,"attributeNameCheck")&&Wt(o.attributeNameCheck)&&(S.attributeNameCheck=o.attributeNameCheck),C(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(S.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),D(S),ee&&(Ke=!1),Ie&&(pe=!0),me&&(A=g({},cn),R=_e(null),me.html===!0&&(g(A,ln),g(R,un)),me.svg===!0&&(g(A,dt),g(R,Tt),g(R,Fe)),me.svgFilters===!0&&(g(A,ht),g(R,Tt),g(R,Fe)),me.mathMl===!0&&(g(A,gt),g(R,fn),g(R,Fe))),J.tagCheck=null,J.attributeCheck=null,C(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?J.tagCheck=e.ADD_TAGS:oe(e.ADD_TAGS)&&(A===It&&(A=P(A)),g(A,e.ADD_TAGS,_))),C(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?J.attributeCheck=e.ADD_ATTR:oe(e.ADD_ATTR)&&(R===Dt&&(R=P(R)),g(R,e.ADD_ATTR,_))),C(e,"ADD_URI_SAFE_ATTR")&&oe(e.ADD_URI_SAFE_ATTR)&&g(ot,e.ADD_URI_SAFE_ATTR,_),C(e,"FORBID_CONTENTS")&&oe(e.FORBID_CONTENTS)&&(Y===rt&&(Y=P(Y)),g(Y,e.FORBID_CONTENTS,_)),C(e,"ADD_FORBID_CONTENTS")&&oe(e.ADD_FORBID_CONTENTS)&&(Y===rt&&(Y=P(Y)),g(Y,e.ADD_FORBID_CONTENTS,_)),tt&&(A["#text"]=!0),ae&&g(A,["html","head","body"]),A.table&&(g(A,["tbody"]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ce('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let i=z;z=e.TRUSTED_TYPES_POLICY;try{ie=fe("")}catch(u){throw z=i,u}}else e.TRUSTED_TYPES_POLICY===null?(z=void 0,ie=""):(z===void 0&&(z=Hn()),z&&typeof ie=="string"&&(ie=fe("")));I&&I(e),he=e},Yt=g({},[...dt,...ht,...Cr]),Xt=g({},[...gt,...Ir]),nr=function(e,o,i){return o.namespaceURI===X?e==="svg":o.namespaceURI===Ue?e==="svg"&&(i==="annotation-xml"||at[i]):!!Yt[e]},rr=function(e,o,i){return o.namespaceURI===X?e==="math":o.namespaceURI===Me?e==="math"&&lt[i]:!!Xt[e]},or=function(e,o,i){return o.namespaceURI===Me&&!lt[i]||o.namespaceURI===Ue&&!at[i]?!1:!Xt[e]&&(Qn[e]||!Yt[e])},sr=function(e){let o=j(e);(!o||!o.tagName)&&(o={namespaceURI:de,tagName:"template"});let i=Le(e.tagName),u=Le(o.tagName);return it[e.namespaceURI]?e.namespaceURI===Me?nr(i,o,u):e.namespaceURI===Ue?rr(i,o,u):e.namespaceURI===X?or(i,o,u):!!(Re==="application/xhtml+xml"&&it[e.namespaceURI]):!1},ne=function(e){Ee(t.removed,{element:e});try{j(e).removeChild(e)}catch{if(Z(e),!j(e))throw ce("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},ve=function(e){ut(e);let o=H(e);if(o){let u=[];Te(o,m=>{Ee(u,m)}),Te(u,m=>{try{Z(m)}catch{}})}let i=Xe(e);if(i)for(let u=i.length-1;u>=0;--u){let m=i[u],d=m&&m.name;if(typeof d=="string")try{e.removeAttribute(d)}catch{}}},le=function(e,o){try{Ee(t.removed,{attribute:o.getAttributeNode(e),from:o})}catch{Ee(t.removed,{attribute:null,from:o})}if(o.removeAttribute(e),e==="is")if(pe||Ie)try{ne(o)}catch{}else try{o.setAttribute(e,"")}catch{}},ir=function(e){let o=Xe(e);if(o)for(let i=o.length-1;i>=0;--i){let u=o[i],m=u&&u.name;if(!(typeof m!="string"||R[_(m)]))try{e.removeAttribute(m)}catch{}}},ut=function(e){let o=[e];for(;o.length>0;){let i=o.pop();(M?M(i):i.nodeType)===G.element&&ir(i);let m=H(i);if(m)for(let d=m.length-1;d>=0;--d)o.push(m[d])}},ar=function(e){if(!te)return;let o=[e];for(;o.length>0;){let i=o.pop(),u=M?M(i):i.nodeType;if(u===G.processingInstruction||u===G.comment&&N(dn,i.data)){try{Z(i)}catch{}continue}if(u===G.element){let d=i,w=_(W?W(i):i.nodeName);try{d.hasAttribute&&d.hasAttribute("patchsrc")&&d.removeAttribute("patchsrc"),d.hasAttribute&&d.hasAttribute("for")&&w!=="label"&&w!=="output"&&d.removeAttribute("for")}catch{}}let m=H(i);if(m)for(let d=m.length-1;d>=0;--d)o.push(m[d])}},Vt=function(e){let o=null,i=null;if(et)e="<remove></remove>"+e;else{let d=rn(e,/^[\r\n\t ]+/);i=d&&d[0]}Re==="application/xhtml+xml"&&de===X&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let u=z?fe(e):e;if(de===X)try{o=new x().parseFromString(u,Re)}catch{}if(!o||!o.documentElement){o=qe.createDocument(de,"template",null);try{o.documentElement.innerHTML=st?ie:u}catch{}}let m=o.body||o.documentElement;return e&&i&&m.insertBefore(r.createTextNode(i),m.childNodes[0]||null),de===X?$n.call(o,ae?"html":"body")[0]:ae?o.documentElement:m},qt=function(e){return Ot.call(e.ownerDocument||e,e,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Pe=function(e){return e=we(e,jn," "),e=we(e,Wn," "),e=we(e,Yn," "),e},ft=function(e){var o;e.normalize();let i=Ot.call(e.ownerDocument||e,e,p.SHOW_TEXT|p.SHOW_COMMENT|p.SHOW_CDATA_SECTION|p.SHOW_PROCESSING_INSTRUCTION,null),u=i.nextNode();for(;u;)u.data=Pe(u.data),u=i.nextNode();let m=(o=e.querySelectorAll)===null||o===void 0?void 0:o.call(e,"template");m&&Te(m,d=>{ge(d.content)&&ft(d.content)})},ke=function(e){let o=W?W(e):null;return typeof o!="string"||_(o)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Xe(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==M(e)||e.childNodes!==H(e)},ge=function(e){if(!M||typeof e!="object"||e===null)return!1;try{return M(e)===G.documentFragment}catch{return!1}},Se=function(e){if(!M||typeof e!="object"||e===null)return!1;try{return typeof M(e)=="number"}catch{return!1}};function V(l,e,o){l.length!==0&&Te(l,i=>{i.call(t,e,o,he)})}let lr=function(e,o){return!!(te&&e.hasChildNodes()&&!Se(e.firstElementChild)&&N(mn,e.textContent)&&N(mn,e.innerHTML)||te&&e.namespaceURI===X&&o==="style"&&Se(e.firstElementChild)||e.nodeType===G.processingInstruction||te&&e.nodeType===G.comment&&N(dn,e.data))},cr=function(e,o){if(!Ae[o]&&Qt(o)&&(S.tagNameCheck instanceof RegExp&&N(S.tagNameCheck,o)||S.tagNameCheck instanceof Function&&S.tagNameCheck(o)))return!1;if(tt&&!Y[o]){let i=j(e),u=H(e);if(u&&i){let m=u.length;for(let d=m-1;d>=0;--d){let w=nt?u[d]:k(u[d],!0);i.insertBefore(w,Ne(e))}}}return ne(e),!0},Kt=function(e,o){if(V(b.beforeSanitizeElements,e,null),e!==o&&j(e)===null)return!0;if(ke(e))return ne(e),!0;let i=_(W?W(e):e.nodeName);if(V(b.uponSanitizeElement,e,{tagName:i,allowedTags:A}),e!==o&&j(e)===null)return!0;if(lr(e,i))return ne(e),!0;if(Ae[i]||!(J.tagCheck instanceof Function&&J.tagCheck(i))&&!A[i]){let m=cr(e,i);return m===!1&&V(b.afterSanitizeElements,e,null),m}if((M?M(e):e.nodeType)===G.element&&!sr(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&N(Gr,e.innerHTML))return ne(e),!0;if(ee&&e.nodeType===G.text){let m=Pe(e.textContent);e.textContent!==m&&(Ee(t.removed,{element:e.cloneNode()}),e.textContent=m)}return V(b.afterSanitizeElements,e,null),!1},Zt=function(e,o,i){if(Ut[o]||te&&o==="patchsrc"||te&&o==="for"&&e!=="label"&&e!=="output"||kt&&(o==="id"||o==="name")&&(i in r||i in tr))return!1;let u=R[o]||J.attributeCheck instanceof Function&&J.attributeCheck(o,e);if(!(Ke&&N(Xn,o))){if(!(Mt&&N(Vn,o))){if(u){if(!ot[o]){if(!N(Ct,we(i,Nt,""))){if(!((o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&on(i,"data:")===0&&Ht[e])){if(!(vt&&!N(qn,we(i,Nt,"")))){if(i)return!1}}}}}else if(!(Qt(e)&&(S.tagNameCheck instanceof RegExp&&N(S.tagNameCheck,e)||S.tagNameCheck instanceof Function&&S.tagNameCheck(e))&&(S.attributeNameCheck instanceof RegExp&&N(S.attributeNameCheck,o)||S.attributeNameCheck instanceof Function&&S.attributeNameCheck(o,e))||o==="is"&&S.allowCustomizedBuiltInElements&&(S.tagNameCheck instanceof RegExp&&N(S.tagNameCheck,i)||S.tagNameCheck instanceof Function&&S.tagNameCheck(i))))return!1}}return!0},ur=g({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Qt=function(e){return!ur[Le(e)]&&N(Kn,e)},fr=function(e,o,i,u){if(z&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!i)switch(y.getAttributeType(e,o)){case"TrustedHTML":return fe(u);case"TrustedScriptURL":return Fn(u)}return u},pr=function(e,o,i,u){try{i?e.setAttributeNS(i,o,u):e.setAttribute(o,u),ke(e)?ne(e):nn(t.removed)}catch{le(o,e)}},Jt=function(e){V(b.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||ke(e))return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},u=o.length,m=_(e.nodeName);for(;u--;){let d=o[u],w=d.name,U=d.namespaceURI,$=d.value,F=_(w),B=$,v=w==="value"?B:Rr(B);if(i.attrName=F,i.attrValue=v,i.keepAttr=!0,i.forceKeepAttr=void 0,V(b.uponSanitizeAttribute,e,i),v=i.attrValue,zt&&(F==="id"||F==="name")&&on(v,Ft)!==0&&(le(w,e),v=Ft+v),te&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,v)){le(w,e);continue}if(F==="attributename"&&rn(v,"href")){le(w,e);continue}if(!i.forceKeepAttr){if(!i.keepAttr){le(w,e);continue}if(!Pt&&N($r,v)){le(w,e);continue}if(ee&&(v=Pe(v)),!Zt(m,F,v)){le(w,e);continue}v=fr(m,F,U,v),v!==B&&pr(e,w,U,v)}}V(b.afterSanitizeAttributes,e,null)},ze=function(e){let o=null,i=qt(e);for(V(b.beforeSanitizeShadowDOM,e,null);o=i.nextNode();)if(V(b.uponSanitizeShadowNode,o,null),Kt(o,e),Jt(o),ge(o.content)&&ze(o.content),(M?M(o):o.nodeType)===G.element){let m=wt(o);ge(m)&&(pt(m),ze(m))}V(b.afterSanitizeShadowDOM,e,null)},pt=function(e){let o=[{node:e,shadow:null}];for(;o.length>0;){let i=o.pop();if(i.shadow){ze(i.shadow);continue}let u=i.node,d=(M?M(u):u.nodeType)===G.element,w=H(u);if(w)for(let U=w.length-1;U>=0;--U)o.push({node:w[U],shadow:null});if(d){let U=W?W(u):null;if(typeof U=="string"&&_(U)==="template"){let $=u.content;ge($)&&o.push({node:$,shadow:null})}}if(d){let U=wt(u);ge(U)&&o.push({node:null,shadow:U},{node:U,shadow:null})}}};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,i=null,u=null,m=null;if(st=!l,st&&(l="<!-->"),typeof l!="string"&&!Se(l)&&(l=Or(l),typeof l!="string"))throw ce("dirty is not a string, aborting");if(!t.isSupported)return l;Ze?(A=Qe,R=Je):ct(e),(b.uponSanitizeElement.length>0||b.uponSanitizeAttribute.length>0)&&(A=P(A)),b.uponSanitizeAttribute.length>0&&(R=P(R)),t.removed=[];let d=nt&&typeof l!="string"&&Se(l);if(d){ar(l);let F=W?W(l):l.nodeName;if(typeof F=="string"){let B=_(F);if(!A[B]||Ae[B])throw ve(l),ce("root node is forbidden and cannot be sanitized in-place")}if(ke(l))throw ve(l),ce("root node is clobbered and cannot be sanitized in-place");try{pt(l)}catch(B){throw ve(l),B}}else if(Se(l))o=Vt("<!---->"),i=o.ownerDocument.importNode(l,!0),i.nodeType===G.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?o=i:o.appendChild(i),pt(i);else{if(!pe&&!ee&&!ae&&l.indexOf("<")===-1)return z&&De?fe(l):l;if(o=Vt(l),!o)return pe?null:De?ie:""}o&&et&&ne(o.firstChild);let w=d?l:o,U=qt(w);try{for(;u=U.nextNode();)Kt(u,w),Jt(u),ge(u.content)&&ze(u.content)}catch(F){throw d&&(ve(l),Te(t.removed,B=>{B.element&&ut(B.element)})),F}if(d)return Te(t.removed,F=>{F.element&&ut(F.element)}),ee&&ft(l),l;if(pe){if(ee&&ft(o),Ie)for(m=Gn.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(R.shadowroot||R.shadowrootmode)&&(m=Bn.call(s,m,!0)),m}let $=ae?o.outerHTML:o.innerHTML;return ae&&A["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&N(Fr,o.ownerDocument.doctype.name)&&($="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
3
+ `+$),ee&&($=Pe($)),z&&De?fe($):$},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(l),Ze=!0,Qe=A,Je=R},t.clearConfig=function(){he=null,Ze=!1,Qe=null,Je=null,z=Ve,ie=""},t.isValidAttribute=function(l,e,o){he||ct({});let i=_(l),u=_(e);return Zt(i,u,o)},t.addHook=function(l,e){typeof e=="function"&&C(b,l)&&Ee(b[l],e)},t.removeHook=function(l,e){if(C(b,l)){if(e!==void 0){let o=br(b[l],e);return o===-1?void 0:Ar(b[l],o,1)[0]}return nn(b[l])}},t.removeHooks=function(l){C(b,l)&&(b[l]=[])},t.removeAllHooks=function(){b=hn()},t}var _n=En();var He=_n(globalThis.window);var ue=n=>Object.prototype.toString.call(n).slice(8,-1),O=n=>typeof n=="string"||n instanceof String;var yn=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","afp","afs","agtp","aim","amss","android","appdata","apt","ar","ari","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","bl","blob","bluetooth","bolo","brid","browserext","cabal","caip","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cttps","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dilithium3","dis","dlna-playcontainer","dlna-playsingle","dnp","dns","dntp","doi","donau","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","esim","ethereum","example","ez","facetime","feed","feedready","fido","file","finger","first-run-pen-experience","fish","fm","ftp","fuchsia-pkg","geo","gg","git","gitoid","gizmoproject","go","gopher","graph","gtalk","h323","ham","hcap","hcp","hs20","http","https","hxxp","hxxps","hydrazone","hyper","i0","iax","ibi","ibi-","icap","icon","ilstring","im","imap","info","iotdisco","ipfs","ipn","ipns","ipp","ipps","irc","irc6","ircs","iris","iris.beep","iris.lwz","iris.xpc","iris.xpcs","isostore","itms","jabber","jar","jms","keyparc","lastfm","lbry","ldap","ldaps","leaptofrogans","lid","linkid","lorawan","lpa","lvlt","machineProvisioningProgressReporter","magnet","mailto","maps","market","matrix","mdoc","mdoc-openid4vp","message","microsoft.windows.camera","microsoft.windows.camera.multipicker","microsoft.windows.camera.picker","mid","mms","mongodb","moz","moz-extension","mqtt","mqtts","ms-access","ms-appinstaller","ms-browser-extension","ms-calculator","ms-drive-to","ms-enrollment","ms-excel","ms-eyecontrolspeech","ms-gamebarservices","ms-gamingoverlay","ms-getoffice","ms-help","ms-infopath","ms-inputapp","ms-launchremotedesktop","ms-lockscreencomponent-config","ms-media-stream-id","ms-meetnow","ms-mixedrealitycapture","ms-mobileplans","ms-newsandinterests","ms-officeapp","ms-people","ms-personacard","ms-powerpoint","ms-project","ms-publisher","ms-recall","ms-remotedesktop","ms-remotedesktop-launch","ms-restoretabcompanion","ms-screenclip","ms-screensketch","ms-search","ms-search-repair","ms-secondary-screen-controller","ms-secondary-screen-setup","ms-settings","ms-settings-airplanemode","ms-settings-bluetooth","ms-settings-camera","ms-settings-cellular","ms-settings-cloudstorage","ms-settings-connectabledevices","ms-settings-displays-topology","ms-settings-emailandaccounts","ms-settings-language","ms-settings-location","ms-settings-lock","ms-settings-nfctransactions","ms-settings-notifications","ms-settings-power","ms-settings-privacy","ms-settings-proximity","ms-settings-screenrotation","ms-settings-wifi","ms-settings-workplace","ms-spd","ms-stickers","ms-sttoverlay","ms-transit-to","ms-useractivityset","ms-uup","ms-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-widgetboard","ms-widgets","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mtrust","mumble","mupdate","musik","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","nostr","notes","npamp","num","ocf","oid","onenote","onenote-cmd","opaquelocktoken","openid","openpgp4fpr","otpauth","palm","paparazzi","payto","pkcs11","platform","pop","pres","proxy","psyc","pttp","pwid","qb","query","quic-transport","redis","rediss","reload","res","resource","rmi","rsync","rtmfp","rtmp","rtsp","rtsps","rtspu","sarif","secondlife","secret-token","service","session","sftp","sgn","shc","shelter","sieve","simpleledger","simplex","sip","sips","skype","smb","smp","sms","smtp","snmp","soap.beep","soap.beeps","soldat","spacify","spiffe","spotify","ssb","ssh","sss","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","teapot","teapots","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","tttps","turn","turns","tv","udp","unreal","upn","urn","ust","ut2004","uuaid","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wasm","wasm-js","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcompute","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s","ztdnaid"];var bn=/(?:#|%23)$/,An=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var Rn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,Sn=/^((?:[^#%]|%(?!23))*)(?:\?|%3F)$/i,yt=/^[a-z][\da-z+.-]*$/,wn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,Oe=/^(?:java|vb)script$/i,bt=/^(?:(?:java|vb)script|blob)$/i,Ge=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,xn=/^%[\dA-F]{2}$/i,At=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i,Ln=/(?:%[\dA-F]{2})+/gi,On=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Nn=[9,10,13,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];var Rt=new Set(Nn),$e=new Map([[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),qr=()=>{let n=new Map;for(let t=0;t<256;t++)!Rt.has(t)&&!$e.has(t)&&n.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return n},Be=qr();var[ye,Zr,Qr,Jr,eo,to]=["&","#","<",">",'"',"'"].map(n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`),no={[ye]:`${ye}amp;`,[Qr]:`${ye}lt;`,[Jr]:`${ye}gt;`,[eo]:`${ye}quot;`,[to]:`${ye}${Zr}39;`},ko=Array.from({length:256},(n,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),In=globalThis.process?.versions?.node!==void 0,ro=new RegExp(`[${[...Be.values()].join("")}]`),oo=new RegExp(`[${[...Be.values()].join("")}]`,"g"),zo=new TextEncoder,so=new TextDecoder("utf-8",{fatal:!0}),We=class{#e=new Set(yn);get(){return[...this.#e]}has(t){return O(t)?this.#e.has(t.trim().toLowerCase()):!1}verify(t,r=this.#e){if(!O(t))return!1;let s=t.normalize("NFKC"),a=URL.parse(s);if(!a)return!1;let c=a.protocol.replace(/:$/,""),f=c.split("+");return f.some(p=>Oe.test(p))?!1:wn.test(c)||f.every(p=>r.has(p))}};var Dn=n=>{if(!O(n))return n;let t=xn.test(n)?n.toUpperCase():n;return no[t]??n},Un=n=>{if(!O(n))throw new TypeError(`Expected String but got ${ue(n)}.`);let t=n.replace(/\s/g,""),r;try{r=atob(t)}catch{throw new Error(`Invalid base64 data: ${n}`)}let s;if(In&&globalThis.Buffer)s=globalThis.Buffer.from(r,"latin1");else{let a=r.length;s=new Uint8Array(a);for(let c=0;c<a;c++)s[c]=r.charCodeAt(c)}try{let a=so.decode(s);return ro.test(a)?t:a}catch{return t}},io=(n,t)=>{let r=/x/i.test(t[0])?parseInt(t.substring(1),16):parseInt(t,10);if(Number.isInteger(r)){if(Rt.has(r))return String.fromCharCode(r);if($e.has(r)){let s=$e.get(r);return String.fromCodePoint(s)}else if(Be.has(r))return""}return n},Mn=n=>O(n)?n.replace(bn,"").replace(Sn,"$1"):n,vn=(n,t=0)=>{if(!O(n))throw new TypeError(`Expected String but got ${ue(n)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${ue(t)}.`);let r;try{r=decodeURIComponent(n)}catch{r=n.replace(Ln,a=>{try{return decodeURIComponent(a)}catch{return a}})}r=r.replace(oo,"");let s=0;for(;s+t<=16;s++){let a=r;if(r=r.replace(/&amp;/gi,"&").replace(Rn,io),r===a)break}if(s+t>16&&/&#/.test(r))throw new Error("Character references nested too deeply.");return r},ao=async n=>{let t=n.type?`${n.type};base64`:"base64",r=await n.arrayBuffer(),s=globalThis.Buffer.from(r).toString("base64");return`data:${t},${s}`},lo=n=>new Promise((t,r)=>{let s=new globalThis.FileReader;s.addEventListener("error",()=>r(s.error)),s.addEventListener("abort",()=>t(null)),s.addEventListener("load",()=>t(s.result)),s.readAsDataURL(n)}),co=async n=>{let t=n.type?`${n.type};base64`:"base64",r=await n.arrayBuffer(),s=new Uint8Array(r),a=[];for(let c=0;c<s.length;c+=8192)a.push(String.fromCharCode(...s.subarray(c,c+8192)));return`data:${t},${btoa(a.join(""))}`},Pn=async(n,t=16777216)=>{if(Number.isInteger(n?.size)){if(Number.isInteger(t)&&n.size>t){let r=`Blob size (${n.size} bytes) exceeds max (${t} bytes).`;throw new DOMException(r,"NotReadableError")}}else return null;return In&&globalThis.Buffer?ao(n):globalThis.FileReader?lo(n):co(n)};var uo=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),fo=Object.freeze({RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,RETURN_TRUSTED_TYPE:!1}),K=(n,t,r)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,r)},St=class n extends We{#e;static#t=null;static#n=null;static#s(t,r){if(!r.attrValue||!/^\s*data:/i.test(r.attrValue))return;let s=n.#t,a=n.#n;if(!s||!a)return;let c=URL.parse(r.attrValue);if(c&&c.protocol==="data:"){let f=r.attrValue;if(a.recurse||(a.recurse=new Set),a.recurse.has(f)){let h=`Circular Data URL detected and skipped: ${f}`;K(a.debug,h),r.attrValue="";return}a.nest++,a.recurse.add(f);try{let h=s.#o(f,{allow:["data"],deny:[],only:[],allowRelative:!1},a);r.attrValue=h||""}finally{a.nest--,a.recurse.delete(f)}}}static{He.setConfig(fo),He.addHook("uponSanitizeAttribute",n.#s)}constructor(){super(),this.#e=new Set(super.get())}#r(t,r,s,a,c){if(bt.test(t))return!1;if(t.split("+").some(p=>Oe.test(p))||!yt.test(t)){let p=`Failed to add scheme '${t}' in '${r}' list.`;return K(c.debug,p),!1}return a.set(t,!0),s.add(t),!0}#i(t,r){let s=t;try{s=decodeURIComponent(t)}catch{}let a=n.#t,c=n.#n;n.#t=this,n.#n=r;let f;try{f=r.domPurify.sanitize(s)}finally{n.#t=a,n.#n=c}f=Mn(f);try{return encodeURI(f)}catch{return f}}#o(t,r,s){if(s.nest>16)throw new Error("Data URLs nested too deeply.");let{allowedSchemes:a,restrictScheme:c,schemeMap:f}=this.#a(r,s),{isDataUrl:h,isRelative:p,isVerified:T,scheme:x,schemeParts:y,urlObj:E,urlToSanitize:k}=this.#l(t,r.allowRelative,a,s);return!T||!this.#c(x,y,c,f,p)?null:h?this.#u(E,x,s):this.#f(k)}#a({allow:t,deny:r,only:s},a){let c=this.#e,f=!1,h=new Map(a.schemeMap);if(s.length){c=new Set;for(let p of s)O(p)&&this.#r(p.trim(),"only",c,h,a)&&!f&&(f=!0)}else{if(t.length){c=new Set(this.#e);for(let p of t)O(p)&&this.#r(p.trim(),"allow",c,h,a)}if(r.length)for(let p of r)O(p)&&(p=p.trim(),p&&h.set(p,!1))}return{allowedSchemes:c,restrictScheme:f,schemeMap:h}}#l(t,r,s,a){let c=super.verify(t,s),f=!1,h="";if(!c&&r&&!On.test(t)){let y=t.normalize("NFKC"),E=URL.parse(t,"http://dummy.local"),k=URL.parse(y,"http://dummy.local");E&&k?E.protocol==="http:"&&E.hostname==="dummy.local"&&k.protocol==="http:"&&(c=!0,f=!0,h=`${E.pathname}${E.search}${E.hash}`):K(a.debug,"Failed to parse relative URL.")}if(!c)return{isVerified:!1};if(f)return{isRelative:f,isVerified:c,isDataUrl:!1,scheme:"",schemeParts:[],urlToSanitize:h};let p=URL.parse(t),T=p.protocol.replace(/:$/,"").normalize("NFKC"),x=T.split("+");return{isRelative:f,isVerified:c,scheme:T,schemeParts:x,urlObj:p,isDataUrl:x.includes("data"),urlToSanitize:p.href}}#c(t,r,s,a,c){if(c)return!0;if(s)return r.every(f=>a.get(f));for(let[f,h]of a.entries())if(!(h||t!==f&&r.every(T=>T!==f)))return!1;return!0}#u(t,r,s){let[a,...c]=t.pathname.split(","),f=`${c.join(",")}${t.search}${t.hash}`,h=a.split(";"),p=h[h.length-1]==="base64",T=f;if(p)try{T=Un(f)}catch(x){return K(s.debug,"Failed to parse base64 data.",x),null}try{let y=vn(T).trim().normalize("NFKC"),k=URL.parse(y,"http://dummy.local");if(!k)return K(s.debug,"Failed to parse inner data URL protocol."),null;if(k.protocol.replace(/:$/,"").split("+").some(H=>bt.test(H)))return null}catch(x){return K(s.debug,"Failed to parse inner data URL protocol.",x),null}return(!a||An.test(a))&&(T=this.#i(T,s)),T?(p&&T!==f&&h.pop(),`${r}:${h.join(";")},${T}`):null}#f(t){let r=t;if(Ge.test(r)){let{index:s}=Ge.exec(r);r=r.substring(0,s).replace(/[?&]$/,"")}if(At.test(r)){let{index:s}=At.exec(r);r=r.substring(0,s).replace(/[?&]$/,"")}return r}sanitize(t,r){if(!t||!O(t))return null;let s=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0;if(s&&t.length>s){let h=`URL length ${t.length} exceeds maxLength ${s}.`;throw new RangeError(h)}if(!(r&&(Array.isArray(r.deny)&&r.deny.length>0||Array.isArray(r.only)&&r.only.length>0||r.allowRelative))&&(t.startsWith("https://")||t.startsWith("http://"))&&!Ge.test(t)&&!t.includes("data:")){let h=URL.parse(t);return h?h.href.replace(/%26/g,Dn):(K(r?.debug,"Failed to parse URL."),null)}let c={allow:Array.isArray(r?.allow)?r.allow:[],deny:Array.isArray(r?.deny)?r.deny:[],only:Array.isArray(r?.only)?r.only:[],allowRelative:!!r?.allowRelative},f={debug:!!r?.debug,domPurify:He,nest:0,recurse:null,schemeMap:new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]])};return this.#o(t,c,f)}inspect(t,r){if(!O(t))throw new TypeError(`Expected String but got ${ue(t)}.`);let s={input:t,valid:!1},a,c=null,f=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0,h=t.length;if(f&&h>f)c=`URL length ${h} exceeds maxLength ${f}.`;else if(this.verify(t)){let{protocol:p}=new URL(t);if(p==="blob:")a=t;else try{a=this.sanitize(t,r??{allow:["data"]}),a||(c="Sanitization failed (blocked by allowed schemes or rules).")}catch(T){c=T.message}}else c="Invalid URI syntax or scheme is not registered.";if(a){let p=new URL(a),{pathname:T,protocol:x}=p,E=x.replace(/:$/,"").split("+").includes("data");if(s.valid=!0,E){let[k,...Z]=T.split(","),Ne=`${Z.join(",")}${p.search}${p.hash}`,H=k.split(";"),j=H[H.length-1]==="base64";j&&H.pop(),s.data={mime:H.join(";"),base64:j,data:Ne}}else s.data=null;for(let k of uo){let Z=p[k];O(Z)&&(s[k]=Z)}}else s.valid=!1,c&&(s.reason=c);return s}get(){return[...this.#e]}has(t){return O(t)?this.#e.has(t.trim().toLowerCase()):!1}add(t){let r;if(O(t))r=t.trim().toLowerCase();else throw new TypeError(`Expected String but got ${ue(t)}.`);if(r.split("+").some(c=>Oe.test(c))||!yt.test(r))throw new Error(`Invalid scheme: ${t}`);return this.#e.add(r),[...this.#e]}remove(t){return O(t)?this.#e.delete(t.trim().toLowerCase()):!1}reset(){this.#e=new Set(super.get())}verify(t,r=this.#e){return super.verify(t,r)}};var se=new St,po=async(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216})=>{let r=!!t?.debug,s=Number.isInteger(t?.maxBlobSize)&&t.maxBlobSize>0?t.maxBlobSize:16777216,a;if(n&&O(n)){let c,f=URL.parse(n);if(f?c=f.protocol.replace(/:$/,""):K(r,`Invalid URL input format: ${n}`),c==="blob"){let{allow:h,deny:p,only:T}=t;if(Array.isArray(h)&&h.includes("blob")&&!(Array.isArray(p)&&p.includes("blob"))||Array.isArray(T)&&T.includes("blob")){let x;try{x=await fetch(n).then(y=>y.blob()).then(y=>Pn(y,s))}catch(y){let E=`Failed to fetch and convert blob URL: ${n}`;K(r,E,y)}if(x){let y={...t};Array.isArray(t.only)?y.only=t.only.includes("data")?t.only:[...t.only,"data"]:Array.isArray(t.allow)&&(y.allow=t.allow.includes("data")?t.allow:[...t.allow,"data"],Array.isArray(t.deny)&&(y.deny=t.deny.filter(E=>E!=="data"))),a=se.sanitize(x,y)}}t?.revokeObjectURL&&URL.revokeObjectURL(n)}else(c||t.allowRelative)&&(a=se.sanitize(n,t))}return a||null},mo=(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1})=>{let r=!!t?.debug,s;if(n&&O(n)){let a,c=URL.parse(n);if(c?a=c.protocol.replace(/:$/,""):K(r,`Invalid URL input format: ${n}`),a==="blob")return t?.revokeObjectURL&&URL.revokeObjectURL(n),null;(a||t.allowRelative)&&(s=se.sanitize(n,t))}return s||null},kn=async n=>se.inspect(n),ho=async n=>kn(n),zn=n=>se.inspect(n),go=n=>zn(n),To=async n=>se.verify(n),Eo=n=>se.verify(n),_o=se;export{_o as default,kn as inspectURL,zn as inspectURLSync,To as isURI,Eo as isURISync,ho as parseURL,go as parseURLSync,po as sanitizeURL,mo as sanitizeURLSync};
4
4
  /*!
5
5
  * URL Sanitizer
6
6
  *