New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

url-sanitizer

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

url-sanitizer - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

6

dist/url-sanitizer.min.js

@@ -1,3 +0,3 @@

var{entries:zt,setPrototypeOf:It,isFrozen:hn,getPrototypeOf:gn,getOwnPropertyDescriptor:En}=Object,{freeze:D,seal:U,create:Ht}=Object,{apply:Qe,construct:Je}=typeof Reflect<"u"&&Reflect;D||(D=function(t){return t});U||(U=function(t){return t});Qe||(Qe=function(t,o,r){return t.apply(o,r)});Je||(Je=function(t,o){return new t(...o)});var Oe=N(Array.prototype.forEach),Nt=N(Array.prototype.pop),de=N(Array.prototype.push),Ce=N(String.prototype.toLowerCase),Xe=N(String.prototype.toString),Mt=N(String.prototype.match),he=N(String.prototype.replace),Tn=N(String.prototype.indexOf),_n=N(String.prototype.trim),G=N(Object.prototype.hasOwnProperty),O=N(RegExp.prototype.test),ge=An(TypeError);function N(n){return function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return Qe(n,t,r)}}function An(n){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return Je(n,o)}}function f(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ce;It&&It(n,null);let r=t.length;for(;r--;){let l=t[r];if(typeof l=="string"){let c=o(l);c!==l&&(hn(t)||(t[r]=c),l=c)}n[l]=!0}return n}function yn(n){for(let t=0;t<n.length;t++)G(n,t)||(n[t]=null);return n}function K(n){let t=Ht(null);for(let[o,r]of zt(n))G(n,o)&&(Array.isArray(r)?t[o]=yn(r):r&&typeof r=="object"&&r.constructor===Object?t[o]=K(r):t[o]=r);return t}function Ee(n,t){for(;n!==null;){let r=En(n,t);if(r){if(r.get)return N(r.get);if(typeof r.value=="function")return N(r.value)}n=gn(n)}function o(){return null}return o}var Ut=D(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),qe=D(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ve=D(["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"]),Rn=D(["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"]),Ke=D(["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"]),bn=D(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pt=D(["#text"]),kt=D(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ze=D(["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","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"]),Ft=D(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),De=D(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sn=U(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wn=U(/<%[\w\W]*|[\w\W]*%>/gm),xn=U(/\${[\w\W]*}/gm),Ln=U(/^data-[\-\w.\u00B7-\uFFFF]/),On=U(/^aria-[\-\w]+$/),$t=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dn=U(/^(?:\w+script|data):/i),Cn=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Bt=U(/^html$/i),vn=U(/^[a-z][.\w]*(-[.\w]+)+$/i),Gt=Object.freeze({__proto__:null,ARIA_ATTR:On,ATTR_WHITESPACE:Cn,CUSTOM_ELEMENT:vn,DATA_ATTR:Ln,DOCTYPE_NAME:Bt,ERB_EXPR:wn,IS_ALLOWED_URI:$t,IS_SCRIPT_OR_DATA:Dn,MUSTACHE_EXPR:Sn,TMPLIT_EXPR:xn}),Te={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},In=function(){return typeof window>"u"?null:window},Nn=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,l="data-tt-policy-suffix";o&&o.hasAttribute(l)&&(r=o.getAttribute(l));let c="dompurify"+(r?"#"+r:"");try{return t.createPolicy(c,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}};function Wt(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:In(),t=a=>Wt(a);if(t.version="3.2.1",t.removed=[],!n||!n.document||n.document.nodeType!==Te.document)return t.isSupported=!1,t;let{document:o}=n,r=o,l=r.currentScript,{DocumentFragment:c,HTMLTemplateElement:p,Node:u,Element:E,NodeFilter:w,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:m,DOMParser:T,trustedTypes:B}=n,M=E.prototype,Y=Ee(M,"cloneNode"),le=Ee(M,"remove"),Q=Ee(M,"nextSibling"),P=Ee(M,"childNodes"),k=Ee(M,"parentNode");if(typeof p=="function"){let a=o.createElement("template");a.content&&a.content.ownerDocument&&(o=a.content.ownerDocument)}let d,F="",{implementation:q,createNodeIterator:J,createDocumentFragment:ee,getElementsByTagName:_e}=o,{importNode:v}=r,I={};t.isSupported=typeof zt=="function"&&typeof k=="function"&&q&&q.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:te,ERB_EXPR:ce,TMPLIT_EXPR:Ae,DATA_ATTR:Pe,ARIA_ATTR:sn,IS_SCRIPT_OR_DATA:on,ATTR_WHITESPACE:it,CUSTOM_ELEMENT:rn}=Gt,{IS_ALLOWED_URI:at}=Gt,A=null,lt=f({},[...Ut,...qe,...Ve,...Ke,...Pt]),y=null,ct=f({},[...kt,...Ze,...Ft,...De]),_=Object.seal(Ht(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}})),pe=null,ke=null,pt=!0,Fe=!0,ft=!1,mt=!0,ne=!1,Ge=!0,V=!1,ze=!1,He=!1,se=!1,ye=!1,Re=!1,ut=!0,dt=!1,an="user-content-",$e=!0,fe=!1,oe={},re=null,ht=f({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),gt=null,Et=f({},["audio","video","img","source","image","track"]),Be=null,Tt=f({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),be="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",W="http://www.w3.org/1999/xhtml",ie=W,We=!1,je=null,ln=f({},[be,Se,W],Xe),we=f({},["mi","mo","mn","ms","mtext"]),xe=f({},["annotation-xml"]),cn=f({},["title","style","font","a","script"]),me=null,pn=["application/xhtml+xml","text/html"],fn="text/html",R=null,ae=null,mn=o.createElement("form"),_t=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ae&&ae===e)){if((!e||typeof e!="object")&&(e={}),e=K(e),me=pn.indexOf(e.PARSER_MEDIA_TYPE)===-1?fn:e.PARSER_MEDIA_TYPE,R=me==="application/xhtml+xml"?Xe:Ce,A=G(e,"ALLOWED_TAGS")?f({},e.ALLOWED_TAGS,R):lt,y=G(e,"ALLOWED_ATTR")?f({},e.ALLOWED_ATTR,R):ct,je=G(e,"ALLOWED_NAMESPACES")?f({},e.ALLOWED_NAMESPACES,Xe):ln,Be=G(e,"ADD_URI_SAFE_ATTR")?f(K(Tt),e.ADD_URI_SAFE_ATTR,R):Tt,gt=G(e,"ADD_DATA_URI_TAGS")?f(K(Et),e.ADD_DATA_URI_TAGS,R):Et,re=G(e,"FORBID_CONTENTS")?f({},e.FORBID_CONTENTS,R):ht,pe=G(e,"FORBID_TAGS")?f({},e.FORBID_TAGS,R):{},ke=G(e,"FORBID_ATTR")?f({},e.FORBID_ATTR,R):{},oe=G(e,"USE_PROFILES")?e.USE_PROFILES:!1,pt=e.ALLOW_ARIA_ATTR!==!1,Fe=e.ALLOW_DATA_ATTR!==!1,ft=e.ALLOW_UNKNOWN_PROTOCOLS||!1,mt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=e.SAFE_FOR_TEMPLATES||!1,Ge=e.SAFE_FOR_XML!==!1,V=e.WHOLE_DOCUMENT||!1,se=e.RETURN_DOM||!1,ye=e.RETURN_DOM_FRAGMENT||!1,Re=e.RETURN_TRUSTED_TYPE||!1,He=e.FORCE_BODY||!1,ut=e.SANITIZE_DOM!==!1,dt=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,fe=e.IN_PLACE||!1,at=e.ALLOWED_URI_REGEXP||$t,ie=e.NAMESPACE||W,we=e.MATHML_TEXT_INTEGRATION_POINTS||we,xe=e.HTML_INTEGRATION_POINTS||xe,_=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&_t(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ne&&(Fe=!1),ye&&(se=!0),oe&&(A=f({},Pt),y=[],oe.html===!0&&(f(A,Ut),f(y,kt)),oe.svg===!0&&(f(A,qe),f(y,Ze),f(y,De)),oe.svgFilters===!0&&(f(A,Ve),f(y,Ze),f(y,De)),oe.mathMl===!0&&(f(A,Ke),f(y,Ft),f(y,De))),e.ADD_TAGS&&(A===lt&&(A=K(A)),f(A,e.ADD_TAGS,R)),e.ADD_ATTR&&(y===ct&&(y=K(y)),f(y,e.ADD_ATTR,R)),e.ADD_URI_SAFE_ATTR&&f(Be,e.ADD_URI_SAFE_ATTR,R),e.FORBID_CONTENTS&&(re===ht&&(re=K(re)),f(re,e.FORBID_CONTENTS,R)),$e&&(A["#text"]=!0),V&&f(A,["html","head","body"]),A.table&&(f(A,["tbody"]),delete pe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');d=e.TRUSTED_TYPES_POLICY,F=d.createHTML("")}else d===void 0&&(d=Nn(B,l)),d!==null&&typeof F=="string"&&(F=d.createHTML(""));D&&D(e),ae=e}},At=f({},[...qe,...Ve,...Rn]),yt=f({},[...Ke,...bn]),un=function(e){let s=k(e);(!s||!s.tagName)&&(s={namespaceURI:ie,tagName:"template"});let i=Ce(e.tagName),g=Ce(s.tagName);return je[e.namespaceURI]?e.namespaceURI===Se?s.namespaceURI===W?i==="svg":s.namespaceURI===be?i==="svg"&&(g==="annotation-xml"||we[g]):!!At[i]:e.namespaceURI===be?s.namespaceURI===W?i==="math":s.namespaceURI===Se?i==="math"&&xe[g]:!!yt[i]:e.namespaceURI===W?s.namespaceURI===Se&&!xe[g]||s.namespaceURI===be&&!we[g]?!1:!yt[i]&&(cn[i]||!At[i]):!!(me==="application/xhtml+xml"&&je[e.namespaceURI]):!1},z=function(e){de(t.removed,{element:e});try{k(e).removeChild(e)}catch{le(e)}},Le=function(e,s){try{de(t.removed,{attribute:s.getAttributeNode(e),from:s})}catch{de(t.removed,{attribute:null,from:s})}if(s.removeAttribute(e),e==="is"&&!y[e])if(se||ye)try{z(s)}catch{}else try{s.setAttribute(e,"")}catch{}},Rt=function(e){let s=null,i=null;if(He)e="<remove></remove>"+e;else{let b=Mt(e,/^[\r\n\t ]+/);i=b&&b[0]}me==="application/xhtml+xml"&&ie===W&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let g=d?d.createHTML(e):e;if(ie===W)try{s=new T().parseFromString(g,me)}catch{}if(!s||!s.documentElement){s=q.createDocument(ie,"template",null);try{s.documentElement.innerHTML=We?F:g}catch{}}let x=s.body||s.documentElement;return e&&i&&x.insertBefore(o.createTextNode(i),x.childNodes[0]||null),ie===W?_e.call(s,V?"html":"body")[0]:V?s.documentElement:x},bt=function(e){return J.call(e.ownerDocument||e,e,w.SHOW_ELEMENT|w.SHOW_COMMENT|w.SHOW_TEXT|w.SHOW_PROCESSING_INSTRUCTION|w.SHOW_CDATA_SECTION,null)},St=function(e){return e instanceof m&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof h)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},wt=function(e){return typeof u=="function"&&e instanceof u};function j(a,e,s){I[a]&&Oe(I[a],i=>{i.call(t,e,s,ae)})}let xt=function(e){let s=null;if(j("beforeSanitizeElements",e,null),St(e))return z(e),!0;let i=R(e.nodeName);if(j("uponSanitizeElement",e,{tagName:i,allowedTags:A}),e.hasChildNodes()&&!wt(e.firstElementChild)&&O(/<[/\w]/g,e.innerHTML)&&O(/<[/\w]/g,e.textContent)||e.nodeType===Te.progressingInstruction||Ge&&e.nodeType===Te.comment&&O(/<[/\w]/g,e.data))return z(e),!0;if(!A[i]||pe[i]){if(!pe[i]&&Ot(i)&&(_.tagNameCheck instanceof RegExp&&O(_.tagNameCheck,i)||_.tagNameCheck instanceof Function&&_.tagNameCheck(i)))return!1;if($e&&!re[i]){let g=k(e)||e.parentNode,x=P(e)||e.childNodes;if(x&&g){let b=x.length;for(let C=b-1;C>=0;--C){let H=Y(x[C],!0);H.__removalCount=(e.__removalCount||0)+1,g.insertBefore(H,Q(e))}}}return z(e),!0}return e instanceof E&&!un(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&O(/<\/no(script|embed|frames)/i,e.innerHTML)?(z(e),!0):(ne&&e.nodeType===Te.text&&(s=e.textContent,Oe([te,ce,Ae],g=>{s=he(s,g," ")}),e.textContent!==s&&(de(t.removed,{element:e.cloneNode()}),e.textContent=s)),j("afterSanitizeElements",e,null),!1)},Lt=function(e,s,i){if(ut&&(s==="id"||s==="name")&&(i in o||i in mn))return!1;if(!(Fe&&!ke[s]&&O(Pe,s))){if(!(pt&&O(sn,s))){if(!y[s]||ke[s]){if(!(Ot(e)&&(_.tagNameCheck instanceof RegExp&&O(_.tagNameCheck,e)||_.tagNameCheck instanceof Function&&_.tagNameCheck(e))&&(_.attributeNameCheck instanceof RegExp&&O(_.attributeNameCheck,s)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(s))||s==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&O(_.tagNameCheck,i)||_.tagNameCheck instanceof Function&&_.tagNameCheck(i))))return!1}else if(!Be[s]){if(!O(at,he(i,it,""))){if(!((s==="src"||s==="xlink:href"||s==="href")&&e!=="script"&&Tn(i,"data:")===0&&gt[e])){if(!(ft&&!O(on,he(i,it,"")))){if(i)return!1}}}}}}return!0},Ot=function(e){return e!=="annotation-xml"&&Mt(e,rn)},Dt=function(e){j("beforeSanitizeAttributes",e,null);let{attributes:s}=e;if(!s)return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:y,forceKeepAttr:void 0},g=s.length;for(;g--;){let x=s[g],{name:b,namespaceURI:C,value:H}=x,ue=R(b),L=b==="value"?H:_n(H);if(i.attrName=ue,i.attrValue=L,i.keepAttr=!0,i.forceKeepAttr=void 0,j("uponSanitizeAttribute",e,i),L=i.attrValue,dt&&(ue==="id"||ue==="name")&&(Le(b,e),L=an+L),Ge&&O(/((--!?|])>)|<\/(style|title)/i,L)){Le(b,e);continue}if(i.forceKeepAttr||(Le(b,e),!i.keepAttr))continue;if(!mt&&O(/\/>/i,L)){Le(b,e);continue}ne&&Oe([te,ce,Ae],vt=>{L=he(L,vt," ")});let Ct=R(e.nodeName);if(Lt(Ct,ue,L)){if(d&&typeof B=="object"&&typeof B.getAttributeType=="function"&&!C)switch(B.getAttributeType(Ct,ue)){case"TrustedHTML":{L=d.createHTML(L);break}case"TrustedScriptURL":{L=d.createScriptURL(L);break}}try{C?e.setAttributeNS(C,b,L):e.setAttribute(b,L),St(e)?z(e):Nt(t.removed)}catch{}}}j("afterSanitizeAttributes",e,null)},dn=function a(e){let s=null,i=bt(e);for(j("beforeSanitizeShadowDOM",e,null);s=i.nextNode();)j("uponSanitizeShadowNode",s,null),!xt(s)&&(s.content instanceof c&&a(s.content),Dt(s));j("afterSanitizeShadowDOM",e,null)};return t.sanitize=function(a){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=null,i=null,g=null,x=null;if(We=!a,We&&(a="<!-->"),typeof a!="string"&&!wt(a))if(typeof a.toString=="function"){if(a=a.toString(),typeof a!="string")throw ge("dirty is not a string, aborting")}else throw ge("toString is not a function");if(!t.isSupported)return a;if(ze||Ye(e),t.removed=[],typeof a=="string"&&(fe=!1),fe){if(a.nodeName){let H=R(a.nodeName);if(!A[H]||pe[H])throw ge("root node is forbidden and cannot be sanitized in-place")}}else if(a instanceof u)s=Rt("<!---->"),i=s.ownerDocument.importNode(a,!0),i.nodeType===Te.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?s=i:s.appendChild(i);else{if(!se&&!ne&&!V&&a.indexOf("<")===-1)return d&&Re?d.createHTML(a):a;if(s=Rt(a),!s)return se?null:Re?F:""}s&&He&&z(s.firstChild);let b=bt(fe?a:s);for(;g=b.nextNode();)xt(g)||(g.content instanceof c&&dn(g.content),Dt(g));if(fe)return a;if(se){if(ye)for(x=ee.call(s.ownerDocument);s.firstChild;)x.appendChild(s.firstChild);else x=s;return(y.shadowroot||y.shadowrootmode)&&(x=v.call(r,x,!0)),x}let C=V?s.outerHTML:s.innerHTML;return V&&A["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&O(Bt,s.ownerDocument.doctype.name)&&(C="<!DOCTYPE "+s.ownerDocument.doctype.name+`>
`+C),ne&&Oe([te,ce,Ae],H=>{C=he(C,H," ")}),d&&Re?d.createHTML(C):C},t.setConfig=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(a),ze=!0},t.clearConfig=function(){ae=null,ze=!1},t.isValidAttribute=function(a,e,s){ae||Ye({});let i=R(a),g=R(e);return Lt(i,g,s)},t.addHook=function(a,e){typeof e=="function"&&(I[a]=I[a]||[],de(I[a],e))},t.removeHook=function(a){if(I[a])return Nt(I[a])},t.removeHooks=function(a){I[a]&&(I[a]=[])},t.removeAllHooks=function(){I={}},t}var et=Wt();var jt=/^[\w+/=-]+$/;var ve=/data:[\w#&+./;=-]*,/,tt=/data:[\w#&+./;=^]*base64,[\w+/=-]+/i,Yt=/data:[\w#&+./;=-]*,[^\x22]+/g,Xt=/&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi,qt=/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;var Vt=/^[a-z][\da-z+.-]*$/,Kt=/^(?:ext|web)\+[a-z]+$/,nt=/(?:java|vb)script/,Ie=/(?:java|vb)script|blob/,st=/%(?:22|27|3C|3E)|[\x22\x27<>]/,Zt=/^%[\dA-F]{2}$/i;var $=n=>Object.prototype.toString.call(n).slice(8,-1),S=n=>typeof n=="string"||n instanceof String;var{FileReader:Qt}=globalThis;var Ne=[7,8,9,10,11,12,13,27,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,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,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 Me=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","afp","afs","aim","amss","android","appdata","apt","ar","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","blob","bluetooth","bolo","brid","browserext","cabal","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dis","dlna-playcontainer","dlna-playsingle","dns","dntp","doi","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","ethereum","example","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","iax","icap","icon","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","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","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-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mumble","mupdate","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","notes","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","spiffe","spotify","ssb","ssh","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","turn","turns","tv","udp","unreal","urn","ut2004","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s"];var Jt=n=>{if(!S(n))throw new TypeError(`Expected String but got ${$(n)}.`);let t=[];for(let o of n)t.push(`%${o.charCodeAt(0).toString(16).toUpperCase()}`);return t.join("")},en=n=>{S(n)&&Zt.test(n)&&(n=n.toUpperCase());let[t,o,r,l,c,p]=["&","#","<",">",'"',"'"].map(Jt),u;return n===t?u=`${t}amp;`:n===r?u=`${t}lt;`:n===l?u=`${t}gt;`:n===c?u=`${t}quot;`:n===p?u=`${t}${o}39;`:u=n,u},tn=n=>{if(S(n)){if(!jt.test(n))throw new Error(`Invalid base64 data: ${n}`)}else throw new TypeError(`Expected String but got ${$(n)}.`);let t=atob(n),o=Uint8Array.from([...t].map(c=>c.charCodeAt(0))),r=new Set(Ne),l;return o.every(c=>r.has(c))?l=t.replace(/\s/g,Jt):l=n,l},ot=(n,t=0)=>{if(!S(n))throw new TypeError(`Expected String but got ${$(n)}.`);if(Number.isInteger(t)){if(t>16)throw new Error("Character references nested too deeply.")}else throw new TypeError(`Expected Number but got ${$(t)}.`);let o=decodeURIComponent(n);if(/&#/.test(o)){let r=new Set(Ne),l=[...o.matchAll(Xt)].reverse();for(let c of l){let[p,u]=c,E;if(/^x[\dA-F]+/i.test(u)?E=parseInt(`0${u}`,16):/^\d+/.test(u)&&(E=parseInt(u)),Number.isInteger(E)){let{index:w}=c,[h,m]=[o.substring(0,w),o.substring(w+p.length)];r.has(E)?(o=`${h}${String.fromCharCode(E)}${m}`,(/#x?$/.test(h)||/^#(?:x(?:00)?[2-7]|\d)/.test(m))&&(o=ot(o,++t))):E<16*16&&(o=`${h}${m}`)}}}return o},nn=n=>new Promise((t,o)=>{let r=new Qt;r.addEventListener("error",()=>o(r.error)),r.addEventListener("abort",()=>t(r.result)),r.addEventListener("load",()=>t(r.result)),r.readAsDataURL(n)}),Ue=class{#e;constructor(){this.#e=new Set(Me)}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(S(t)){if(nt.test(t)||!Vt.test(t))throw new Error(`Invalid scheme: ${t}`)}else throw new TypeError(`Expected String but got ${$(t)}.`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}verify(t){let o;if(S(t))try{let{protocol:r}=new URL(t),l=r.replace(/:$/,""),c=l.split("+");o=!nt.test(l)&&Kt.test(l)||c.every(p=>this.#e.has(p))}catch{o=!1}return!!o}reset(){this.#e.clear();for(let t of Me)this.#e.add(t)}};var rt=class extends Ue{#e;#t;constructor(){super(),this.#e=0,this.#t=new Set}replace(t){if(!S(t))throw new TypeError(`Expected String but got ${$(t)}.`);let o=t;if(ve.test(o)){let l=[...o.matchAll(Yt)].reverse();for(let c of l){let[p]=c;tt.test(p)&&([p]=tt.exec(p)),this.#e++,this.#t.add(p);let u=this.sanitize(p,{allow:["data"]}),{index:E}=c,[w,h]=[o.substring(0,E),o.substring(E+p.length)];u?o=`${w}${u}${h}`:o=`${w}${h}`}}return o}purify(t){if(!S(t))throw new TypeError(`Expected String but got ${$(t)}.`);let o=et.sanitize(decodeURIComponent(t));return o&&ve.test(o)&&(o=this.replace(o)),o=o.replace(/(?:#|%23)$/,"").replace(/(?<!(?:#|%23).*)(?:\?|%3F)$/,""),encodeURI(o)}sanitize(t,o){if(this.#e>16)throw this.#e=0,new Error("Data URLs nested too deeply.");let{allow:r,deny:l,only:c}=o??{},p=new Map([["blob",!1],["data",!1],["file",!1],["javascrpt",!1],["vbscript",!1]]),u=new Set,E=!1;if(Array.isArray(c)&&c.length){let h=super.get();for(let T of h)p.set(T,!1);let m=Object.values(c);for(let T of m)if(S(T)&&(T=T.trim(),!Ie.test(T))){if(super.has(T))p.set(T,!0);else{try{super.add(T)}catch{}super.has(T)&&(p.set(T,!0),u.add(T))}!E&&p.has(T)&&(E=p.get(T))}}else{if(Array.isArray(r)&&r.length){let h=Object.values(r);for(let m of h)if(S(m)&&(m=m.trim(),!Ie.test(m)))if(super.has(m))p.set(m,!0);else{try{super.add(m)}catch{}super.has(m)&&(p.set(m,!0),u.add(m))}}if(Array.isArray(l)&&l.length){let h=Object.values(l);for(let m of h)S(m)&&(m=m.trim(),m&&p.set(m,!1))}}let w;if(super.verify(t)){let{hash:h,href:m,pathname:T,protocol:B,search:M}=new URL(t),Y=B.replace(/:$/,""),le=Y.split("+"),Q;if(E)Q=le.every(P=>p.get(P));else for(let[P,k]of p.entries())if(Q=k||Y!==P&&le.every(d=>d!==P),!Q)break;if(Q){let P=le.includes("data"),k,d=m;if(P){let[F,...q]=T.split(","),J=`${q.join(",")}${M}${h}`,ee=F.split(";"),_e=ee[ee.length-1]==="base64",v=J;_e&&(v=tn(J));try{let te=ot(v).trim(),{protocol:ce}=new URL(te);ce.replace(/:$/,"").split("+").some(Pe=>Ie.test(Pe))&&(d="")}catch{}let I=ve.test(v);v!==J||I?I?v=this.replace(v):this.#t.has(t)?this.#t.delete(t):k=!0:this.#t.has(t)?this.#t.delete(t):k=!0,(!F||qt.test(F))&&(v=this.purify(v)),d&&v?(_e&&v!==J&&ee.pop(),d=`${Y}:${ee.join(";")},${v}`):d=""}else k=!0;if(!P&&st.test(d)){let F=st.exec(d),{index:q}=F;d=d.substring(0,q).replace(/[?&]$/,"")}d?(w=d.replace(/%26/g,en),k&&(this.#e=0)):this.#e=0}u.size&&u.forEach(P=>{super.remove(P)})}return w||null}parse(t,o){if(!S(t))throw new TypeError(`Expected String but got ${$(t)}.`);let r=new Map([["input",t]]),l;if(this.verify(t)){let{protocol:c}=new URL(t);c==="blob:"?l=t:l=this.sanitize(t,o??{allow:["data","file"]})}if(l){let c=new URL(l),{pathname:p,protocol:u}=c,w=u.replace(/:$/,"").split("+").includes("data");if(r.set("valid",!0),w){let h=new Map,[m,...T]=p.split(","),B=`${T.join(",")}`,M=m.split(";"),Y=M[M.length-1]==="base64";Y&&M.pop(),h.set("mime",M.join(";")),h.set("base64",Y),h.set("data",B),r.set("data",Object.fromEntries(h))}else r.set("data",null);for(let h in c){let m=c[h];S(m)&&r.set(h,m)}}else r.set("valid",!1);return Object.fromEntries(r)}reset(){super.reset(),this.#e=0,this.#t.clear()}},X=new rt,Fn=async(n,t={allow:[],deny:[],only:[]})=>{let o;if(n&&S(n)){let r;try{let{protocol:l}=new URL(n);r=l.replace(/:$/,"")}catch{}if(r==="blob"){let{allow:l,deny:c,only:p}=t;if(Array.isArray(l)&&l.includes("blob")&&!(Array.isArray(c)&&c.includes("blob"))||Array.isArray(p)&&p.includes("blob")){let u;try{u=await fetch(n).then(E=>E.blob()).then(nn)}catch{}if(u){if(Array.isArray(p))p.includes("data")||p.push("data");else if(Array.isArray(l)&&(l.includes("data")||l.push("data"),Array.isArray(c)&&c.includes("data"))){let E=c.indexOf("data");c.splice(E,1)}o=X.sanitize(u,t)}}URL.revokeObjectURL(n)}else r&&(o=X.sanitize(n,t))}return o||null},Gn=(n,t)=>{let o;if(n&&S(n)){let r;try{let{protocol:l}=new URL(n);r=l.replace(/:$/,"")}catch{}r==="blob"?URL.revokeObjectURL(n):r&&(o=X.sanitize(n,t))}return o||null},zn=async n=>X.parse(n),Hn=n=>X.parse(n),$n=async n=>X.verify(n),Bn=n=>X.verify(n),Wn=X;export{Wn as default,$n as isURI,Bn as isURISync,zn as parseURL,Hn as parseURLSync,Fn as sanitizeURL,Gn as sanitizeURLSync};
var{entries:Ht,setPrototypeOf:vt,isFrozen:gn,getPrototypeOf:En,getOwnPropertyDescriptor:Tn}=Object,{freeze:C,seal:U,create:$t}=Object,{apply:Je,construct:et}=typeof Reflect<"u"&&Reflect;C||(C=function(t){return t});U||(U=function(t){return t});Je||(Je=function(t,o,r){return t.apply(o,r)});et||(et=function(t,o){return new t(...o)});var Oe=I(Array.prototype.forEach),It=I(Array.prototype.pop),de=I(Array.prototype.push),Ce=I(String.prototype.toLowerCase),qe=I(String.prototype.toString),Nt=I(String.prototype.match),he=I(String.prototype.replace),_n=I(String.prototype.indexOf),An=I(String.prototype.trim),z=I(Object.prototype.hasOwnProperty),D=I(RegExp.prototype.test),ge=yn(TypeError);function I(n){return function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),l=1;l<o;l++)r[l-1]=arguments[l];return Je(n,t,r)}}function yn(n){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return et(n,o)}}function f(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ce;vt&&vt(n,null);let r=t.length;for(;r--;){let l=t[r];if(typeof l=="string"){let c=o(l);c!==l&&(gn(t)||(t[r]=c),l=c)}n[l]=!0}return n}function Rn(n){for(let t=0;t<n.length;t++)z(n,t)||(n[t]=null);return n}function K(n){let t=$t(null);for(let[o,r]of Ht(n))z(n,o)&&(Array.isArray(r)?t[o]=Rn(r):r&&typeof r=="object"&&r.constructor===Object?t[o]=K(r):t[o]=r);return t}function Ee(n,t){for(;n!==null;){let r=Tn(n,t);if(r){if(r.get)return I(r.get);if(typeof r.value=="function")return I(r.value)}n=En(n)}function o(){return null}return o}var Ut=C(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Ve=C(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ke=C(["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"]),bn=C(["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"]),Ze=C(["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"]),Sn=C(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pt=C(["#text"]),kt=C(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Qe=C(["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","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"]),Ft=C(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),De=C(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),wn=U(/\{\{[\w\W]*|[\w\W]*\}\}/gm),xn=U(/<%[\w\W]*|[\w\W]*%>/gm),Ln=U(/\$\{[\w\W]*}/gm),On=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Dn=U(/^aria-[\-\w]+$/),Bt=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Cn=U(/^(?:\w+script|data):/i),Mn=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wt=U(/^html$/i),vn=U(/^[a-z][.\w]*(-[.\w]+)+$/i),zt=Object.freeze({__proto__:null,ARIA_ATTR:Dn,ATTR_WHITESPACE:Mn,CUSTOM_ELEMENT:vn,DATA_ATTR:On,DOCTYPE_NAME:Wt,ERB_EXPR:xn,IS_ALLOWED_URI:Bt,IS_SCRIPT_OR_DATA:Cn,MUSTACHE_EXPR:wn,TMPLIT_EXPR:Ln}),Te={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},In=function(){return typeof window>"u"?null:window},Nn=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,l="data-tt-policy-suffix";o&&o.hasAttribute(l)&&(r=o.getAttribute(l));let c="dompurify"+(r?"#"+r:"");try{return t.createPolicy(c,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+c+" could not be created."),null}},Gt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function jt(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:In(),t=a=>jt(a);if(t.version="3.2.3",t.removed=[],!n||!n.document||n.document.nodeType!==Te.document)return t.isSupported=!1,t;let{document:o}=n,r=o,l=r.currentScript,{DocumentFragment:c,HTMLTemplateElement:p,Node:u,Element:E,NodeFilter:w,NamedNodeMap:h=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:m,DOMParser:T,trustedTypes:B}=n,N=E.prototype,Y=Ee(N,"cloneNode"),le=Ee(N,"remove"),Q=Ee(N,"nextSibling"),P=Ee(N,"childNodes"),k=Ee(N,"parentNode");if(typeof p=="function"){let a=o.createElement("template");a.content&&a.content.ownerDocument&&(o=a.content.ownerDocument)}let d,F="",{implementation:q,createNodeIterator:J,createDocumentFragment:ee,getElementsByTagName:_e}=o,{importNode:v}=r,x=Gt();t.isSupported=typeof Ht=="function"&&typeof k=="function"&&q&&q.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:te,ERB_EXPR:ce,TMPLIT_EXPR:Ae,DATA_ATTR:Pe,ARIA_ATTR:on,IS_SCRIPT_OR_DATA:rn,ATTR_WHITESPACE:at,CUSTOM_ELEMENT:an}=zt,{IS_ALLOWED_URI:lt}=zt,A=null,ct=f({},[...Ut,...Ve,...Ke,...Ze,...Pt]),R=null,pt=f({},[...kt,...Qe,...Ft,...De]),_=Object.seal($t(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}})),pe=null,ke=null,ft=!0,Fe=!0,mt=!1,ut=!0,ne=!1,ze=!0,V=!1,Ge=!1,He=!1,se=!1,ye=!1,Re=!1,dt=!0,ht=!1,ln="user-content-",$e=!0,fe=!1,oe={},re=null,gt=f({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Et=null,Tt=f({},["audio","video","img","source","image","track"]),Be=null,_t=f({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),be="http://www.w3.org/1998/Math/MathML",Se="http://www.w3.org/2000/svg",W="http://www.w3.org/1999/xhtml",ie=W,We=!1,je=null,cn=f({},[be,Se,W],qe),we=f({},["mi","mo","mn","ms","mtext"]),xe=f({},["annotation-xml"]),pn=f({},["title","style","font","a","script"]),me=null,fn=["application/xhtml+xml","text/html"],mn="text/html",y=null,ae=null,un=o.createElement("form"),At=function(e){return e instanceof RegExp||e instanceof Function},Ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ae&&ae===e)){if((!e||typeof e!="object")&&(e={}),e=K(e),me=fn.indexOf(e.PARSER_MEDIA_TYPE)===-1?mn:e.PARSER_MEDIA_TYPE,y=me==="application/xhtml+xml"?qe:Ce,A=z(e,"ALLOWED_TAGS")?f({},e.ALLOWED_TAGS,y):ct,R=z(e,"ALLOWED_ATTR")?f({},e.ALLOWED_ATTR,y):pt,je=z(e,"ALLOWED_NAMESPACES")?f({},e.ALLOWED_NAMESPACES,qe):cn,Be=z(e,"ADD_URI_SAFE_ATTR")?f(K(_t),e.ADD_URI_SAFE_ATTR,y):_t,Et=z(e,"ADD_DATA_URI_TAGS")?f(K(Tt),e.ADD_DATA_URI_TAGS,y):Tt,re=z(e,"FORBID_CONTENTS")?f({},e.FORBID_CONTENTS,y):gt,pe=z(e,"FORBID_TAGS")?f({},e.FORBID_TAGS,y):{},ke=z(e,"FORBID_ATTR")?f({},e.FORBID_ATTR,y):{},oe=z(e,"USE_PROFILES")?e.USE_PROFILES:!1,ft=e.ALLOW_ARIA_ATTR!==!1,Fe=e.ALLOW_DATA_ATTR!==!1,mt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ut=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ne=e.SAFE_FOR_TEMPLATES||!1,ze=e.SAFE_FOR_XML!==!1,V=e.WHOLE_DOCUMENT||!1,se=e.RETURN_DOM||!1,ye=e.RETURN_DOM_FRAGMENT||!1,Re=e.RETURN_TRUSTED_TYPE||!1,He=e.FORCE_BODY||!1,dt=e.SANITIZE_DOM!==!1,ht=e.SANITIZE_NAMED_PROPS||!1,$e=e.KEEP_CONTENT!==!1,fe=e.IN_PLACE||!1,lt=e.ALLOWED_URI_REGEXP||Bt,ie=e.NAMESPACE||W,we=e.MATHML_TEXT_INTEGRATION_POINTS||we,xe=e.HTML_INTEGRATION_POINTS||xe,_=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&At(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&At(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ne&&(Fe=!1),ye&&(se=!0),oe&&(A=f({},Pt),R=[],oe.html===!0&&(f(A,Ut),f(R,kt)),oe.svg===!0&&(f(A,Ve),f(R,Qe),f(R,De)),oe.svgFilters===!0&&(f(A,Ke),f(R,Qe),f(R,De)),oe.mathMl===!0&&(f(A,Ze),f(R,Ft),f(R,De))),e.ADD_TAGS&&(A===ct&&(A=K(A)),f(A,e.ADD_TAGS,y)),e.ADD_ATTR&&(R===pt&&(R=K(R)),f(R,e.ADD_ATTR,y)),e.ADD_URI_SAFE_ATTR&&f(Be,e.ADD_URI_SAFE_ATTR,y),e.FORBID_CONTENTS&&(re===gt&&(re=K(re)),f(re,e.FORBID_CONTENTS,y)),$e&&(A["#text"]=!0),V&&f(A,["html","head","body"]),A.table&&(f(A,["tbody"]),delete pe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ge('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');d=e.TRUSTED_TYPES_POLICY,F=d.createHTML("")}else d===void 0&&(d=Nn(B,l)),d!==null&&typeof F=="string"&&(F=d.createHTML(""));C&&C(e),ae=e}},yt=f({},[...Ve,...Ke,...bn]),Rt=f({},[...Ze,...Sn]),dn=function(e){let s=k(e);(!s||!s.tagName)&&(s={namespaceURI:ie,tagName:"template"});let i=Ce(e.tagName),g=Ce(s.tagName);return je[e.namespaceURI]?e.namespaceURI===Se?s.namespaceURI===W?i==="svg":s.namespaceURI===be?i==="svg"&&(g==="annotation-xml"||we[g]):!!yt[i]:e.namespaceURI===be?s.namespaceURI===W?i==="math":s.namespaceURI===Se?i==="math"&&xe[g]:!!Rt[i]:e.namespaceURI===W?s.namespaceURI===Se&&!xe[g]||s.namespaceURI===be&&!we[g]?!1:!Rt[i]&&(pn[i]||!yt[i]):!!(me==="application/xhtml+xml"&&je[e.namespaceURI]):!1},G=function(e){de(t.removed,{element:e});try{k(e).removeChild(e)}catch{le(e)}},Le=function(e,s){try{de(t.removed,{attribute:s.getAttributeNode(e),from:s})}catch{de(t.removed,{attribute:null,from:s})}if(s.removeAttribute(e),e==="is")if(se||ye)try{G(s)}catch{}else try{s.setAttribute(e,"")}catch{}},bt=function(e){let s=null,i=null;if(He)e="<remove></remove>"+e;else{let b=Nt(e,/^[\r\n\t ]+/);i=b&&b[0]}me==="application/xhtml+xml"&&ie===W&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let g=d?d.createHTML(e):e;if(ie===W)try{s=new T().parseFromString(g,me)}catch{}if(!s||!s.documentElement){s=q.createDocument(ie,"template",null);try{s.documentElement.innerHTML=We?F:g}catch{}}let L=s.body||s.documentElement;return e&&i&&L.insertBefore(o.createTextNode(i),L.childNodes[0]||null),ie===W?_e.call(s,V?"html":"body")[0]:V?s.documentElement:L},St=function(e){return J.call(e.ownerDocument||e,e,w.SHOW_ELEMENT|w.SHOW_COMMENT|w.SHOW_TEXT|w.SHOW_PROCESSING_INSTRUCTION|w.SHOW_CDATA_SECTION,null)},Xe=function(e){return e instanceof m&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof h)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},wt=function(e){return typeof u=="function"&&e instanceof u};function j(a,e,s){Oe(a,i=>{i.call(t,e,s,ae)})}let xt=function(e){let s=null;if(j(x.beforeSanitizeElements,e,null),Xe(e))return G(e),!0;let i=y(e.nodeName);if(j(x.uponSanitizeElement,e,{tagName:i,allowedTags:A}),e.hasChildNodes()&&!wt(e.firstElementChild)&&D(/<[/\w]/g,e.innerHTML)&&D(/<[/\w]/g,e.textContent)||e.nodeType===Te.progressingInstruction||ze&&e.nodeType===Te.comment&&D(/<[/\w]/g,e.data))return G(e),!0;if(!A[i]||pe[i]){if(!pe[i]&&Ot(i)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,i)||_.tagNameCheck instanceof Function&&_.tagNameCheck(i)))return!1;if($e&&!re[i]){let g=k(e)||e.parentNode,L=P(e)||e.childNodes;if(L&&g){let b=L.length;for(let M=b-1;M>=0;--M){let H=Y(L[M],!0);H.__removalCount=(e.__removalCount||0)+1,g.insertBefore(H,Q(e))}}}return G(e),!0}return e instanceof E&&!dn(e)||(i==="noscript"||i==="noembed"||i==="noframes")&&D(/<\/no(script|embed|frames)/i,e.innerHTML)?(G(e),!0):(ne&&e.nodeType===Te.text&&(s=e.textContent,Oe([te,ce,Ae],g=>{s=he(s,g," ")}),e.textContent!==s&&(de(t.removed,{element:e.cloneNode()}),e.textContent=s)),j(x.afterSanitizeElements,e,null),!1)},Lt=function(e,s,i){if(dt&&(s==="id"||s==="name")&&(i in o||i in un))return!1;if(!(Fe&&!ke[s]&&D(Pe,s))){if(!(ft&&D(on,s))){if(!R[s]||ke[s]){if(!(Ot(e)&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,e)||_.tagNameCheck instanceof Function&&_.tagNameCheck(e))&&(_.attributeNameCheck instanceof RegExp&&D(_.attributeNameCheck,s)||_.attributeNameCheck instanceof Function&&_.attributeNameCheck(s))||s==="is"&&_.allowCustomizedBuiltInElements&&(_.tagNameCheck instanceof RegExp&&D(_.tagNameCheck,i)||_.tagNameCheck instanceof Function&&_.tagNameCheck(i))))return!1}else if(!Be[s]){if(!D(lt,he(i,at,""))){if(!((s==="src"||s==="xlink:href"||s==="href")&&e!=="script"&&_n(i,"data:")===0&&Et[e])){if(!(mt&&!D(rn,he(i,at,"")))){if(i)return!1}}}}}}return!0},Ot=function(e){return e!=="annotation-xml"&&Nt(e,an)},Dt=function(e){j(x.beforeSanitizeAttributes,e,null);let{attributes:s}=e;if(!s||Xe(e))return;let i={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:R,forceKeepAttr:void 0},g=s.length;for(;g--;){let L=s[g],{name:b,namespaceURI:M,value:H}=L,ue=y(b),O=b==="value"?H:An(H);if(i.attrName=ue,i.attrValue=O,i.keepAttr=!0,i.forceKeepAttr=void 0,j(x.uponSanitizeAttribute,e,i),O=i.attrValue,ht&&(ue==="id"||ue==="name")&&(Le(b,e),O=ln+O),ze&&D(/((--!?|])>)|<\/(style|title)/i,O)){Le(b,e);continue}if(i.forceKeepAttr||(Le(b,e),!i.keepAttr))continue;if(!ut&&D(/\/>/i,O)){Le(b,e);continue}ne&&Oe([te,ce,Ae],Mt=>{O=he(O,Mt," ")});let Ct=y(e.nodeName);if(Lt(Ct,ue,O)){if(d&&typeof B=="object"&&typeof B.getAttributeType=="function"&&!M)switch(B.getAttributeType(Ct,ue)){case"TrustedHTML":{O=d.createHTML(O);break}case"TrustedScriptURL":{O=d.createScriptURL(O);break}}try{M?e.setAttributeNS(M,b,O):e.setAttribute(b,O),Xe(e)?G(e):It(t.removed)}catch{}}}j(x.afterSanitizeAttributes,e,null)},hn=function a(e){let s=null,i=St(e);for(j(x.beforeSanitizeShadowDOM,e,null);s=i.nextNode();)j(x.uponSanitizeShadowNode,s,null),xt(s),Dt(s),s.content instanceof c&&a(s.content);j(x.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(a){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=null,i=null,g=null,L=null;if(We=!a,We&&(a="<!-->"),typeof a!="string"&&!wt(a))if(typeof a.toString=="function"){if(a=a.toString(),typeof a!="string")throw ge("dirty is not a string, aborting")}else throw ge("toString is not a function");if(!t.isSupported)return a;if(Ge||Ye(e),t.removed=[],typeof a=="string"&&(fe=!1),fe){if(a.nodeName){let H=y(a.nodeName);if(!A[H]||pe[H])throw ge("root node is forbidden and cannot be sanitized in-place")}}else if(a instanceof u)s=bt("<!---->"),i=s.ownerDocument.importNode(a,!0),i.nodeType===Te.element&&i.nodeName==="BODY"||i.nodeName==="HTML"?s=i:s.appendChild(i);else{if(!se&&!ne&&!V&&a.indexOf("<")===-1)return d&&Re?d.createHTML(a):a;if(s=bt(a),!s)return se?null:Re?F:""}s&&He&&G(s.firstChild);let b=St(fe?a:s);for(;g=b.nextNode();)xt(g),Dt(g),g.content instanceof c&&hn(g.content);if(fe)return a;if(se){if(ye)for(L=ee.call(s.ownerDocument);s.firstChild;)L.appendChild(s.firstChild);else L=s;return(R.shadowroot||R.shadowrootmode)&&(L=v.call(r,L,!0)),L}let M=V?s.outerHTML:s.innerHTML;return V&&A["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&D(Wt,s.ownerDocument.doctype.name)&&(M="<!DOCTYPE "+s.ownerDocument.doctype.name+`>
`+M),ne&&Oe([te,ce,Ae],H=>{M=he(M,H," ")}),d&&Re?d.createHTML(M):M},t.setConfig=function(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ye(a),Ge=!0},t.clearConfig=function(){ae=null,Ge=!1},t.isValidAttribute=function(a,e,s){ae||Ye({});let i=y(a),g=y(e);return Lt(i,g,s)},t.addHook=function(a,e){typeof e=="function"&&de(x[a],e)},t.removeHook=function(a){return It(x[a])},t.removeHooks=function(a){x[a]=[]},t.removeAllHooks=function(){x=Gt()},t}var tt=jt();var Yt=/^[\w+/=-]+$/;var Me=/data:[\w#&+./;=-]*,/,nt=/data:[\w#&+./;=^]*base64,[\w+/=-]+/i,Xt=/data:[\w#&+./;=-]*,[^\x22]+/g,qt=/&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi,Vt=/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;var Kt=/^[a-z][\da-z+.-]*$/,Zt=/^(?:ext|web)\+[a-z]+$/,st=/(?:java|vb)script/,ve=/(?:java|vb)script|blob/,ot=/%(?:22|27|3C|3E)|[\x22\x27<>]/,Qt=/^%[\dA-F]{2}$/i;var $=n=>Object.prototype.toString.call(n).slice(8,-1),S=n=>typeof n=="string"||n instanceof String;var{FileReader:Jt}=globalThis;var Ie=[7,8,9,10,11,12,13,27,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,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,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 Ne=["aaa","aaas","about","acap","acct","acd","acr","adiumxtra","adt","afp","afs","aim","amss","android","appdata","apt","ar","ark","at","attachment","aw","barion","beshare","bitcoin","bitcoincash","blob","bluetooth","bolo","brid","browserext","cabal","calculator","callto","cap","cast","casts","chrome","chrome-extension","cid","coap","coaps","com-eventbrite-attendee","content","content-type","crid","cstr","cvs","dab","dat","data","dav","dhttp","diaspora","dict","did","dis","dlna-playcontainer","dlna-playsingle","dns","dntp","doi","dpp","drm","dtmi","dtn","dvb","dvx","dweb","ed2k","eid","elsi","embedded","ens","ethereum","example","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","iax","icap","icon","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","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","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-virtualtouchpad","ms-visio","ms-walk-to","ms-whiteboard","ms-whiteboard-cmd","ms-word","msnim","msrp","msrps","mss","mt","mtqp","mumble","mupdate","mvn","mvrp","mvrps","news","nfs","ni","nih","nntp","notes","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","spiffe","spotify","ssb","ssh","starknet","steam","stun","stuns","submit","svn","swh","swid","swidpath","tag","taler","teamspeak","tel","teliaeid","telnet","tftp","things","thismessage","tip","tn3270","tool","turn","turns","tv","udp","unreal","urn","ut2004","uuid-in-package","v-event","vemmi","ventrilo","ves","view-source","vnc","vscode","vscode-insiders","vsls","w3","wcr","web3","webcal","wifi","ws","wss","wtai","wyciwyg","xcon","xcon-userid","xfire","xftp","xmlrpc.beep","xmlrpc.beeps","xmpp","xrcp","xri","ymsgr","z39.50r","z39.50s"];var en=n=>{if(!S(n))throw new TypeError(`Expected String but got ${$(n)}.`);let t=[];for(let o of n)t.push(`%${o.charCodeAt(0).toString(16).toUpperCase()}`);return t.join("")},tn=n=>{S(n)&&Qt.test(n)&&(n=n.toUpperCase());let[t,o,r,l,c,p]=["&","#","<",">",'"',"'"].map(en),u;return n===t?u=`${t}amp;`:n===r?u=`${t}lt;`:n===l?u=`${t}gt;`:n===c?u=`${t}quot;`:n===p?u=`${t}${o}39;`:u=n,u},nn=n=>{if(S(n)){if(!Yt.test(n))throw new Error(`Invalid base64 data: ${n}`)}else throw new TypeError(`Expected String but got ${$(n)}.`);let t=atob(n),o=Uint8Array.from([...t].map(c=>c.charCodeAt(0))),r=new Set(Ie),l;return o.every(c=>r.has(c))?l=t.replace(/\s/g,en):l=n,l},rt=(n,t=0)=>{if(!S(n))throw new TypeError(`Expected String but got ${$(n)}.`);if(Number.isInteger(t)){if(t>16)throw new Error("Character references nested too deeply.")}else throw new TypeError(`Expected Number but got ${$(t)}.`);let o=decodeURIComponent(n);if(/&#/.test(o)){let r=new Set(Ie),l=[...o.matchAll(qt)].reverse();for(let c of l){let[p,u]=c,E;if(/^x[\dA-F]+/i.test(u)?E=parseInt(`0${u}`,16):/^\d+/.test(u)&&(E=parseInt(u)),Number.isInteger(E)){let{index:w}=c,[h,m]=[o.substring(0,w),o.substring(w+p.length)];r.has(E)?(o=`${h}${String.fromCharCode(E)}${m}`,(/#x?$/.test(h)||/^#(?:x(?:00)?[2-7]|\d)/.test(m))&&(o=rt(o,++t))):E<16*16&&(o=`${h}${m}`)}}}return o},sn=n=>new Promise((t,o)=>{let r=new Jt;r.addEventListener("error",()=>o(r.error)),r.addEventListener("abort",()=>t(r.result)),r.addEventListener("load",()=>t(r.result)),r.readAsDataURL(n)}),Ue=class{#e;constructor(){this.#e=new Set(Ne)}get(){return[...this.#e]}has(t){return this.#e.has(t)}add(t){if(S(t)){if(st.test(t)||!Kt.test(t))throw new Error(`Invalid scheme: ${t}`)}else throw new TypeError(`Expected String but got ${$(t)}.`);return this.#e.add(t),[...this.#e]}remove(t){return this.#e.delete(t)}verify(t){let o;if(S(t))try{let{protocol:r}=new URL(t),l=r.replace(/:$/,""),c=l.split("+");o=!st.test(l)&&Zt.test(l)||c.every(p=>this.#e.has(p))}catch{o=!1}return!!o}reset(){this.#e.clear();for(let t of Ne)this.#e.add(t)}};var it=class extends Ue{#e;#t;constructor(){super(),this.#e=0,this.#t=new Set}replace(t){if(!S(t))throw new TypeError(`Expected String but got ${$(t)}.`);let o=t;if(Me.test(o)){let l=[...o.matchAll(Xt)].reverse();for(let c of l){let[p]=c;nt.test(p)&&([p]=nt.exec(p)),this.#e++,this.#t.add(p);let u=this.sanitize(p,{allow:["data"]}),{index:E}=c,[w,h]=[o.substring(0,E),o.substring(E+p.length)];u?o=`${w}${u}${h}`:o=`${w}${h}`}}return o}purify(t){if(!S(t))throw new TypeError(`Expected String but got ${$(t)}.`);let o=tt.sanitize(decodeURIComponent(t));return o&&Me.test(o)&&(o=this.replace(o)),o=o.replace(/(?:#|%23)$/,"").replace(/(?<!(?:#|%23).*)(?:\?|%3F)$/,""),encodeURI(o)}sanitize(t,o){if(this.#e>16)throw this.#e=0,new Error("Data URLs nested too deeply.");let{allow:r,deny:l,only:c}=o??{},p=new Map([["blob",!1],["data",!1],["file",!1],["javascrpt",!1],["vbscript",!1]]),u=new Set,E=!1;if(Array.isArray(c)&&c.length){let h=super.get();for(let T of h)p.set(T,!1);let m=Object.values(c);for(let T of m)if(S(T)&&(T=T.trim(),!ve.test(T))){if(super.has(T))p.set(T,!0);else{try{super.add(T)}catch{}super.has(T)&&(p.set(T,!0),u.add(T))}!E&&p.has(T)&&(E=p.get(T))}}else{if(Array.isArray(r)&&r.length){let h=Object.values(r);for(let m of h)if(S(m)&&(m=m.trim(),!ve.test(m)))if(super.has(m))p.set(m,!0);else{try{super.add(m)}catch{}super.has(m)&&(p.set(m,!0),u.add(m))}}if(Array.isArray(l)&&l.length){let h=Object.values(l);for(let m of h)S(m)&&(m=m.trim(),m&&p.set(m,!1))}}let w;if(super.verify(t)){let{hash:h,href:m,pathname:T,protocol:B,search:N}=new URL(t),Y=B.replace(/:$/,""),le=Y.split("+"),Q;if(E)Q=le.every(P=>p.get(P));else for(let[P,k]of p.entries())if(Q=k||Y!==P&&le.every(d=>d!==P),!Q)break;if(Q){let P=le.includes("data"),k,d=m;if(P){let[F,...q]=T.split(","),J=`${q.join(",")}${N}${h}`,ee=F.split(";"),_e=ee[ee.length-1]==="base64",v=J;_e&&(v=nn(J));try{let te=rt(v).trim(),{protocol:ce}=new URL(te);ce.replace(/:$/,"").split("+").some(Pe=>ve.test(Pe))&&(d="")}catch{}let x=Me.test(v);v!==J||x?x?v=this.replace(v):this.#t.has(t)?this.#t.delete(t):k=!0:this.#t.has(t)?this.#t.delete(t):k=!0,(!F||Vt.test(F))&&(v=this.purify(v)),d&&v?(_e&&v!==J&&ee.pop(),d=`${Y}:${ee.join(";")},${v}`):d=""}else k=!0;if(!P&&ot.test(d)){let F=ot.exec(d),{index:q}=F;d=d.substring(0,q).replace(/[?&]$/,"")}d?(w=d.replace(/%26/g,tn),k&&(this.#e=0)):this.#e=0}u.size&&u.forEach(P=>{super.remove(P)})}return w||null}parse(t,o){if(!S(t))throw new TypeError(`Expected String but got ${$(t)}.`);let r=new Map([["input",t]]),l;if(this.verify(t)){let{protocol:c}=new URL(t);c==="blob:"?l=t:l=this.sanitize(t,o??{allow:["data","file"]})}if(l){let c=new URL(l),{pathname:p,protocol:u}=c,w=u.replace(/:$/,"").split("+").includes("data");if(r.set("valid",!0),w){let h=new Map,[m,...T]=p.split(","),B=`${T.join(",")}`,N=m.split(";"),Y=N[N.length-1]==="base64";Y&&N.pop(),h.set("mime",N.join(";")),h.set("base64",Y),h.set("data",B),r.set("data",Object.fromEntries(h))}else r.set("data",null);for(let h in c){let m=c[h];S(m)&&r.set(h,m)}}else r.set("valid",!1);return Object.fromEntries(r)}reset(){super.reset(),this.#e=0,this.#t.clear()}},X=new it,zn=async(n,t={allow:[],deny:[],only:[]})=>{let o;if(n&&S(n)){let r;try{let{protocol:l}=new URL(n);r=l.replace(/:$/,"")}catch{}if(r==="blob"){let{allow:l,deny:c,only:p}=t;if(Array.isArray(l)&&l.includes("blob")&&!(Array.isArray(c)&&c.includes("blob"))||Array.isArray(p)&&p.includes("blob")){let u;try{u=await fetch(n).then(E=>E.blob()).then(sn)}catch{}if(u){if(Array.isArray(p))p.includes("data")||p.push("data");else if(Array.isArray(l)&&(l.includes("data")||l.push("data"),Array.isArray(c)&&c.includes("data"))){let E=c.indexOf("data");c.splice(E,1)}o=X.sanitize(u,t)}}URL.revokeObjectURL(n)}else r&&(o=X.sanitize(n,t))}return o||null},Gn=(n,t)=>{let o;if(n&&S(n)){let r;try{let{protocol:l}=new URL(n);r=l.replace(/:$/,"")}catch{}r==="blob"?URL.revokeObjectURL(n):r&&(o=X.sanitize(n,t))}return o||null},Hn=async n=>X.parse(n),$n=n=>X.parse(n),Bn=async n=>X.verify(n),Wn=n=>X.verify(n),jn=X;export{jn as default,Bn as isURI,Wn as isURISync,Hn as parseURL,$n as parseURLSync,zn as sanitizeURL,Gn as sanitizeURLSync};
/*!

@@ -13,4 +13,4 @@ * URL Sanitizer

dompurify/dist/purify.es.mjs:
(*! @license DOMPurify 3.2.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.1/LICENSE *)
(*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE *)
*/
//# sourceMappingURL=url-sanitizer.min.js.map

@@ -24,3 +24,3 @@ {

"dependencies": {
"dompurify": "^3.2.1",
"dompurify": "^3.2.3",
"jsdom": "^25.0.1"

@@ -40,10 +40,10 @@ },

"esbuild": "^0.24.0",
"eslint": "^9.15.0",
"eslint-plugin-import-x": "^4.4.3",
"eslint": "^9.16.0",
"eslint-plugin-import-x": "^4.5.0",
"eslint-plugin-jsdoc": "^50.6.0",
"eslint-plugin-regexp": "^2.7.0",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.12.0",
"globals": "^15.13.0",
"http-server": "^14.1.1",
"mocha": "^10.8.2",
"mocha": "^11.0.1",
"neostandard": "^0.11.9",

@@ -53,3 +53,3 @@ "npm-run-all2": "^7.0.1",

"typescript": "^5.7.2",
"undici": "^7.0.0"
"undici": "^7.1.0"
},

@@ -73,3 +73,3 @@ "scripts": {

},
"version": "2.0.5"
"version": "2.0.6"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc