url-sanitizer 4.1.2 → 4.1.4

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
- function rn(n,t){(t==null||t>n.length)&&(t=n.length);for(var o=0,s=Array(t);o<t;o++)s[o]=n[o];return s}function fr(n){if(Array.isArray(n))return n}function ur(n,t){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var s,i,l,u,g=[],h=!0,k=!1;try{if(l=(o=o.call(n)).next,t!==0)for(;!(h=(s=l.call(o)).done)&&(g.push(s.value),g.length!==t);h=!0);}catch(R){k=!0,i=R}finally{try{if(!h&&o.return!=null&&(u=o.return(),Object(u)!==u))return}finally{if(k)throw i}}return g}}function pr(){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 mr(n,t){return fr(n)||ur(n,t)||dr(n,t)||pr()}function dr(n,t){if(n){if(typeof n=="string")return rn(n,t);var o={}.toString.call(n).slice(8,-1);return o==="Object"&&n.constructor&&(o=n.constructor.name),o==="Map"||o==="Set"?Array.from(n):o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?rn(n,t):void 0}}var En=Object.entries,on=Object.setPrototypeOf,hr=Object.isFrozen,gr=Object.getPrototypeOf,Tr=Object.getOwnPropertyDescriptor,M=Object.freeze,v=Object.seal,we=Object.create,yn=typeof Reflect<"u"&&Reflect,Rt=yn.apply,St=yn.construct;M||(M=function(t){return t});v||(v=function(t){return t});Rt||(Rt=function(t,o){for(var s=arguments.length,i=new Array(s>2?s-2:0),l=2;l<s;l++)i[l-2]=arguments[l];return t.apply(o,i)});St||(St=function(t){for(var o=arguments.length,s=new Array(o>1?o-1:0),i=1;i<o;i++)s[i-1]=arguments[i];return new t(...s)});var De=O(Array.prototype.forEach),Er=O(Array.prototype.lastIndexOf),sn=O(Array.prototype.pop),Se=O(Array.prototype.push),yr=O(Array.prototype.splice),ce=Array.isArray,Ue=O(String.prototype.toLowerCase),Et=O(String.prototype.toString),an=O(String.prototype.match),Me=O(String.prototype.replace),cn=O(String.prototype.indexOf),_r=O(String.prototype.trim),br=O(Number.prototype.toString),Ar=O(Boolean.prototype.toString),ln=typeof BigInt>"u"?null:O(BigInt.prototype.toString),fn=typeof Symbol>"u"?null:O(Symbol.prototype.toString),C=O(Object.prototype.hasOwnProperty),ve=O(Object.prototype.toString),D=O(RegExp.prototype.test),de=Rr(TypeError);function O(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,s=new Array(o>1?o-1:0),i=1;i<o;i++)s[i-1]=arguments[i];return Rt(n,t,s)}}function Rr(n){return function(){for(var t=arguments.length,o=new Array(t),s=0;s<t;s++)o[s]=arguments[s];return St(n,o)}}function m(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ue;if(on&&on(n,null),!ce(t))return n;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let l=o(i);l!==i&&(hr(t)||(t[s]=l),i=l)}n[i]=!0}return n}function Sr(n){for(let t=0;t<n.length;t++)C(n,t)||(n[t]=null);return n}function F(n){let t=we(null);for(let s of En(n)){var o=mr(s,2);let i=o[0],l=o[1];C(n,i)&&(ce(l)?t[i]=Sr(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=F(l):t[i]=l)}return t}function wr(n){switch(typeof n){case"string":return n;case"number":return br(n);case"boolean":return Ar(n);case"bigint":return ln?ln(n):"0";case"symbol":return fn?fn(n):"Symbol()";case"undefined":return ve(n);case"function":case"object":{if(n===null)return ve(n);let t=n,o=J(t,"toString");if(typeof o=="function"){let s=o(t);return typeof s=="string"?s:ve(s)}return ve(n)}default:return ve(n)}}function J(n,t){for(;n!==null;){let s=Tr(n,t);if(s){if(s.get)return O(s.get);if(typeof s.value=="function")return O(s.value)}n=gr(n)}function o(){return null}return o}function xr(n){try{return D(n,""),!0}catch{return!1}}var un=M(["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"]),yt=M(["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"]),_t=M(["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"]),Or=M(["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"]),bt=M(["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"]),Lr=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pn=M(["#text"]),mn=M(["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"]),At=M(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),dn=M(["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"]),Ye=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Nr=v(/{{[\w\W]*|^[\w\W]*}}/g),Ir=v(/<%[\w\W]*|^[\w\W]*%>/g),Cr=v(/\${[\w\W]*/g),Dr=v(/^data-[\-\w.\u00B7-\uFFFF]+$/),Mr=v(/^aria-[\-\w]+$/),hn=v(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vr=v(/^(?:\w+script|data):/i),Ur=v(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Pr=v(/^html$/i),kr=v(/^[a-z][.\w]*(-[.\w]+)+$/i),gn=v(/<[/\w!]/g),zr=v(/<[/\w]/g),Fr=v(/<\/no(script|embed|frames)/i),Hr=v(/\/>/i),Q={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Gr=function(){return typeof window>"u"?null:window},$r=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,i="data-tt-policy-suffix";o&&o.hasAttribute(i)&&(s=o.getAttribute(i));let l="dompurify"+(s?"#"+s:"");try{return t.createPolicy(l,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},Tn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ae=function(t,o,s,i){return C(t,o)&&ce(t[o])?m(i.base?F(i.base):{},t[o],i.transform):s};function _n(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gr(),t=c=>_n(c);if(t.version="3.4.11",t.removed=[],!n||!n.document||n.document.nodeType!==Q.document||!n.Element)return t.isSupported=!1,t;let o=n.document,s=o,i=s.currentScript;n.DocumentFragment;let l=n.HTMLTemplateElement,u=n.Node,g=n.Element,h=n.NodeFilter,k=n.NamedNodeMap;k===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let R=n.DOMParser,H=n.trustedTypes,L=g.prototype,W=J(L,"cloneNode"),ue=J(L,"remove"),T=J(L,"nextSibling"),U=J(L,"childNodes"),Y=J(L,"parentNode"),Oe=J(L,"shadowRoot"),ge=J(L,"attributes"),N=u&&u.prototype?J(u.prototype,"nodeType"):null,G=u&&u.prototype?J(u.prototype,"nodeName"):null;if(typeof l=="function"){let c=o.createElement("template");c.content&&c.content.ownerDocument&&(o=c.content.ownerDocument)}let w,X="",E,B=!1,$=0,Te=function(){if($>0)throw de('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.')},V=function(e){Te(),$++;try{return w.createHTML(e)}finally{$--}},ke=function(e){Te(),$++;try{return w.createScriptURL(e)}finally{$--}},ee=function(){return B||(E=$r(H,i),B=!0),E},te=o,Ee=te.implementation,ze=te.createNodeIterator,It=te.createDocumentFragment,et=te.getElementsByTagName,Hn=s.importNode,S=Tn();t.isSupported=typeof En=="function"&&typeof Y=="function"&&Ee&&Ee.createHTMLDocument!==void 0;let Gn=Nr,$n=Ir,Bn=Cr,jn=Dr,Wn=Mr,Yn=vr,Ct=Ur,Xn=kr,Dt=hn,y=null,Mt=m({},[...un,...yt,..._t,...bt,...pn]),_=null,vt=m({},[...mn,...At,...dn,...Ye]),b=Object.seal(we(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}})),Le=null,Ut=null,oe=Object.seal(we(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Pt=!0,tt=!0,kt=!1,zt=!0,se=!1,Ne=!0,pe=!1,nt=!1,rt=null,ot=null,st=!1,ye=!1,Fe=!1,He=!1,Ft=!0,Ht=!1,Gt="user-content-",it=!0,at=!1,_e={},K=null,ct=m({},["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"]),$t=null,Bt=m({},["audio","video","img","source","image","track"]),lt=null,jt=m({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ge="http://www.w3.org/1998/Math/MathML",$e="http://www.w3.org/2000/svg",Z="http://www.w3.org/1999/xhtml",be=Z,ft=!1,ut=null,Vn=m({},[Ge,$e,Z],Et),Wt=M(["mi","mo","mn","ms","mtext"]),pt=m({},Wt),Yt=M(["annotation-xml"]),mt=m({},Yt),qn=m({},["title","style","font","a","script"]),Ie=null,Kn=["application/xhtml+xml","text/html"],Zn="text/html",A=null,Ae=null,Qn=o.createElement("form"),Xt=function(e){return e instanceof RegExp||e instanceof Function},dt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ae&&Ae===e)return;(!e||typeof e!="object")&&(e={}),e=F(e),Ie=Kn.indexOf(e.PARSER_MEDIA_TYPE)===-1?Zn:e.PARSER_MEDIA_TYPE,A=Ie==="application/xhtml+xml"?Et:Ue,y=ae(e,"ALLOWED_TAGS",Mt,{transform:A}),_=ae(e,"ALLOWED_ATTR",vt,{transform:A}),ut=ae(e,"ALLOWED_NAMESPACES",Vn,{transform:Et}),lt=ae(e,"ADD_URI_SAFE_ATTR",jt,{transform:A,base:jt}),$t=ae(e,"ADD_DATA_URI_TAGS",Bt,{transform:A,base:Bt}),K=ae(e,"FORBID_CONTENTS",ct,{transform:A}),Le=ae(e,"FORBID_TAGS",F({}),{transform:A}),Ut=ae(e,"FORBID_ATTR",F({}),{transform:A}),_e=C(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?F(e.USE_PROFILES):e.USE_PROFILES:!1,Pt=e.ALLOW_ARIA_ATTR!==!1,tt=e.ALLOW_DATA_ATTR!==!1,kt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,zt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=e.SAFE_FOR_TEMPLATES||!1,Ne=e.SAFE_FOR_XML!==!1,pe=e.WHOLE_DOCUMENT||!1,ye=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,He=e.RETURN_TRUSTED_TYPE||!1,st=e.FORCE_BODY||!1,Ft=e.SANITIZE_DOM!==!1,Ht=e.SANITIZE_NAMED_PROPS||!1,it=e.KEEP_CONTENT!==!1,at=e.IN_PLACE||!1,Dt=xr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:hn,be=typeof e.NAMESPACE=="string"?e.NAMESPACE:Z,pt=C(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?F(e.MATHML_TEXT_INTEGRATION_POINTS):m({},Wt),mt=C(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?F(e.HTML_INTEGRATION_POINTS):m({},Yt);let r=C(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?F(e.CUSTOM_ELEMENT_HANDLING):we(null);if(b=we(null),C(r,"tagNameCheck")&&Xt(r.tagNameCheck)&&(b.tagNameCheck=r.tagNameCheck),C(r,"attributeNameCheck")&&Xt(r.attributeNameCheck)&&(b.attributeNameCheck=r.attributeNameCheck),C(r,"allowCustomizedBuiltInElements")&&typeof r.allowCustomizedBuiltInElements=="boolean"&&(b.allowCustomizedBuiltInElements=r.allowCustomizedBuiltInElements),v(b),se&&(tt=!1),Fe&&(ye=!0),_e&&(y=m({},pn),_=we(null),_e.html===!0&&(m(y,un),m(_,mn)),_e.svg===!0&&(m(y,yt),m(_,At),m(_,Ye)),_e.svgFilters===!0&&(m(y,_t),m(_,At),m(_,Ye)),_e.mathMl===!0&&(m(y,bt),m(_,dn),m(_,Ye))),oe.tagCheck=null,oe.attributeCheck=null,C(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?oe.tagCheck=e.ADD_TAGS:ce(e.ADD_TAGS)&&(y===Mt&&(y=F(y)),m(y,e.ADD_TAGS,A))),C(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?oe.attributeCheck=e.ADD_ATTR:ce(e.ADD_ATTR)&&(_===vt&&(_=F(_)),m(_,e.ADD_ATTR,A))),C(e,"ADD_URI_SAFE_ATTR")&&ce(e.ADD_URI_SAFE_ATTR)&&m(lt,e.ADD_URI_SAFE_ATTR,A),C(e,"FORBID_CONTENTS")&&ce(e.FORBID_CONTENTS)&&(K===ct&&(K=F(K)),m(K,e.FORBID_CONTENTS,A)),C(e,"ADD_FORBID_CONTENTS")&&ce(e.ADD_FORBID_CONTENTS)&&(K===ct&&(K=F(K)),m(K,e.ADD_FORBID_CONTENTS,A)),it&&(y["#text"]=!0),pe&&m(y,["html","head","body"]),y.table&&(m(y,["tbody"]),delete Le.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw de('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=w;w=e.TRUSTED_TYPES_POLICY;try{X=V("")}catch(f){throw w=a,f}}else e.TRUSTED_TYPES_POLICY===null?(w=void 0,X=""):(w===void 0&&(w=ee()),w&&typeof X=="string"&&(X=V("")));M&&M(e),Ae=e},Vt=m({},[...yt,..._t,...Or]),qt=m({},[...bt,...Lr]),Jn=function(e,r,a){return r.namespaceURI===Z?e==="svg":r.namespaceURI===Ge?e==="svg"&&(a==="annotation-xml"||pt[a]):!!Vt[e]},er=function(e,r,a){return r.namespaceURI===Z?e==="math":r.namespaceURI===$e?e==="math"&&mt[a]:!!qt[e]},tr=function(e,r,a){return r.namespaceURI===$e&&!mt[a]||r.namespaceURI===Ge&&!pt[a]?!1:!qt[e]&&(qn[e]||!Vt[e])},nr=function(e){let r=Y(e);(!r||!r.tagName)&&(r={namespaceURI:be,tagName:"template"});let a=Ue(e.tagName),f=Ue(r.tagName);return ut[e.namespaceURI]?e.namespaceURI===$e?Jn(a,r,f):e.namespaceURI===Ge?er(a,r,f):e.namespaceURI===Z?tr(a,r,f):!!(Ie==="application/xhtml+xml"&&ut[e.namespaceURI]):!1},ie=function(e){Se(t.removed,{element:e});try{Y(e).removeChild(e)}catch{if(ue(e),!Y(e))throw de("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Kt=function(e){let r=U(e);if(r){let f=[];De(r,p=>{Se(f,p)}),De(f,p=>{try{ue(p)}catch{}})}let a=ge(e);if(a)for(let f=a.length-1;f>=0;--f){let p=a[f],d=p&&p.name;if(typeof d=="string")try{e.removeAttribute(d)}catch{}}},me=function(e,r){try{Se(t.removed,{attribute:r.getAttributeNode(e),from:r})}catch{Se(t.removed,{attribute:null,from:r})}if(r.removeAttribute(e),e==="is")if(ye||Fe)try{ie(r)}catch{}else try{r.setAttribute(e,"")}catch{}},rr=function(e){let r=ge(e);if(r)for(let a=r.length-1;a>=0;--a){let f=r[a],p=f&&f.name;if(!(typeof p!="string"||_[A(p)]))try{e.removeAttribute(p)}catch{}}},or=function(e){let r=[e];for(;r.length>0;){let a=r.pop();(N?N(a):a.nodeType)===Q.element&&rr(a);let p=U(a);if(p)for(let d=p.length-1;d>=0;--d)r.push(p[d])}},Zt=function(e){let r=null,a=null;if(st)e="<remove></remove>"+e;else{let d=an(e,/^[\r\n\t ]+/);a=d&&d[0]}Ie==="application/xhtml+xml"&&be===Z&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let f=w?V(e):e;if(be===Z)try{r=new R().parseFromString(f,Ie)}catch{}if(!r||!r.documentElement){r=Ee.createDocument(be,"template",null);try{r.documentElement.innerHTML=ft?X:f}catch{}}let p=r.body||r.documentElement;return e&&a&&p.insertBefore(o.createTextNode(a),p.childNodes[0]||null),be===Z?et.call(r,pe?"html":"body")[0]:pe?r.documentElement:p},Qt=function(e){return ze.call(e.ownerDocument||e,e,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Be=function(e){return e=Me(e,Gn," "),e=Me(e,$n," "),e=Me(e,Bn," "),e},ht=function(e){var r;e.normalize();let a=ze.call(e.ownerDocument||e,e,h.SHOW_TEXT|h.SHOW_COMMENT|h.SHOW_CDATA_SECTION|h.SHOW_PROCESSING_INSTRUCTION,null),f=a.nextNode();for(;f;)f.data=Be(f.data),f=a.nextNode();let p=(r=e.querySelectorAll)===null||r===void 0?void 0:r.call(e,"template");p&&De(p,d=>{Re(d.content)&&ht(d.content)})},je=function(e){let r=G?G(e):null;return typeof r!="string"||A(r)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==ge(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==N(e)||e.childNodes!==U(e)},Re=function(e){if(!N||typeof e!="object"||e===null)return!1;try{return N(e)===Q.documentFragment}catch{return!1}},Ce=function(e){if(!N||typeof e!="object"||e===null)return!1;try{return typeof N(e)=="number"}catch{return!1}};function ne(c,e,r){c.length!==0&&De(c,a=>{a.call(t,e,r,Ae)})}let sr=function(e,r){return!!(Ne&&e.hasChildNodes()&&!Ce(e.firstElementChild)&&D(gn,e.textContent)&&D(gn,e.innerHTML)||Ne&&e.namespaceURI===Z&&r==="style"&&Ce(e.firstElementChild)||e.nodeType===Q.processingInstruction||Ne&&e.nodeType===Q.comment&&D(zr,e.data))},ir=function(e,r){if(!Le[r]&&tn(r)&&(b.tagNameCheck instanceof RegExp&&D(b.tagNameCheck,r)||b.tagNameCheck instanceof Function&&b.tagNameCheck(r)))return!1;if(it&&!K[r]){let a=Y(e),f=U(e);if(f&&a){let p=f.length;for(let d=p-1;d>=0;--d){let I=at?f[d]:W(f[d],!0);a.insertBefore(I,T(e))}}}return ie(e),!0},Jt=function(e){if(ne(S.beforeSanitizeElements,e,null),je(e))return ie(e),!0;let r=A(G?G(e):e.nodeName);if(ne(S.uponSanitizeElement,e,{tagName:r,allowedTags:y}),sr(e,r))return ie(e),!0;if(Le[r]||!(oe.tagCheck instanceof Function&&oe.tagCheck(r))&&!y[r])return ir(e,r);if((N?N(e):e.nodeType)===Q.element&&!nr(e)||(r==="noscript"||r==="noembed"||r==="noframes")&&D(Fr,e.innerHTML))return ie(e),!0;if(se&&e.nodeType===Q.text){let f=Be(e.textContent);e.textContent!==f&&(Se(t.removed,{element:e.cloneNode()}),e.textContent=f)}return ne(S.afterSanitizeElements,e,null),!1},en=function(e,r,a){if(Ut[r]||Ft&&(r==="id"||r==="name")&&(a in o||a in Qn))return!1;let f=_[r]||oe.attributeCheck instanceof Function&&oe.attributeCheck(r,e);if(!(tt&&D(jn,r))){if(!(Pt&&D(Wn,r))){if(f){if(!lt[r]){if(!D(Dt,Me(a,Ct,""))){if(!((r==="src"||r==="xlink:href"||r==="href")&&e!=="script"&&cn(a,"data:")===0&&$t[e])){if(!(kt&&!D(Yn,Me(a,Ct,"")))){if(a)return!1}}}}}else if(!(tn(e)&&(b.tagNameCheck instanceof RegExp&&D(b.tagNameCheck,e)||b.tagNameCheck instanceof Function&&b.tagNameCheck(e))&&(b.attributeNameCheck instanceof RegExp&&D(b.attributeNameCheck,r)||b.attributeNameCheck instanceof Function&&b.attributeNameCheck(r,e))||r==="is"&&b.allowCustomizedBuiltInElements&&(b.tagNameCheck instanceof RegExp&&D(b.tagNameCheck,a)||b.tagNameCheck instanceof Function&&b.tagNameCheck(a))))return!1}}return!0},ar=m({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),tn=function(e){return!ar[Ue(e)]&&D(Xn,e)},cr=function(e,r,a,f){if(w&&typeof H=="object"&&typeof H.getAttributeType=="function"&&!a)switch(H.getAttributeType(e,r)){case"TrustedHTML":return V(f);case"TrustedScriptURL":return ke(f)}return f},lr=function(e,r,a,f){try{a?e.setAttributeNS(a,r,f):e.setAttribute(r,f),je(e)?ie(e):sn(t.removed)}catch{me(r,e)}},nn=function(e){ne(S.beforeSanitizeAttributes,e,null);let r=e.attributes;if(!r||je(e))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0},f=r.length,p=A(e.nodeName);for(;f--;){let d=r[f],I=d.name,x=d.namespaceURI,j=d.value,q=A(I),Tt=j,z=I==="value"?Tt:_r(Tt);if(a.attrName=q,a.attrValue=z,a.keepAttr=!0,a.forceKeepAttr=void 0,ne(S.uponSanitizeAttribute,e,a),z=a.attrValue,Ht&&(q==="id"||q==="name")&&cn(z,Gt)!==0&&(me(I,e),z=Gt+z),Ne&&D(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,z)){me(I,e);continue}if(q==="attributename"&&an(z,"href")){me(I,e);continue}if(!a.forceKeepAttr){if(!a.keepAttr){me(I,e);continue}if(!zt&&D(Hr,z)){me(I,e);continue}if(se&&(z=Be(z)),!en(p,q,z)){me(I,e);continue}z=cr(p,q,x,z),z!==Tt&&lr(e,I,x,z)}}ne(S.afterSanitizeAttributes,e,null)},We=function(e){let r=null,a=Qt(e);for(ne(S.beforeSanitizeShadowDOM,e,null);r=a.nextNode();)if(ne(S.uponSanitizeShadowNode,r,null),Jt(r),nn(r),Re(r.content)&&We(r.content),(N?N(r):r.nodeType)===Q.element){let p=Oe(r);Re(p)&&(gt(p),We(p))}ne(S.afterSanitizeShadowDOM,e,null)},gt=function(e){let r=[{node:e,shadow:null}];for(;r.length>0;){let a=r.pop();if(a.shadow){We(a.shadow);continue}let f=a.node,d=(N?N(f):f.nodeType)===Q.element,I=U(f);if(I)for(let x=I.length-1;x>=0;--x)r.push({node:I[x],shadow:null});if(d){let x=G?G(f):null;if(typeof x=="string"&&A(x)==="template"){let j=f.content;Re(j)&&r.push({node:j,shadow:null})}}if(d){let x=Oe(f);Re(x)&&r.push({node:null,shadow:x},{node:x,shadow:null})}}};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,f=null,p=null;if(ft=!c,ft&&(c="<!-->"),typeof c!="string"&&!Ce(c)&&(c=wr(c),typeof c!="string"))throw de("dirty is not a string, aborting");if(!t.isSupported)return c;nt?(y=rt,_=ot):dt(e),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(y=F(y)),S.uponSanitizeAttribute.length>0&&(_=F(_)),t.removed=[];let d=at&&typeof c!="string"&&Ce(c);if(d){let j=G?G(c):c.nodeName;if(typeof j=="string"){let q=A(j);if(!y[q]||Le[q])throw de("root node is forbidden and cannot be sanitized in-place")}if(je(c))throw de("root node is clobbered and cannot be sanitized in-place");try{gt(c)}catch(q){throw Kt(c),q}}else if(Ce(c))r=Zt("<!---->"),a=r.ownerDocument.importNode(c,!0),a.nodeType===Q.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?r=a:r.appendChild(a),gt(a);else{if(!ye&&!se&&!pe&&c.indexOf("<")===-1)return w&&He?V(c):c;if(r=Zt(c),!r)return ye?null:He?X:""}r&&st&&ie(r.firstChild);let I=Qt(d?c:r);try{for(;f=I.nextNode();)Jt(f),nn(f),Re(f.content)&&We(f.content)}catch(j){throw d&&Kt(c),j}if(d)return De(t.removed,j=>{j.element&&or(j.element)}),se&&ht(c),c;if(ye){if(se&&ht(r),Fe)for(p=It.call(r.ownerDocument);r.firstChild;)p.appendChild(r.firstChild);else p=r;return(_.shadowroot||_.shadowrootmode)&&(p=Hn.call(s,p,!0)),p}let x=pe?r.outerHTML:r.innerHTML;return pe&&y["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&D(Pr,r.ownerDocument.doctype.name)&&(x="<!DOCTYPE "+r.ownerDocument.doctype.name+`>
3
- `+x),se&&(x=Be(x)),w&&He?V(x):x},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};dt(c),nt=!0,rt=y,ot=_},t.clearConfig=function(){Ae=null,nt=!1,rt=null,ot=null,w=E,X=""},t.isValidAttribute=function(c,e,r){Ae||dt({});let a=A(c),f=A(e);return en(a,f,r)},t.addHook=function(c,e){typeof e=="function"&&C(S,c)&&Se(S[c],e)},t.removeHook=function(c,e){if(C(S,c)){if(e!==void 0){let r=Er(S[c],e);return r===-1?void 0:yr(S[c],r,1)[0]}return sn(S[c])}},t.removeHooks=function(c){C(S,c)&&(S[c]=[])},t.removeAllHooks=function(){S=Tn()},t}var bn=_n();var Xe=bn(globalThis.window);var he=n=>Object.prototype.toString.call(n).slice(8,-1),P=n=>typeof n=="string"||n instanceof String;var An=["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","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","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","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","turn","turns","tv","udp","unreal","upn","urn","ut2004","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 Rn=/(?:#|%23)$/,Sn=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var wn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,xn=/^((?:[^#%]|%(?!23))*)(?:\?|%3F)$/i,wt=/^[a-z][\da-z+.-]*$/,On=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,Pe=/^(?:java|vb)script$/i,xt=/^(?:(?:java|vb)script|blob)$/i,Ve=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,Ln=/^%[\dA-F]{2}$/i,Ot=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i,Nn=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var In=[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 Lt=new Set(In),qe=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]]),Xr=()=>{let n=new Map;for(let t=0;t<256;t++)!Lt.has(t)&&!qe.has(t)&&n.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return n},Ke=Xr();var[xe,qr,Kr,Zr,Qr,Jr]=["&","#","<",">",'"',"'"].map(n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`),eo={[xe]:`${xe}amp;`,[Kr]:`${xe}lt;`,[Zr]:`${xe}gt;`,[Qr]:`${xe}quot;`,[Jr]:`${xe}${qr}39;`},Uo=Array.from({length:256},(n,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),Dn=globalThis.process?.versions?.node!==void 0,to=new RegExp(`[${[...Ke.values()].join("")}]`),no=new RegExp(`[${[...Ke.values()].join("")}]`,"g"),Po=new TextEncoder,ro=new TextDecoder("utf-8",{fatal:!0}),Qe=class{#e=new Set(An);get(){return[...this.#e]}has(t){return this.#e.has(t)}verify(t,o=this.#e){if(!P(t))return!1;try{let{protocol:s}=new URL(t.normalize("NFKC")),i=s.replace(/:$/,""),l=i.split("+");return l.some(g=>Pe.test(g))?!1:On.test(i)||l.every(g=>o.has(g))}catch{return!1}}};var Mn=n=>{if(!P(n))return n;let t=Ln.test(n)?n.toUpperCase():n;return eo[t]??n},vn=n=>{if(!P(n))throw new TypeError(`Expected String but got ${he(n)}.`);let t=n.replace(/\s/g,""),o;try{o=atob(t)}catch{throw new Error(`Invalid base64 data: ${n}`)}let s;if(Dn&&globalThis.Buffer)s=globalThis.Buffer.from(o,"latin1");else{let i=o.length;s=new Uint8Array(i);for(let l=0;l<i;l++)s[l]=o.charCodeAt(l)}try{let i=ro.decode(s);return to.test(i)?t:i}catch{return t}},oo=(n,t)=>{let o=/x/i.test(t[0])?parseInt(t.substring(1),16):parseInt(t,10);if(Number.isInteger(o)){if(Lt.has(o))return String.fromCharCode(o);if(qe.has(o)){let s=qe.get(o);return String.fromCodePoint(s)}else if(Ke.has(o))return""}return n},Un=n=>P(n)?n.replace(Rn,"").replace(xn,"$1"):n,Pn=(n,t=0)=>{if(!P(n))throw new TypeError(`Expected String but got ${he(n)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${he(t)}.`);let o;try{o=decodeURIComponent(n)}catch{o=n.replace(/(?:%[\dA-F]{2})+/gi,i=>{try{return decodeURIComponent(i)}catch{return i}})}o=o.replace(no,"");let s=0;for(;s+t<=16;s++){let i=o;if(o=o.replace(/&amp;/gi,"&").replace(wn,oo),o===i)break}if(s+t>16&&/&#/.test(o))throw new Error("Character references nested too deeply.");return o},so=async n=>{let t=n.type?`${n.type};base64`:"base64",o=await n.arrayBuffer(),s=globalThis.Buffer.from(o).toString("base64");return`data:${t},${s}`},io=n=>new Promise((t,o)=>{let s=new globalThis.FileReader;s.addEventListener("error",()=>o(s.error)),s.addEventListener("abort",()=>t(null)),s.addEventListener("load",()=>t(s.result)),s.readAsDataURL(n)}),ao=async n=>{let t=n.type?`${n.type};base64`:"base64",o=await n.arrayBuffer(),s=new Uint8Array(o),i=[];for(let l=0;l<s.length;l+=8192)i.push(String.fromCharCode(...s.subarray(l,l+8192)));return`data:${t},${btoa(i.join(""))}`},kn=async(n,t=16777216)=>{if(Number.isInteger(n?.size)){if(Number.isInteger(t)&&n.size>t){let o=`Blob size (${n.size} bytes) exceeds max (${t} bytes).`;throw new DOMException(o,"NotReadableError")}}else return null;return Dn&&globalThis.Buffer?so(n):globalThis.FileReader?io(n):ao(n)};var co=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),lo=Object.freeze({RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,RETURN_TRUSTED_TYPE:!1}),le=(n,t,o)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,o?o.message:"")},Nt=class n extends Qe{#e;static#t=null;static#n=null;static#s(t,o){if(!o.attrValue||!/^\s*data:/i.test(o.attrValue))return;let s=n.#t,i=n.#n;if(!s||!i)return;let l;try{l=new URL(o.attrValue)}catch{return}if(l.protocol==="data:"){let u=o.attrValue;if(i.recurse||(i.recurse=new Set),i.recurse.has(u)){let g=`Circular Data URL detected and skipped: ${u}`;le(i.debug,g),o.attrValue="";return}i.nest++,i.recurse.add(u);try{let g=s.#o(u,{allow:["data"],deny:[],only:[],allowRelative:!1},i);o.attrValue=g||""}finally{i.nest--,i.recurse.delete(u)}}}static{Xe.setConfig(lo),Xe.addHook("uponSanitizeAttribute",n.#s)}constructor(){super(),this.#e=new Set(super.get())}#r(t,o,s,i,l){if(xt.test(t))return!1;if(t.split("+").some(h=>Pe.test(h))||!wt.test(t)){let h=`Failed to add scheme '${t}' in '${o}' list.`;return le(l.debug,h),!1}return i.set(t,!0),s.add(t),!0}#i(t,o){let s=t;try{s=decodeURIComponent(t)}catch{}let i=n.#t,l=n.#n;n.#t=this,n.#n=o;let u;try{u=o.domPurify.sanitize(s)}finally{n.#t=i,n.#n=l}u=Un(u);try{return encodeURI(u)}catch{return u}}#o(t,o,s){if(s.nest>16)throw new Error("Data URLs nested too deeply.");let{allow:i,deny:l,only:u,allowRelative:g}=o,h=this.#e,k=!1,R=new Map(s.schemeMap);if(u.length){h=new Set;for(let T of u)P(T)&&(T=T.trim(),this.#r(T,"only",h,R,s)&&!k&&(k=!0))}else{if(i.length){h=new Set(this.#e);for(let T of i)P(T)&&this.#r(T.trim(),"allow",h,R,s)}if(l.length)for(let T of l)P(T)&&(T=T.trim(),T&&R.set(T,!1))}let H,L=super.verify(t,h),W=!1,ue="";if(!L&&g&&!Nn.test(t))try{let T=new URL(t,"http://dummy.local"),U=new URL(t.normalize("NFKC"),"http://dummy.local");T.protocol==="http:"&&T.hostname==="dummy.local"&&U.protocol==="http:"&&(L=!0,W=!0,ue=`${T.pathname}${T.search}${T.hash}`)}catch(T){le(s.debug,"Failed to parse relative URL.",T)}if(L){let T,U,Y,Oe,ge,N="",G=[],w=!1;if(W)w=!0;else if({hash:T,href:U,pathname:Y,protocol:Oe,search:ge}=new URL(t),N=Oe.replace(/:$/,"").normalize("NFKC"),G=N.split("+"),k)w=G.every(E=>R.get(E));else for(let[E,B]of R.entries())if(w=B||N!==E&&G.every($=>$!==E),!w)break;if(w){let X=W?!1:G.includes("data"),E=W?ue:U;if(X){let[B,...$]=Y.split(","),Te=`${$.join(",")}${ge}${T}`,V=B.split(";"),ke=V[V.length-1]==="base64",ee=Te;if(ke)try{ee=vn(Te)}catch(te){le(s.debug,"Failed to parse base64 data.",te),E=""}try{let Ee=Pn(ee).trim().normalize("NFKC"),{protocol:ze}=new URL(Ee,"http://dummy.local");ze.replace(/:$/,"").split("+").some(et=>xt.test(et))&&(E="")}catch(te){le(s.debug,"Failed to parse inner data URL protocol.",te),E=""}(!B||Sn.test(B))&&(ee=this.#i(ee,s)),E&&ee?(ke&&ee!==Te&&V.pop(),E=`${N}:${V.join(";")},${ee}`):E=""}if(!X){if(Ve.test(E)){let B=Ve.exec(E),{index:$}=B;E=E.substring(0,$).replace(/[?&]$/,"")}if(Ot.test(E)){let B=Ot.exec(E),{index:$}=B;E=E.substring(0,$).replace(/[?&]$/,"")}}E&&(H=E)}}return H||null}sanitize(t,o){if(!t||!P(t))return null;let s=Number.isInteger(o?.maxLength)&&o.maxLength?o.maxLength:0;if(s&&t.length>s){let g=`URL length ${t.length} exceeds maxLength ${s}.`;throw new RangeError(g)}if(!(o&&(Array.isArray(o.deny)&&o.deny.length>0||Array.isArray(o.only)&&o.only.length>0||o.allowRelative))&&(t.startsWith("https://")||t.startsWith("http://"))&&!Ve.test(t)&&!t.includes("data:"))try{let{href:g}=new URL(t);return g.replace(/%26/g,Mn)}catch{return null}let l={allow:Array.isArray(o?.allow)?o.allow:[],deny:Array.isArray(o?.deny)?o.deny:[],only:Array.isArray(o?.only)?o.only:[],allowRelative:!!o?.allowRelative},u={debug:!!o?.debug,domPurify:Xe,nest:0,recurse:null,schemeMap:new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]])};return this.#o(t,l,u)}inspect(t,o){if(!P(t))throw new TypeError(`Expected String but got ${he(t)}.`);let s=new Map([["input",t]]),i,l=null,u=Number.isInteger(o?.maxLength)&&o.maxLength?o.maxLength:0;if(u&&t.length>u)l=`URL length ${t.length} exceeds maxLength ${u}.`;else if(this.verify(t)){let{protocol:g}=new URL(t);if(g==="blob:")i=t;else try{i=this.sanitize(t,o??{allow:["data"]}),i||(l="Sanitization failed (blocked by allowed schemes or rules).")}catch(h){l=h.message}}else l="Invalid URI syntax or scheme is not registered.";if(i){let g=new URL(i),{pathname:h,protocol:k}=g,H=k.replace(/:$/,"").split("+").includes("data");if(s.set("valid",!0),H){let L=new Map,[W,...ue]=h.split(","),T=`${ue.join(",")}${g.search}${g.hash}`,U=W.split(";"),Y=U[U.length-1]==="base64";Y&&U.pop(),L.set("mime",U.join(";")),L.set("base64",Y),L.set("data",T),s.set("data",Object.fromEntries(L))}else s.set("data",null);for(let L of co){let W=g[L];P(W)&&s.set(L,W)}}else s.set("valid",!1),l&&s.set("reason",l);return Object.fromEntries(s)}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(!P(t))throw new TypeError(`Expected String but got ${he(t)}.`);if(t.split("+").some(i=>Pe.test(i))||!wt.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,o=this.#e){return super.verify(t,o)}};var fe=new Nt,fo=async(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1,maxBlobSize:16777216})=>{let o=!!t?.debug,s=Number.isInteger(t?.maxBlobSize)&&t.maxBlobSize>0?t.maxBlobSize:16777216,i;if(n&&P(n)){let l;try{let{protocol:u}=new URL(n);l=u.replace(/:$/,"")}catch(u){le(o,`Invalid URL input format: ${n}`,u)}if(l==="blob"){let{allow:u,deny:g,only:h}=t;if(Array.isArray(u)&&u.includes("blob")&&!(Array.isArray(g)&&g.includes("blob"))||Array.isArray(h)&&h.includes("blob")){let k;try{k=await fetch(n).then(R=>R.blob()).then(R=>kn(R,s))}catch(R){let H=`Failed to fetch and convert blob URL: ${n}`;le(o,H,R)}if(k){let R={...t};Array.isArray(t.only)?R.only=t.only.includes("data")?t.only:[...t.only,"data"]:Array.isArray(t.allow)&&(R.allow=t.allow.includes("data")?t.allow:[...t.allow,"data"],Array.isArray(t.deny)&&(R.deny=t.deny.filter(H=>H!=="data"))),i=fe.sanitize(k,R)}}t?.revokeObjectURL&&URL.revokeObjectURL(n)}else(l||t.allowRelative)&&(i=fe.sanitize(n,t))}return i||null},uo=(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1})=>{let o=!!t?.debug,s;if(n&&P(n)){let i;try{let{protocol:l}=new URL(n);i=l.replace(/:$/,"")}catch(l){let u=`Invalid URL input format: ${n}`;le(o,u,l)}if(i==="blob")return t?.revokeObjectURL&&URL.revokeObjectURL(n),null;(i||t.allowRelative)&&(s=fe.sanitize(n,t))}return s||null},zn=async n=>fe.inspect(n),po=n=>zn(n),Fn=n=>fe.inspect(n),mo=n=>Fn(n),ho=async n=>fe.verify(n),go=n=>fe.verify(n),To=fe;export{To as default,zn as inspectURL,Fn as inspectURLSync,ho as isURI,go as isURISync,po as parseURL,mo as parseURLSync,fo as sanitizeURL,uo as sanitizeURLSync};
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 pr(n){if(Array.isArray(n))return n}function mr(n,t){var r=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(r!=null){var s,a,l,u,h=[],p=!0,T=!1;try{if(l=(r=r.call(n)).next,t!==0)for(;!(p=(s=l.call(r)).done)&&(h.push(s.value),h.length!==t);p=!0);}catch(E){T=!0,a=E}finally{try{if(!p&&r.return!=null&&(u=r.return(),Object(u)!==u))return}finally{if(T)throw a}}return h}}function dr(){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 hr(n,t){return pr(n)||mr(n,t)||gr(n,t)||dr()}function gr(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,Tr=Object.isFrozen,Er=Object.getPrototypeOf,yr=Object.getOwnPropertyDescriptor,N=Object.freeze,I=Object.seal,ye=Object.create,Tn=typeof Reflect<"u"&&Reflect,Et=Tn.apply,yt=Tn.construct;N||(N=function(t){return t});I||(I=function(t){return t});Et||(Et=function(t,r){for(var s=arguments.length,a=new Array(s>2?s-2:0),l=2;l<s;l++)a[l-2]=arguments[l];return t.apply(r,a)});yt||(yt=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=x(Array.prototype.forEach),_r=x(Array.prototype.lastIndexOf),nn=x(Array.prototype.pop),Ee=x(Array.prototype.push),br=x(Array.prototype.splice),oe=Array.isArray,Oe=x(String.prototype.toLowerCase),mt=x(String.prototype.toString),rn=x(String.prototype.match),xe=x(String.prototype.replace),on=x(String.prototype.indexOf),Ar=x(String.prototype.trim),Rr=x(Number.prototype.toString),Sr=x(Boolean.prototype.toString),sn=typeof BigInt>"u"?null:x(BigInt.prototype.toString),an=typeof Symbol>"u"?null:x(Symbol.prototype.toString),O=x(Object.prototype.hasOwnProperty),Le=x(Object.prototype.toString),L=x(RegExp.prototype.test),le=wr(TypeError);function x(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 wr(n){return function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return yt(n,r)}}function g(n,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Oe;if(tn&&tn(n,null),!oe(t))return n;let s=t.length;for(;s--;){let a=t[s];if(typeof a=="string"){let l=r(a);l!==a&&(Tr(t)||(t[s]=l),a=l)}n[a]=!0}return n}function xr(n){for(let t=0;t<n.length;t++)O(n,t)||(n[t]=null);return n}function P(n){let t=ye(null);for(let s of gn(n)){var r=hr(s,2);let a=r[0],l=r[1];O(n,a)&&(oe(l)?t[a]=xr(l):l&&typeof l=="object"&&l.constructor===Object?t[a]=P(l):t[a]=l)}return t}function Lr(n){switch(typeof n){case"string":return n;case"number":return Rr(n);case"boolean":return Sr(n);case"bigint":return sn?sn(n):"0";case"symbol":return an?an(n):"Symbol()";case"undefined":return Le(n);case"function":case"object":{if(n===null)return Le(n);let t=n,r=q(t,"toString");if(typeof r=="function"){let s=r(t);return typeof s=="string"?s:Le(s)}return Le(n)}default:return Le(n)}}function q(n,t){for(;n!==null;){let s=yr(n,t);if(s){if(s.get)return x(s.get);if(typeof s.value=="function")return x(s.value)}n=Er(n)}function r(){return null}return r}function Or(n){try{return L(n,""),!0}catch{return!1}}var cn=N(["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=N(["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=N(["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"]),Nr=N(["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=N(["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=N(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ln=N(["#text"]),un=N(["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=N(["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=N(["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=N(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cr=I(/{{[\w\W]*|^[\w\W]*}}/g),Dr=I(/<%[\w\W]*|^[\w\W]*%>/g),Mr=I(/\${[\w\W]*/g),Ur=I(/^data-[\-\w.\u00B7-\uFFFF]+$/),vr=I(/^aria-[\-\w]+$/),pn=I(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pr=I(/^(?:\w+script|data):/i),kr=I(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zr=I(/^html$/i),Fr=I(/^[a-z][.\w]*(-[.\w]+)+$/i),mn=I(/<[/\w!]/g),dn=I(/<[/\w]/g),Hr=I(/<\/no(script|embed|frames)/i),Gr=I(/\/>/i),F={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},$r=function(){return typeof window>"u"?null:window},Br=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 l="dompurify"+(s?"#"+s:"");try{return t.createPolicy(l,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},hn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},re=function(t,r,s,a){return O(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]:$r(),t=c=>En(c);if(t.version="3.4.12",t.removed=[],!n||!n.document||n.document.nodeType!==F.document||!n.Element)return t.isSupported=!1,t;let r=n.document,s=r,a=s.currentScript;n.DocumentFragment;let l=n.HTMLTemplateElement,u=n.Node,h=n.Element,p=n.NodeFilter,T=n.NamedNodeMap;T===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let E=n.DOMParser,_=n.trustedTypes,M=h.prototype,H=q(M,"cloneNode"),K=q(M,"remove"),be=q(M,"nextSibling"),G=q(M,"childNodes"),j=q(M,"parentNode"),wt=q(M,"shadowRoot"),Xe=q(M,"attributes"),U=u&&u.prototype?q(u.prototype,"nodeType"):null,W=u&&u.prototype?q(u.prototype,"nodeName"):null;if(typeof l=="function"){let c=r.createElement("template");c.content&&c.content.ownerDocument&&(r=c.content.ownerDocument)}let k,ie="",Ve,xt=!1,Ae=0,Lt=function(){if(Ae>0)throw le('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(),Ae++;try{return k.createHTML(e)}finally{Ae--}},zn=function(e){Lt(),Ae++;try{return k.createScriptURL(e)}finally{Ae--}},Fn=function(){return xt||(Ve=Br(_,a),xt=!0),Ve},Ie=r,qe=Ie.implementation,Ot=Ie.createNodeIterator,Hn=Ie.createDocumentFragment,Gn=Ie.getElementsByTagName,$n=s.importNode,b=hn();t.isSupported=typeof gn=="function"&&typeof j=="function"&&qe&&qe.createHTMLDocument!==void 0;let Bn=Cr,jn=Dr,Wn=Mr,Yn=Ur,Xn=vr,Vn=Pr,Nt=kr,qn=Fr,It=pn,A=null,Ct=g({},[...cn,...dt,...ht,...gt,...ln]),R=null,Dt=g({},[...un,...Tt,...fn,...Fe]),S=Object.seal(ye(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}})),Re=null,Mt=null,J=Object.seal(ye(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ut=!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"]),Me="http://www.w3.org/1998/Math/MathML",Ue="http://www.w3.org/2000/svg",X="http://www.w3.org/1999/xhtml",de=X,st=!1,it=null,Kn=g({},[Me,Ue,X],mt),Bt=N(["mi","mo","mn","ms","mtext"]),at=g({},Bt),jt=N(["annotation-xml"]),ct=g({},jt),Zn=g({},["title","style","font","a","script"]),Se=null,Qn=["application/xhtml+xml","text/html"],Jn="text/html",y=null,he=null,er=r.createElement("form"),Wt=function(e){return e instanceof RegExp||e instanceof Function},lt=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),Se=Qn.indexOf(e.PARSER_MEDIA_TYPE)===-1?Jn:e.PARSER_MEDIA_TYPE,y=Se==="application/xhtml+xml"?mt:Oe,A=re(e,"ALLOWED_TAGS",Ct,{transform:y}),R=re(e,"ALLOWED_ATTR",Dt,{transform:y}),it=re(e,"ALLOWED_NAMESPACES",Kn,{transform:mt}),ot=re(e,"ADD_URI_SAFE_ATTR",$t,{transform:y,base:$t}),Ht=re(e,"ADD_DATA_URI_TAGS",Gt,{transform:y,base:Gt}),Y=re(e,"FORBID_CONTENTS",rt,{transform:y}),Re=re(e,"FORBID_TAGS",P({}),{transform:y}),Mt=re(e,"FORBID_ATTR",P({}),{transform:y}),me=O(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?P(e.USE_PROFILES):e.USE_PROFILES:!1,Ut=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=Or(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:pn,de=typeof e.NAMESPACE=="string"?e.NAMESPACE:X,at=O(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),ct=O(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?P(e.HTML_INTEGRATION_POINTS):g({},jt);let o=O(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?P(e.CUSTOM_ELEMENT_HANDLING):ye(null);if(S=ye(null),O(o,"tagNameCheck")&&Wt(o.tagNameCheck)&&(S.tagNameCheck=o.tagNameCheck),O(o,"attributeNameCheck")&&Wt(o.attributeNameCheck)&&(S.attributeNameCheck=o.attributeNameCheck),O(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(S.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),I(S),ee&&(Ke=!1),Ce&&(pe=!0),me&&(A=g({},ln),R=ye(null),me.html===!0&&(g(A,cn),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,O(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,y))),O(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,y))),O(e,"ADD_URI_SAFE_ATTR")&&oe(e.ADD_URI_SAFE_ATTR)&&g(ot,e.ADD_URI_SAFE_ATTR,y),O(e,"FORBID_CONTENTS")&&oe(e.FORBID_CONTENTS)&&(Y===rt&&(Y=P(Y)),g(Y,e.FORBID_CONTENTS,y)),O(e,"ADD_FORBID_CONTENTS")&&oe(e.ADD_FORBID_CONTENTS)&&(Y===rt&&(Y=P(Y)),g(Y,e.ADD_FORBID_CONTENTS,y)),tt&&(A["#text"]=!0),ae&&g(A,["html","head","body"]),A.table&&(g(A,["tbody"]),delete Re.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw le('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw le('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let i=k;k=e.TRUSTED_TYPES_POLICY;try{ie=fe("")}catch(f){throw k=i,f}}else e.TRUSTED_TYPES_POLICY===null?(k=void 0,ie=""):(k===void 0&&(k=Fn()),k&&typeof ie=="string"&&(ie=fe("")));N&&N(e),he=e},Yt=g({},[...dt,...ht,...Nr]),Xt=g({},[...gt,...Ir]),tr=function(e,o,i){return o.namespaceURI===X?e==="svg":o.namespaceURI===Me?e==="svg"&&(i==="annotation-xml"||at[i]):!!Yt[e]},nr=function(e,o,i){return o.namespaceURI===X?e==="math":o.namespaceURI===Ue?e==="math"&&ct[i]:!!Xt[e]},rr=function(e,o,i){return o.namespaceURI===Ue&&!ct[i]||o.namespaceURI===Me&&!at[i]?!1:!Xt[e]&&(Zn[e]||!Yt[e])},or=function(e){let o=j(e);(!o||!o.tagName)&&(o={namespaceURI:de,tagName:"template"});let i=Oe(e.tagName),f=Oe(o.tagName);return it[e.namespaceURI]?e.namespaceURI===Ue?tr(i,o,f):e.namespaceURI===Me?nr(i,o,f):e.namespaceURI===X?rr(i,o,f):!!(Se==="application/xhtml+xml"&&it[e.namespaceURI]):!1},ne=function(e){Ee(t.removed,{element:e});try{j(e).removeChild(e)}catch{if(K(e),!j(e))throw le("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=G(e);if(o){let f=[];Te(o,m=>{Ee(f,m)}),Te(f,m=>{try{K(m)}catch{}})}let i=Xe(e);if(i)for(let f=i.length-1;f>=0;--f){let m=i[f],d=m&&m.name;if(typeof d=="string")try{e.removeAttribute(d)}catch{}}},ce=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{}},sr=function(e){let o=Xe(e);if(o)for(let i=o.length-1;i>=0;--i){let f=o[i],m=f&&f.name;if(!(typeof m!="string"||R[y(m)]))try{e.removeAttribute(m)}catch{}}},ut=function(e){let o=[e];for(;o.length>0;){let i=o.pop();(U?U(i):i.nodeType)===F.element&&sr(i);let m=G(i);if(m)for(let d=m.length-1;d>=0;--d)o.push(m[d])}},ir=function(e){if(!te)return;let o=[e];for(;o.length>0;){let i=o.pop(),f=U?U(i):i.nodeType;if(f===F.processingInstruction||f===F.comment&&L(dn,i.data)){try{K(i)}catch{}continue}if(f===F.element){let d=i,w=y(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=G(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]}Se==="application/xhtml+xml"&&de===X&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let f=k?fe(e):e;if(de===X)try{o=new E().parseFromString(f,Se)}catch{}if(!o||!o.documentElement){o=qe.createDocument(de,"template",null);try{o.documentElement.innerHTML=st?ie:f}catch{}}let m=o.body||o.documentElement;return e&&i&&m.insertBefore(r.createTextNode(i),m.childNodes[0]||null),de===X?Gn.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=xe(e,Bn," "),e=xe(e,jn," "),e=xe(e,Wn," "),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),f=i.nextNode();for(;f;)f.data=Pe(f.data),f=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"||y(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!==U(e)||e.childNodes!==G(e)},ge=function(e){if(!U||typeof e!="object"||e===null)return!1;try{return U(e)===F.documentFragment}catch{return!1}},we=function(e){if(!U||typeof e!="object"||e===null)return!1;try{return typeof U(e)=="number"}catch{return!1}};function V(c,e,o){c.length!==0&&Te(c,i=>{i.call(t,e,o,he)})}let ar=function(e,o){return!!(te&&e.hasChildNodes()&&!we(e.firstElementChild)&&L(mn,e.textContent)&&L(mn,e.innerHTML)||te&&e.namespaceURI===X&&o==="style"&&we(e.firstElementChild)||e.nodeType===F.processingInstruction||te&&e.nodeType===F.comment&&L(dn,e.data))},cr=function(e,o){if(!Re[o]&&Qt(o)&&(S.tagNameCheck instanceof RegExp&&L(S.tagNameCheck,o)||S.tagNameCheck instanceof Function&&S.tagNameCheck(o)))return!1;if(tt&&!Y[o]){let i=j(e),f=G(e);if(f&&i){let m=f.length;for(let d=m-1;d>=0;--d){let w=nt?f[d]:H(f[d],!0);i.insertBefore(w,be(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=y(W?W(e):e.nodeName);if(V(b.uponSanitizeElement,e,{tagName:i,allowedTags:A}),e!==o&&j(e)===null)return!0;if(ar(e,i))return ne(e),!0;if(Re[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((U?U(e):e.nodeType)===F.element&&!or(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&L(Hr,e.innerHTML))return ne(e),!0;if(ee&&e.nodeType===F.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(Mt[o]||te&&o==="patchsrc"||te&&o==="for"&&e!=="label"&&e!=="output"||kt&&(o==="id"||o==="name")&&(i in r||i in er))return!1;let f=R[o]||J.attributeCheck instanceof Function&&J.attributeCheck(o,e);if(!(Ke&&L(Yn,o))){if(!(Ut&&L(Xn,o))){if(f){if(!ot[o]){if(!L(It,xe(i,Nt,""))){if(!((o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&on(i,"data:")===0&&Ht[e])){if(!(vt&&!L(Vn,xe(i,Nt,"")))){if(i)return!1}}}}}else if(!(Qt(e)&&(S.tagNameCheck instanceof RegExp&&L(S.tagNameCheck,e)||S.tagNameCheck instanceof Function&&S.tagNameCheck(e))&&(S.attributeNameCheck instanceof RegExp&&L(S.attributeNameCheck,o)||S.attributeNameCheck instanceof Function&&S.attributeNameCheck(o,e))||o==="is"&&S.allowCustomizedBuiltInElements&&(S.tagNameCheck instanceof RegExp&&L(S.tagNameCheck,i)||S.tagNameCheck instanceof Function&&S.tagNameCheck(i))))return!1}}return!0},lr=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!lr[Oe(e)]&&L(qn,e)},ur=function(e,o,i,f){if(k&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!i)switch(_.getAttributeType(e,o)){case"TrustedHTML":return fe(f);case"TrustedScriptURL":return zn(f)}return f},fr=function(e,o,i,f){try{i?e.setAttributeNS(i,o,f):e.setAttribute(o,f),ke(e)?ne(e):nn(t.removed)}catch{ce(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},f=o.length,m=y(e.nodeName);for(;f--;){let d=o[f],w=d.name,C=d.namespaceURI,$=d.value,z=y(w),B=$,v=w==="value"?B:Ar(B);if(i.attrName=z,i.attrValue=v,i.keepAttr=!0,i.forceKeepAttr=void 0,V(b.uponSanitizeAttribute,e,i),v=i.attrValue,zt&&(z==="id"||z==="name")&&on(v,Ft)!==0&&(ce(w,e),v=Ft+v),te&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,v)){ce(w,e);continue}if(z==="attributename"&&rn(v,"href")){ce(w,e);continue}if(!i.forceKeepAttr){if(!i.keepAttr){ce(w,e);continue}if(!Pt&&L(Gr,v)){ce(w,e);continue}if(ee&&(v=Pe(v)),!Zt(m,z,v)){ce(w,e);continue}v=ur(m,z,C,v),v!==B&&fr(e,w,C,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),(U?U(o):o.nodeType)===F.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 f=i.node,d=(U?U(f):f.nodeType)===F.element,w=G(f);if(w)for(let C=w.length-1;C>=0;--C)o.push({node:w[C],shadow:null});if(d){let C=W?W(f):null;if(typeof C=="string"&&y(C)==="template"){let $=f.content;ge($)&&o.push({node:$,shadow:null})}}if(d){let C=wt(f);ge(C)&&o.push({node:null,shadow:C},{node:C,shadow:null})}}};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,i=null,f=null,m=null;if(st=!c,st&&(c="<!-->"),typeof c!="string"&&!we(c)&&(c=Lr(c),typeof c!="string"))throw le("dirty is not a string, aborting");if(!t.isSupported)return c;Ze?(A=Qe,R=Je):lt(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 c!="string"&&we(c);if(d){ir(c);let z=W?W(c):c.nodeName;if(typeof z=="string"){let B=y(z);if(!A[B]||Re[B])throw ve(c),le("root node is forbidden and cannot be sanitized in-place")}if(ke(c))throw ve(c),le("root node is clobbered and cannot be sanitized in-place");try{pt(c)}catch(B){throw ve(c),B}}else if(we(c))o=Vt("<!---->"),i=o.ownerDocument.importNode(c,!0),i.nodeType===F.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?o=i:o.appendChild(i),pt(i);else{if(!pe&&!ee&&!ae&&c.indexOf("<")===-1)return k&&De?fe(c):c;if(o=Vt(c),!o)return pe?null:De?ie:""}o&&et&&ne(o.firstChild);let w=d?c:o,C=qt(w);try{for(;f=C.nextNode();)Kt(f,w),Jt(f),ge(f.content)&&ze(f.content)}catch(z){throw d&&(ve(c),Te(t.removed,B=>{B.element&&ut(B.element)})),z}if(d)return Te(t.removed,z=>{z.element&&ut(z.element)}),ee&&ft(c),c;if(pe){if(ee&&ft(o),Ce)for(m=Hn.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(R.shadowroot||R.shadowrootmode)&&(m=$n.call(s,m,!0)),m}let $=ae?o.outerHTML:o.innerHTML;return ae&&A["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&L(zr,o.ownerDocument.doctype.name)&&($="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
3
+ `+$),ee&&($=Pe($)),k&&De?fe($):$},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};lt(c),Ze=!0,Qe=A,Je=R},t.clearConfig=function(){he=null,Ze=!1,Qe=null,Je=null,k=Ve,ie=""},t.isValidAttribute=function(c,e,o){he||lt({});let i=y(c),f=y(e);return Zt(i,f,o)},t.addHook=function(c,e){typeof e=="function"&&O(b,c)&&Ee(b[c],e)},t.removeHook=function(c,e){if(O(b,c)){if(e!==void 0){let o=_r(b[c],e);return o===-1?void 0:br(b[c],o,1)[0]}return nn(b[c])}},t.removeHooks=function(c){O(b,c)&&(b[c]=[])},t.removeAllHooks=function(){b=hn()},t}var yn=En();var He=yn(globalThis.window);var ue=n=>Object.prototype.toString.call(n).slice(8,-1),D=n=>typeof n=="string"||n instanceof String;var _n=["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","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","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,_t=/^[a-z][\da-z+.-]*$/,wn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,Ne=/^(?: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=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var On=[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(On),$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]]),Vr=()=>{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=Vr();var[_e,Kr,Zr,Qr,Jr,eo]=["&","#","<",">",'"',"'"].map(n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`),to={[_e]:`${_e}amp;`,[Zr]:`${_e}lt;`,[Qr]:`${_e}gt;`,[Jr]:`${_e}quot;`,[eo]:`${_e}${Kr}39;`},Po=Array.from({length:256},(n,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),In=globalThis.process?.versions?.node!==void 0,no=new RegExp(`[${[...Be.values()].join("")}]`),ro=new RegExp(`[${[...Be.values()].join("")}]`,"g"),ko=new TextEncoder,oo=new TextDecoder("utf-8",{fatal:!0}),We=class{#e=new Set(_n);get(){return[...this.#e]}has(t){return this.#e.has(t)}verify(t,r=this.#e){if(!D(t))return!1;try{let{protocol:s}=new URL(t.normalize("NFKC")),a=s.replace(/:$/,""),l=a.split("+");return l.some(h=>Ne.test(h))?!1:wn.test(a)||l.every(h=>r.has(h))}catch{return!1}}};var Cn=n=>{if(!D(n))return n;let t=xn.test(n)?n.toUpperCase():n;return to[t]??n},Dn=n=>{if(!D(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 l=0;l<a;l++)s[l]=r.charCodeAt(l)}try{let a=oo.decode(s);return no.test(a)?t:a}catch{return t}},so=(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=>D(n)?n.replace(bn,"").replace(Sn,"$1"):n,Un=(n,t=0)=>{if(!D(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(/(?:%[\dA-F]{2})+/gi,a=>{try{return decodeURIComponent(a)}catch{return a}})}r=r.replace(ro,"");let s=0;for(;s+t<=16;s++){let a=r;if(r=r.replace(/&amp;/gi,"&").replace(Rn,so),r===a)break}if(s+t>16&&/&#/.test(r))throw new Error("Character references nested too deeply.");return r},io=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}`},ao=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 l=0;l<s.length;l+=8192)a.push(String.fromCharCode(...s.subarray(l,l+8192)));return`data:${t},${btoa(a.join(""))}`},vn=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?io(n):globalThis.FileReader?ao(n):co(n)};var lo=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),uo=Object.freeze({RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,RETURN_TRUSTED_TYPE:!1}),Q=(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 l;try{l=new URL(r.attrValue)}catch{return}if(l.protocol==="data:"){let u=r.attrValue;if(a.recurse||(a.recurse=new Set),a.recurse.has(u)){let h=`Circular Data URL detected and skipped: ${u}`;Q(a.debug,h),r.attrValue="";return}a.nest++,a.recurse.add(u);try{let h=s.#o(u,{allow:["data"],deny:[],only:[],allowRelative:!1},a);r.attrValue=h||""}finally{a.nest--,a.recurse.delete(u)}}}static{He.setConfig(uo),He.addHook("uponSanitizeAttribute",n.#s)}constructor(){super(),this.#e=new Set(super.get())}#r(t,r,s,a,l){if(bt.test(t))return!1;if(t.split("+").some(p=>Ne.test(p))||!_t.test(t)){let p=`Failed to add scheme '${t}' in '${r}' list.`;return Q(l.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,l=n.#n;n.#t=this,n.#n=r;let u;try{u=r.domPurify.sanitize(s)}finally{n.#t=a,n.#n=l}u=Mn(u);try{return encodeURI(u)}catch{return u}}#o(t,r,s){if(s.nest>16)throw new Error("Data URLs nested too deeply.");let{allowedSchemes:a,restrictScheme:l,schemeMap:u}=this.#a(r,s),{isDataUrl:h,isRelative:p,isVerified:T,scheme:E,schemeParts:_,urlObj:M,urlToSanitize:H}=this.#c(t,r.allowRelative,a,s);return!T||!this.#l(E,_,l,u,p)?null:h?this.#u(M,E,s):this.#f(H)}#a({allow:t,deny:r,only:s},a){let l=this.#e,u=!1,h=new Map(a.schemeMap);if(s.length){l=new Set;for(let p of s)D(p)&&this.#r(p.trim(),"only",l,h,a)&&!u&&(u=!0)}else{if(t.length){l=new Set(this.#e);for(let p of t)D(p)&&this.#r(p.trim(),"allow",l,h,a)}if(r.length)for(let p of r)D(p)&&(p=p.trim(),p&&h.set(p,!1))}return{allowedSchemes:l,restrictScheme:u,schemeMap:h}}#c(t,r,s,a){let l=super.verify(t,s),u=!1,h="";if(!l&&r&&!Ln.test(t))try{let _=new URL(t,"http://dummy.local"),M=t.normalize("NFKC"),H=new URL(M,"http://dummy.local");_.protocol==="http:"&&_.hostname==="dummy.local"&&H.protocol==="http:"&&(l=!0,u=!0,h=`${_.pathname}${_.search}${_.hash}`)}catch(_){Q(a.debug,"Failed to parse relative URL.",_)}if(!l)return{isVerified:!1};if(u)return{isRelative:u,isVerified:l,isDataUrl:!1,scheme:"",schemeParts:[],urlToSanitize:h};let p=new URL(t),T=p.protocol.replace(/:$/,"").normalize("NFKC"),E=T.split("+");return{isRelative:u,isVerified:l,scheme:T,schemeParts:E,urlObj:p,isDataUrl:E.includes("data"),urlToSanitize:p.href}}#l(t,r,s,a,l){if(l)return!0;if(s)return r.every(u=>a.get(u));for(let[u,h]of a.entries())if(!(h||t!==u&&r.every(T=>T!==u)))return!1;return!0}#u(t,r,s){let[a,...l]=t.pathname.split(","),u=`${l.join(",")}${t.search}${t.hash}`,h=a.split(";"),p=h[h.length-1]==="base64",T=u;if(p)try{T=Dn(u)}catch(E){return Q(s.debug,"Failed to parse base64 data.",E),null}try{let _=Un(T).trim().normalize("NFKC"),M="http://dummy.local",{protocol:H}=new URL(_,M);if(H.replace(/:$/,"").split("+").some(be=>bt.test(be)))return null}catch(E){return Q(s.debug,"Failed to parse inner data URL protocol.",E),null}return(!a||An.test(a))&&(T=this.#i(T,s)),T?(p&&T!==u&&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||!D(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:"))try{let{href:h}=new URL(t);return h.replace(/%26/g,Cn)}catch(h){return Q(r?.debug,"Failed to parse URL.",h),null}let l={allow:Array.isArray(r?.allow)?r.allow:[],deny:Array.isArray(r?.deny)?r.deny:[],only:Array.isArray(r?.only)?r.only:[],allowRelative:!!r?.allowRelative},u={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,l,u)}inspect(t,r){if(!D(t))throw new TypeError(`Expected String but got ${ue(t)}.`);let s={input:t,valid:!1},a,l=null,u=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0,h=t.length;if(u&&h>u)l=`URL length ${h} exceeds maxLength ${u}.`;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||(l="Sanitization failed (blocked by allowed schemes or rules).")}catch(T){l=T.message}}else l="Invalid URI syntax or scheme is not registered.";if(a){let p=new URL(a),{pathname:T,protocol:E}=p,M=E.replace(/:$/,"").split("+").includes("data");if(s.valid=!0,M){let[H,...K]=T.split(","),be=`${K.join(",")}${p.search}${p.hash}`,G=H.split(";"),j=G[G.length-1]==="base64";j&&G.pop(),s.data={mime:G.join(";"),base64:j,data:be}}else s.data=null;for(let H of lo){let K=p[H];D(K)&&(s[H]=K)}}else s.valid=!1,l&&(s.reason=l);return s}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(D(t))t=t.trim();else throw new TypeError(`Expected String but got ${ue(t)}.`);if(t.split("+").some(a=>Ne.test(a))||!_t.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,fo=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&&D(n)){let l;try{let{protocol:u}=new URL(n);l=u.replace(/:$/,"")}catch(u){Q(r,`Invalid URL input format: ${n}`,u)}if(l==="blob"){let{allow:u,deny:h,only:p}=t;if(Array.isArray(u)&&u.includes("blob")&&!(Array.isArray(h)&&h.includes("blob"))||Array.isArray(p)&&p.includes("blob")){let T;try{T=await fetch(n).then(E=>E.blob()).then(E=>vn(E,s))}catch(E){let _=`Failed to fetch and convert blob URL: ${n}`;Q(r,_,E)}if(T){let E={...t};Array.isArray(t.only)?E.only=t.only.includes("data")?t.only:[...t.only,"data"]:Array.isArray(t.allow)&&(E.allow=t.allow.includes("data")?t.allow:[...t.allow,"data"],Array.isArray(t.deny)&&(E.deny=t.deny.filter(_=>_!=="data"))),a=se.sanitize(T,E)}}t?.revokeObjectURL&&URL.revokeObjectURL(n)}else(l||t.allowRelative)&&(a=se.sanitize(n,t))}return a||null},po=(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1})=>{let r=!!t?.debug,s;if(n&&D(n)){let a;try{let{protocol:l}=new URL(n);a=l.replace(/:$/,"")}catch(l){let u=`Invalid URL input format: ${n}`;Q(r,u,l)}if(a==="blob")return t?.revokeObjectURL&&URL.revokeObjectURL(n),null;(a||t.allowRelative)&&(s=se.sanitize(n,t))}return s||null},Pn=async n=>se.inspect(n),mo=n=>Pn(n),kn=n=>se.inspect(n),ho=n=>kn(n),go=async n=>se.verify(n),To=n=>se.verify(n),Eo=se;export{Eo as default,Pn as inspectURL,kn as inspectURLSync,go as isURI,To as isURISync,mo as parseURL,ho as parseURLSync,fo as sanitizeURL,po as sanitizeURLSync};
4
4
  /*!
5
5
  * URL Sanitizer
6
6
  *
@@ -11,6 +11,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
11
11
  /*! Bundled license information:
12
12
 
13
13
  dompurify/dist/purify.es.mjs:
14
- (*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE *)
14
+ (*! @license DOMPurify 3.4.12 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.12/LICENSE *)
15
15
  */
16
16
  //# sourceMappingURL=url-sanitizer.min.js.map