@commercetools/nimbus 0.0.0-canary-20251014065943 → 0.0.0-canary-20251014070008
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";const Yt=require("./constants.cjs");/*! @license DOMPurify 3.2.7 | (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.7/LICENSE */const{entries:Tt,setPrototypeOf:st,isFrozen:Xt,getPrototypeOf:jt,getOwnPropertyDescriptor:Vt}=Object;let{freeze:R,seal:L,create:Et}=Object,{apply:xe,construct:Pe}=typeof Reflect<"u"&&Reflect;R||(R=function(n){return n});L||(L=function(n){return n});xe||(xe=function(n,l){for(var a=arguments.length,c=new Array(a>2?a-2:0),_=2;_<a;_++)c[_-2]=arguments[_];return n.apply(l,c)});Pe||(Pe=function(n){for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];return new n(...a)});const le=O(Array.prototype.forEach),$t=O(Array.prototype.lastIndexOf),lt=O(Array.prototype.pop),$=O(Array.prototype.push),qt=O(Array.prototype.splice),fe=O(String.prototype.toLowerCase),De=O(String.prototype.toString),Ie=O(String.prototype.match),q=O(String.prototype.replace),Kt=O(String.prototype.indexOf),Zt=O(String.prototype.trim),b=O(Object.prototype.hasOwnProperty),S=O(RegExp.prototype.test),K=Jt(TypeError);function O(r){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];return xe(r,n,a)}}function Jt(r){return function(){for(var n=arguments.length,l=new Array(n),a=0;a<n;a++)l[a]=arguments[a];return Pe(r,l)}}function s(r,n){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fe;st&&st(r,null);let a=n.length;for(;a--;){let c=n[a];if(typeof c=="string"){const _=l(c);_!==c&&(Xt(n)||(n[a]=_),c=_)}r[c]=!0}return r}function Qt(r){for(let n=0;n<r.length;n++)b(r,n)||(r[n]=null);return r}function C(r){const n=Et(null);for(const[l,a]of Tt(r))b(r,l)&&(Array.isArray(a)?n[l]=Qt(a):a&&typeof a=="object"&&a.constructor===Object?n[l]=C(a):n[l]=a);return n}function Z(r,n){for(;r!==null;){const a=Vt(r,n);if(a){if(a.get)return O(a.get);if(typeof a.value=="function")return O(a.value)}r=jt(r)}function l(){return null}return l}const ct=R(["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"]),Ne=R(["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","slot","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Me=R(["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"]),en=R(["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"]),Ce=R(["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"]),tn=R(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ft=R(["#text"]),ut=R(["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","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","slot"]),we=R(["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"]),mt=R(["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"]),ce=R(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nn=L(/\{\{[\w\W]*|[\w\W]*\}\}/gm),on=L(/<%[\w\W]*|[\w\W]*%>/gm),an=L(/\$\{[\w\W]*/gm),rn=L(/^data-[\-\w.\u00B7-\uFFFF]+$/),sn=L(/^aria-[\-\w]+$/),_t=L(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ln=L(/^(?:\w+script|data):/i),cn=L(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),gt=L(/^html$/i),fn=L(/^[a-z][.\w]*(-[.\w]+)+$/i);var pt=Object.freeze({__proto__:null,ARIA_ATTR:sn,ATTR_WHITESPACE:cn,CUSTOM_ELEMENT:fn,DATA_ATTR:rn,DOCTYPE_NAME:gt,ERB_EXPR:on,IS_ALLOWED_URI:_t,IS_SCRIPT_OR_DATA:ln,MUSTACHE_EXPR:nn,TMPLIT_EXPR:an});const J={element:1,text:3,progressingInstruction:7,comment:8,document:9},un=function(){return typeof window>"u"?null:window},mn=function(n,l){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let a=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(a=l.getAttribute(c));const _="dompurify"+(a?"#"+a:"");try{return n.createPolicy(_,{createHTML(w){return w},createScriptURL(w){return w}})}catch{return console.warn("TrustedTypes policy "+_+" could not be created."),null}},dt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function At(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:un();const n=i=>At(i);if(n.version="3.2.7",n.removed=[],!r||!r.document||r.document.nodeType!==J.document||!r.Element)return n.isSupported=!1,n;let{document:l}=r;const a=l,c=a.currentScript,{DocumentFragment:_,HTMLTemplateElement:w,Node:ue,Element:ve,NodeFilter:W,NamedNodeMap:St=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:Rt,DOMParser:Ot,trustedTypes:Q}=r,B=ve.prototype,yt=Z(B,"cloneNode"),Lt=Z(B,"remove"),bt=Z(B,"nextSibling"),Dt=Z(B,"childNodes"),ee=Z(B,"parentNode");if(typeof w=="function"){const i=l.createElement("template");i.content&&i.content.ownerDocument&&(l=i.content.ownerDocument)}let A,Y="";const{implementation:me,createNodeIterator:It,createDocumentFragment:Nt,getElementsByTagName:Mt}=l,{importNode:Ct}=a;let h=dt();n.isSupported=typeof Tt=="function"&&typeof ee=="function"&&me&&me.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:pe,ERB_EXPR:de,TMPLIT_EXPR:Te,DATA_ATTR:wt,ARIA_ATTR:xt,IS_SCRIPT_OR_DATA:Pt,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:vt}=pt;let{IS_ALLOWED_URI:ke}=pt,p=null;const Fe=s({},[...ct,...Ne,...Me,...Ce,...ft]);let T=null;const He=s({},[...ut,...we,...mt,...ce]);let u=Object.seal(Et(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}})),X=null,Ee=null,ze=!0,_e=!0,Ge=!1,We=!0,v=!1,te=!0,x=!1,ge=!1,Ae=!1,U=!1,ne=!1,oe=!1,Be=!0,Ye=!1;const Ut="user-content-";let he=!0,j=!1,k={},F=null;const Xe=s({},["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"]);let je=null;const Ve=s({},["audio","video","img","source","image","track"]);let Se=null;const $e=s({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ie="http://www.w3.org/1998/Math/MathML",ae="http://www.w3.org/2000/svg",I="http://www.w3.org/1999/xhtml";let H=I,Re=!1,Oe=null;const kt=s({},[ie,ae,I],De);let re=s({},["mi","mo","mn","ms","mtext"]),se=s({},["annotation-xml"]);const Ft=s({},["title","style","font","a","script"]);let V=null;const Ht=["application/xhtml+xml","text/html"],zt="text/html";let d=null,z=null;const Gt=l.createElement("form"),qe=function(e){return e instanceof RegExp||e instanceof Function},ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(z&&z===e)){if((!e||typeof e!="object")&&(e={}),e=C(e),V=Ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?zt:e.PARSER_MEDIA_TYPE,d=V==="application/xhtml+xml"?De:fe,p=b(e,"ALLOWED_TAGS")?s({},e.ALLOWED_TAGS,d):Fe,T=b(e,"ALLOWED_ATTR")?s({},e.ALLOWED_ATTR,d):He,Oe=b(e,"ALLOWED_NAMESPACES")?s({},e.ALLOWED_NAMESPACES,De):kt,Se=b(e,"ADD_URI_SAFE_ATTR")?s(C($e),e.ADD_URI_SAFE_ATTR,d):$e,je=b(e,"ADD_DATA_URI_TAGS")?s(C(Ve),e.ADD_DATA_URI_TAGS,d):Ve,F=b(e,"FORBID_CONTENTS")?s({},e.FORBID_CONTENTS,d):Xe,X=b(e,"FORBID_TAGS")?s({},e.FORBID_TAGS,d):C({}),Ee=b(e,"FORBID_ATTR")?s({},e.FORBID_ATTR,d):C({}),k=b(e,"USE_PROFILES")?e.USE_PROFILES:!1,ze=e.ALLOW_ARIA_ATTR!==!1,_e=e.ALLOW_DATA_ATTR!==!1,Ge=e.ALLOW_UNKNOWN_PROTOCOLS||!1,We=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,v=e.SAFE_FOR_TEMPLATES||!1,te=e.SAFE_FOR_XML!==!1,x=e.WHOLE_DOCUMENT||!1,U=e.RETURN_DOM||!1,ne=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,Ae=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ye=e.SANITIZE_NAMED_PROPS||!1,he=e.KEEP_CONTENT!==!1,j=e.IN_PLACE||!1,ke=e.ALLOWED_URI_REGEXP||_t,H=e.NAMESPACE||I,re=e.MATHML_TEXT_INTEGRATION_POINTS||re,se=e.HTML_INTEGRATION_POINTS||se,u=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(u.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&qe(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(u.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(u.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),v&&(_e=!1),ne&&(U=!0),k&&(p=s({},ft),T=[],k.html===!0&&(s(p,ct),s(T,ut)),k.svg===!0&&(s(p,Ne),s(T,we),s(T,ce)),k.svgFilters===!0&&(s(p,Me),s(T,we),s(T,ce)),k.mathMl===!0&&(s(p,Ce),s(T,mt),s(T,ce))),e.ADD_TAGS&&(p===Fe&&(p=C(p)),s(p,e.ADD_TAGS,d)),e.ADD_ATTR&&(T===He&&(T=C(T)),s(T,e.ADD_ATTR,d)),e.ADD_URI_SAFE_ATTR&&s(Se,e.ADD_URI_SAFE_ATTR,d),e.FORBID_CONTENTS&&(F===Xe&&(F=C(F)),s(F,e.FORBID_CONTENTS,d)),he&&(p["#text"]=!0),x&&s(p,["html","head","body"]),p.table&&(s(p,["tbody"]),delete X.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw K('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=e.TRUSTED_TYPES_POLICY,Y=A.createHTML("")}else A===void 0&&(A=mn(Q,c)),A!==null&&typeof Y=="string"&&(Y=A.createHTML(""));R&&R(e),z=e}},Ke=s({},[...Ne,...Me,...en]),Ze=s({},[...Ce,...tn]),Wt=function(e){let t=ee(e);(!t||!t.tagName)&&(t={namespaceURI:H,tagName:"template"});const o=fe(e.tagName),f=fe(t.tagName);return Oe[e.namespaceURI]?e.namespaceURI===ae?t.namespaceURI===I?o==="svg":t.namespaceURI===ie?o==="svg"&&(f==="annotation-xml"||re[f]):!!Ke[o]:e.namespaceURI===ie?t.namespaceURI===I?o==="math":t.namespaceURI===ae?o==="math"&&se[f]:!!Ze[o]:e.namespaceURI===I?t.namespaceURI===ae&&!se[f]||t.namespaceURI===ie&&!re[f]?!1:!Ze[o]&&(Ft[o]||!Ke[o]):!!(V==="application/xhtml+xml"&&Oe[e.namespaceURI]):!1},D=function(e){$(n.removed,{element:e});try{ee(e).removeChild(e)}catch{Lt(e)}},P=function(e,t){try{$(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch{$(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(U||ne)try{D(t)}catch{}else try{t.setAttribute(e,"")}catch{}},Je=function(e){let t=null,o=null;if(Ae)e="<remove></remove>"+e;else{const m=Ie(e,/^[\r\n\t ]+/);o=m&&m[0]}V==="application/xhtml+xml"&&H===I&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const f=A?A.createHTML(e):e;if(H===I)try{t=new Ot().parseFromString(f,V)}catch{}if(!t||!t.documentElement){t=me.createDocument(H,"template",null);try{t.documentElement.innerHTML=Re?Y:f}catch{}}const g=t.body||t.documentElement;return e&&o&&g.insertBefore(l.createTextNode(o),g.childNodes[0]||null),H===I?Mt.call(t,x?"html":"body")[0]:x?t.documentElement:g},Qe=function(e){return It.call(e.ownerDocument||e,e,W.SHOW_ELEMENT|W.SHOW_COMMENT|W.SHOW_TEXT|W.SHOW_PROCESSING_INSTRUCTION|W.SHOW_CDATA_SECTION,null)},Le=function(e){return e instanceof Rt&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof St)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},et=function(e){return typeof ue=="function"&&e instanceof ue};function N(i,e,t){le(i,o=>{o.call(n,e,t,z)})}const tt=function(e){let t=null;if(N(h.beforeSanitizeElements,e,null),Le(e))return D(e),!0;const o=d(e.nodeName);if(N(h.uponSanitizeElement,e,{tagName:o,allowedTags:p}),te&&e.hasChildNodes()&&!et(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent)||e.nodeType===J.progressingInstruction||te&&e.nodeType===J.comment&&S(/<[/\w]/g,e.data))return D(e),!0;if(!p[o]||X[o]){if(!X[o]&&ot(o)&&(u.tagNameCheck instanceof RegExp&&S(u.tagNameCheck,o)||u.tagNameCheck instanceof Function&&u.tagNameCheck(o)))return!1;if(he&&!F[o]){const f=ee(e)||e.parentNode,g=Dt(e)||e.childNodes;if(g&&f){const m=g.length;for(let y=m-1;y>=0;--y){const M=yt(g[y],!0);M.__removalCount=(e.__removalCount||0)+1,f.insertBefore(M,bt(e))}}}return D(e),!0}return e instanceof ve&&!Wt(e)||(o==="noscript"||o==="noembed"||o==="noframes")&&S(/<\/no(script|embed|frames)/i,e.innerHTML)?(D(e),!0):(v&&e.nodeType===J.text&&(t=e.textContent,le([pe,de,Te],f=>{t=q(t,f," ")}),e.textContent!==t&&($(n.removed,{element:e.cloneNode()}),e.textContent=t)),N(h.afterSanitizeElements,e,null),!1)},nt=function(e,t,o){if(Be&&(t==="id"||t==="name")&&(o in l||o in Gt))return!1;if(!(_e&&!Ee[t]&&S(wt,t))){if(!(ze&&S(xt,t))){if(!T[t]||Ee[t]){if(!(ot(e)&&(u.tagNameCheck instanceof RegExp&&S(u.tagNameCheck,e)||u.tagNameCheck instanceof Function&&u.tagNameCheck(e))&&(u.attributeNameCheck instanceof RegExp&&S(u.attributeNameCheck,t)||u.attributeNameCheck instanceof Function&&u.attributeNameCheck(t,e))||t==="is"&&u.allowCustomizedBuiltInElements&&(u.tagNameCheck instanceof RegExp&&S(u.tagNameCheck,o)||u.tagNameCheck instanceof Function&&u.tagNameCheck(o))))return!1}else if(!Se[t]){if(!S(ke,q(o,Ue,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Kt(o,"data:")===0&&je[e])){if(!(Ge&&!S(Pt,q(o,Ue,"")))){if(o)return!1}}}}}}return!0},ot=function(e){return e!=="annotation-xml"&&Ie(e,vt)},it=function(e){N(h.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Le(e))return;const o={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let f=t.length;for(;f--;){const g=t[f],{name:m,namespaceURI:y,value:M}=g,G=d(m),be=M;let E=m==="value"?be:Zt(be);if(o.attrName=G,o.attrValue=E,o.keepAttr=!0,o.forceKeepAttr=void 0,N(h.uponSanitizeAttribute,e,o),E=o.attrValue,Ye&&(G==="id"||G==="name")&&(P(m,e),E=Ut+E),te&&S(/((--!?|])>)|<\/(style|title|textarea)/i,E)){P(m,e);continue}if(G==="attributename"&&Ie(E,"href")){P(m,e);continue}if(o.forceKeepAttr)continue;if(!o.keepAttr){P(m,e);continue}if(!We&&S(/\/>/i,E)){P(m,e);continue}v&&le([pe,de,Te],rt=>{E=q(E,rt," ")});const at=d(e.nodeName);if(!nt(at,G,E)){P(m,e);continue}if(A&&typeof Q=="object"&&typeof Q.getAttributeType=="function"&&!y)switch(Q.getAttributeType(at,G)){case"TrustedHTML":{E=A.createHTML(E);break}case"TrustedScriptURL":{E=A.createScriptURL(E);break}}if(E!==be)try{y?e.setAttributeNS(y,m,E):e.setAttribute(m,E),Le(e)?D(e):lt(n.removed)}catch{P(m,e)}}N(h.afterSanitizeAttributes,e,null)},Bt=function i(e){let t=null;const o=Qe(e);for(N(h.beforeSanitizeShadowDOM,e,null);t=o.nextNode();)N(h.uponSanitizeShadowNode,t,null),tt(t),it(t),t.content instanceof _&&i(t.content);N(h.afterSanitizeShadowDOM,e,null)};return n.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,o=null,f=null,g=null;if(Re=!i,Re&&(i="<!-->"),typeof i!="string"&&!et(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw K("dirty is not a string, aborting")}else throw K("toString is not a function");if(!n.isSupported)return i;if(ge||ye(e),n.removed=[],typeof i=="string"&&(j=!1),j){if(i.nodeName){const M=d(i.nodeName);if(!p[M]||X[M])throw K("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof ue)t=Je("<!---->"),o=t.ownerDocument.importNode(i,!0),o.nodeType===J.element&&o.nodeName==="BODY"||o.nodeName==="HTML"?t=o:t.appendChild(o);else{if(!U&&!v&&!x&&i.indexOf("<")===-1)return A&&oe?A.createHTML(i):i;if(t=Je(i),!t)return U?null:oe?Y:""}t&&Ae&&D(t.firstChild);const m=Qe(j?i:t);for(;f=m.nextNode();)tt(f),it(f),f.content instanceof _&&Bt(f.content);if(j)return i;if(U){if(ne)for(g=Nt.call(t.ownerDocument);t.firstChild;)g.appendChild(t.firstChild);else g=t;return(T.shadowroot||T.shadowrootmode)&&(g=Ct.call(a,g,!0)),g}let y=x?t.outerHTML:t.innerHTML;return x&&p["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&S(gt,t.ownerDocument.doctype.name)&&(y="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
|
|
2
|
-
`+
|
|
1
|
+
"use strict";const Xt=require("./constants.cjs");/*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */const{entries:_t,setPrototypeOf:ct,isFrozen:jt,getPrototypeOf:Vt,getOwnPropertyDescriptor:$t}=Object;let{freeze:R,seal:y,create:Pe}=Object,{apply:ve,construct:ke}=typeof Reflect<"u"&&Reflect;R||(R=function(o){return o});y||(y=function(o){return o});ve||(ve=function(o,l){for(var a=arguments.length,c=new Array(a>2?a-2:0),_=2;_<a;_++)c[_-2]=arguments[_];return o.apply(l,c)});ke||(ke=function(o){for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];return new o(...a)});const ce=O(Array.prototype.forEach),qt=O(Array.prototype.lastIndexOf),ft=O(Array.prototype.pop),q=O(Array.prototype.push),Kt=O(Array.prototype.splice),ue=O(String.prototype.toLowerCase),Ie=O(String.prototype.toString),Ne=O(String.prototype.match),K=O(String.prototype.replace),Zt=O(String.prototype.indexOf),Jt=O(String.prototype.trim),D=O(Object.prototype.hasOwnProperty),S=O(RegExp.prototype.test),Z=Qt(TypeError);function O(r){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var l=arguments.length,a=new Array(l>1?l-1:0),c=1;c<l;c++)a[c-1]=arguments[c];return ve(r,o,a)}}function Qt(r){return function(){for(var o=arguments.length,l=new Array(o),a=0;a<o;a++)l[a]=arguments[a];return ke(r,l)}}function s(r,o){let l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ue;ct&&ct(r,null);let a=o.length;for(;a--;){let c=o[a];if(typeof c=="string"){const _=l(c);_!==c&&(jt(o)||(o[a]=_),c=_)}r[c]=!0}return r}function en(r){for(let o=0;o<r.length;o++)D(r,o)||(r[o]=null);return r}function M(r){const o=Pe(null);for(const[l,a]of _t(r))D(r,l)&&(Array.isArray(a)?o[l]=en(a):a&&typeof a=="object"&&a.constructor===Object?o[l]=M(a):o[l]=a);return o}function J(r,o){for(;r!==null;){const a=$t(r,o);if(a){if(a.get)return O(a.get);if(typeof a.value=="function")return O(a.value)}r=Vt(r)}function l(){return null}return l}const ut=R(["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"]),Ce=R(["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"]),Me=R(["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"]),tn=R(["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"]),we=R(["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"]),nn=R(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mt=R(["#text"]),pt=R(["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","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","slot"]),xe=R(["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"]),dt=R(["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"]),fe=R(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),on=y(/\{\{[\w\W]*|[\w\W]*\}\}/gm),an=y(/<%[\w\W]*|[\w\W]*%>/gm),rn=y(/\$\{[\w\W]*/gm),sn=y(/^data-[\-\w.\u00B7-\uFFFF]+$/),ln=y(/^aria-[\-\w]+$/),gt=y(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cn=y(/^(?:\w+script|data):/i),fn=y(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),At=y(/^html$/i),un=y(/^[a-z][.\w]*(-[.\w]+)+$/i);var Tt=Object.freeze({__proto__:null,ARIA_ATTR:ln,ATTR_WHITESPACE:fn,CUSTOM_ELEMENT:un,DATA_ATTR:sn,DOCTYPE_NAME:At,ERB_EXPR:an,IS_ALLOWED_URI:gt,IS_SCRIPT_OR_DATA:cn,MUSTACHE_EXPR:on,TMPLIT_EXPR:rn});const Q={element:1,text:3,progressingInstruction:7,comment:8,document:9},mn=function(){return typeof window>"u"?null:window},pn=function(o,l){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let a=null;const c="data-tt-policy-suffix";l&&l.hasAttribute(c)&&(a=l.getAttribute(c));const _="dompurify"+(a?"#"+a:"");try{return o.createPolicy(_,{createHTML(w){return w},createScriptURL(w){return w}})}catch{return console.warn("TrustedTypes policy "+_+" could not be created."),null}},Et=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ht(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mn();const o=i=>ht(i);if(o.version="3.3.0",o.removed=[],!r||!r.document||r.document.nodeType!==Q.document||!r.Element)return o.isSupported=!1,o;let{document:l}=r;const a=l,c=a.currentScript,{DocumentFragment:_,HTMLTemplateElement:w,Node:me,Element:Ue,NodeFilter:B,NamedNodeMap:Rt=r.NamedNodeMap||r.MozNamedAttrMap,HTMLFormElement:Ot,DOMParser:bt,trustedTypes:ee}=r,Y=Ue.prototype,yt=J(Y,"cloneNode"),Dt=J(Y,"remove"),Lt=J(Y,"nextSibling"),It=J(Y,"childNodes"),te=J(Y,"parentNode");if(typeof w=="function"){const i=l.createElement("template");i.content&&i.content.ownerDocument&&(l=i.content.ownerDocument)}let A,X="";const{implementation:pe,createNodeIterator:Nt,createDocumentFragment:Ct,getElementsByTagName:Mt}=l,{importNode:wt}=a;let h=Et();o.isSupported=typeof _t=="function"&&typeof te=="function"&&pe&&pe.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:de,ERB_EXPR:Te,TMPLIT_EXPR:Ee,DATA_ATTR:xt,ARIA_ATTR:Pt,IS_SCRIPT_OR_DATA:vt,ATTR_WHITESPACE:Fe,CUSTOM_ELEMENT:kt}=Tt;let{IS_ALLOWED_URI:He}=Tt,p=null;const ze=s({},[...ut,...Ce,...Me,...we,...mt]);let T=null;const Ge=s({},[...pt,...xe,...dt,...fe]);let u=Object.seal(Pe(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}})),j=null,_e=null;const v=Object.seal(Pe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let We=!0,ge=!0,Be=!1,Ye=!0,k=!1,ne=!0,x=!1,Ae=!1,he=!1,U=!1,oe=!1,ie=!1,Xe=!0,je=!1;const Ut="user-content-";let Se=!0,V=!1,F={},H=null;const Ve=s({},["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"]);let $e=null;const qe=s({},["audio","video","img","source","image","track"]);let Re=null;const Ke=s({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",re="http://www.w3.org/2000/svg",I="http://www.w3.org/1999/xhtml";let z=I,Oe=!1,be=null;const Ft=s({},[ae,re,I],Ie);let se=s({},["mi","mo","mn","ms","mtext"]),le=s({},["annotation-xml"]);const Ht=s({},["title","style","font","a","script"]);let $=null;const zt=["application/xhtml+xml","text/html"],Gt="text/html";let d=null,G=null;const Wt=l.createElement("form"),Ze=function(e){return e instanceof RegExp||e instanceof Function},ye=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(G&&G===e)){if((!e||typeof e!="object")&&(e={}),e=M(e),$=zt.indexOf(e.PARSER_MEDIA_TYPE)===-1?Gt:e.PARSER_MEDIA_TYPE,d=$==="application/xhtml+xml"?Ie:ue,p=D(e,"ALLOWED_TAGS")?s({},e.ALLOWED_TAGS,d):ze,T=D(e,"ALLOWED_ATTR")?s({},e.ALLOWED_ATTR,d):Ge,be=D(e,"ALLOWED_NAMESPACES")?s({},e.ALLOWED_NAMESPACES,Ie):Ft,Re=D(e,"ADD_URI_SAFE_ATTR")?s(M(Ke),e.ADD_URI_SAFE_ATTR,d):Ke,$e=D(e,"ADD_DATA_URI_TAGS")?s(M(qe),e.ADD_DATA_URI_TAGS,d):qe,H=D(e,"FORBID_CONTENTS")?s({},e.FORBID_CONTENTS,d):Ve,j=D(e,"FORBID_TAGS")?s({},e.FORBID_TAGS,d):M({}),_e=D(e,"FORBID_ATTR")?s({},e.FORBID_ATTR,d):M({}),F=D(e,"USE_PROFILES")?e.USE_PROFILES:!1,We=e.ALLOW_ARIA_ATTR!==!1,ge=e.ALLOW_DATA_ATTR!==!1,Be=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ye=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=e.SAFE_FOR_TEMPLATES||!1,ne=e.SAFE_FOR_XML!==!1,x=e.WHOLE_DOCUMENT||!1,U=e.RETURN_DOM||!1,oe=e.RETURN_DOM_FRAGMENT||!1,ie=e.RETURN_TRUSTED_TYPE||!1,he=e.FORCE_BODY||!1,Xe=e.SANITIZE_DOM!==!1,je=e.SANITIZE_NAMED_PROPS||!1,Se=e.KEEP_CONTENT!==!1,V=e.IN_PLACE||!1,He=e.ALLOWED_URI_REGEXP||gt,z=e.NAMESPACE||I,se=e.MATHML_TEXT_INTEGRATION_POINTS||se,le=e.HTML_INTEGRATION_POINTS||le,u=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ze(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(u.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ze(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(u.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(u.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(ge=!1),oe&&(U=!0),F&&(p=s({},mt),T=[],F.html===!0&&(s(p,ut),s(T,pt)),F.svg===!0&&(s(p,Ce),s(T,xe),s(T,fe)),F.svgFilters===!0&&(s(p,Me),s(T,xe),s(T,fe)),F.mathMl===!0&&(s(p,we),s(T,dt),s(T,fe))),e.ADD_TAGS&&(typeof e.ADD_TAGS=="function"?v.tagCheck=e.ADD_TAGS:(p===ze&&(p=M(p)),s(p,e.ADD_TAGS,d))),e.ADD_ATTR&&(typeof e.ADD_ATTR=="function"?v.attributeCheck=e.ADD_ATTR:(T===Ge&&(T=M(T)),s(T,e.ADD_ATTR,d))),e.ADD_URI_SAFE_ATTR&&s(Re,e.ADD_URI_SAFE_ATTR,d),e.FORBID_CONTENTS&&(H===Ve&&(H=M(H)),s(H,e.FORBID_CONTENTS,d)),Se&&(p["#text"]=!0),x&&s(p,["html","head","body"]),p.table&&(s(p,["tbody"]),delete j.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Z('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');A=e.TRUSTED_TYPES_POLICY,X=A.createHTML("")}else A===void 0&&(A=pn(ee,c)),A!==null&&typeof X=="string"&&(X=A.createHTML(""));R&&R(e),G=e}},Je=s({},[...Ce,...Me,...tn]),Qe=s({},[...we,...nn]),Bt=function(e){let t=te(e);(!t||!t.tagName)&&(t={namespaceURI:z,tagName:"template"});const n=ue(e.tagName),f=ue(t.tagName);return be[e.namespaceURI]?e.namespaceURI===re?t.namespaceURI===I?n==="svg":t.namespaceURI===ae?n==="svg"&&(f==="annotation-xml"||se[f]):!!Je[n]:e.namespaceURI===ae?t.namespaceURI===I?n==="math":t.namespaceURI===re?n==="math"&&le[f]:!!Qe[n]:e.namespaceURI===I?t.namespaceURI===re&&!le[f]||t.namespaceURI===ae&&!se[f]?!1:!Qe[n]&&(Ht[n]||!Je[n]):!!($==="application/xhtml+xml"&&be[e.namespaceURI]):!1},L=function(e){q(o.removed,{element:e});try{te(e).removeChild(e)}catch{Dt(e)}},P=function(e,t){try{q(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch{q(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),e==="is")if(U||oe)try{L(t)}catch{}else try{t.setAttribute(e,"")}catch{}},et=function(e){let t=null,n=null;if(he)e="<remove></remove>"+e;else{const m=Ne(e,/^[\r\n\t ]+/);n=m&&m[0]}$==="application/xhtml+xml"&&z===I&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const f=A?A.createHTML(e):e;if(z===I)try{t=new bt().parseFromString(f,$)}catch{}if(!t||!t.documentElement){t=pe.createDocument(z,"template",null);try{t.documentElement.innerHTML=Oe?X:f}catch{}}const g=t.body||t.documentElement;return e&&n&&g.insertBefore(l.createTextNode(n),g.childNodes[0]||null),z===I?Mt.call(t,x?"html":"body")[0]:x?t.documentElement:g},tt=function(e){return Nt.call(e.ownerDocument||e,e,B.SHOW_ELEMENT|B.SHOW_COMMENT|B.SHOW_TEXT|B.SHOW_PROCESSING_INSTRUCTION|B.SHOW_CDATA_SECTION,null)},De=function(e){return e instanceof Ot&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof Rt)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},nt=function(e){return typeof me=="function"&&e instanceof me};function N(i,e,t){ce(i,n=>{n.call(o,e,t,G)})}const ot=function(e){let t=null;if(N(h.beforeSanitizeElements,e,null),De(e))return L(e),!0;const n=d(e.nodeName);if(N(h.uponSanitizeElement,e,{tagName:n,allowedTags:p}),ne&&e.hasChildNodes()&&!nt(e.firstElementChild)&&S(/<[/\w!]/g,e.innerHTML)&&S(/<[/\w!]/g,e.textContent)||e.nodeType===Q.progressingInstruction||ne&&e.nodeType===Q.comment&&S(/<[/\w]/g,e.data))return L(e),!0;if(!(v.tagCheck instanceof Function&&v.tagCheck(n))&&(!p[n]||j[n])){if(!j[n]&&at(n)&&(u.tagNameCheck instanceof RegExp&&S(u.tagNameCheck,n)||u.tagNameCheck instanceof Function&&u.tagNameCheck(n)))return!1;if(Se&&!H[n]){const f=te(e)||e.parentNode,g=It(e)||e.childNodes;if(g&&f){const m=g.length;for(let b=m-1;b>=0;--b){const C=yt(g[b],!0);C.__removalCount=(e.__removalCount||0)+1,f.insertBefore(C,Lt(e))}}}return L(e),!0}return e instanceof Ue&&!Bt(e)||(n==="noscript"||n==="noembed"||n==="noframes")&&S(/<\/no(script|embed|frames)/i,e.innerHTML)?(L(e),!0):(k&&e.nodeType===Q.text&&(t=e.textContent,ce([de,Te,Ee],f=>{t=K(t,f," ")}),e.textContent!==t&&(q(o.removed,{element:e.cloneNode()}),e.textContent=t)),N(h.afterSanitizeElements,e,null),!1)},it=function(e,t,n){if(Xe&&(t==="id"||t==="name")&&(n in l||n in Wt))return!1;if(!(ge&&!_e[t]&&S(xt,t))){if(!(We&&S(Pt,t))){if(!(v.attributeCheck instanceof Function&&v.attributeCheck(t,e))){if(!T[t]||_e[t]){if(!(at(e)&&(u.tagNameCheck instanceof RegExp&&S(u.tagNameCheck,e)||u.tagNameCheck instanceof Function&&u.tagNameCheck(e))&&(u.attributeNameCheck instanceof RegExp&&S(u.attributeNameCheck,t)||u.attributeNameCheck instanceof Function&&u.attributeNameCheck(t,e))||t==="is"&&u.allowCustomizedBuiltInElements&&(u.tagNameCheck instanceof RegExp&&S(u.tagNameCheck,n)||u.tagNameCheck instanceof Function&&u.tagNameCheck(n))))return!1}else if(!Re[t]){if(!S(He,K(n,Fe,""))){if(!((t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Zt(n,"data:")===0&&$e[e])){if(!(Be&&!S(vt,K(n,Fe,"")))){if(n)return!1}}}}}}}return!0},at=function(e){return e!=="annotation-xml"&&Ne(e,kt)},rt=function(e){N(h.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||De(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0};let f=t.length;for(;f--;){const g=t[f],{name:m,namespaceURI:b,value:C}=g,W=d(m),Le=C;let E=m==="value"?Le:Jt(Le);if(n.attrName=W,n.attrValue=E,n.keepAttr=!0,n.forceKeepAttr=void 0,N(h.uponSanitizeAttribute,e,n),E=n.attrValue,je&&(W==="id"||W==="name")&&(P(m,e),E=Ut+E),ne&&S(/((--!?|])>)|<\/(style|title|textarea)/i,E)){P(m,e);continue}if(W==="attributename"&&Ne(E,"href")){P(m,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){P(m,e);continue}if(!Ye&&S(/\/>/i,E)){P(m,e);continue}k&&ce([de,Te,Ee],lt=>{E=K(E,lt," ")});const st=d(e.nodeName);if(!it(st,W,E)){P(m,e);continue}if(A&&typeof ee=="object"&&typeof ee.getAttributeType=="function"&&!b)switch(ee.getAttributeType(st,W)){case"TrustedHTML":{E=A.createHTML(E);break}case"TrustedScriptURL":{E=A.createScriptURL(E);break}}if(E!==Le)try{b?e.setAttributeNS(b,m,E):e.setAttribute(m,E),De(e)?L(e):ft(o.removed)}catch{P(m,e)}}N(h.afterSanitizeAttributes,e,null)},Yt=function i(e){let t=null;const n=tt(e);for(N(h.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)N(h.uponSanitizeShadowNode,t,null),ot(t),rt(t),t.content instanceof _&&i(t.content);N(h.afterSanitizeShadowDOM,e,null)};return o.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,n=null,f=null,g=null;if(Oe=!i,Oe&&(i="<!-->"),typeof i!="string"&&!nt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw Z("dirty is not a string, aborting")}else throw Z("toString is not a function");if(!o.isSupported)return i;if(Ae||ye(e),o.removed=[],typeof i=="string"&&(V=!1),V){if(i.nodeName){const C=d(i.nodeName);if(!p[C]||j[C])throw Z("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof me)t=et("<!---->"),n=t.ownerDocument.importNode(i,!0),n.nodeType===Q.element&&n.nodeName==="BODY"||n.nodeName==="HTML"?t=n:t.appendChild(n);else{if(!U&&!k&&!x&&i.indexOf("<")===-1)return A&&ie?A.createHTML(i):i;if(t=et(i),!t)return U?null:ie?X:""}t&&he&&L(t.firstChild);const m=tt(V?i:t);for(;f=m.nextNode();)ot(f),rt(f),f.content instanceof _&&Yt(f.content);if(V)return i;if(U){if(oe)for(g=Ct.call(t.ownerDocument);t.firstChild;)g.appendChild(t.firstChild);else g=t;return(T.shadowroot||T.shadowrootmode)&&(g=wt.call(a,g,!0)),g}let b=x?t.outerHTML:t.innerHTML;return x&&p["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&S(At,t.ownerDocument.doctype.name)&&(b="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
|
|
2
|
+
`+b),k&&ce([de,Te,Ee],C=>{b=K(b,C," ")}),A&&ie?A.createHTML(b):b},o.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ye(i),Ae=!0},o.clearConfig=function(){G=null,Ae=!1},o.isValidAttribute=function(i,e,t){G||ye({});const n=d(i),f=d(e);return it(n,f,t)},o.addHook=function(i,e){typeof e=="function"&&q(h[i],e)},o.removeHook=function(i,e){if(e!==void 0){const t=qt(h[i],e);return t===-1?void 0:Kt(h[i],t,1)[0]}return ft(h[i])},o.removeHooks=function(i){h[i]=[]},o.removeAllHooks=function(){h=Et()},o}var dn=ht();function Tn(r,o={}){const{allowStyles:l=!1,forbiddenAttributes:a=[],forbiddenTags:c=[]}=o;if(!r||typeof r!="string")return null;if(!St())return r;const _=[...Xt.DEFAULT_FORBIDDEN_TAGS,...c],w=[...l?[]:["style"],...a];return dn.sanitize(r,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:_,FORBID_ATTR:w})}function St(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}exports.canUseDOM=St;exports.sanitizeSvg=Tn;
|
|
3
3
|
//# sourceMappingURL=utils.cjs.map
|