url-sanitizer 4.1.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/url-sanitizer-wo-dompurify.min.js +1 -1
- package/dist/url-sanitizer-wo-dompurify.min.js.map +2 -2
- package/dist/url-sanitizer.min.js +4 -4
- package/dist/url-sanitizer.min.js.map +3 -3
- package/package.json +12 -10
- package/src/lib/iana/uri-schemes.json +1 -1
- package/src/mjs/sanitizer.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yn(n,t){return Bn(n)||jn(n,t)||Xn(n,t)||Wn()}function Xn(n,t){if(n){if(typeof n=="string")return Kt(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)?Kt(n,t):void 0}}var fn=Object.entries,Zt=Object.setPrototypeOf,Vn=Object.isFrozen,qn=Object.getPrototypeOf,Kn=Object.getOwnPropertyDescriptor,z=Object.freeze,j=Object.seal,Oe=Object.create,pn=typeof Reflect<"u"&&Reflect,At=pn.apply,Rt=pn.construct;z||(z=function(t){return t});j||(j=function(t){return t});At||(At=function(t,r){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(r,i)});Rt||(Rt=function(t){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return new t(...s)});var me=x(Array.prototype.forEach),Zn=x(Array.prototype.lastIndexOf),Qt=x(Array.prototype.pop),Se=x(Array.prototype.push),Qn=x(Array.prototype.splice),F=Array.isArray,Ue=x(String.prototype.toLowerCase),gt=x(String.prototype.toString),Jt=x(String.prototype.match),we=x(String.prototype.replace),en=x(String.prototype.indexOf),Jn=x(String.prototype.trim),er=x(Number.prototype.toString),tr=x(Boolean.prototype.toString),tn=typeof BigInt>"u"?null:x(BigInt.prototype.toString),nn=typeof Symbol>"u"?null:x(Symbol.prototype.toString),y=x(Object.prototype.hasOwnProperty),Me=x(Object.prototype.toString),N=x(RegExp.prototype.test),xe=nr(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),i=1;i<r;i++)s[i-1]=arguments[i];return At(n,t,s)}}function nr(n){return function(){for(var t=arguments.length,r=new Array(t),s=0;s<t;s++)r[s]=arguments[s];return Rt(n,r)}}function p(n,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ue;if(Zt&&Zt(n,null),!F(t))return n;let s=t.length;for(;s--;){let i=t[s];if(typeof i=="string"){let l=r(i);l!==i&&(Vn(t)||(t[s]=l),i=l)}n[i]=!0}return n}function rr(n){for(let t=0;t<n.length;t++)y(n,t)||(n[t]=null);return n}function M(n){let t=Oe(null);for(let s of fn(n)){var r=Yn(s,2);let i=r[0],l=r[1];y(n,i)&&(F(l)?t[i]=rr(l):l&&typeof l=="object"&&l.constructor===Object?t[i]=M(l):t[i]=l)}return t}function or(n){switch(typeof n){case"string":return n;case"number":return er(n);case"boolean":return tr(n);case"bigint":return tn?tn(n):"0";case"symbol":return nn?nn(n):"Symbol()";case"undefined":return Me(n);case"function":case"object":{if(n===null)return Me(n);let t=n,r=Q(t,"toString");if(typeof r=="function"){let s=r(t);return typeof s=="string"?s:Me(s)}return Me(n)}default:return Me(n)}}function Q(n,t){for(;n!==null;){let s=Kn(n,t);if(s){if(s.get)return x(s.get);if(typeof s.value=="function")return x(s.value)}n=qn(n)}function r(){return null}return r}function sr(n){try{return N(n,""),!0}catch{return!1}}var rn=z(["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"]),Tt=z(["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"]),Et=z(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ir=z(["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"]),yt=z(["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"]),ar=z(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),on=z(["#text"]),sn=z(["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"]),_t=z(["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"]),an=z(["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"]),Xe=z(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lr=j(/{{[\w\W]*|^[\w\W]*}}/g),cr=j(/<%[\w\W]*|^[\w\W]*%>/g),fr=j(/\${[\w\W]*/g),pr=j(/^data-[\-\w.\u00B7-\uFFFF]+$/),mr=j(/^aria-[\-\w]+$/),ln=j(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ur=j(/^(?:\w+script|data):/i),dr=j(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),hr=j(/^html$/i),gr=j(/^[a-z][.\w]*(-[.\w]+)+$/i),Z={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Tr=function(){return typeof window>"u"?null:window},Er=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let s=null,i="data-tt-policy-suffix";r&&r.hasAttribute(i)&&(s=r.getAttribute(i));let l="dompurify"+(s?"#"+s:"");try{return t.createPolicy(l,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},cn=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function mn(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Tr(),t=c=>mn(c);if(t.version="3.4.8",t.removed=[],!n||!n.document||n.document.nodeType!==Z.document||!n.Element)return t.isSupported=!1,t;let r=n.document,s=r,i=s.currentScript;n.DocumentFragment;let l=n.HTMLTemplateElement,f=n.Node,h=n.Element,u=n.NodeFilter,P=n.NamedNodeMap;P===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let _=n.DOMParser,H=n.trustedTypes,O=h.prototype,W=Q(O,"cloneNode"),de=Q(O,"remove"),g=Q(O,"nextSibling"),k=Q(O,"childNodes"),V=Q(O,"parentNode"),ae=Q(O,"shadowRoot"),ke=Q(O,"attributes"),D=f&&f.prototype?Q(f.prototype,"nodeType"):null,$=f&&f.prototype?Q(f.prototype,"nodeName"):null;if(typeof l=="function"){let c=r.createElement("template");c.content&&c.content.ownerDocument&&(r=c.content.ownerDocument)}let I,J="",E=0,v=function(e){if(E>0)throw xe('The configured TRUSTED_TYPES_POLICY.createHTML must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose createHTML wraps DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');E++;try{return I.createHTML(e)}finally{E--}},G=r,le=G.implementation,ce=G.createNodeIterator,Fe=G.createDocumentFragment,ee=G.getElementsByTagName,he=s.importNode,A=cn();t.isSupported=typeof fn=="function"&&typeof V=="function"&&le&&le.createHTMLDocument!==void 0;let ge=lr,Ie=cr,Te=fr,Dn=pr,vn=mr,Mn=ur,Lt=dr,Un=gr,It=ln,R=null,tt=p({},[...rn,...Tt,...Et,...yt,...on]),w=null,nt=p({},[...sn,..._t,...an,...Xe]),b=Object.seal(Oe(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}})),Ce=null,ze=null,re=Object.seal(Oe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ct=!0,rt=!0,Nt=!1,Dt=!0,oe=!1,Ne=!0,fe=!1,ot=!1,st=!1,Ee=!1,He=!1,$e=!1,vt=!0,Mt=!1,Ut="user-content-",it=!0,De=!1,ye={},q=null,at=p({},["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"]),Pt=null,kt=p({},["audio","video","img","source","image","track"]),lt=null,Ft=p({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ge="http://www.w3.org/1998/Math/MathML",Be="http://www.w3.org/2000/svg",K="http://www.w3.org/1999/xhtml",_e=K,ct=!1,ft=null,Pn=p({},[Ge,Be,K],gt),pt=p({},["mi","mo","mn","ms","mtext"]),mt=p({},["annotation-xml"]),kn=p({},["title","style","font","a","script"]),ve=null,Fn=["application/xhtml+xml","text/html"],zn="text/html",S=null,Ae=null,Hn=r.createElement("form"),zt=function(e){return e instanceof RegExp||e instanceof Function},ut=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ae&&Ae===e)return;(!e||typeof e!="object")&&(e={}),e=M(e),ve=Fn.indexOf(e.PARSER_MEDIA_TYPE)===-1?zn:e.PARSER_MEDIA_TYPE,S=ve==="application/xhtml+xml"?gt:Ue,R=y(e,"ALLOWED_TAGS")&&F(e.ALLOWED_TAGS)?p({},e.ALLOWED_TAGS,S):tt,w=y(e,"ALLOWED_ATTR")&&F(e.ALLOWED_ATTR)?p({},e.ALLOWED_ATTR,S):nt,ft=y(e,"ALLOWED_NAMESPACES")&&F(e.ALLOWED_NAMESPACES)?p({},e.ALLOWED_NAMESPACES,gt):Pn,lt=y(e,"ADD_URI_SAFE_ATTR")&&F(e.ADD_URI_SAFE_ATTR)?p(M(Ft),e.ADD_URI_SAFE_ATTR,S):Ft,Pt=y(e,"ADD_DATA_URI_TAGS")&&F(e.ADD_DATA_URI_TAGS)?p(M(kt),e.ADD_DATA_URI_TAGS,S):kt,q=y(e,"FORBID_CONTENTS")&&F(e.FORBID_CONTENTS)?p({},e.FORBID_CONTENTS,S):at,Ce=y(e,"FORBID_TAGS")&&F(e.FORBID_TAGS)?p({},e.FORBID_TAGS,S):M({}),ze=y(e,"FORBID_ATTR")&&F(e.FORBID_ATTR)?p({},e.FORBID_ATTR,S):M({}),ye=y(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?M(e.USE_PROFILES):e.USE_PROFILES:!1,Ct=e.ALLOW_ARIA_ATTR!==!1,rt=e.ALLOW_DATA_ATTR!==!1,Nt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Dt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=e.SAFE_FOR_TEMPLATES||!1,Ne=e.SAFE_FOR_XML!==!1,fe=e.WHOLE_DOCUMENT||!1,Ee=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,$e=e.RETURN_TRUSTED_TYPE||!1,st=e.FORCE_BODY||!1,vt=e.SANITIZE_DOM!==!1,Mt=e.SANITIZE_NAMED_PROPS||!1,it=e.KEEP_CONTENT!==!1,De=e.IN_PLACE||!1,It=sr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ln,_e=typeof e.NAMESPACE=="string"?e.NAMESPACE:K,pt=y(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS=="object"?M(e.MATHML_TEXT_INTEGRATION_POINTS):p({},["mi","mo","mn","ms","mtext"]),mt=y(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS=="object"?M(e.HTML_INTEGRATION_POINTS):p({},["annotation-xml"]);let o=y(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING=="object"?M(e.CUSTOM_ELEMENT_HANDLING):Oe(null);if(b=Oe(null),y(o,"tagNameCheck")&&zt(o.tagNameCheck)&&(b.tagNameCheck=o.tagNameCheck),y(o,"attributeNameCheck")&&zt(o.attributeNameCheck)&&(b.attributeNameCheck=o.attributeNameCheck),y(o,"allowCustomizedBuiltInElements")&&typeof o.allowCustomizedBuiltInElements=="boolean"&&(b.allowCustomizedBuiltInElements=o.allowCustomizedBuiltInElements),oe&&(rt=!1),He&&(Ee=!0),ye&&(R=p({},on),w=Oe(null),ye.html===!0&&(p(R,rn),p(w,sn)),ye.svg===!0&&(p(R,Tt),p(w,_t),p(w,Xe)),ye.svgFilters===!0&&(p(R,Et),p(w,_t),p(w,Xe)),ye.mathMl===!0&&(p(R,yt),p(w,an),p(w,Xe))),re.tagCheck=null,re.attributeCheck=null,y(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?re.tagCheck=e.ADD_TAGS:F(e.ADD_TAGS)&&(R===tt&&(R=M(R)),p(R,e.ADD_TAGS,S))),y(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?re.attributeCheck=e.ADD_ATTR:F(e.ADD_ATTR)&&(w===nt&&(w=M(w)),p(w,e.ADD_ATTR,S))),y(e,"ADD_URI_SAFE_ATTR")&&F(e.ADD_URI_SAFE_ATTR)&&p(lt,e.ADD_URI_SAFE_ATTR,S),y(e,"FORBID_CONTENTS")&&F(e.FORBID_CONTENTS)&&(q===at&&(q=M(q)),p(q,e.FORBID_CONTENTS,S)),y(e,"ADD_FORBID_CONTENTS")&&F(e.ADD_FORBID_CONTENTS)&&(q===at&&(q=M(q)),p(q,e.ADD_FORBID_CONTENTS,S)),it&&(R["#text"]=!0),fe&&p(R,["html","head","body"]),R.table&&(p(R,["tbody"]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw xe('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xe('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=I;I=e.TRUSTED_TYPES_POLICY;try{J=v("")}catch(d){throw I=a,d}}else I===void 0&&e.TRUSTED_TYPES_POLICY!==null&&(I=Er(H,i)),I&&typeof J=="string"&&(J=v(""));(A.uponSanitizeElement.length>0||A.uponSanitizeAttribute.length>0)&&R===tt&&(R=M(R)),A.uponSanitizeAttribute.length>0&&w===nt&&(w=M(w)),z&&z(e),Ae=e},Ht=p({},[...Tt,...Et,...ir]),$t=p({},[...yt,...ar]),$n=function(e){let o=V(e);(!o||!o.tagName)&&(o={namespaceURI:_e,tagName:"template"});let a=Ue(e.tagName),d=Ue(o.tagName);return ft[e.namespaceURI]?e.namespaceURI===Be?o.namespaceURI===K?a==="svg":o.namespaceURI===Ge?a==="svg"&&(d==="annotation-xml"||pt[d]):!!Ht[a]:e.namespaceURI===Ge?o.namespaceURI===K?a==="math":o.namespaceURI===Be?a==="math"&&mt[d]:!!$t[a]:e.namespaceURI===K?o.namespaceURI===Be&&!mt[d]||o.namespaceURI===Ge&&!pt[d]?!1:!$t[a]&&(kn[a]||!Ht[a]):!!(ve==="application/xhtml+xml"&&ft[e.namespaceURI]):!1},Y=function(e){Se(t.removed,{element:e});try{V(e).removeChild(e)}catch{de(e)}},pe=function(e,o){try{Se(t.removed,{attribute:o.getAttributeNode(e),from:o})}catch{Se(t.removed,{attribute:null,from:o})}if(o.removeAttribute(e),e==="is")if(Ee||He)try{Y(o)}catch{}else try{o.setAttribute(e,"")}catch{}},Gt=function(e){let o=null,a=null;if(st)e="<remove></remove>"+e;else{let T=Jt(e,/^[\r\n\t ]+/);a=T&&T[0]}ve==="application/xhtml+xml"&&_e===K&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let d=I?v(e):e;if(_e===K)try{o=new _().parseFromString(d,ve)}catch{}if(!o||!o.documentElement){o=le.createDocument(_e,"template",null);try{o.documentElement.innerHTML=ct?J:d}catch{}}let m=o.body||o.documentElement;return e&&a&&m.insertBefore(r.createTextNode(a),m.childNodes[0]||null),_e===K?ee.call(o,fe?"html":"body")[0]:fe?o.documentElement:m},Bt=function(e){return ce.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},dt=function(e){var o,a;e.normalize();let d=ce.call(e.ownerDocument||e,e,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),m=d.nextNode();for(;m;){let L=m.data;me([ge,Ie,Te],B=>{L=we(L,B," ")}),m.data=L,m=d.nextNode()}let T=(o=(a=e.querySelectorAll)===null||a===void 0?void 0:a.call(e,"template"))!==null&&o!==void 0?o:[];me(Array.from(T),L=>{Re(L.content)&&dt(L.content)})},je=function(e){let o=$?$(e):null;return typeof o!="string"||S(o)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==ke(e)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==D(e)||e.childNodes!==k(e)},Re=function(e){if(!D||typeof e!="object"||e===null)return!1;try{return D(e)===Z.documentFragment}catch{return!1}},We=function(e){if(!D||typeof e!="object"||e===null)return!1;try{return typeof D(e)=="number"}catch{return!1}};function te(c,e,o){me(c,a=>{a.call(t,e,o,Ae)})}let jt=function(e){let o=null;if(te(A.beforeSanitizeElements,e,null),je(e))return Y(e),!0;let a=S($?$(e):e.nodeName);if(te(A.uponSanitizeElement,e,{tagName:a,allowedTags:R}),Ne&&e.hasChildNodes()&&!We(e.firstElementChild)&&N(/<[/\w!]/g,e.innerHTML)&&N(/<[/\w!]/g,e.textContent)||Ne&&e.namespaceURI===K&&a==="style"&&We(e.firstElementChild)||e.nodeType===Z.progressingInstruction||Ne&&e.nodeType===Z.comment&&N(/<[/\w]/g,e.data))return Y(e),!0;if(Ce[a]||!(re.tagCheck instanceof Function&&re.tagCheck(a))&&!R[a]){if(!Ce[a]&&Yt(a)&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,a)||b.tagNameCheck instanceof Function&&b.tagNameCheck(a)))return!1;if(it&&!q[a]){let m=V(e),T=k(e);if(T&&m){let L=T.length;for(let B=L-1;B>=0;--B){let X=W(T[B],!0);m.insertBefore(X,g(e))}}}return Y(e),!0}return(D?D(e):e.nodeType)===Z.element&&!$n(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&N(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y(e),!0):(oe&&e.nodeType===Z.text&&(o=e.textContent,me([ge,Ie,Te],m=>{o=we(o,m," ")}),e.textContent!==o&&(Se(t.removed,{element:e.cloneNode()}),e.textContent=o)),te(A.afterSanitizeElements,e,null),!1)},Wt=function(e,o,a){if(ze[o]||vt&&(o==="id"||o==="name")&&(a in r||a in Hn))return!1;let d=w[o]||re.attributeCheck instanceof Function&&re.attributeCheck(o,e);if(!(rt&&!ze[o]&&N(Dn,o))){if(!(Ct&&N(vn,o))){if(!d||ze[o]){if(!(Yt(e)&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,e)||b.tagNameCheck instanceof Function&&b.tagNameCheck(e))&&(b.attributeNameCheck instanceof RegExp&&N(b.attributeNameCheck,o)||b.attributeNameCheck instanceof Function&&b.attributeNameCheck(o,e))||o==="is"&&b.allowCustomizedBuiltInElements&&(b.tagNameCheck instanceof RegExp&&N(b.tagNameCheck,a)||b.tagNameCheck instanceof Function&&b.tagNameCheck(a))))return!1}else if(!lt[o]){if(!N(It,we(a,Lt,""))){if(!((o==="src"||o==="xlink:href"||o==="href")&&e!=="script"&&en(a,"data:")===0&&Pt[e])){if(!(Nt&&!N(Mn,we(a,Lt,"")))){if(a)return!1}}}}}}return!0},Gn=p({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Yt=function(e){return!Gn[Ue(e)]&&N(Un,e)},Xt=function(e){te(A.beforeSanitizeAttributes,e,null);let o=e.attributes;if(!o||je(e))return;let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0},d=o.length;for(;d--;){let m=o[d],T=m.name,L=m.namespaceURI,B=m.value,X=S(T),ht=B,C=T==="value"?ht:Jn(ht);if(a.attrName=X,a.attrValue=C,a.keepAttr=!0,a.forceKeepAttr=void 0,te(A.uponSanitizeAttribute,e,a),C=a.attrValue,Mt&&(X==="id"||X==="name")&&en(C,Ut)!==0&&(pe(T,e),C=Ut+C),Ne&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,C)){pe(T,e);continue}if(X==="attributename"&&Jt(C,"href")){pe(T,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){pe(T,e);continue}if(!Dt&&N(/\/>/i,C)){pe(T,e);continue}oe&&me([ge,Ie,Te],qt=>{C=we(C,qt," ")});let Vt=S(e.nodeName);if(!Wt(Vt,X,C)){pe(T,e);continue}if(I&&typeof H=="object"&&typeof H.getAttributeType=="function"&&!L)switch(H.getAttributeType(Vt,X)){case"TrustedHTML":{C=v(C);break}case"TrustedScriptURL":{C=I.createScriptURL(C);break}}if(C!==ht)try{L?e.setAttributeNS(L,T,C):e.setAttribute(T,C),je(e)?Y(e):Qt(t.removed)}catch{pe(T,e)}}te(A.afterSanitizeAttributes,e,null)},Ye=function(e){let o=null,a=Bt(e);for(te(A.beforeSanitizeShadowDOM,e,null);o=a.nextNode();)if(te(A.uponSanitizeShadowNode,o,null),jt(o),Xt(o),Re(o.content)&&Ye(o.content),(D?D(o):o.nodeType)===Z.element){let m=ae?ae(o):o.shadowRoot;Re(m)&&(be(m),Ye(m))}te(A.afterSanitizeShadowDOM,e,null)},be=function(e){let o=D?D(e):e.nodeType;if(o===Z.element){let m=ae?ae(e):e.shadowRoot;Re(m)&&(be(m),Ye(m))}let a=k?k(e):e.childNodes;if(!a)return;let d=[];me(a,m=>{Se(d,m)});for(let m of d)be(m);if(o===Z.element){let m=$?$(e):null;if(typeof m=="string"&&S(m)==="template"){let T=e.content;Re(T)&&be(T)}}};return t.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=null,a=null,d=null,m=null;if(ct=!c,ct&&(c="<!-->"),typeof c!="string"&&!We(c)&&(c=or(c),typeof c!="string"))throw xe("dirty is not a string, aborting");if(!t.isSupported)return c;if(ot||ut(e),t.removed=[],typeof c=="string"&&(De=!1),De){let B=$?$(c):c.nodeName;if(typeof B=="string"){let X=S(B);if(!R[X]||Ce[X])throw xe("root node is forbidden and cannot be sanitized in-place")}if(je(c))throw xe("root node is clobbered and cannot be sanitized in-place");be(c)}else if(We(c))o=Gt("<!---->"),a=o.ownerDocument.importNode(c,!0),a.nodeType===Z.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?o=a:o.appendChild(a),be(a);else{if(!Ee&&!oe&&!fe&&c.indexOf("<")===-1)return I&&$e?v(c):c;if(o=Gt(c),!o)return Ee?null:$e?J:""}o&&st&&Y(o.firstChild);let T=Bt(De?c:o);for(;d=T.nextNode();)jt(d),Xt(d),Re(d.content)&&Ye(d.content);if(De)return oe&&dt(c),c;if(Ee){if(oe&&dt(o),He)for(m=Fe.call(o.ownerDocument);o.firstChild;)m.appendChild(o.firstChild);else m=o;return(w.shadowroot||w.shadowrootmode)&&(m=he.call(s,m,!0)),m}let L=fe?o.outerHTML:o.innerHTML;return fe&&R["!doctype"]&&o.ownerDocument&&o.ownerDocument.doctype&&o.ownerDocument.doctype.name&&N(hr,o.ownerDocument.doctype.name)&&(L="<!DOCTYPE "+o.ownerDocument.doctype.name+`>
|
|
3
|
-
`+L),oe&&me([ge,Ie,Te],B=>{L=we(L,B," ")}),I&&$e?v(L):L},t.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ut(c),ot=!0},t.clearConfig=function(){Ae=null,ot=!1},t.isValidAttribute=function(c,e,o){Ae||ut({});let a=S(c),d=S(e);return Wt(a,d,o)},t.addHook=function(c,e){typeof e=="function"&&Se(A[c],e)},t.removeHook=function(c,e){if(e!==void 0){let o=Zn(A[c],e);return o===-1?void 0:Qn(A[c],o,1)[0]}return Qt(A[c])},t.removeHooks=function(c){A[c]=[]},t.removeAllHooks=function(){A=cn()},t}var un=mn();var Ve=un(globalThis.window);var ue=n=>Object.prototype.toString.call(n).slice(8,-1),U=n=>typeof n=="string"||n instanceof String;var dn=["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","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","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 hn=/(?:#|%23)$/,gn=/^(?:application\/(?:[\w.-]+\+)?xml|image\/svg\+xml|text\/(?:html|xml))(?:\s*;\s*|$)/i;var Tn=/&#(x0*[\dA-F]{1,2}|0*\d{1,3});?/gi,En=/^((?:[^#%]|%(?!23))*)(?:\?|%3F)$/i,bt=/^[a-z][\da-z+.-]*$/,yn=/^(?:web\+[a-z]+|ext\+[a-z][\da-z.-]*)$/,Pe=/^(?:java|vb)script$/i,St=/^(?:(?:java|vb)script|blob)$/i,qe=/["'<>]|%(?:22|27|3C|3E)|&(?:apos|lt|gt|quot|#0*(?:34|39|60|62)|#x0*(?:22|27|3C|3E));/i,_n=/^%[\dA-F]{2}$/i,wt=/&(?=[#a-z0-9])(?![a-z0-9]+=)/i,An=/^(?:\/{2,}|\\|[a-z][a-z\d+\-.]*:[^/])/i;var Rn=[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 xt=new Set(Rn),Ke=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]]),br=()=>{let n=new Map;for(let t=0;t<256;t++)!xt.has(t)&&!Ke.has(t)&&n.set(t,`\\x${t.toString(16).padStart(2,"0").toUpperCase()}`);return n},Ze=br();var[Le,wr,xr,Or,Lr,Ir]=["&","#","<",">",'"',"'"].map(n=>`%${n.charCodeAt(0).toString(16).toUpperCase()}`),Cr={[Le]:`${Le}amp;`,[xr]:`${Le}lt;`,[Or]:`${Le}gt;`,[Lr]:`${Le}quot;`,[Ir]:`${Le}${wr}39;`},fo=Array.from({length:256},(n,t)=>`%${t.toString(16).padStart(2,"0").toUpperCase()}`),Sn=globalThis.process?.versions?.node!==void 0,Nr=new RegExp(`[${[...Ze.values()].join("")}]`),Dr=new RegExp(`[${[...Ze.values()].join("")}]`,"g"),po=new TextEncoder,vr=new TextDecoder("utf-8",{fatal:!0}),Je=class{#e=new Set(dn);get(){return[...this.#e]}has(t){return this.#e.has(t)}verify(t,r=this.#e){if(!U(t))return!1;try{let{protocol:s}=new URL(t.normalize("NFKC")),i=s.replace(/:$/,""),l=i.split("+");return l.some(h=>Pe.test(h))?!1:yn.test(i)||l.every(h=>r.has(h))}catch{return!1}}};var wn=n=>{if(!U(n))return n;let t=_n.test(n)?n.toUpperCase():n;return Cr[t]??n},xn=n=>{if(!U(n))throw new TypeError(`Expected String but got ${ue(n)}.`);let t=n.replace(/\s/g,""),r;try{r=atob(t)}catch{throw new Error(`Invalid base64 data: ${n}`)}let s;if(Sn&&globalThis.Buffer)s=globalThis.Buffer.from(r,"latin1");else{let i=r.length;s=new Uint8Array(i);for(let l=0;l<i;l++)s[l]=r.charCodeAt(l)}try{let i=vr.decode(s);return Nr.test(i)?t:i}catch{return t}},Mr=(n,t)=>{let r=/x/i.test(t[0])?parseInt(t.substring(1),16):parseInt(t,10);if(Number.isInteger(r)){if(xt.has(r))return String.fromCharCode(r);if(Ke.has(r)){let s=Ke.get(r);return String.fromCodePoint(s)}else if(Ze.has(r))return""}return n},On=n=>U(n)?n.replace(hn,"").replace(En,"$1"):n,Ln=(n,t=0)=>{if(!U(n))throw new TypeError(`Expected String but got ${ue(n)}.`);if(!Number.isInteger(t))throw new TypeError(`Expected Number but got ${ue(t)}.`);let r;try{r=decodeURIComponent(n)}catch{r=n.replace(/(?:%[\dA-F]{2})+/gi,i=>{try{return decodeURIComponent(i)}catch{return i}})}r=r.replace(Dr,"");let s=0;for(;s+t<=16;s++){let i=r;if(r=r.replace(/&/gi,"&").replace(Tn,Mr),r===i)break}if(s+t>16&&/&#/.test(r))throw new Error("Character references nested too deeply.");return r},Ur=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}`},Pr=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)}),kr=async n=>{let t=n.type?`${n.type};base64`:"base64",r=await n.arrayBuffer(),s=new Uint8Array(r),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(""))}`},In=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 Sn&&globalThis.Buffer?Ur(n):globalThis.FileReader?Pr(n):kr(n)};var Fr=Object.freeze(["href","origin","protocol","username","password","host","hostname","port","pathname","search","hash"]),zr=Object.freeze({RETURN_DOM:!1,RETURN_DOM_FRAGMENT:!1,RETURN_TRUSTED_TYPE:!1}),se=(n,t,r)=>{n&&console.warn(`[URLSanitizer Debug] ${t}`,r?r.message:"")},Ot=class n extends Je{#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,i=n.#n;if(!s||!i)return;let l;try{l=new URL(r.attrValue)}catch{return}if(l.protocol==="data:"){let f=r.attrValue;if(i.recurse||(i.recurse=new Set),i.recurse.has(f)){let h=`Circular Data URL detected and skipped: ${f}`;se(i.debug,h),r.attrValue="";return}i.nest++,i.recurse.add(f);try{let h=s.#o(f,{allow:["data"],deny:[],only:[],allowRelative:!1},i);r.attrValue=h||""}finally{i.nest--,i.recurse.delete(f)}}}static{Ve.setConfig(zr),Ve.addHook("uponSanitizeAttribute",n.#s)}constructor(){super(),this.#e=new Set(super.get())}#r(t,r,s,i,l){if(St.test(t))return!1;if(t.split("+").some(u=>Pe.test(u))||!bt.test(t)){let u=`Failed to add scheme '${t}' in '${r}' list.`;return se(l.debug,u),!1}return i.set(t,!0),s.add(t),!0}#i(t,r){let s=t;try{s=decodeURIComponent(t)}catch{}let i=n.#t,l=n.#n;n.#t=this,n.#n=r;let f;try{f=r.domPurify.sanitize(s)}finally{n.#t=i,n.#n=l}f=On(f);try{return encodeURI(f)}catch{return f}}#o(t,r,s){if(s.nest>16)throw new Error("Data URLs nested too deeply.");let{allow:i,deny:l,only:f,allowRelative:h}=r,u=this.#e,P=!1,_=new Map(s.schemeMap);if(f.length){u=new Set;for(let g of f)U(g)&&(g=g.trim(),this.#r(g,"only",u,_,s)&&!P&&(P=!0))}else{if(i.length){u=new Set(this.#e);for(let g of i)U(g)&&this.#r(g.trim(),"allow",u,_,s)}if(l.length)for(let g of l)U(g)&&(g=g.trim(),g&&_.set(g,!1))}let H,O=super.verify(t,u),W=!1,de="";if(!O&&h&&!An.test(t))try{let g=new URL(t,"http://dummy.local"),k=new URL(t.normalize("NFKC"),"http://dummy.local");g.protocol==="http:"&&g.hostname==="dummy.local"&&k.protocol==="http:"&&(O=!0,W=!0,de=`${g.pathname}${g.search}${g.hash}`)}catch(g){se(s.debug,"Failed to parse relative URL.",g)}if(O){let g,k,V,ae,ke,D="",$=[],I=!1;if(W)I=!0;else if({hash:g,href:k,pathname:V,protocol:ae,search:ke}=new URL(t),D=ae.replace(/:$/,"").normalize("NFKC"),$=D.split("+"),P)I=$.every(E=>_.get(E));else for(let[E,v]of _.entries())if(I=v||D!==E&&$.every(G=>G!==E),!I)break;if(I){let J=W?!1:$.includes("data"),E=W?de:k;if(J){let[v,...G]=V.split(","),le=`${G.join(",")}${ke}${g}`,ce=v.split(";"),Fe=ce[ce.length-1]==="base64",ee=le;if(Fe)try{ee=xn(le)}catch(he){se(s.debug,"Failed to parse base64 data.",he),E=""}try{let A=Ln(ee).trim().normalize("NFKC"),{protocol:ge}=new URL(A,"http://dummy.local");ge.replace(/:$/,"").split("+").some(Te=>St.test(Te))&&(E="")}catch(he){se(s.debug,"Failed to parse inner data URL protocol.",he),E=""}(!v||gn.test(v))&&(ee=this.#i(ee,s)),E&&ee?(Fe&&ee!==le&&ce.pop(),E=`${D}:${ce.join(";")},${ee}`):E=""}if(!J){if(qe.test(E)){let v=qe.exec(E),{index:G}=v;E=E.substring(0,G).replace(/[?&]$/,"")}if(wt.test(E)){let v=wt.exec(E),{index:G}=v;E=E.substring(0,G).replace(/[?&]$/,"")}}E&&(H=E)}}return H||null}sanitize(t,r){if(!t||!U(t))return null;let s=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0;if(s&&t.length>s){let h=`URL length ${t.length} exceeds maxLength ${s}.`;throw new RangeError(h)}if(!(r&&(Array.isArray(r.deny)&&r.deny.length>0||Array.isArray(r.only)&&r.only.length>0||r.allowRelative))&&(t.startsWith("https://")||t.startsWith("http://"))&&!qe.test(t)&&!t.includes("data:"))try{let{href:h}=new URL(t);return h.replace(/%26/g,wn)}catch{return 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},f={debug:!!r?.debug,domPurify:Ve,nest:0,recurse:null,schemeMap:new Map([["blob",!1],["data",!1],["file",!1],["javascript",!1],["vbscript",!1]])};return this.#o(t,l,f)}inspect(t,r){if(!U(t))throw new TypeError(`Expected String but got ${ue(t)}.`);let s=new Map([["input",t]]),i,l=null,f=Number.isInteger(r?.maxLength)&&r.maxLength?r.maxLength:0;if(f&&t.length>f)l=`URL length ${t.length} exceeds maxLength ${f}.`;else if(this.verify(t)){let{protocol:h}=new URL(t);if(h==="blob:")i=t;else try{i=this.sanitize(t,r??{allow:["data","file"]}),i||(l="Sanitization failed (blocked by allowed schemes or rules).")}catch(u){l=u.message}}else l="Invalid URI syntax or scheme is not registered.";if(i){let h=new URL(i),{pathname:u,protocol:P}=h,H=P.replace(/:$/,"").split("+").includes("data");if(s.set("valid",!0),H){let O=new Map,[W,...de]=u.split(","),g=`${de.join(",")}${h.search}${h.hash}`,k=W.split(";"),V=k[k.length-1]==="base64";V&&k.pop(),O.set("mime",k.join(";")),O.set("base64",V),O.set("data",g),s.set("data",Object.fromEntries(O))}else s.set("data",null);for(let O of Fr){let W=h[O];U(W)&&s.set(O,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(!U(t))throw new TypeError(`Expected String but got ${ue(t)}.`);if(t.split("+").some(i=>Pe.test(i))||!bt.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 ie=new Ot,Hr=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,i;if(n&&U(n)){let l;try{let{protocol:f}=new URL(n);l=f.replace(/:$/,"")}catch(f){se(r,`Invalid URL input format: ${n}`,f)}if(l==="blob"){let{allow:f,deny:h,only:u}=t;if(Array.isArray(f)&&f.includes("blob")&&!(Array.isArray(h)&&h.includes("blob"))||Array.isArray(u)&&u.includes("blob")){let P;try{P=await fetch(n).then(_=>_.blob()).then(_=>In(_,s))}catch(_){let H=`Failed to fetch and convert blob URL: ${n}`;se(r,H,_)}if(P){let _={...t};Array.isArray(t.only)?_.only=t.only.includes("data")?t.only:[...t.only,"data"]:Array.isArray(t.allow)&&(_.allow=t.allow.includes("data")?t.allow:[...t.allow,"data"],Array.isArray(t.deny)&&(_.deny=t.deny.filter(H=>H!=="data"))),i=ie.sanitize(P,_)}}t?.revokeObjectURL&&URL.revokeObjectURL(n)}else(l||t.allowRelative)&&(i=ie.sanitize(n,t))}return i||null},$r=(n,t={allow:[],deny:[],only:[],allowRelative:!1,debug:!1,revokeObjectURL:!1})=>{let r=!!t?.debug,s;if(n&&U(n)){let i;try{let{protocol:l}=new URL(n);i=l.replace(/:$/,"")}catch(l){let f=`Invalid URL input format: ${n}`;se(r,f,l)}if(i==="blob")return t?.revokeObjectURL&&URL.revokeObjectURL(n),null;(i||t.allowRelative)&&(s=ie.sanitize(n,t))}return s||null},Cn=async n=>ie.inspect(n),Gr=n=>Cn(n),Nn=n=>ie.inspect(n),Br=n=>Nn(n),jr=async n=>ie.verify(n),Wr=n=>ie.verify(n),Yr=ie;export{Yr as default,Cn as inspectURL,Nn as inspectURLSync,jr as isURI,Wr as isURISync,Gr as parseURL,Br as parseURLSync,Hr as sanitizeURL,$r as sanitizeURLSync};
|
|
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(/&/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};
|
|
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.
|
|
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 *)
|
|
15
15
|
*/
|
|
16
16
|
//# sourceMappingURL=url-sanitizer.min.js.map
|