@atlasprivacy/consent-sdk 1.0.0 → 1.1.0
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/CHANGELOG.md +5 -0
- package/README.md +1 -1
- package/dist/atlas-consent-preview.esm.js +10 -0
- package/dist/atlas-consent.esm.js +4 -4
- package/dist/atlas-consent.js +4 -4
- package/dist/manifest.json +4 -5
- package/dist/preview.d.ts +26 -0
- package/dist/shared/constants.d.ts +1 -1
- package/package.json +7 -3
- package/dist/atlas-consent-ui.js +0 -10
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui.html +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
- Add `renderPreview` at `@atlasprivacy/consent-sdk/preview`, for the Atlas dashboard preview. It draws the form from a configuration the caller passes in, and sends and saves nothing.
|
|
6
|
+
- Remove `ui.html` and `atlas-consent-ui.js`. The dashboard imports the preview from npm, and Atlas no longer hosts SDK files.
|
|
7
|
+
|
|
3
8
|
## 1.0.0 (unreleased)
|
|
4
9
|
|
|
5
10
|
First public release, published to npm as `@atlasprivacy/consent-sdk` under the MIT license. The internal builds listed below were never released; their changes are all part of 1.0.0.
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ In Atlas, open **Consents → Integrations**, create an app and select a publish
|
|
|
6
6
|
|
|
7
7
|
## Add the SDK
|
|
8
8
|
|
|
9
|
-
Load the script from jsDelivr
|
|
9
|
+
Load the script from jsDelivr. Pin an exact version; a version URL never changes. Replace the version and app ID below. See [npm](https://www.npmjs.com/package/@atlasprivacy/consent-sdk?activeTab=versions) for the current version.
|
|
10
10
|
|
|
11
11
|
```html
|
|
12
12
|
<script src="https://cdn.jsdelivr.net/npm/@atlasprivacy/consent-sdk@1.0.0/dist/atlas-consent.js"></script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function kn(){if(!globalThis.crypto?.getRandomValues)throw new Error("Atlas Consent needs a secure browser context.");return[...crypto.getRandomValues(new Uint8Array(24))].map(o=>o.toString(16).padStart(2,"0")).join("")}var Ze=class extends Error{constructor(i,r,p=0){super(i);this.code=r;this.status=p;this.name="ConsentError"}};var Nn={system:'Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif',serif:"Georgia,'Times New Roman',serif",rounded:"'Trebuchet MS','Segoe UI',Verdana,'Helvetica Neue',sans-serif"},Mn={sharp:["2px","2px"],soft:["6px","6px"],round:["999px","16px"]},jo=/^#[0-9a-f]{6}$/i,De={theme:"light",primary_color:"#ae0a60",background_color:"#ffffff",text_color:"#1a202c",radius:"soft",font:"system",density:"comfortable"},In={background_color:"#0f172a",text_color:"#f1f5f9"};function Pn(o){let[n,i,r]=[1,3,5].map(p=>parseInt(o.slice(p,p+2),16)/255).map(p=>p<=.03928?p/12.92:((p+.055)/1.055)**2.4);return .2126*n+.7152*i+.0722*r}function Un(o,n){let i=Pn(o),r=Pn(n);return(Math.max(i,r)+.05)/(Math.min(i,r)+.05)}function Fn(o,n,i){let r={...De,...n||{}};for(let A of["primary_color","background_color","text_color"])(typeof r[A]!="string"||!jo.test(r[A]))&&(r[A]=De[A]);(typeof r.radius!="string"||!Object.prototype.hasOwnProperty.call(Mn,r.radius))&&(r.radius=De.radius),(typeof r.font!="string"||!Object.prototype.hasOwnProperty.call(Nn,r.font))&&(r.font=De.font),["light","dark","system"].includes(r.theme)||(r.theme=De.theme);let p=r.theme==="dark"||r.theme==="system"&&i.matches;p&&(r.background_color.toLowerCase()===De.background_color&&(r.background_color=In.background_color),r.text_color.toLowerCase()===De.text_color&&(r.text_color=In.text_color));let[f,l]=Mn[r.radius],m=r.density==="compact",u={"--primary":r.primary_color,"--bg":r.background_color,"--text":r.text_color,"--on-primary":Un(r.primary_color,"#000000")>Un(r.primary_color,"#ffffff")?"#000000":"#ffffff","--muted":`color-mix(in srgb,${r.text_color} 66%,${r.background_color})`,"--line":`color-mix(in srgb,${r.text_color} 14%,${r.background_color})`,"--line-strong":`color-mix(in srgb,${r.text_color} 26%,${r.background_color})`,"--tint":`color-mix(in srgb,${r.text_color} 8%,${r.background_color})`,"--page":`color-mix(in srgb,${r.text_color} 4%,${r.background_color})`,"--font":Nn[r.font],"--r-btn":f,"--r-card":l,"--pad":m?"16px":"28px","--gap":m?"10px":"20px","--fs":m?"14px":"16px","--btn":m?"42px":"52px","--rowy":m?"4px":"12px","--rowx":m?"12px":"18px"};for(let[A,S]of Object.entries(u))o.style.setProperty(A,S);o.style.colorScheme=p?"dark":"light"}function zn(o){let n=window.matchMedia("(prefers-color-scheme: dark)"),i,r=()=>{i?.theme==="system"&&Fn(o,i,n)};return n.addEventListener("change",r),{apply(p){i=p,Fn(o,p,n)},destroy(){n.removeEventListener("change",r)}}}function Bo(o,n){this.v=o,this.k=n}function Hn(o,n){(n==null||n>o.length)&&(n=o.length);for(var i=0,r=Array(n);i<n;i++)r[i]=o[i];return r}function Go(o){if(Array.isArray(o))return o}function Wo(o,n){var i=o==null?null:typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(i!=null){var r,p,f,l,m=[],u=!0,A=!1;try{if(f=(i=i.call(o)).next,n===0){if(Object(i)!==i)return;u=!1}else for(;!(u=(r=f.call(i)).done)&&(m.push(r.value),m.length!==n);u=!0);}catch(S){A=!0,p=S}finally{try{if(!u&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(A)throw p}}return m}}function Yo(){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 $o(o,n){return Go(o)||Wo(o,n)||Vo(o,n)||Yo()}function Vo(o,n){if(o){if(typeof o=="string")return Hn(o,n);var i={}.toString.call(o).slice(8,-1);return i==="Object"&&o.constructor&&(i=o.constructor.name),i==="Map"||i==="Set"?Array.from(o):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Hn(o,n):void 0}}function ht(o){var n,i;function r(f,l){try{var m=o[f](l),u=m.value,A=u instanceof Bo;Promise.resolve(A?u.v:u).then(function(S){if(A){var F=f==="return"&&u.k?f:"next";if(!u.k||S.done)return r(F,S);S=o[F](S).value}p(!!m.done,S)},function(S){r("throw",S)})}catch(S){p(2,S)}}function p(f,l){f===2?n.reject(l):n.resolve({value:l,done:f}),(n=n.next)?r(n.key,n.arg):i=null}this._invoke=function(f,l){return new Promise(function(m,u){var A={key:f,arg:l,resolve:m,reject:u,next:null};i?i=i.next=A:(n=i=A,r(f,l))})},typeof o.return!="function"&&(this.return=void 0)}ht.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},ht.prototype.next=function(o){return this._invoke("next",o)},ht.prototype.throw=function(o){return this._invoke("throw",o)},ht.prototype.return=function(o){return this._invoke("return",o)};var to=Object.entries,jn=Object.setPrototypeOf,qo=Object.isFrozen,no=Object.getPrototypeOf,oo=Object.getOwnPropertyDescriptor,M=Object.freeze,P=Object.seal,je=Object.create,ro=typeof Reflect<"u"&&Reflect,Zt=ro.apply,Qt=ro.construct;M||(M=function(n){return n});P||(P=function(n){return n});Zt||(Zt=function(n,i){for(var r=arguments.length,p=new Array(r>2?r-2:0),f=2;f<r;f++)p[f-2]=arguments[f];return n.apply(i,p)});Qt||(Qt=function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),p=1;p<i;p++)r[p-1]=arguments[p];return new n(...r)});var ge=R(Array.prototype.forEach);Array.prototype.indexOf;var Ko=R(Array.prototype.lastIndexOf),Bn=R(Array.prototype.pop),Qe=R(Array.prototype.push),Xo=R(Array.prototype.slice),Zo=R(Array.prototype.splice),Be=Array.isArray,Bt=io(Set),Gt=R(Set.prototype.add),Je=R(Set.prototype.has),Le=R(String.prototype.toLowerCase),Wt=R(String.prototype.toString),Gn=R(String.prototype.match),et=R(String.prototype.replace),Wn=R(String.prototype.indexOf),Qo=R(String.prototype.trim),Jo=R(Number.prototype.toString),er=R(Boolean.prototype.toString),Yn=typeof BigInt>"u"?null:R(BigInt.prototype.toString),$n=typeof Symbol>"u"?null:R(Symbol.prototype.toString),W=R(Object.prototype.hasOwnProperty),tt=R(Object.prototype.toString),I=R(RegExp.prototype.test),he=io(TypeError);function R(o){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),p=1;p<i;p++)r[p-1]=arguments[p];return Zt(o,n,r)}}function io(o){return function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];return Qt(o,i)}}function T(o,n){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Le;if(jn&&jn(o,null),!Be(n))return o;let r=n.length;for(;r--;){let p=n[r];if(typeof p=="string"){let f=i(p);f!==p&&(qo(n)||(n[r]=f),p=f)}o[p]=!0}return o}function tr(o){for(let n=0;n<o.length;n++)W(o,n)||(o[n]=null);return o}function q(o){let n=je(null);for(let r of to(o)){var i=$o(r,2);let p=i[0],f=i[1];W(o,p)&&(Be(f)?n[p]=tr(f):f&&typeof f=="object"&&f.constructor===Object?n[p]=q(f):n[p]=f)}return n}function nr(o){switch(typeof o){case"string":return o;case"number":return Jo(o);case"boolean":return er(o);case"bigint":return Yn?Yn(o):"0";case"symbol":return $n?$n(o):"Symbol()";case"undefined":return tt(o);case"function":case"object":{if(o===null)return tt(o);let n=o,i=K(n,"toString");if(typeof i=="function"){let r=i(n);return typeof r=="string"?r:tt(r)}return tt(o)}default:return tt(o)}}function K(o,n){for(;o!==null;){let r=oo(o,n);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}o=no(o)}function i(){return null}return i}function or(o,n){for(;o!==null;){let i=oo(o,n);if(i)return i.get?R(i.get):null;o=no(o)}return null}function rr(o){try{return I(o,""),!0}catch{return!1}}var Vn=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"]),ir=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"]),Vt=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"]),sr=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),qn=M(["#text"]),Kn=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"]),qt=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","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),Xn=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"]),_t=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ar=P(/{{[\w\W]*|^[\w\W]*}}/g),cr=P(/<%[\w\W]*|^[\w\W]*%>/g),lr=P(/\${[\w\W]*/g),pr=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),ur=P(/^aria-[\-\w]+$/),Zn=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fr=P(/^(?:\w+script|data):/i),dr=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),mr=P(/^html$/i),gr=P(/^[a-z][.\w]*(-[.\w]+)+$/i),Kt=P(/<[/\w!]/g),Qn=P(/<[/\w]/g),hr=P(/<\/no(script|embed|frames)/i),Jn=P(/\/>/i),D={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_r=M(T({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),yr=function(){return typeof window>"u"?null:window},br=function(n,i){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let r=null,p="data-tt-policy-suffix";i&&i.hasAttribute(p)&&(r=i.getAttribute(p));let f="dompurify"+(r?"#"+r:"");try{return n.createPolicy(f,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+f+" could not be created."),null}},eo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Se=function(n,i,r,p){return W(n,i)&&Be(n[i])?T(p.base?q(p.base):{},n[i],p.transform):r},Xt=function(n,i,r){let p=W(n,i)?n[i]:void 0;return p&&typeof p=="object"?q(p):r()};function so(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:yr(),n=c=>so(c);if(n.version="3.4.17",n.removed=[],!o||!o.document||o.document.nodeType!==D.document||!o.Element)return n.isSupported=!1,n;let i=o.document,r=i,p=r.currentScript;o.DocumentFragment;let f=o.HTMLTemplateElement,l=o.Node,m=o.Element,u=o.NodeFilter;o.NamedNodeMap===void 0&&(o.NamedNodeMap||o.MozNamedAttrMap),o.HTMLFormElement;let A=o.DOMParser,S=o.trustedTypes,F=m.prototype,ve=K(F,"cloneNode"),$=K(F,"remove"),ke=K(F,"removeAttributeNode"),ee=K(F,"nextSibling"),ae=K(F,"childNodes"),ce=K(F,"parentNode"),le=K(F,"shadowRoot"),Ne=K(F,"attributes"),X=l&&l.prototype?K(l.prototype,"nodeType"):null,pe=l&&l.prototype?K(l.prototype,"nodeName"):null,ye=l&&l.prototype?K(l.prototype,"ownerDocument"):null,z=function(e){return X?X(e):e.nodeType},be=function(e){return pe?pe(e):e.nodeName},Ge=or(F,"namespaceURI"),We=function(e){return Ge?Ge(e):e.namespaceURI};if(typeof f=="function"){let c=i.createElement("template");c.content&&c.content.ownerDocument&&(i=c.content.ownerDocument)}let U,ue="",Ye,d=!1,b=0,x=function(){if(b>0)throw he('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.')},k=function(e){x(),b++;try{return U.createHTML(e)}finally{b--}},fe=function(e){x(),b++;try{return U.createScriptURL(e)}finally{b--}},te=function(){return d||(Ye=br(S,p),d=!0),Ye},O=i,V=O.implementation,Z=O.createNodeIterator,bt=O.createDocumentFragment,nt=O.getElementsByTagName,ot=r.importNode,E=eo();n.isSupported=typeof to=="function"&&typeof ce=="function"&&V&&V.createHTMLDocument!==void 0;let de=ar,rt=cr,N=lr,ne=pr,Te=ur,$e=fr,oe=dr,it=gr,st=Zn,v=null,Tt=T({},[...Vn,...Yt,...$t,...Vt,...qn]),w=null,At=T({},[...Kn,...qt,...Xn,..._t]),re=Object.seal(je(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}})),Ve=null,rn=null,Ae=Object.seal(je(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),sn=!0,Et=!0,an=!1,xt=!0,me=!1,we=!0,Re=!1,St=!1,at=null,ct=null,vt=!1,Me=!1,lt=!1,pt=!1,cn=!0,ln=!1,pn="user-content-",wt=!0,Rt=!1,Oe=null,Ie={},Ce=null,un=T({},["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"]),fn=null,dn=T({},["audio","video","img","source","image","track"]),mn=null,gn=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ut="http://www.w3.org/1998/Math/MathML",ft="http://www.w3.org/2000/svg",ie="http://www.w3.org/1999/xhtml",Pe=ie,Ot=!1,Ct=null,Ao=T({},[ut,ft,ie],Wt),hn=M(["mi","mo","mn","ms","mtext"]),Dt=T({},hn),_n=M(["annotation-xml"]),Lt=T({},_n),Eo=T({},["title","style","font","a","script"]),qe=null,xo=["application/xhtml+xml","text/html"],So="text/html",C=null,Ue=null,vo=i.createElement("form"),yn=function(e){return e instanceof RegExp||e instanceof Function},kt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ue&&Ue===e)return;(!e||typeof e!="object")&&(e={}),e=q(e),qe=xo.indexOf(e.PARSER_MEDIA_TYPE)===-1?So:e.PARSER_MEDIA_TYPE,C=qe==="application/xhtml+xml"?Wt:Le,v=Se(e,"ALLOWED_TAGS",Tt,{transform:C}),w=Se(e,"ALLOWED_ATTR",At,{transform:C}),Ct=Se(e,"ALLOWED_NAMESPACES",Ao,{transform:Wt}),mn=Se(e,"ADD_URI_SAFE_ATTR",gn,{transform:C,base:gn}),fn=Se(e,"ADD_DATA_URI_TAGS",dn,{transform:C,base:dn}),Ce=Se(e,"FORBID_CONTENTS",un,{transform:C}),Ve=Se(e,"FORBID_TAGS",q({}),{transform:C}),rn=Se(e,"FORBID_ATTR",q({}),{transform:C}),Ie=W(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?q(e.USE_PROFILES):e.USE_PROFILES:!1,sn=e.ALLOW_ARIA_ATTR!==!1,Et=e.ALLOW_DATA_ATTR!==!1,an=e.ALLOW_UNKNOWN_PROTOCOLS||!1,xt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=e.SAFE_FOR_TEMPLATES||!1,we=e.SAFE_FOR_XML!==!1,Re=e.WHOLE_DOCUMENT||!1,Me=e.RETURN_DOM||!1,lt=e.RETURN_DOM_FRAGMENT||!1,pt=e.RETURN_TRUSTED_TYPE||!1,vt=e.FORCE_BODY||!1,cn=e.SANITIZE_DOM!==!1,ln=e.SANITIZE_NAMED_PROPS||!1,wt=e.KEEP_CONTENT!==!1,Rt=e.IN_PLACE||!1,st=rr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Zn,Pe=typeof e.NAMESPACE=="string"?e.NAMESPACE:ie,Dt=Xt(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>T({},hn)),Lt=Xt(e,"HTML_INTEGRATION_POINTS",()=>T({},_n));let t=Xt(e,"CUSTOM_ELEMENT_HANDLING",()=>je(null));if(re=je(null),W(t,"tagNameCheck")&&yn(t.tagNameCheck)&&(re.tagNameCheck=t.tagNameCheck),W(t,"attributeNameCheck")&&yn(t.attributeNameCheck)&&(re.attributeNameCheck=t.attributeNameCheck),W(t,"allowCustomizedBuiltInElements")&&typeof t.allowCustomizedBuiltInElements=="boolean"&&(re.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),P(re),me&&(Et=!1),lt&&(Me=!0),Ie&&(v=T({},qn),w=je(null),Ie.html===!0&&(T(v,Vn),T(w,Kn)),Ie.svg===!0&&(T(v,Yt),T(w,qt),T(w,_t)),Ie.svgFilters===!0&&(T(v,$t),T(w,qt),T(w,_t)),Ie.mathMl===!0&&(T(v,Vt),T(w,Xn),T(w,_t))),Ae.tagCheck=null,Ae.attributeCheck=null,W(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?Ae.tagCheck=e.ADD_TAGS:Be(e.ADD_TAGS)&&(v===Tt&&(v=q(v)),T(v,e.ADD_TAGS,C))),W(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?Ae.attributeCheck=e.ADD_ATTR:Be(e.ADD_ATTR)&&(w===At&&(w=q(w)),T(w,e.ADD_ATTR,C))),W(e,"ADD_FORBID_CONTENTS")&&Be(e.ADD_FORBID_CONTENTS)&&(Ce===un&&(Ce=q(Ce)),T(Ce,e.ADD_FORBID_CONTENTS,C)),wt&&(v["#text"]=!0),Re&&T(v,["html","head","body"]),v.table&&(T(v,["tbody"]),delete Ve.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw he('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw he('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let s=U;U=e.TRUSTED_TYPES_POLICY;try{ue=k("")}catch(a){throw U=s,a}}else e.TRUSTED_TYPES_POLICY===null?(U=void 0,ue=""):(U===void 0&&(U=te()),U&&typeof ue=="string"&&(ue=k("")));M&&M(e),Ue=e},bn=T({},[...Yt,...$t,...ir]),Tn=T({},[...Vt,...sr]),wo=function(e,t,s){return t.namespaceURI===ie?e==="svg":t.namespaceURI===ut?e==="svg"&&(s==="annotation-xml"||Dt[s]):!!bn[e]},Ro=function(e,t,s){return t.namespaceURI===ie?e==="math":t.namespaceURI===ft?e==="math"&&Lt[s]:!!Tn[e]},Oo=function(e,t,s){return t.namespaceURI===ft&&!Lt[s]||t.namespaceURI===ut&&!Dt[s]?!1:!Tn[e]&&(Eo[e]||!bn[e])},Co=function(e){let t=We(e),s=Le(be(e)),a=ce(e),g,h;return a&&z(a)===D.element?(g={namespaceURI:We(a)},h=Le(be(a))):(g={namespaceURI:Pe},h="template"),Ct[t]?t===ft?wo(s,g,h):t===ut?Ro(s,g,h):t===ie?Oo(s,g,h):!!(qe==="application/xhtml+xml"&&Ct[t]):!1},Ee=function(e){Qe(n.removed,{element:e});try{ce(e).removeChild(e)}catch{if($(e),!ce(e))throw he("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},An=function(e,t,s){try{ke(e,t)}catch{try{e.removeAttribute(s)}catch{}}},Nt=function(e){It(e);let t=ae(e);t&&ge(Xo(t),a=>{try{$(a)}catch{}});let s=z(e)===D.element?Ne(e):null;if(s)for(let a=s.length-1;a>=0;--a){let g=s[a],h=g&&g.name;typeof h=="string"&&An(e,g,h)}},Fe=function(e,t,s){if(!s)try{s=t.getAttributeNode(e)}catch{s=null}Qe(n.removed,{attribute:s||null,from:t});try{s?ke(t,s):t.removeAttribute(e)}catch{try{t.removeAttribute(e)}catch{}}if(e==="is")if(Me||lt)try{Ee(t)}catch{}else try{t.setAttribute(e,"")}catch{}},En=function(e){let t=Ne(e);if(t)for(let s=t.length-1;s>=0;--s){let a=t[s],g=a&&a.name;typeof g!="string"||w[C(g)]||An(e,a,g)}},Mt=function(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=[e];for(;a.length>0;){let g=a.pop();if(t(g)===!1)continue;if(s&&z(g)===D.element){let y=le(g);xe(y)&&a.push(y)}let h=ae(g);if(h)for(let y=h.length-1;y>=0;--y)a.push(h[y])}},It=function(e){Mt(e,t=>{z(t)===D.element&&En(t)})},Pt=function(e){let t=[];return Mt(e,s=>{t.push(s)},!0),t},Do=function(e,t){let s=Bt();ge(Pt(e),a=>{z(a)===D.element&&Gt(s,a)}),ge(t,a=>{z(a)===D.element&&!Je(s,a)&&En(a)})},xn=function(e,t){let s=!1;return ge(n.removed,a=>{a.element&&(s=s||a.element===e,It(a.element))}),Do(e,t),s},Lo=8,ko=function(e,t){let s=Oe,a=null,g=()=>(a||(a=Bt(),ge(t,h=>{Gt(a,h)})),a);for(let h=0;;h++){let y=Pt(e),L=[e],se=!1;if(ge(y,H=>{z(H)===D.documentFragment?Qe(L,H):!se&&!Je(s,H)&&(se=Je(g(),H))}),!se)return;if(h>=Lo)throw he("the tree kept changing during in-place sanitization; refusing to return it");ge(L,(H,B)=>{No(H,B>0,e,g())})}},No=function(e,t,s,a){let g=Ut(e),h;for(;h=g.nextNode();)!Je(a,h)||Je(Oe,h)||(t&&Q(E.uponSanitizeShadowNode,h,null),zt(h,s),Ht(h,s),xe(h.content)&&Xe(h.content))},Mo=function(e){Oe&&Gt(Oe,e)},Sn=function(e,t){return we?e==="patchsrc"?!0:e==="for"&&t!=="label"&&t!=="output":!1},Io=function(e){we&&Mt(e,t=>{let s=z(t);if(s===D.processingInstruction||s===D.comment&&I(Qn,t.data)){try{$(t)}catch{}return!1}if(s===D.element){let a=t,g=C(be(t));try{a.hasAttribute&&a.hasAttribute("patchsrc")&&a.removeAttribute("patchsrc"),a.hasAttribute&&a.hasAttribute("for")&&Sn("for",g)&&a.removeAttribute("for")}catch{}}return!0})},vn=function(e){let t=null,s=null;if(vt)e="<remove></remove>"+e;else{let h=Gn(e,/^[\r\n\t ]+/);s=h&&h[0]}qe==="application/xhtml+xml"&&Pe===ie&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let a=U?k(e):e;if(Pe===ie)try{t=new A().parseFromString(a,qe)}catch{}if(!t||!t.documentElement){t=V.createDocument(Pe,"template",null);try{t.documentElement.innerHTML=Ot?ue:a}catch{}}let g=t.body||t.documentElement;return e&&s&&g.insertBefore(i.createTextNode(s),g.childNodes[0]||null),Pe===ie?nt.call(t,Re?"html":"body")[0]:Re?t.documentElement:g},Ut=function(e){let t=ye?ye(e):e.ownerDocument;return Z.call(t||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},dt=function(e){return e=et(e,de," "),e=et(e,rt," "),e=et(e,N," "),e},Ft=function(e){var t;wn(e);let s=(t=e.querySelectorAll)===null||t===void 0?void 0:t.call(e,"template");s&&ge(s,a=>{xe(a.content)&&Ft(a.content)})},wn=function(e){e.normalize();let t=ye?ye(e):e.ownerDocument,s=Z.call(t||e,e,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),a=s.nextNode();for(;a;)a.data=dt(a.data),a=s.nextNode()},mt=function(e){let t=pe?pe(e):null;return typeof t!="string"||C(t)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Ne(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==X(e)||e.childNodes!==ae(e)},xe=function(e){if(!X||typeof e!="object"||e===null)return!1;try{return X(e)===D.documentFragment}catch{return!1}},Ke=function(e){if(!X||typeof e!="object"||e===null)return!1;try{return typeof X(e)=="number"}catch{return!1}};function Q(c,e,t){c.length!==0&&ge(c,s=>{s.call(n,e,t,Ue)})}let Po=function(e,t){return!!(we&&e.hasChildNodes()&&!Ke(e.firstElementChild)&&I(Kt,e.textContent)&&I(Kt,e.innerHTML)||we&&_r[t]&&z(e)===D.element&&We(e)===ie&&(Ke(e.firstElementChild)||typeof e.textContent=="string"&&I(Kt,e.textContent))||e.nodeType===D.processingInstruction||we&&e.nodeType===D.comment&&I(Qn,e.data))},gt=function(e,t){if(e instanceof RegExp)return I(e,t);if(e instanceof Function){for(var s=arguments.length,a=new Array(s>2?s-2:0),g=2;g<s;g++)a[g-2]=arguments[g];return!!e(t,...a)}return!1},Uo=function(e,t,s){if(!Ve[t]&&Cn(t)&>(re.tagNameCheck,t))return!1;if(wt&&!Ce[t]&&!Ce[Le(t)]){let a=ce(e),g=ae(e);if(g&&a){let h=g.length;for(let y=h-1;y>=0;--y){let L=e===s?ve(g[y],!0):g[y];a.insertBefore(L,ee(e))}}}return Ee(e),!0},Rn=function(e,t,s,a){return e.length===0?t:t===s||t===a?q(t):t},ze=function(e,t){return e===t||ce(e)!==null?!1:(Rt&&It(e),!0)},zt=function(e,t){if(Mo(e),Q(E.beforeSanitizeElements,e,null),ze(e,t))return!0;if(mt(e))return Ee(e),!0;let s=C(be(e));if(v=Rn(E.uponSanitizeElement,v,Tt,at),Q(E.uponSanitizeElement,e,{tagName:s,allowedTags:v}),ze(e,t))return!0;if(Po(e,s))return Ee(e),!0;if(Ve[s]||!(Ae.tagCheck instanceof Function&&Ae.tagCheck(s))&&!v[s]){let a=Uo(e,s,t);return a===!1&&(Q(E.afterSanitizeElements,e,null),ze(e,t))?!0:a}if(z(e)===D.element&&!Co(e)||(s==="noscript"||s==="noembed"||s==="noframes")&&I(hr,e.innerHTML))return Ee(e),!0;if(me&&e.nodeType===D.text){let a=dt(e.textContent);e.textContent!==a&&(Qe(n.removed,{element:e.cloneNode()}),e.textContent=a)}return Q(E.afterSanitizeElements,e,null),ze(e,t)},On=function(e,t,s){if(rn[t]||Sn(t,e)||cn&&(t==="id"||t==="name")&&(s in i||s in vo))return!1;let a=w[t]||Ae.attributeCheck instanceof Function&&Ae.attributeCheck(t,e);return Et&&I(ne,t)||sn&&I(Te,t)?!0:a?mn[t]||I(st,et(s,oe,""))||(t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&Wn(s,"data:")===0&&fn[e]||an&&!I($e,et(s,oe,""))?!0:!s:Cn(e)&>(re.tagNameCheck,e)&>(re.attributeNameCheck,t,e)||t==="is"&&re.allowCustomizedBuiltInElements&>(re.tagNameCheck,s)},Fo=T({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Cn=function(e){return!Fo[Le(e)]&&I(it,e)},zo=function(e,t,s,a){if(U&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!s)switch(S.getAttributeType(e,t)){case"TrustedHTML":return k(a);case"TrustedScriptURL":return fe(a)}return a},Ho=function(e,t,s,a){try{return s?e.setAttributeNS(s,t,a):e.setAttribute(t,a),mt(e)?(Ee(e),!1):!0}catch{return Fe(t,e),!1}},Dn=function(e,t){return we&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Le(e)==="attributename"&&Gn(t,"href")!==null},Ht=function(e,t){if(Q(E.beforeSanitizeAttributes,e,null),ze(e,t))return;let s=e.attributes;if(!s||mt(e))return;w=Rn(E.uponSanitizeAttribute,w,At,ct);let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0},g=s.length,h=C(e.nodeName);for(;g--;){let y=s[g],L=y.name,se=y.namespaceURI,H=y.value,B=C(L),He=H,G=L==="value"?He:Qo(He),Ln=!1;if(a.attrName=B,a.attrValue=G,a.keepAttr=!0,a.forceKeepAttr=void 0,Q(E.uponSanitizeAttribute,e,a),G=a.attrValue,ln&&(B==="id"||B==="name")&&Wn(G,pn)!==0&&(Fe(L,e,y),G=pn+G,Ln=!0),Dn(L,G)){Fe(L,e,y);continue}if(!a.forceKeepAttr){if(!a.keepAttr){Fe(L,e,y);continue}if(!xt&&I(Jn,G)){Fe(L,e,y);continue}if(me&&(G=dt(G)),!On(h,B,G)){Fe(L,e,y);continue}G=zo(h,B,se,G),G!==He&&Ho(e,L,se,G)&&Ln&&Bn(n.removed)}}Q(E.afterSanitizeAttributes,e,null),ze(e,t)},Xe=function(e){let t=null,s=Ut(e);for(Q(E.beforeSanitizeShadowDOM,e,null);t=s.nextNode();)if(Q(E.uponSanitizeShadowNode,t,null),zt(t,e),Ht(t,e),xe(t.content)&&Xe(t.content),z(t)===D.element){let a=le(t);xe(a)&&(jt(a),Xe(a))}me&&wn(e),Q(E.afterSanitizeShadowDOM,e,null)},jt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let s=t.pop();if(s.shadow){Xe(s.shadow);continue}let a=s.node,g=z(a)===D.element,h=ae(a);if(h)for(let y=h.length-1;y>=0;--y)t.push({node:h[y],shadow:null});if(g){let y=pe?pe(a):null;if(typeof y=="string"&&C(y)==="template"){let L=a.content;xe(L)&&t.push({node:L,shadow:null})}}if(g){let y=le(a);xe(y)&&t.push({node:null,shadow:y},{node:y,shadow:null})}}};return n.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,s=null,a=null,g=null;if(Ot=!c,Ot&&(c="<!-->"),typeof c!="string"&&!Ke(c)&&(c=nr(c),typeof c!="string"))throw he("dirty is not a string, aborting");if(!n.isSupported)return c;St?(v=at,w=ct):kt(e),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(v=q(v)),E.uponSanitizeAttribute.length>0&&(w=q(w)),n.removed=[];let h=Rt&&typeof c!="string"&&Ke(c),y=[],L=Oe;if(h){Io(c);let B=be(c);if(typeof B=="string"){let He=C(B);if(!v[He]||Ve[He])throw Nt(c),he("root node is forbidden and cannot be sanitized in-place")}if(mt(c))throw Nt(c),he("root node is clobbered and cannot be sanitized in-place");y=Pt(c),Oe=Bt()}else if(Ke(c))t=vn("<!---->"),s=t.ownerDocument.importNode(c,!0),s.nodeType===D.element&&s.nodeName==="BODY"||s.nodeName==="HTML"?t=s:t.appendChild(s),jt(t);else{if(!Me&&!me&&!Re&&c.indexOf("<")===-1)return U&&pt?k(c):c;if(t=vn(c),!t)return Me?null:pt?ue:""}t&&vt&&Ee(t.firstChild);let se=h?c:t;try{h&&jt(c);let B=Ut(se);for(;a=B.nextNode();)zt(a,se),Ht(a,se),xe(a.content)&&Xe(a.content);h&&ko(c,y)}catch(B){throw h&&(Nt(c),xn(c,y)),B}finally{Oe=L}if(h){if(xn(c,y))throw he("a node selected for removal could not be safely returned; refusing to sanitize in place");return me&&Ft(c),c}if(Me){if(me&&Ft(t),lt)for(g=bt.call(t.ownerDocument);t.firstChild;)g.appendChild(t.firstChild);else g=t;return(w.shadowroot||w.shadowrootmode)&&(g=ot.call(r,g,!0)),g}let H=Re?t.outerHTML:t.innerHTML;return Re&&v["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&I(mr,t.ownerDocument.doctype.name)&&(H="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
|
|
3
|
+
`+H),me&&(H=dt(H)),U&&pt?k(H):H},n.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};kt(c),St=!0,at=v,ct=w},n.clearConfig=function(){Ue=null,St=!1,at=null,ct=null,U=Ye,ue=""},n.isValidAttribute=function(c,e,t){Ue||kt({});let s=C(c),a=C(e);return typeof t=="string"&&(Dn(e,t)||!xt&&I(Jn,t))?!1:On(s,a,t)},n.addHook=function(c,e){typeof e=="function"&&W(E,c)&&Qe(E[c],e)},n.removeHook=function(c,e){if(W(E,c)){if(e!==void 0){let t=Ko(E[c],e);return t===-1?void 0:Zo(E[c],t,1)[0]}return Bn(E[c])}},n.removeHooks=function(c){W(E,c)&&(E[c]=[])},n.removeAllHooks=function(){E=eo()},n}var ao=so();function _(o,n,i){let r=document.createElement(o);return n&&(r.textContent=n),i&&(r.className=i),r}function j(o){return typeof o!="string"?"":(uo(o).textContent||"").trim()}var lo=new Set(["A","B","BLOCKQUOTE","BR","CODE","EM","I","LI","OL","P","PRE","STRONG","U","UL"]),po=new Set(["H1","H2","H3","H4","H5","H6"]),co;function uo(o){return co??(co=ao(window)),co.sanitize(o,{ALLOWED_TAGS:[...lo,...po].map(n=>n.toLowerCase()),ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,RETURN_DOM_FRAGMENT:!0})}function fo(o){let n=document.createDocumentFragment();if(typeof o!="string")return n;let i=(r,p)=>{for(let f of Array.from(r.childNodes)){if(f.nodeType===Node.TEXT_NODE){p.appendChild(document.createTextNode(f.textContent||""));continue}if(!(f instanceof Element))continue;let l=f.tagName;if(po.has(l)){let m=document.createElement("p"),u=document.createElement("strong");m.appendChild(u),i(f,u),p.appendChild(m)}else if(lo.has(l)){let m=document.createElement(l.toLowerCase());if(l==="A"){let u=f.getAttribute("href")||"";/^(https?:|mailto:)/i.test(u.trim())&&(m.setAttribute("href",u.trim()),m.setAttribute("target","_blank"),m.setAttribute("rel","noopener noreferrer nofollow"))}i(f,m),p.appendChild(m)}else["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"].includes(l)||i(f,p)}};return i(uo(o),n),n}var Jt=4,mo="http://www.w3.org/2000/svg";function Tr(){let o=document.createElementNS(mo,"svg");o.setAttribute("viewBox","0 0 24 24"),o.setAttribute("class","chev"),o.setAttribute("aria-hidden","true");let n=document.createElementNS(mo,"path");return n.setAttribute("d","M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"),o.append(n),o}function en(o,n){let i=(o||[]).map(u=>j(u.data_item_name)).filter(Boolean);if(!i.length){let u=(n||[]).map(j).filter(Boolean).join(" \xB7 ");return u?_("div",u,"ps"):null}let r=_("div",void 0,"ps"),p=document.createTextNode("");r.append(p);let f=!1,l=()=>{p.data=(f?i:i.slice(0,Jt)).join(", "),m.textContent=f?"show less":`+${i.length-Jt} more`},m=_("button",void 0,"more");return m.type="button",m.onclick=()=>{f=!f,l()},l(),i.length>Jt&&r.append(m),r}function go(o,n,i){let r=_("div",void 0,"grp"),p=_("button",void 0,"gh");p.type="button",p.setAttribute("aria-expanded","false");let f=_("span",void 0,"gx");f.append(_("span",o,"gt")),n&&f.append(_("span",n,"gd")),p.append(f,Tr()),p.onclick=()=>{let m=!r.classList.contains("open");r.classList.toggle("open",m),p.setAttribute("aria-expanded",String(m))};let l=_("div",void 0,"gb");return i.forEach(m=>l.append(_("span",m,"gi"))),r.append(p,l),r}function tn(o){if(!j(o))return null;let n=_("div",void 0,"text");return n.append(fo(o)),n}function ho({root:o,config:n,state:i,mode:r,demo:p,onClose:f,onSubmit:l,onChange:m}){o.replaceChildren();for(let d of n.purposes)d.required&&(i.choices[String(d.id)]=!0);let u=n.notice||{},A=[...u.purposes||[]],S=new Set(A.flatMap(d=>(d.sub_items||[]).map(b=>b.purpose_id))),F=n.purposes.filter(d=>!S.has(d.id));F.length&&A.push({purpose_reason:A.length?"Other purposes":"Purposes",sub_items:F.map(d=>({purpose_id:d.id,purpose_name:d.name}))});let ve=u.content?.consent_data?.find(d=>d.section_type==="initial-section")?.section_data,$=_("section",void 0,"shell"),ke=_("div",void 0,"body");if(r!=="panel"){let d=_("button","\xD7","close");d.type="button",d.setAttribute("aria-label","Close consent form"),d.onclick=()=>f(),$.append(d)}ke.append(_("h1",j(ve?.title)||n.name||"Your consent preferences"));let ee=_("form",void 0,"sec");ee.id="consent-form",ee.style.padding="0",ee.style.gap="16px";let ae=new Map,ce=[],le=()=>{ae.forEach((d,b)=>{d.forEach(x=>x.checked=!!i.choices[String(b)])}),ce.forEach(d=>{d.box.checked=d.ids.every(b=>!!i.choices[String(b)])}),ue()},Ne=(d,b)=>{if(i.busy){le();return}for(let x of d)n.purposes.find(k=>k.id===x)?.required||(i.choices[String(x)]=b);m(),le()},X=ve?.sections?.length?[...ve.sections]:[{section_type:"data_process_section",section_data:{section_title:"How we use it"}}];X.some(d=>d.section_type==="data_process_section")||X.push({section_type:"data_process_section",section_data:{section_title:"Purposes"}});let pe=u.sections_language_code&&u.sections_language_code!==n.language_code?u.sections_language_code:void 0;for(let d of X){let b=d.section_data,x=d.section_type;if(x==="link_section")continue;let k=_("div",void 0,"sec");if(x==="generic_section"){let O=tn(b.section_body);O&&k.append(O),ee.append(k);continue}b.section_title&&k.append(_("p",j(b.section_title),"st"));let fe=tn(b.section_body);fe&&k.append(fe);let te=_("div",void 0,"grps");if(pe&&(te.lang=pe),x==="data_collect_section")for(let O of u.collected||[]){let V=O.sub_items||[];te.append(go(`${j(O.data_category_name)||"Data"} (${V.length})`,j(O.desc),V.map(j)))}else if(x==="data_process_section")for(let O of A){let V=O.sub_items||[],Z=V.map(N=>N.purpose_id),bt=Z.length>0&&Z.every(N=>n.purposes.find(ne=>ne.id===N)?.required);for(let N of Z){let ne=!!n.purposes.find(Te=>Te.id===N)?.required;i.choices[String(N)]=ne||!!i.choices[String(N)]}let nt=_("div",void 0,"grp pg"),ot=_("div",void 0,"ph"),E=_("span",void 0,"gx");E.append(_("span",j(O.purpose_reason)||"Purposes","gt")),O.desc&&E.append(_("span",j(O.desc),"gd"));let de=_("input");de.type="checkbox",de.disabled=bt,de.setAttribute("aria-label",`Select all: ${O.purpose_reason||"purposes"}`),de.onchange=()=>Ne(Z,de.checked),ce.push({box:de,ids:Z}),ot.append(E,de);let rt=_("div",void 0,"pb");for(let N of V){let ne=n.purposes.find(st=>st.id===N.purpose_id),Te=_("div",void 0,"pr"),$e=_("label",void 0,"prh");$e.append(_("span",j(N.purpose_name||ne?.name),"pn"));let oe=_("input");oe.type="checkbox",oe.name=String(N.purpose_id),oe.disabled=!!ne?.required,oe.onchange=()=>Ne([N.purpose_id],oe.checked),ae.set(N.purpose_id,[...ae.get(N.purpose_id)||[],oe]),$e.append(oe),Te.append($e),ne?.description&&Te.append(_("p",j(ne.description),"ps"));let it=en(N.data_items,N.data_categories);it&&Te.append(it),rt.append(Te)}nt.append(ot,_("hr",void 0,"hr"),rt),te.append(nt)}else if(x==="data_share_section"){for(let O of u.shared||[]){let V=_("div",void 0,"sh");V.append(_("span",j(O.purpose_name)||"Sharing","gt"));let Z=en(O.data_items,O.data_categories);Z&&V.append(Z),te.append(V)}te.childElementCount||te.append(_("p","NIL","st"))}te.childElementCount&&k.append(te),ee.append(k)}le();let ye=_("div");ye.id="feedback",ye.setAttribute("aria-live","polite"),ee.append(ye),ee.onsubmit=d=>{d.preventDefault(),l()},ke.append(ee),$.append(ke);let z=ve?.buttons?.length?ve.buttons:[{button_type:"accept-all",button_text:"Accept All",button_enabled:!0},{button_type:"reject-all",button_text:"Reject All",button_enabled:!0},{button_type:"accept-necessary",button_enabled:!0,button_data:{accept_necessary_text:"Accept Necessary",accept_selected_text:"Accept Selected"}}],be=_("div",void 0,"foot"),Ge=_("div",void 0,"actions"),We=d=>{d==="accept-all"?n.purposes.forEach(b=>i.choices[String(b.id)]=!0):d==="reject-all"&&n.purposes.forEach(b=>i.choices[String(b.id)]=b.required),l()},U=[...z.filter(d=>d.button_type!=="accept-necessary"),...z.filter(d=>d.button_type==="accept-necessary")];for(let d of U){if(d.button_enabled===!1)continue;let b=d.button_type==="accept-necessary",x=_("button",void 0,b?"primary":void 0);x.type="button",x.dataset.type=d.button_type,x.textContent=b?d.button_data?.accept_necessary_text||"Accept Necessary":d.button_text||d.button_type,x.onclick=()=>We(d.button_type),b&&(x.dataset.necessary=d.button_data?.accept_necessary_text||"Accept Necessary",x.dataset.selected=d.button_data?.accept_selected_text||"Accept Selected"),Ge.append(x)}return be.append(Ge),$.append(be),o.append($),le(),(r==="popup"||r==="page")&&$.addEventListener("keydown",Ye),r!=="panel"&&!p&&($.tabIndex=-1,$.focus({preventScroll:!0})),le;function ue(){let d=o.querySelector("button.primary");if(!d?.dataset.necessary)return;let b=n.purposes.some(x=>!x.required&&i.choices[String(x.id)]);d.textContent=b?d.dataset.selected:d.dataset.necessary}function Ye(d){if(d.key==="Escape"){f();return}if(d.key!=="Tab")return;let b=[...o.querySelectorAll("button:not([disabled]),input:not([disabled]),summary,a[href]")],x=b[0],k=b[b.length-1],fe=o.getRootNode().activeElement;d.shiftKey&&(fe===x||fe===$)?(d.preventDefault(),k?.focus()):!d.shiftKey&&(fe===k||fe===$)&&(d.preventDefault(),x?.focus())}}var nn=`*{box-sizing:border-box}:host{all:initial;display:block}.theme,.root{height:100%}.root{background:var(--page);color:var(--text);font:var(--fs)/1.5 var(--font)}button,input{font:inherit;color:inherit}button{cursor:pointer}button:disabled{cursor:wait;opacity:.65}button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid var(--primary);outline-offset:2px}.shell:focus{outline:none}.shell{max-width:560px;margin:auto;background:var(--bg);height:100%;display:flex;flex-direction:column;position:relative}.body{flex:1;min-height:0;overflow:auto;padding:var(--pad) var(--pad) 8px;display:flex;flex-direction:column;gap:var(--gap)}h1{font-size:calc(var(--fs) + 2px);line-height:1.4;font-weight:700;margin:0}.sec{display:flex;flex-direction:column;gap:calc(var(--gap) * .5);padding-bottom:var(--gap)}.st{font-weight:700;margin:0}.text{margin:0;white-space:pre-wrap}.text :is(p,ul,ol,pre,blockquote){margin:0 0 .5em}.text>:last-child{margin-bottom:0}.text a{color:var(--primary)}.grps{display:flex;flex-direction:column;gap:calc(var(--gap) * .6)}.grp{border:1.2px solid var(--line);border-radius:var(--r-card)}.gh{display:flex;width:100%;gap:12px;align-items:center;padding:var(--rowy) var(--rowx);background:none;border:0;text-align:left}.gx{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}.gt{font-weight:600}.gd{font-size:12px;font-weight:400;color:var(--muted);display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}@media(min-width:480px){.gd{-webkit-line-clamp:2}}.chev{flex-shrink:0;width:1.25em;height:1.25em;fill:currentColor;transition:transform .2s ease}.open .chev{transform:rotate(180deg)}.gb{display:none;flex-direction:column;gap:4px;padding:0 var(--rowx) var(--rowx)}.open .gb{display:flex}.gi{font-size:16px;font-weight:800}.pg{display:flex;flex-direction:column}.ph{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:var(--rowy) var(--rowx)}.hr{border:0;border-top:1px solid var(--line);margin:0}.pb{display:flex;flex-direction:column;padding:var(--rowy) var(--rowx)}.pr{display:flex;flex-direction:column;gap:2px;padding:4px 0}.prh{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:28px;cursor:pointer}.pn{font-size:15px;font-weight:800;min-width:0;flex:1}.ps{font-size:12px;font-weight:400;color:var(--muted);padding-right:32px}.more{background:none;border:0;padding:0;margin-left:4px;color:var(--muted);text-decoration:underline;font-size:12px}.pg input[type=checkbox]{width:16px;height:16px;margin:0;flex-shrink:0;accent-color:var(--primary)}.sh{display:flex;flex-direction:column;gap:2px;border:1.2px solid var(--line);border-radius:var(--r-card);padding:8px 16px}.foot{position:relative;flex-shrink:0;padding:0 var(--pad) var(--pad)}.foot:before{content:"";position:absolute;left:0;right:0;top:-50px;height:50px;background:linear-gradient(to top,var(--bg),var(--bg),transparent);pointer-events:none}.actions{display:flex;flex-direction:column;gap:calc(var(--gap) * .4)}.actions button{min-height:calc(var(--btn) - 8px);padding:0 16px;border-radius:var(--r-btn);border:1px solid var(--text);background:transparent;color:var(--text);font-weight:600;width:100%}.actions button:hover:not(:disabled){background:color-mix(in srgb,var(--text) 8%,transparent)}.actions .primary{min-height:var(--btn);background:var(--primary);border-color:var(--primary);color:var(--on-primary)}.actions .primary:hover:not(:disabled){background:var(--primary);filter:brightness(.92)}.close{position:absolute;top:10px;right:12px;background:none;border:0;font-size:23px;line-height:1;color:var(--muted);padding:4px 10px;z-index:1}.message{padding:12px 14px;border-radius:8px;background:#eff8f2;color:#19683e}.error{background:#fff0ef;color:#a43328}.root[data-mode=page] .shell{margin:36px auto;height:auto;max-height:calc(100dvh - 72px);border-radius:calc(var(--r-card) + 6px);box-shadow:0 15px 60px #16324c12}.root[data-mode=panel]{background:var(--bg);--fs: 14px}.root[data-mode=panel] .shell{max-width:none}@media(max-width:520px){.root[data-mode=page] .shell{margin:0;border-radius:0;height:100dvh;max-height:none}}
|
|
4
|
+
`;var _o=new WeakMap;function yo(o){let n=o.ownerDocument,i=n.defaultView;if(i&&"adoptedStyleSheets"in i.Document.prototype&&"replaceSync"in i.CSSStyleSheet.prototype){let p=_o.get(n);p||(p=new i.CSSStyleSheet,p.replaceSync(nn),_o.set(n,p)),o.adoptedStyleSheets=[p];return}let r=n.createElement("style");r.textContent=nn,o.append(r)}var J=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Y=o=>o==null||typeof o=="string",_e=(o,n)=>o==null||Array.isArray(o)&&o.length<=1e3&&o.every(n),on=o=>_e(o,n=>typeof n=="string"),bo=o=>_e(o,n=>J(n)&&Y(n.data_item_name));function To(o,n){if(!J(o)||!Y(o.sections_language_code))return!1;let i=new Set(n.map(l=>l.id)),r=new Set,p=l=>J(l)&&["accept-all","reject-all","accept-necessary"].includes(l.button_type)&&Y(l.button_text)&&(l.button_enabled===void 0||typeof l.button_enabled=="boolean")&&(l.button_data==null||J(l.button_data)&&Y(l.button_data.accept_necessary_text)&&Y(l.button_data.accept_selected_text)),f=(l,m=0)=>{if(!J(l)||typeof l.section_type!="string"||!J(l.section_data))return!1;let u=l.section_data;return m<8&&Y(u.title)&&Y(u.section_title)&&Y(u.section_body)&&_e(u.buttons,p)&&_e(u.sections,A=>f(A,m+1))};return(o.content==null||J(o.content)&&_e(o.content.consent_data,l=>f(l)))&&_e(o.purposes,l=>J(l)&&Y(l.purpose_reason)&&Y(l.desc)&&_e(l.sub_items,m=>!J(m)||!i.has(m.purpose_id)||r.has(m.purpose_id)?!1:(r.add(m.purpose_id),Y(m.purpose_name)&&bo(m.data_items)&&on(m.data_categories))))&&_e(o.collected,l=>J(l)&&Y(l.data_category_name)&&Y(l.desc)&&on(l.sub_items))&&_e(o.shared,l=>J(l)&&Y(l.purpose_name)&&bo(l.data_items)&&on(l.data_categories))}var yt=class{constructor(n){this.options=n;this.syncChecks=()=>{};this.pendingKey="";this.pendingBody="";this.needsRefresh=!1;let i=n.host.attachShadow({mode:"open"});yo(i);let r=document.createElement("div");r.className="theme",r.lang=n.config.language_code,this.root=document.createElement("div"),this.root.className="root",this.root.dataset.mode=n.mode,r.append(this.root),i.append(r),this.appearance=zn(r),this.appearance.apply(n.appearance),this.state={choices:{...n.choices},busy:!1}}render(){let{config:n,mode:i,demo:r=!1,onClose:p}=this.options;try{if(!To(n.notice,n.purposes))throw new Error("Invalid notice");this.syncChecks=ho({root:this.root,config:n,state:this.state,mode:i,demo:r,onClose:p,onSubmit:()=>this.submit(),onChange:()=>{this.pendingKey=""}})}catch{let f="The consent form could not be displayed. Check the notice configuration and reload.",l=_("section",void 0,"shell"),m=_("p",f,"message error");m.setAttribute("role","alert");let u=_("div",void 0,"body");if(u.append(m),l.append(u),i!=="panel"){let A=_("button","\xD7","close");A.setAttribute("aria-label","Close consent form"),A.type="button",A.onclick=p,l.append(A)}this.root.replaceChildren(l),i!=="panel"&&!r&&l.querySelector("button")?.focus(),this.options.onError(new Ze(f,"form_error"))}}setAppearance(n){this.appearance.apply(n),this.render()}destroy(){this.appearance.destroy()}message(n,i=!1){let r=this.root.querySelector("#feedback");r&&(r.textContent=n,r.className=i?"message error":"message",r.setAttribute("role",i?"alert":"status"))}async submit(){let{state:n,root:i,options:r}=this;if(n.busy||this.needsRefresh)return;n.busy=!0;let p=[...i.querySelectorAll("input:not(:disabled)")];p.forEach(u=>u.disabled=!0),i.querySelectorAll("button:not(.close)").forEach(u=>u.disabled=!0);let f={config_version:r.config.config_version,language_code:r.config.language_code,answers:r.config.purposes.map(u=>({purpose_id:u.id,given:!!n.choices[String(u.id)]}))},l=JSON.stringify(f);(!this.pendingKey||this.pendingBody!==l)&&(this.pendingKey=kn(),this.pendingBody=l);let m;try{m=await r.save(f,this.pendingKey),n.choices=m.choices,this.message(r.demo?"Demo complete. No record was saved.":"Your choices are saved.")}catch(u){let A=u instanceof Error?u.message:"Your choices could not be saved. Please retry.";if(this.message(A,!0),u instanceof Ze&&u.code==="notice_changed"&&r.onRefresh){this.needsRefresh=!0;let S=_("button","Reload consent form");S.type="button",S.onclick=()=>void r.onRefresh().catch(()=>{}),i.querySelector("#feedback")?.append(S)}r.onError(u)}finally{n.busy=!1,i.querySelectorAll("button").forEach(u=>u.disabled=!1),p.forEach(u=>u.disabled=!1),this.syncChecks(),this.needsRefresh&&i.querySelectorAll(".actions button").forEach(u=>{u.disabled=!0})}m&&r.onComplete(m)}};function $r(o,n){let{config:i,mode:r="panel"}=n,p=o.ownerDocument.createElement("div");o.append(p);let f=new yt({host:p,config:i,choices:{},mode:r,appearance:n.appearance??i.appearance,demo:!0,save:l=>Promise.resolve({ref_id:"demo-no-record",app_id:i.app_id,level_id:i.level_id,config_version:i.config_version,choices:Object.fromEntries(l.answers.map(m=>[m.purpose_id,m.given]))}),onComplete:l=>n.onComplete?.(l),onError:l=>n.onError?.(l),onClose:()=>n.onClose?.()});return f.render(),{setAppearance:l=>f.setAppearance(l),destroy(){f.destroy(),p.remove()}}}export{$r as renderPreview};
|
|
5
|
+
/*! Bundled license information:
|
|
6
|
+
|
|
7
|
+
dompurify/dist/purify.es.mjs:
|
|
8
|
+
(*! @license DOMPurify 3.4.17 | (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.17/LICENSE *)
|
|
9
|
+
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
|
|
10
|
+
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dr(n,t){return cr(n)||lr(n,t)||ur(n,t)||pr()}function ur(n,t){if(n){if(typeof n=="string")return to(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)?to(n,t):void 0}}function vt(n){var t,o;function r(d,p){try{var f=n[d](p),u=f.value,_=u instanceof ar;Promise.resolve(_?u.v:u).then(function(S){if(_){var H=d==="return"&&u.k?d:"next";if(!u.k||S.done)return r(H,S);S=n[H](S).value}s(!!f.done,S)},function(S){r("throw",S)})}catch(S){s(2,S)}}function s(d,p){d===2?t.reject(p):t.resolve({value:p,done:d}),(t=t.next)?r(t.key,t.arg):o=null}this._invoke=function(d,p){return new Promise(function(f,u){var _={key:d,arg:p,resolve:f,reject:u,next:null};o?o=o.next=_:(t=o=_,r(d,p))})},typeof n.return!="function"&&(this.return=void 0)}vt.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},vt.prototype.next=function(n){return this._invoke("next",n)},vt.prototype.throw=function(n){return this._invoke("throw",n)},vt.prototype.return=function(n){return this._invoke("return",n)};var yo=Object.entries,no=Object.setPrototypeOf,fr=Object.isFrozen,_o=Object.getPrototypeOf,bo=Object.getOwnPropertyDescriptor,M=Object.freeze,U=Object.seal,Ge=Object.create,vo=typeof Reflect<"u"&&Reflect,pn=vo.apply,dn=vo.construct;M||(M=function(t){return t});U||(U=function(t){return t});pn||(pn=function(t,o){for(var r=arguments.length,s=new Array(r>2?r-2:0),d=2;d<r;d++)s[d-2]=arguments[d];return t.apply(o,s)});dn||(dn=function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),s=1;s<o;s++)r[s-1]=arguments[s];return new t(...r)});var ye=R(Array.prototype.forEach);Array.prototype.indexOf;var hr=R(Array.prototype.lastIndexOf),oo=R(Array.prototype.pop),et=R(Array.prototype.push),mr=R(Array.prototype.slice),gr=R(Array.prototype.splice),We=Array.isArray,en=To(Set),tn=R(Set.prototype.add),tt=R(Set.prototype.has),Ie=R(String.prototype.toLowerCase),nn=R(String.prototype.toString),ro=R(String.prototype.match),nt=R(String.prototype.replace),io=R(String.prototype.indexOf),yr=R(String.prototype.trim),_r=R(Number.prototype.toString),br=R(Boolean.prototype.toString),so=typeof BigInt>"u"?null:R(BigInt.prototype.toString),ao=typeof Symbol>"u"?null:R(Symbol.prototype.toString),q=R(Object.prototype.hasOwnProperty),ot=R(Object.prototype.toString),N=R(RegExp.prototype.test),_e=To(TypeError);function R(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,r=new Array(o>1?o-1:0),s=1;s<o;s++)r[s-1]=arguments[s];return pn(n,t,r)}}function To(n){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return dn(n,o)}}function T(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;if(no&&no(n,null),!We(t))return n;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){let d=o(s);d!==s&&(fr(t)||(t[r]=d),s=d)}n[s]=!0}return n}function vr(n){for(let t=0;t<n.length;t++)q(n,t)||(n[t]=null);return n}function K(n){let t=Ge(null);for(let r of yo(n)){var o=dr(r,2);let s=o[0],d=o[1];q(n,s)&&(We(d)?t[s]=vr(d):d&&typeof d=="object"&&d.constructor===Object?t[s]=K(d):t[s]=d)}return t}function Tr(n){switch(typeof n){case"string":return n;case"number":return _r(n);case"boolean":return br(n);case"bigint":return so?so(n):"0";case"symbol":return ao?ao(n):"Symbol()";case"undefined":return ot(n);case"function":case"object":{if(n===null)return ot(n);let t=n,o=J(t,"toString");if(typeof o=="function"){let r=o(t);return typeof r=="string"?r:ot(r)}return ot(n)}default:return ot(n)}}function J(n,t){for(;n!==null;){let r=bo(n,t);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}n=_o(n)}function o(){return null}return o}function Er(n,t){for(;n!==null;){let o=bo(n,t);if(o)return o.get?R(o.get):null;n=_o(n)}return null}function wr(n){try{return N(n,""),!0}catch{return!1}}var co=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"]),on=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"]),rn=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"]),Ar=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"]),sn=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"]),Sr=M(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),lo=M(["#text"]),po=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"]),an=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","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),uo=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"]),Tt=M(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xr=U(/{{[\w\W]*|^[\w\W]*}}/g),kr=U(/<%[\w\W]*|^[\w\W]*%>/g),Rr=U(/\${[\w\W]*/g),Cr=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Or=U(/^aria-[\-\w]+$/),fo=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lr=U(/^(?:\w+script|data):/i),Dr=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ir=U(/^html$/i),Pr=U(/^[a-z][.\w]*(-[.\w]+)+$/i),cn=U(/<[/\w!]/g),ho=U(/<[/\w]/g),Mr=U(/<\/no(script|embed|frames)/i),mo=U(/\/>/i),L={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Nr=M(T({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Ur=function(){return typeof window>"u"?null:window},Fr=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";o&&o.hasAttribute(s)&&(r=o.getAttribute(s));let d="dompurify"+(r?"#"+r:"");try{return t.createPolicy(d,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},go=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},xe=function(t,o,r,s){return q(t,o)&&We(t[o])?T(s.base?K(s.base):{},t[o],s.transform):r},ln=function(t,o,r){let s=q(t,o)?t[o]:void 0;return s&&typeof s=="object"?K(s):r()};function Eo(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ur(),t=l=>Eo(l);if(t.version="3.4.17",t.removed=[],!n||!n.document||n.document.nodeType!==L.document||!n.Element)return t.isSupported=!1,t;let o=n.document,r=o,s=r.currentScript;n.DocumentFragment;let d=n.HTMLTemplateElement,p=n.Node,f=n.Element,u=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let _=n.DOMParser,S=n.trustedTypes,H=f.prototype,ke=J(H,"cloneNode"),Y=J(H,"remove"),Pe=J(H,"removeAttributeNode"),ne=J(H,"nextSibling"),le=J(H,"childNodes"),pe=J(H,"parentNode"),de=J(H,"shadowRoot"),Me=J(H,"attributes"),Z=p&&p.prototype?J(p.prototype,"nodeType"):null,ue=p&&p.prototype?J(p.prototype,"nodeName"):null,ve=p&&p.prototype?J(p.prototype,"ownerDocument"):null,z=function(e){return Z?Z(e):e.nodeType},Te=function(e){return ue?ue(e):e.nodeName},$e=Er(H,"namespaceURI"),Ye=function(e){return $e?$e(e):e.namespaceURI};if(typeof d=="function"){let l=o.createElement("template");l.content&&l.content.ownerDocument&&(o=l.content.ownerDocument)}let F,fe="",Ve,h=!1,v=0,A=function(){if(v>0)throw _e('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.')},I=function(e){A(),v++;try{return F.createHTML(e)}finally{v--}},he=function(e){A(),v++;try{return F.createScriptURL(e)}finally{v--}},oe=function(){return h||(Ve=Fr(S,s),h=!0),Ve},C=o,V=C.implementation,Q=C.createNodeIterator,Ot=C.createDocumentFragment,it=C.getElementsByTagName,st=r.importNode,E=go();t.isSupported=typeof yo=="function"&&typeof pe=="function"&&V&&V.createHTMLDocument!==void 0;let me=xr,at=kr,P=Rr,re=Cr,Ee=Or,Ke=Lr,ie=Dr,ct=Pr,lt=fo,x=null,Lt=T({},[...co,...on,...rn,...sn,...lo]),k=null,Dt=T({},[...po,...an,...uo,...Tt]),se=Object.seal(Ge(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}})),Xe=null,bn=null,we=Object.seal(Ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),vn=!0,It=!0,Tn=!1,Pt=!0,ge=!1,Re=!0,Ce=!1,Mt=!1,pt=null,dt=null,Nt=!1,Ne=!1,ut=!1,ft=!1,En=!0,wn=!1,An="user-content-",Ut=!0,Ft=!1,Oe=null,Ue={},Le=null,Sn=T({},["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"]),xn=null,kn=T({},["audio","video","img","source","image","track"]),Rn=null,Cn=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",Fe=ae,Ht=!1,zt=null,zo=T({},[ht,mt,ae],nn),On=M(["mi","mo","mn","ms","mtext"]),Bt=T({},On),Ln=M(["annotation-xml"]),jt=T({},Ln),Bo=T({},["title","style","font","a","script"]),Je=null,jo=["application/xhtml+xml","text/html"],Go="text/html",O=null,He=null,Wo=o.createElement("form"),Dn=function(e){return e instanceof RegExp||e instanceof Function},Gt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===e)return;(!e||typeof e!="object")&&(e={}),e=K(e),Je=jo.indexOf(e.PARSER_MEDIA_TYPE)===-1?Go:e.PARSER_MEDIA_TYPE,O=Je==="application/xhtml+xml"?nn:Ie,x=xe(e,"ALLOWED_TAGS",Lt,{transform:O}),k=xe(e,"ALLOWED_ATTR",Dt,{transform:O}),zt=xe(e,"ALLOWED_NAMESPACES",zo,{transform:nn}),Rn=xe(e,"ADD_URI_SAFE_ATTR",Cn,{transform:O,base:Cn}),xn=xe(e,"ADD_DATA_URI_TAGS",kn,{transform:O,base:kn}),Le=xe(e,"FORBID_CONTENTS",Sn,{transform:O}),Xe=xe(e,"FORBID_TAGS",K({}),{transform:O}),bn=xe(e,"FORBID_ATTR",K({}),{transform:O}),Ue=q(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?K(e.USE_PROFILES):e.USE_PROFILES:!1,vn=e.ALLOW_ARIA_ATTR!==!1,It=e.ALLOW_DATA_ATTR!==!1,Tn=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=e.SAFE_FOR_TEMPLATES||!1,Re=e.SAFE_FOR_XML!==!1,Ce=e.WHOLE_DOCUMENT||!1,Ne=e.RETURN_DOM||!1,ut=e.RETURN_DOM_FRAGMENT||!1,ft=e.RETURN_TRUSTED_TYPE||!1,Nt=e.FORCE_BODY||!1,En=e.SANITIZE_DOM!==!1,wn=e.SANITIZE_NAMED_PROPS||!1,Ut=e.KEEP_CONTENT!==!1,Ft=e.IN_PLACE||!1,lt=wr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:fo,Fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:ae,Bt=ln(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>T({},On)),jt=ln(e,"HTML_INTEGRATION_POINTS",()=>T({},Ln));let i=ln(e,"CUSTOM_ELEMENT_HANDLING",()=>Ge(null));if(se=Ge(null),q(i,"tagNameCheck")&&Dn(i.tagNameCheck)&&(se.tagNameCheck=i.tagNameCheck),q(i,"attributeNameCheck")&&Dn(i.attributeNameCheck)&&(se.attributeNameCheck=i.attributeNameCheck),q(i,"allowCustomizedBuiltInElements")&&typeof i.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),U(se),ge&&(It=!1),ut&&(Ne=!0),Ue&&(x=T({},lo),k=Ge(null),Ue.html===!0&&(T(x,co),T(k,po)),Ue.svg===!0&&(T(x,on),T(k,an),T(k,Tt)),Ue.svgFilters===!0&&(T(x,rn),T(k,an),T(k,Tt)),Ue.mathMl===!0&&(T(x,sn),T(k,uo),T(k,Tt))),we.tagCheck=null,we.attributeCheck=null,q(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?we.tagCheck=e.ADD_TAGS:We(e.ADD_TAGS)&&(x===Lt&&(x=K(x)),T(x,e.ADD_TAGS,O))),q(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?we.attributeCheck=e.ADD_ATTR:We(e.ADD_ATTR)&&(k===Dt&&(k=K(k)),T(k,e.ADD_ATTR,O))),q(e,"ADD_FORBID_CONTENTS")&&We(e.ADD_FORBID_CONTENTS)&&(Le===Sn&&(Le=K(Le)),T(Le,e.ADD_FORBID_CONTENTS,O)),Ut&&(x["#text"]=!0),Ce&&T(x,["html","head","body"]),x.table&&(T(x,["tbody"]),delete Xe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=F;F=e.TRUSTED_TYPES_POLICY;try{fe=I("")}catch(c){throw F=a,c}}else e.TRUSTED_TYPES_POLICY===null?(F=void 0,fe=""):(F===void 0&&(F=oe()),F&&typeof fe=="string"&&(fe=I("")));M&&M(e),He=e},In=T({},[...on,...rn,...Ar]),Pn=T({},[...sn,...Sr]),qo=function(e,i,a){return i.namespaceURI===ae?e==="svg":i.namespaceURI===ht?e==="svg"&&(a==="annotation-xml"||Bt[a]):!!In[e]},$o=function(e,i,a){return i.namespaceURI===ae?e==="math":i.namespaceURI===mt?e==="math"&&jt[a]:!!Pn[e]},Yo=function(e,i,a){return i.namespaceURI===mt&&!jt[a]||i.namespaceURI===ht&&!Bt[a]?!1:!Pn[e]&&(Bo[e]||!In[e])},Vo=function(e){let i=Ye(e),a=Ie(Te(e)),c=pe(e),m,g;return c&&z(c)===L.element?(m={namespaceURI:Ye(c)},g=Ie(Te(c))):(m={namespaceURI:Fe},g="template"),zt[i]?i===mt?qo(a,m,g):i===ht?$o(a,m,g):i===ae?Yo(a,m,g):!!(Je==="application/xhtml+xml"&&zt[i]):!1},Ae=function(e){et(t.removed,{element:e});try{pe(e).removeChild(e)}catch{if(Y(e),!pe(e))throw _e("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Mn=function(e,i,a){try{Pe(e,i)}catch{try{e.removeAttribute(a)}catch{}}},Wt=function(e){$t(e);let i=le(e);i&&ye(mr(i),c=>{try{Y(c)}catch{}});let a=z(e)===L.element?Me(e):null;if(a)for(let c=a.length-1;c>=0;--c){let m=a[c],g=m&&m.name;typeof g=="string"&&Mn(e,m,g)}},ze=function(e,i,a){if(!a)try{a=i.getAttributeNode(e)}catch{a=null}et(t.removed,{attribute:a||null,from:i});try{a?Pe(i,a):i.removeAttribute(e)}catch{try{i.removeAttribute(e)}catch{}}if(e==="is")if(Ne||ut)try{Ae(i)}catch{}else try{i.setAttribute(e,"")}catch{}},Nn=function(e){let i=Me(e);if(i)for(let a=i.length-1;a>=0;--a){let c=i[a],m=c&&c.name;typeof m!="string"||k[O(m)]||Mn(e,c,m)}},qt=function(e,i){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=[e];for(;c.length>0;){let m=c.pop();if(i(m)===!1)continue;if(a&&z(m)===L.element){let b=de(m);Se(b)&&c.push(b)}let g=le(m);if(g)for(let b=g.length-1;b>=0;--b)c.push(g[b])}},$t=function(e){qt(e,i=>{z(i)===L.element&&Nn(i)})},Yt=function(e){let i=[];return qt(e,a=>{i.push(a)},!0),i},Ko=function(e,i){let a=en();ye(Yt(e),c=>{z(c)===L.element&&tn(a,c)}),ye(i,c=>{z(c)===L.element&&!tt(a,c)&&Nn(c)})},Un=function(e,i){let a=!1;return ye(t.removed,c=>{c.element&&(a=a||c.element===e,$t(c.element))}),Ko(e,i),a},Xo=8,Jo=function(e,i){let a=Oe,c=null,m=()=>(c||(c=en(),ye(i,g=>{tn(c,g)})),c);for(let g=0;;g++){let b=Yt(e),D=[e],ce=!1;if(ye(b,B=>{z(B)===L.documentFragment?et(D,B):!ce&&!tt(a,B)&&(ce=tt(m(),B))}),!ce)return;if(g>=Xo)throw _e("the tree kept changing during in-place sanitization; refusing to return it");ye(D,(B,G)=>{Zo(B,G>0,e,m())})}},Zo=function(e,i,a,c){let m=Vt(e),g;for(;g=m.nextNode();)!tt(c,g)||tt(Oe,g)||(i&&ee(E.uponSanitizeShadowNode,g,null),Xt(g,a),Jt(g,a),Se(g.content)&&Qe(g.content))},Qo=function(e){Oe&&tn(Oe,e)},Fn=function(e,i){return Re?e==="patchsrc"?!0:e==="for"&&i!=="label"&&i!=="output":!1},er=function(e){Re&&qt(e,i=>{let a=z(i);if(a===L.processingInstruction||a===L.comment&&N(ho,i.data)){try{Y(i)}catch{}return!1}if(a===L.element){let c=i,m=O(Te(i));try{c.hasAttribute&&c.hasAttribute("patchsrc")&&c.removeAttribute("patchsrc"),c.hasAttribute&&c.hasAttribute("for")&&Fn("for",m)&&c.removeAttribute("for")}catch{}}return!0})},Hn=function(e){let i=null,a=null;if(Nt)e="<remove></remove>"+e;else{let g=ro(e,/^[\r\n\t ]+/);a=g&&g[0]}Je==="application/xhtml+xml"&&Fe===ae&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let c=F?I(e):e;if(Fe===ae)try{i=new _().parseFromString(c,Je)}catch{}if(!i||!i.documentElement){i=V.createDocument(Fe,"template",null);try{i.documentElement.innerHTML=Ht?fe:c}catch{}}let m=i.body||i.documentElement;return e&&a&&m.insertBefore(o.createTextNode(a),m.childNodes[0]||null),Fe===ae?it.call(i,Ce?"html":"body")[0]:Ce?i.documentElement:m},Vt=function(e){let i=ve?ve(e):e.ownerDocument;return Q.call(i||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},gt=function(e){return e=nt(e,me," "),e=nt(e,at," "),e=nt(e,P," "),e},Kt=function(e){var i;zn(e);let a=(i=e.querySelectorAll)===null||i===void 0?void 0:i.call(e,"template");a&&ye(a,c=>{Se(c.content)&&Kt(c.content)})},zn=function(e){e.normalize();let i=ve?ve(e):e.ownerDocument,a=Q.call(i||e,e,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),c=a.nextNode();for(;c;)c.data=gt(c.data),c=a.nextNode()},yt=function(e){let i=ue?ue(e):null;return typeof i!="string"||O(i)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Me(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==Z(e)||e.childNodes!==le(e)},Se=function(e){if(!Z||typeof e!="object"||e===null)return!1;try{return Z(e)===L.documentFragment}catch{return!1}},Ze=function(e){if(!Z||typeof e!="object"||e===null)return!1;try{return typeof Z(e)=="number"}catch{return!1}};function ee(l,e,i){l.length!==0&&ye(l,a=>{a.call(t,e,i,He)})}let tr=function(e,i){return!!(Re&&e.hasChildNodes()&&!Ze(e.firstElementChild)&&N(cn,e.textContent)&&N(cn,e.innerHTML)||Re&&Nr[i]&&z(e)===L.element&&Ye(e)===ae&&(Ze(e.firstElementChild)||typeof e.textContent=="string"&&N(cn,e.textContent))||e.nodeType===L.processingInstruction||Re&&e.nodeType===L.comment&&N(ho,e.data))},_t=function(e,i){if(e instanceof RegExp)return N(e,i);if(e instanceof Function){for(var a=arguments.length,c=new Array(a>2?a-2:0),m=2;m<a;m++)c[m-2]=arguments[m];return!!e(i,...c)}return!1},nr=function(e,i,a){if(!Xe[i]&&Gn(i)&&_t(se.tagNameCheck,i))return!1;if(Ut&&!Le[i]&&!Le[Ie(i)]){let c=pe(e),m=le(e);if(m&&c){let g=m.length;for(let b=g-1;b>=0;--b){let D=e===a?ke(m[b],!0):m[b];c.insertBefore(D,ne(e))}}}return Ae(e),!0},Bn=function(e,i,a,c){return e.length===0?i:i===a||i===c?K(i):i},Be=function(e,i){return e===i||pe(e)!==null?!1:(Ft&&$t(e),!0)},Xt=function(e,i){if(Qo(e),ee(E.beforeSanitizeElements,e,null),Be(e,i))return!0;if(yt(e))return Ae(e),!0;let a=O(Te(e));if(x=Bn(E.uponSanitizeElement,x,Lt,pt),ee(E.uponSanitizeElement,e,{tagName:a,allowedTags:x}),Be(e,i))return!0;if(tr(e,a))return Ae(e),!0;if(Xe[a]||!(we.tagCheck instanceof Function&&we.tagCheck(a))&&!x[a]){let c=nr(e,a,i);return c===!1&&(ee(E.afterSanitizeElements,e,null),Be(e,i))?!0:c}if(z(e)===L.element&&!Vo(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&N(Mr,e.innerHTML))return Ae(e),!0;if(ge&&e.nodeType===L.text){let c=gt(e.textContent);e.textContent!==c&&(et(t.removed,{element:e.cloneNode()}),e.textContent=c)}return ee(E.afterSanitizeElements,e,null),Be(e,i)},jn=function(e,i,a){if(bn[i]||Fn(i,e)||En&&(i==="id"||i==="name")&&(a in o||a in Wo))return!1;let c=k[i]||we.attributeCheck instanceof Function&&we.attributeCheck(i,e);return It&&N(re,i)||vn&&N(Ee,i)?!0:c?Rn[i]||N(lt,nt(a,ie,""))||(i==="src"||i==="xlink:href"||i==="href")&&e!=="script"&&io(a,"data:")===0&&xn[e]||Tn&&!N(Ke,nt(a,ie,""))?!0:!a:Gn(e)&&_t(se.tagNameCheck,e)&&_t(se.attributeNameCheck,i,e)||i==="is"&&se.allowCustomizedBuiltInElements&&_t(se.tagNameCheck,a)},or=T({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Gn=function(e){return!or[Ie(e)]&&N(ct,e)},rr=function(e,i,a,c){if(F&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!a)switch(S.getAttributeType(e,i)){case"TrustedHTML":return I(c);case"TrustedScriptURL":return he(c)}return c},ir=function(e,i,a,c){try{return a?e.setAttributeNS(a,i,c):e.setAttribute(i,c),yt(e)?(Ae(e),!1):!0}catch{return ze(i,e),!1}},Wn=function(e,i){return Re&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,i)?!0:Ie(e)==="attributename"&&ro(i,"href")!==null},Jt=function(e,i){if(ee(E.beforeSanitizeAttributes,e,null),Be(e,i))return;let a=e.attributes;if(!a||yt(e))return;k=Bn(E.uponSanitizeAttribute,k,Dt,dt);let c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0},m=a.length,g=O(e.nodeName);for(;m--;){let b=a[m],D=b.name,ce=b.namespaceURI,B=b.value,G=O(D),je=B,W=D==="value"?je:yr(je),qn=!1;if(c.attrName=G,c.attrValue=W,c.keepAttr=!0,c.forceKeepAttr=void 0,ee(E.uponSanitizeAttribute,e,c),W=c.attrValue,wn&&(G==="id"||G==="name")&&io(W,An)!==0&&(ze(D,e,b),W=An+W,qn=!0),Wn(D,W)){ze(D,e,b);continue}if(!c.forceKeepAttr){if(!c.keepAttr){ze(D,e,b);continue}if(!Pt&&N(mo,W)){ze(D,e,b);continue}if(ge&&(W=gt(W)),!jn(g,G,W)){ze(D,e,b);continue}W=rr(g,G,ce,W),W!==je&&ir(e,D,ce,W)&&qn&&oo(t.removed)}}ee(E.afterSanitizeAttributes,e,null),Be(e,i)},Qe=function(e){let i=null,a=Vt(e);for(ee(E.beforeSanitizeShadowDOM,e,null);i=a.nextNode();)if(ee(E.uponSanitizeShadowNode,i,null),Xt(i,e),Jt(i,e),Se(i.content)&&Qe(i.content),z(i)===L.element){let c=de(i);Se(c)&&(Zt(c),Qe(c))}ge&&zn(e),ee(E.afterSanitizeShadowDOM,e,null)},Zt=function(e){let i=[{node:e,shadow:null}];for(;i.length>0;){let a=i.pop();if(a.shadow){Qe(a.shadow);continue}let c=a.node,m=z(c)===L.element,g=le(c);if(g)for(let b=g.length-1;b>=0;--b)i.push({node:g[b],shadow:null});if(m){let b=ue?ue(c):null;if(typeof b=="string"&&O(b)==="template"){let D=c.content;Se(D)&&i.push({node:D,shadow:null})}}if(m){let b=de(c);Se(b)&&i.push({node:null,shadow:b},{node:b,shadow:null})}}};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,c=null,m=null;if(Ht=!l,Ht&&(l="<!-->"),typeof l!="string"&&!Ze(l)&&(l=Tr(l),typeof l!="string"))throw _e("dirty is not a string, aborting");if(!t.isSupported)return l;Mt?(x=pt,k=dt):Gt(e),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(x=K(x)),E.uponSanitizeAttribute.length>0&&(k=K(k)),t.removed=[];let g=Ft&&typeof l!="string"&&Ze(l),b=[],D=Oe;if(g){er(l);let G=Te(l);if(typeof G=="string"){let je=O(G);if(!x[je]||Xe[je])throw Wt(l),_e("root node is forbidden and cannot be sanitized in-place")}if(yt(l))throw Wt(l),_e("root node is clobbered and cannot be sanitized in-place");b=Yt(l),Oe=en()}else if(Ze(l))i=Hn("<!---->"),a=i.ownerDocument.importNode(l,!0),a.nodeType===L.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?i=a:i.appendChild(a),Zt(i);else{if(!Ne&&!ge&&!Ce&&l.indexOf("<")===-1)return F&&ft?I(l):l;if(i=Hn(l),!i)return Ne?null:ft?fe:""}i&&Nt&&Ae(i.firstChild);let ce=g?l:i;try{g&&Zt(l);let G=Vt(ce);for(;c=G.nextNode();)Xt(c,ce),Jt(c,ce),Se(c.content)&&Qe(c.content);g&&Jo(l,b)}catch(G){throw g&&(Wt(l),Un(l,b)),G}finally{Oe=D}if(g){if(Un(l,b))throw _e("a node selected for removal could not be safely returned; refusing to sanitize in place");return ge&&Kt(l),l}if(Ne){if(ge&&Kt(i),ut)for(m=Ot.call(i.ownerDocument);i.firstChild;)m.appendChild(i.firstChild);else m=i;return(k.shadowroot||k.shadowrootmode)&&(m=st.call(r,m,!0)),m}let B=Ce?i.outerHTML:i.innerHTML;return Ce&&x["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&N(Ir,i.ownerDocument.doctype.name)&&(B="<!DOCTYPE "+i.ownerDocument.doctype.name+`>
|
|
3
|
-
`+B),ge&&(B=gt(B)),F&&ft?I(B):B},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gt(l),Mt=!0,pt=x,dt=k},t.clearConfig=function(){He=null,Mt=!1,pt=null,dt=null,F=Ve,fe=""},t.isValidAttribute=function(l,e,i){He||Gt({});let a=O(l),c=O(e);return typeof i=="string"&&(Wn(e,i)||!Pt&&N(mo,i))?!1:jn(a,c,i)},t.addHook=function(l,e){typeof e=="function"&&q(E,l)&&et(E[l],e)},t.removeHook=function(l,e){if(q(E,l)){if(e!==void 0){let i=hr(E[l],e);return i===-1?void 0:gr(E[l],i,1)[0]}return oo(E[l])}},t.removeHooks=function(l){q(E,l)&&(E[l]=[])},t.removeAllHooks=function(){E=go()},t}var wo=Eo();function y(n,t,o){let r=document.createElement(n);return t&&(r.textContent=t),o&&(r.className=o),r}function j(n){return typeof n!="string"?"":(ko(n).textContent||"").trim()}var So=new Set(["A","B","BLOCKQUOTE","BR","CODE","EM","I","LI","OL","P","PRE","STRONG","U","UL"]),xo=new Set(["H1","H2","H3","H4","H5","H6"]),Ao;function ko(n){return Ao??(Ao=wo(window)),Ao.sanitize(n,{ALLOWED_TAGS:[...So,...xo].map(t=>t.toLowerCase()),ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,RETURN_DOM_FRAGMENT:!0})}function Ro(n){let t=document.createDocumentFragment();if(typeof n!="string")return t;let o=(r,s)=>{for(let d of Array.from(r.childNodes)){if(d.nodeType===Node.TEXT_NODE){s.appendChild(document.createTextNode(d.textContent||""));continue}if(!(d instanceof Element))continue;let p=d.tagName;if(xo.has(p)){let f=document.createElement("p"),u=document.createElement("strong");f.appendChild(u),o(d,u),s.appendChild(f)}else if(So.has(p)){let f=document.createElement(p.toLowerCase());if(p==="A"){let u=d.getAttribute("href")||"";/^(https?:|mailto:)/i.test(u.trim())&&(f.setAttribute("href",u.trim()),f.setAttribute("target","_blank"),f.setAttribute("rel","noopener noreferrer nofollow"))}o(d,f),s.appendChild(f)}else["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"].includes(p)||o(d,s)}};return o(ko(n),t),t}var un=4,Co="http://www.w3.org/2000/svg";function Hr(){let n=document.createElementNS(Co,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("class","chev"),n.setAttribute("aria-hidden","true");let t=document.createElementNS(Co,"path");return t.setAttribute("d","M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"),n.append(t),n}function fn(n,t){let o=(n||[]).map(u=>j(u.data_item_name)).filter(Boolean);if(!o.length){let u=(t||[]).map(j).filter(Boolean).join(" \xB7 ");return u?y("div",u,"ps"):null}let r=y("div",void 0,"ps"),s=document.createTextNode("");r.append(s);let d=!1,p=()=>{s.data=(d?o:o.slice(0,un)).join(", "),f.textContent=d?"show less":`+${o.length-un} more`},f=y("button",void 0,"more");return f.type="button",f.onclick=()=>{d=!d,p()},p(),o.length>un&&r.append(f),r}function Oo(n,t,o){let r=y("div",void 0,"grp"),s=y("button",void 0,"gh");s.type="button",s.setAttribute("aria-expanded","false");let d=y("span",void 0,"gx");d.append(y("span",n,"gt")),t&&d.append(y("span",t,"gd")),s.append(d,Hr()),s.onclick=()=>{let f=!r.classList.contains("open");r.classList.toggle("open",f),s.setAttribute("aria-expanded",String(f))};let p=y("div",void 0,"gb");return o.forEach(f=>p.append(y("span",f,"gi"))),r.append(s,p),r}function hn(n){if(!j(n))return null;let t=y("div",void 0,"text");return t.append(Ro(n)),t}function Lo({root:n,config:t,state:o,mode:r,demo:s,onClose:d,onSubmit:p,onChange:f}){n.replaceChildren();for(let h of t.purposes)h.required&&(o.choices[String(h.id)]=!0);let u=t.notice||{},_=[...u.purposes||[]],S=new Set(_.flatMap(h=>(h.sub_items||[]).map(v=>v.purpose_id))),H=t.purposes.filter(h=>!S.has(h.id));H.length&&_.push({purpose_reason:_.length?"Other purposes":"Purposes",sub_items:H.map(h=>({purpose_id:h.id,purpose_name:h.name}))});let ke=u.content?.consent_data?.find(h=>h.section_type==="initial-section")?.section_data,Y=y("section",void 0,"shell"),Pe=y("div",void 0,"body");if(r!=="panel"){let h=y("button","\xD7","close");h.type="button",h.setAttribute("aria-label","Close consent form"),h.onclick=()=>d(),Y.append(h)}Pe.append(y("h1",j(ke?.title)||t.name||"Your consent preferences"));let ne=y("form",void 0,"sec");ne.id="consent-form",ne.style.padding="0",ne.style.gap="16px";let le=new Map,pe=[],de=()=>{le.forEach((h,v)=>{h.forEach(A=>A.checked=!!o.choices[String(v)])}),pe.forEach(h=>{h.box.checked=h.ids.every(v=>!!o.choices[String(v)])}),fe()},Me=(h,v)=>{if(o.busy){de();return}for(let A of h)t.purposes.find(I=>I.id===A)?.required||(o.choices[String(A)]=v);f(),de()},Z=ke?.sections?.length?[...ke.sections]:[{section_type:"data_process_section",section_data:{section_title:"How we use it"}}];Z.some(h=>h.section_type==="data_process_section")||Z.push({section_type:"data_process_section",section_data:{section_title:"Purposes"}});let ue=u.sections_language_code&&u.sections_language_code!==t.language_code?u.sections_language_code:void 0;for(let h of Z){let v=h.section_data,A=h.section_type;if(A==="link_section")continue;let I=y("div",void 0,"sec");if(A==="generic_section"){let C=hn(v.section_body);C&&I.append(C),ne.append(I);continue}v.section_title&&I.append(y("p",j(v.section_title),"st"));let he=hn(v.section_body);he&&I.append(he);let oe=y("div",void 0,"grps");if(ue&&(oe.lang=ue),A==="data_collect_section")for(let C of u.collected||[]){let V=C.sub_items||[];oe.append(Oo(`${j(C.data_category_name)||"Data"} (${V.length})`,j(C.desc),V.map(j)))}else if(A==="data_process_section")for(let C of _){let V=C.sub_items||[],Q=V.map(P=>P.purpose_id),Ot=Q.length>0&&Q.every(P=>t.purposes.find(re=>re.id===P)?.required);for(let P of Q){let re=!!t.purposes.find(Ee=>Ee.id===P)?.required;o.choices[String(P)]=re||!!o.choices[String(P)]}let it=y("div",void 0,"grp pg"),st=y("div",void 0,"ph"),E=y("span",void 0,"gx");E.append(y("span",j(C.purpose_reason)||"Purposes","gt")),C.desc&&E.append(y("span",j(C.desc),"gd"));let me=y("input");me.type="checkbox",me.disabled=Ot,me.setAttribute("aria-label",`Select all: ${C.purpose_reason||"purposes"}`),me.onchange=()=>Me(Q,me.checked),pe.push({box:me,ids:Q}),st.append(E,me);let at=y("div",void 0,"pb");for(let P of V){let re=t.purposes.find(lt=>lt.id===P.purpose_id),Ee=y("div",void 0,"pr"),Ke=y("label",void 0,"prh");Ke.append(y("span",j(P.purpose_name||re?.name),"pn"));let ie=y("input");ie.type="checkbox",ie.name=String(P.purpose_id),ie.disabled=!!re?.required,ie.onchange=()=>Me([P.purpose_id],ie.checked),le.set(P.purpose_id,[...le.get(P.purpose_id)||[],ie]),Ke.append(ie),Ee.append(Ke),re?.description&&Ee.append(y("p",j(re.description),"ps"));let ct=fn(P.data_items,P.data_categories);ct&&Ee.append(ct),at.append(Ee)}it.append(st,y("hr",void 0,"hr"),at),oe.append(it)}else if(A==="data_share_section"){for(let C of u.shared||[]){let V=y("div",void 0,"sh");V.append(y("span",j(C.purpose_name)||"Sharing","gt"));let Q=fn(C.data_items,C.data_categories);Q&&V.append(Q),oe.append(V)}oe.childElementCount||oe.append(y("p","NIL","st"))}oe.childElementCount&&I.append(oe),ne.append(I)}de();let ve=y("div");ve.id="feedback",ve.setAttribute("aria-live","polite"),ne.append(ve),ne.onsubmit=h=>{h.preventDefault(),p()},Pe.append(ne),Y.append(Pe);let z=ke?.buttons?.length?ke.buttons:[{button_type:"accept-all",button_text:"Accept All",button_enabled:!0},{button_type:"reject-all",button_text:"Reject All",button_enabled:!0},{button_type:"accept-necessary",button_enabled:!0,button_data:{accept_necessary_text:"Accept Necessary",accept_selected_text:"Accept Selected"}}],Te=y("div",void 0,"foot"),$e=y("div",void 0,"actions"),Ye=h=>{h==="accept-all"?t.purposes.forEach(v=>o.choices[String(v.id)]=!0):h==="reject-all"&&t.purposes.forEach(v=>o.choices[String(v.id)]=v.required),p()},F=[...z.filter(h=>h.button_type!=="accept-necessary"),...z.filter(h=>h.button_type==="accept-necessary")];for(let h of F){if(h.button_enabled===!1)continue;let v=h.button_type==="accept-necessary",A=y("button",void 0,v?"primary":void 0);A.type="button",A.dataset.type=h.button_type,A.textContent=v?h.button_data?.accept_necessary_text||"Accept Necessary":h.button_text||h.button_type,A.onclick=()=>Ye(h.button_type),v&&(A.dataset.necessary=h.button_data?.accept_necessary_text||"Accept Necessary",A.dataset.selected=h.button_data?.accept_selected_text||"Accept Selected"),$e.append(A)}return Te.append($e),Y.append(Te),n.append(Y),de(),(r==="popup"||r==="page")&&Y.addEventListener("keydown",Ve),r!=="panel"&&!s&&(Y.tabIndex=-1,Y.focus({preventScroll:!0})),de;function fe(){let h=n.querySelector("button.primary");if(!h?.dataset.necessary)return;let v=t.purposes.some(A=>!A.required&&o.choices[String(A.id)]);h.textContent=v?h.dataset.selected:h.dataset.necessary}function Ve(h){if(h.key==="Escape"){d();return}if(h.key!=="Tab")return;let v=[...n.querySelectorAll("button:not([disabled]),input:not([disabled]),summary,a[href]")],A=v[0],I=v[v.length-1],he=n.getRootNode().activeElement;h.shiftKey&&(he===A||he===Y)?(h.preventDefault(),I?.focus()):!h.shiftKey&&(he===I||he===Y)&&(h.preventDefault(),A?.focus())}}var mn=`*{box-sizing:border-box}:host{all:initial;display:block}.theme,.root{height:100%}.root{background:var(--page);color:var(--text);font:var(--fs)/1.5 var(--font)}button,input{font:inherit;color:inherit}button{cursor:pointer}button:disabled{cursor:wait;opacity:.65}button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid var(--primary);outline-offset:2px}.shell:focus{outline:none}.shell{max-width:560px;margin:auto;background:var(--bg);height:100%;display:flex;flex-direction:column;position:relative}.body{flex:1;min-height:0;overflow:auto;padding:var(--pad) var(--pad) 8px;display:flex;flex-direction:column;gap:var(--gap)}h1{font-size:calc(var(--fs) + 2px);line-height:1.4;font-weight:700;margin:0}.sec{display:flex;flex-direction:column;gap:calc(var(--gap) * .5);padding-bottom:var(--gap)}.st{font-weight:700;margin:0}.text{margin:0;white-space:pre-wrap}.text :is(p,ul,ol,pre,blockquote){margin:0 0 .5em}.text>:last-child{margin-bottom:0}.text a{color:var(--primary)}.grps{display:flex;flex-direction:column;gap:calc(var(--gap) * .6)}.grp{border:1.2px solid var(--line);border-radius:var(--r-card)}.gh{display:flex;width:100%;gap:12px;align-items:center;padding:var(--rowy) var(--rowx);background:none;border:0;text-align:left}.gx{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}.gt{font-weight:600}.gd{font-size:12px;font-weight:400;color:var(--muted);display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}@media(min-width:480px){.gd{-webkit-line-clamp:2}}.chev{flex-shrink:0;width:1.25em;height:1.25em;fill:currentColor;transition:transform .2s ease}.open .chev{transform:rotate(180deg)}.gb{display:none;flex-direction:column;gap:4px;padding:0 var(--rowx) var(--rowx)}.open .gb{display:flex}.gi{font-size:16px;font-weight:800}.pg{display:flex;flex-direction:column}.ph{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:var(--rowy) var(--rowx)}.hr{border:0;border-top:1px solid var(--line);margin:0}.pb{display:flex;flex-direction:column;padding:var(--rowy) var(--rowx)}.pr{display:flex;flex-direction:column;gap:2px;padding:4px 0}.prh{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:28px;cursor:pointer}.pn{font-size:15px;font-weight:800;min-width:0;flex:1}.ps{font-size:12px;font-weight:400;color:var(--muted);padding-right:32px}.more{background:none;border:0;padding:0;margin-left:4px;color:var(--muted);text-decoration:underline;font-size:12px}.pg input[type=checkbox]{width:16px;height:16px;margin:0;flex-shrink:0;accent-color:var(--primary)}.sh{display:flex;flex-direction:column;gap:2px;border:1.2px solid var(--line);border-radius:var(--r-card);padding:8px 16px}.foot{position:relative;flex-shrink:0;padding:0 var(--pad) var(--pad)}.foot:before{content:"";position:absolute;left:0;right:0;top:-50px;height:50px;background:linear-gradient(to top,var(--bg),var(--bg),transparent);pointer-events:none}.actions{display:flex;flex-direction:column;gap:calc(var(--gap) * .4)}.actions button{min-height:calc(var(--btn) - 8px);padding:0 16px;border-radius:var(--r-btn);border:1px solid var(--text);background:transparent;color:var(--text);font-weight:600;width:100%}.actions button:hover:not(:disabled){background:color-mix(in srgb,var(--text) 8%,transparent)}.actions .primary{min-height:var(--btn);background:var(--primary);border-color:var(--primary);color:var(--on-primary)}.actions .primary:hover:not(:disabled){background:var(--primary);filter:brightness(.92)}.close{position:absolute;top:10px;right:12px;background:none;border:0;font-size:23px;line-height:1;color:var(--muted);padding:4px 10px;z-index:1}.message{padding:12px 14px;border-radius:8px;background:#eff8f2;color:#19683e}.error{background:#fff0ef;color:#a43328}.root[data-mode=page] .shell{margin:36px auto;height:auto;max-height:calc(100dvh - 72px);border-radius:calc(var(--r-card) + 6px);box-shadow:0 15px 60px #16324c12}.root[data-mode=panel]{background:var(--bg);--fs: 14px}.root[data-mode=panel] .shell{max-width:none}@media(max-width:520px){.root[data-mode=page] .shell{margin:0;border-radius:0;height:100dvh;max-height:none}}
|
|
4
|
-
`;var Et;function Do(n){if("adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype){Et||(Et=new CSSStyleSheet,Et.replaceSync(mn)),n.adoptedStyleSheets=[Et];return}let t=document.createElement("style");t.textContent=mn,n.append(t)}var te=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),$=n=>n==null||typeof n=="string",be=(n,t)=>n==null||Array.isArray(n)&&n.length<=1e3&&n.every(t),gn=n=>be(n,t=>typeof t=="string"),Io=n=>be(n,t=>te(t)&&$(t.data_item_name));function wt(n,t){if(!te(n)||!$(n.sections_language_code))return!1;let o=new Set(t.map(p=>p.id)),r=new Set,s=p=>te(p)&&["accept-all","reject-all","accept-necessary"].includes(p.button_type)&&$(p.button_text)&&(p.button_enabled===void 0||typeof p.button_enabled=="boolean")&&(p.button_data==null||te(p.button_data)&&$(p.button_data.accept_necessary_text)&&$(p.button_data.accept_selected_text)),d=(p,f=0)=>{if(!te(p)||typeof p.section_type!="string"||!te(p.section_data))return!1;let u=p.section_data;return f<8&&$(u.title)&&$(u.section_title)&&$(u.section_body)&&be(u.buttons,s)&&be(u.sections,_=>d(_,f+1))};return(n.content==null||te(n.content)&&be(n.content.consent_data,p=>d(p)))&&be(n.purposes,p=>te(p)&&$(p.purpose_reason)&&$(p.desc)&&be(p.sub_items,f=>!te(f)||!o.has(f.purpose_id)||r.has(f.purpose_id)?!1:(r.add(f.purpose_id),$(f.purpose_name)&&Io(f.data_items)&&gn(f.data_categories))))&&be(n.collected,p=>te(p)&&$(p.data_category_name)&&$(p.desc)&&gn(p.sub_items))&&be(n.shared,p=>te(p)&&$(p.purpose_name)&&Io(p.data_items)&&gn(p.data_categories))}var At=class{constructor(t){this.options=t;this.syncChecks=()=>{};this.pendingKey="";this.pendingBody="";this.needsRefresh=!1;let o=t.host.attachShadow({mode:"open"});Do(o);let r=document.createElement("div");r.className="theme",r.lang=t.config.language_code,this.root=document.createElement("div"),this.root.className="root",this.root.dataset.mode=t.mode,r.append(this.root),o.append(r),this.appearance=eo(r),this.appearance.apply(t.appearance),this.state={choices:{...t.choices},busy:!1}}render(){let{config:t,mode:o,demo:r=!1,onClose:s}=this.options;try{if(!wt(t.notice,t.purposes))throw new Error("Invalid notice");this.syncChecks=Lo({root:this.root,config:t,state:this.state,mode:o,demo:r,onClose:s,onSubmit:()=>this.submit(),onChange:()=>{this.pendingKey=""}})}catch{let d="The consent form could not be displayed. Check the notice configuration and reload.",p=y("section",void 0,"shell"),f=y("p",d,"message error");f.setAttribute("role","alert");let u=y("div",void 0,"body");if(u.append(f),p.append(u),o!=="panel"){let _=y("button","\xD7","close");_.setAttribute("aria-label","Close consent form"),_.type="button",_.onclick=s,p.append(_)}this.root.replaceChildren(p),o!=="panel"&&!r&&p.querySelector("button")?.focus(),this.options.onError(new w(d,"form_error"))}}setAppearance(t){this.appearance.apply(t),this.render()}destroy(){this.appearance.destroy()}message(t,o=!1){let r=this.root.querySelector("#feedback");r&&(r.textContent=t,r.className=o?"message error":"message",r.setAttribute("role",o?"alert":"status"))}async submit(){let{state:t,root:o,options:r}=this;if(t.busy||this.needsRefresh)return;t.busy=!0;let s=[...o.querySelectorAll("input:not(:disabled)")];s.forEach(u=>u.disabled=!0),o.querySelectorAll("button:not(.close)").forEach(u=>u.disabled=!0);let d={config_version:r.config.config_version,language_code:r.config.language_code,answers:r.config.purposes.map(u=>({purpose_id:u.id,given:!!t.choices[String(u.id)]}))},p=JSON.stringify(d);(!this.pendingKey||this.pendingBody!==p)&&(this.pendingKey=Yn(),this.pendingBody=p);let f;try{f=await r.save(d,this.pendingKey),t.choices=f.choices,this.message(r.demo?"Demo complete. No record was saved.":"Your choices are saved.")}catch(u){let _=u instanceof Error?u.message:"Your choices could not be saved. Please retry.";if(this.message(_,!0),u instanceof w&&u.code==="notice_changed"&&r.onRefresh){this.needsRefresh=!0;let S=y("button","Reload consent form");S.type="button",S.onclick=()=>void r.onRefresh().catch(()=>{}),o.querySelector("#feedback")?.append(S)}r.onError(u)}finally{t.busy=!1,o.querySelectorAll("button").forEach(u=>u.disabled=!1),s.forEach(u=>u.disabled=!1),this.syncChecks(),this.needsRefresh&&o.querySelectorAll(".actions button").forEach(u=>{u.disabled=!0})}f&&r.onComplete(f)}};function X(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function yn(n,t){if(!X(n))return!1;let o=new Set(t.purposes.map(r=>String(r.id)));return Object.entries(n).every(([r,s])=>o.has(r)&&typeof s=="boolean")}function rt(n,t){if(!X(n)||n.app_id!==t||typeof n.name!="string"||typeof n.level_id!="string"||!n.level_id||typeof n.mode!="string"||!["panel","popup","page"].includes(n.mode)||typeof n.config_version!="string"||!/^[a-f0-9]{64}$/i.test(n.config_version)||typeof n.language_code!="string"||!n.language_code||!Array.isArray(n.purposes)||!n.purposes.length||n.purposes.length>300||!X(n.notice)||n.description!==null&&typeof n.description!="string"||n.template_id!==null&&typeof n.template_id!="string"||typeof n.revision!="number"||!Number.isInteger(n.revision)||n.revision<1||typeof n.sdk_version!="string"||!n.sdk_version||n.appearance!==void 0&&!X(n.appearance))return!1;let o=new Set;return n.purposes.every(r=>!X(r)||typeof r.id!="number"||!Number.isSafeInteger(r.id)||r.id<1||o.has(r.id)||typeof r.name!="string"||typeof r.required!="boolean"||!Array.isArray(r.data_items)||typeof r.description!="string"?!1:(o.add(r.id),!0))&&wt(n.notice,n.purposes)}var St=class{notePointer(t){this.pointerFocus=t.composedPath().find(o=>o instanceof HTMLElement&&o.matches("button,a[href],input,select,textarea,[tabindex]"))}activate(t){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;this.previousFocus=o instanceof HTMLElement&&o!==document.body?o:this.pointerFocus?.isConnected?this.pointerFocus:void 0,this.previousOverflow=document.body.style.overflow,document.body.style.overflow="hidden",t.showModal()}release(){this.previousOverflow!==void 0&&(document.body.style.overflow=this.previousOverflow,this.previousOverflow=void 0),this.previousFocus?.isConnected&&this.previousFocus.focus({preventScroll:!0}),this.previousFocus=void 0,this.pointerFocus=void 0}};function Po(n,t){let o=document.createElement("dialog");return o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-label","Consent preferences"),o.style.cssText="position:fixed;inset:0;margin:0;border:0;padding:0;width:100%;height:100%;max-width:none;max-height:none;z-index:2147483000;display:flex;align-items:center;justify-content:center;box-sizing:border-box",t==="page"?(o.style.cssText+=";background:white",n.style.cssText+=";width:100%;height:100%;border-radius:0"):(o.style.cssText+=";background:#10182888;padding:20px",n.style.cssText+=";width:min(560px,100%);height:min(760px,90dvh);border-radius:16px;overflow:hidden;box-shadow:0 20px 70px #0004"),o}var xt;function Mo(n){xt?.close(),xt=n}function No(n){xt===n&&(xt=void 0)}function Uo(n){let t=new URL(n,window.location.href);if(t.username||t.password||t.search||t.hash)throw new Error("Use an Atlas backend base URL without credentials or query parameters.");if(t.protocol!=="https:"&&!(t.protocol==="http:"&&(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]"||t.hostname.endsWith(".localhost"))))throw new Error("Atlas Consent requires HTTPS. HTTP is only supported for localhost.");return t.href.replace(/\/$/,"")}function _n(n){if(!n)return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t.token!="string"||!t.token||typeof t.expires!="string"||!Number.isFinite(Date.parse(t.expires)))return;let o=t.result;return{token:t.token,expires:t.expires,result:o&&typeof o=="object"&&typeof o.ref_id=="string"?o:void 0}}function kt(n){try{return localStorage.getItem(n)}catch{return}}function Fo(n,t){try{return t?localStorage.setItem(n,JSON.stringify(t)):localStorage.removeItem(n),!0}catch{try{localStorage.removeItem(n)}catch{}return!1}}var Rt="atlas-consent:storage";async function Ho(n,t,o,r="Consent is temporarily unavailable."){if(t.aborted)throw new w("This consent instance was destroyed.","destroyed");let s=new AbortController,d=()=>s.abort();t.addEventListener("abort",d);let p=setTimeout(d,15e3),f,u;try{f=await fetch(n,{...o,signal:s.signal,credentials:"omit",headers:{"Content-Type":"application/json",...o?.headers}}),u=await f.json()}catch(_){throw t.aborted?new w("This consent instance was destroyed.","destroyed"):s.signal.aborted?new w("Atlas took too long to respond.","request_timeout"):_ instanceof SyntaxError||_ instanceof DOMException&&_.name==="SyntaxError"?new w(f?.ok?"Atlas returned an invalid response.":r,f&&!f.ok?"request_failed":"invalid_response",f?.status):new w("Atlas could not be reached.","network_error",f?.status)}finally{clearTimeout(p),t.removeEventListener("abort",d)}if(!f.ok||!X(u)||u.data===void 0||u.data===null){let _=X(u)&&X(u.error)?u.error:{};throw new w(typeof _.message=="string"&&_.message?_.message:r,typeof _.code=="string"?_.code:typeof _.type=="string"?_.type:"request_failed",f.status)}return u.data}var Br=60*864e5,qe=n=>({ref_id:n.ref_id,app_id:n.app_id,level_id:n.level_id,config_version:n.config_version,choices:{...n.choices}}),Ct=class{constructor(t){this.options=t;this.controller=new AbortController;this.preferenceSnapshot="null";this.accessibility=new St;this.destroyed=!1;this.generation=0;this.reportedErrors=new WeakSet;this.storageChanged=t=>{(t.key===null||t.key===this.key)&&this.syncSaved()};this.documentStorageChanged=t=>{t.detail===this.key&&this.syncSaved()};this.keydown=t=>{t.key==="Escape"&&this.overlay&&this.close()};this.pointerdown=t=>this.accessibility.notePointer(t);if(!/^ac_app_[A-Za-z0-9_-]{10,40}$/.test(t.appId))throw new w("Use the app ID from Atlas Integrations.","invalid_app");let o=t.apiBaseUrl??$n;if(!o)throw new w("Set apiBaseUrl or use an SDK build with a configured backend URL.","invalid_api_base_url");try{this.api=Uo(o)}catch(s){throw new w(s.message,"invalid_api_base_url")}this.key=`atlas-consent:v2:${encodeURIComponent(this.api)}:${t.appId}`,this.stored=kt(this.key),this.saved=_n(this.stored??null),window.addEventListener("keydown",this.keydown),window.addEventListener("pointerdown",this.pointerdown,!0),window.addEventListener("storage",this.storageChanged),window.addEventListener(Rt,this.documentStorageChanged);let r=this.generation;this.ready=this.load().then(s=>{if(this.destroyed)throw new w("This consent instance was destroyed.","destroyed");return this.config=s,this.notifyPreference(),this.renewIfEnding(),r!==this.generation||(t.target?this.mount(t.target).catch(()=>{}):(t.mode||s.mode)==="popup"&&t.autoShow!==!1&&!this.hasChoice()&&this.open().catch(()=>{})),s}),this.ready.catch(s=>{this.loadFailure=s,this.fail(s)})}async load(){let t=await this.request(`/config?language_code=${encodeURIComponent(this.options.language||"en")}`);if(!rt(t,this.options.appId))throw new w("Atlas returned an invalid configuration.","invalid_response");return t}request(t,o,r){return this.assertAlive(),Ho(`${this.api}/consent-sdk/v1/apps/${this.options.appId}${t}`,this.controller.signal,o,r)}persist(){let t=this.stored,o=Fo(this.key,this.saved),r=o?this.saved?JSON.stringify(this.saved):null:kt(this.key);r!==void 0&&(this.stored=r),this.notifyPreference(),(o||t!==this.stored)&&window.dispatchEvent(new CustomEvent(Rt,{detail:this.key}))}syncSaved(){if(this.destroyed)return;let t=kt(this.key);if(t===void 0||t===this.stored)return;let o=_n(t),r=o?.token!==this.saved?.token||JSON.stringify(o?.result)!==JSON.stringify(this.saved?.result);this.stored=t,this.saved=o,r&&this.form&&this.close(!0),this.notifyPreference()}notifyPreference(){let t=this.hasChoice()?qe(this.saved.result):null,o=JSON.stringify(t);if(o!==this.preferenceSnapshot){this.preferenceSnapshot=o;try{this.options.onPreferenceChange?.(t?qe(t):null)}catch(r){queueMicrotask(()=>{throw r})}window.dispatchEvent(new CustomEvent("atlas-consent:change",{detail:{appId:this.options.appId,preference:t?qe(t):null}}))}}alive(){return!!this.saved&&Date.parse(this.saved.expires)>Date.now()}hasChoice(){return!!this.config&&this.alive()&&bt(this.saved.result,this.config)}getPreference(){return this.syncSaved(),this.notifyPreference(),this.hasChoice()?qe(this.saved.result):null}getClaim(){return this.syncSaved(),this.alive()&&this.saved.result?.app_id===this.options.appId?{app_id:this.options.appId,ref_id:this.saved.result.ref_id,claim_token:this.saved.token}:null}async session(t){this.syncSaved();let o=this.stored,r=this.saved;if(this.alive())try{let d=await this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${r.token}`}});if(t!==this.generation)return{};if(this.syncSaved(),t!==this.generation)return{};if(o!==this.stored)return this.session(t);if(!X(d)||!rt(d.config,this.options.appId)||!yn(d.choices,d.config))throw new w("Atlas returned an invalid session.","invalid_response");return this.reconcileSession(d,r),typeof d.expires_at=="string"&&Number.isFinite(Date.parse(d.expires_at))&&(r.expires=d.expires_at),this.persist(),d.choices}catch(d){if(t!==this.generation)return{};if(!(d instanceof w)||d.status!==401)throw d;this.saved=void 0,this.persist(),o=this.stored}let s=await this.request("/sessions",{method:"POST",body:JSON.stringify({language_code:this.options.language||"en"})});if(t!==this.generation)return{};if(this.syncSaved(),t!==this.generation)return{};if(o!==this.stored)return this.session(t);if(!X(s)||typeof s.session_token!="string"||!s.session_token||typeof s.expires_at!="string"||!Number.isFinite(Date.parse(s.expires_at))||!rt(s.config,this.options.appId))throw new w("Atlas returned an invalid session.","invalid_response");return this.config=s.config,this.saved={token:s.session_token,expires:s.expires_at},this.persist(),{}}reconcileSession(t,o){let r=t.config,s=o.result;if(s?.config_version===r.config_version){let d={...s,choices:t.choices};o.result=bt(d,r)&&t.ref_id===s.ref_id?d:void 0}this.config=r}renewIfEnding(){if(!this.alive()||Date.parse(this.saved.expires)-Date.now()>Br)return;let t=this.saved,o=this.stored;this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${t.token}`}}).then(r=>{this.syncSaved(),this.saved===t&&this.stored===o&&X(r)&&rt(r.config,this.options.appId)&&yn(r.choices,r.config)&&typeof r.expires_at=="string"&&Number.isFinite(Date.parse(r.expires_at))&&(this.reconcileSession(r,t),t.expires=r.expires_at,this.persist())}).catch(()=>{})}async save(t,o,r,s,d){if(this.syncSaved(),d!==this.generation||this.saved?.token!==s)throw new w("This consent form was closed. Open it again.","form_closed");let p=await this.request("/decisions",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Idempotency-Key":o},body:JSON.stringify({...t,sdk_version:Qt})},"Your choices could not be saved. Please retry.");if(!bt(p,r))throw new w("Atlas returned an invalid consent result. Please retry.","invalid_response");let f=p.expires_at;return d===this.generation&&this.saved?.token===s&&typeof f=="string"&&Number.isFinite(Date.parse(f))&&(this.saved.expires=f),qe(p)}recordView(){this.request("/events",{method:"POST",headers:{Authorization:`Bearer ${this.saved?.token}`},body:JSON.stringify({event:"viewed"})}).catch(()=>{})}async reported(t){try{await t()}catch(o){throw o!==this.loadFailure&&this.fail(o),o}}mount(t){return this.reported(()=>this.mountForm(t))}async mountForm(t){let o=this.generation;if(await this.ready,this.assertAlive(),o!==this.generation)return;let r=typeof t=="string"?document.querySelector(t):t;if(!(r instanceof HTMLElement))throw new w("The consent container was not found.","missing_container");return this.startForm(this.options.mode||this.config?.mode||"panel",r)}open(){return this.reported(async()=>{let t=this.generation;if(await this.ready,this.assertAlive(),t!==this.generation)return;if(this.host&&!this.overlay){this.host.scrollIntoView({block:"nearest"}),this.host.focus({preventScroll:!0});return}let o=this.options.mode||this.config.mode;return this.startForm(o==="panel"?"popup":o)})}refresh(){let t=this.mountTarget;return this.close(!0),t?this.mount(t):this.open()}startForm(t,o){if(this.form)return Promise.resolve();if(this.launchTask)return this.launchTask;let r=this.generation,s=Promise.resolve().then(()=>this.insertForm(t,o,r));this.launchTask=s;let d=()=>{this.launchTask===s&&(this.launchTask=void 0)};return s.then(d,d),s}async insertForm(t,o,r){try{if(this.assertAlive(),r!==this.generation)return;let s=await this.session(r);if(this.assertAlive(),r!==this.generation)return;o||Mo(this);let d=this.createForm(t,s);if(o)this.mountTarget=o,this.host.tabIndex=-1,this.host.setAttribute("role","region"),this.host.setAttribute("aria-label","Consent preferences"),o.append(this.host);else{this.overlay=Po(this.host,t);let p=this.overlay;p.addEventListener("cancel",f=>{f.preventDefault(),this.overlay===p&&this.close()}),p.addEventListener("close",()=>{this.overlay===p&&this.close()}),this.overlay.append(this.host),document.body.append(this.overlay),this.accessibility.activate(this.overlay)}d.render(),this.recordView()}catch(s){if(this.destroyed)throw s;if(r!==this.generation)return;throw this.close(!0),s}}createForm(t,o){let r=this.generation,s=this.saved.token,d=this.config,p=document.createElement("atlas-consent-form");return p.style.cssText="display:block;width:100%;height:650px",this.host=p,this.form=new At({host:p,config:this.config,choices:o,mode:t,appearance:{...this.config?.appearance,...this.options.appearance},save:(f,u)=>this.save(f,u,d,s,r),onComplete:f=>{this.syncSaved(),r===this.generation&&this.saved?.token===s&&this.complete(f)},onError:f=>{r===this.generation&&this.fail(f)},onClose:()=>{r===this.generation&&this.close()},onRefresh:()=>r===this.generation?this.refresh():Promise.resolve()}),this.form}complete(t){let o=this.overlay,r={app_id:t.app_id,ref_id:t.ref_id,claim_token:this.saved.token};this.saved.result=qe(t),this.persist();try{this.options.onComplete?.(t,r)}finally{o&&this.overlay===o&&this.close()}}assertAlive(){if(this.destroyed)throw new w("This consent instance was destroyed.","destroyed")}fail(t){if(this.destroyed||t instanceof w&&t.code==="destroyed")return;if(t&&typeof t=="object"){if(this.reportedErrors.has(t))return;this.reportedErrors.add(t)}let o=t instanceof w?t:new w(t instanceof Error?t.message:"Consent is unavailable.","unexpected_error");try{this.options.onError?.(o)}catch(r){queueMicrotask(()=>{throw r})}window.dispatchEvent(new CustomEvent("atlas-consent:error",{detail:{appId:this.options.appId,error:o}}))}close(t=!1){this.generation+=1,this.launchTask=void 0,No(this);let o=!!(this.form||this.overlay);this.form?.destroy(),this.form=void 0,this.host?.remove(),this.host=void 0,this.mountTarget=void 0,this.overlay?.close(),this.overlay?.remove(),this.overlay=void 0,this.accessibility.release(),o&&!t&&this.options.onClose?.()}destroy(){this.destroyed=!0,this.controller.abort(),this.close(!0),window.removeEventListener("keydown",this.keydown),window.removeEventListener("pointerdown",this.pointerdown,!0),window.removeEventListener("storage",this.storageChanged),window.removeEventListener(Rt,this.documentStorageChanged)}};function Pi(n){return new Ct(n)}export{Ct as ConsentClient,w as ConsentError,Qt as VERSION,Pi as create};
|
|
1
|
+
var qn="https://play.dashboard.atlaskyc.com/v3/api";var Zt="1.1.0";function $n(){if(!globalThis.crypto?.getRandomValues)throw new Error("Atlas Consent needs a secure browser context.");return[...crypto.getRandomValues(new Uint8Array(24))].map(n=>n.toString(16).padStart(2,"0")).join("")}function bt(n,t){if(!n||typeof n!="object")return!1;let o=n;return typeof o.ref_id!="string"||!o.ref_id||o.app_id!==t.app_id||o.level_id!==t.level_id||o.config_version!==t.config_version||!o.choices||typeof o.choices!="object"||Array.isArray(o.choices)?!1:Object.keys(o.choices).length===t.purposes.length&&t.purposes.every(r=>typeof o.choices[String(r.id)]=="boolean"&&(!r.required||o.choices[String(r.id)]))}var w=class extends Error{constructor(o,r,s=0){super(o);this.code=r;this.status=s;this.name="ConsentError"}};var Yn={system:'Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",system-ui,sans-serif',serif:"Georgia,'Times New Roman',serif",rounded:"'Trebuchet MS','Segoe UI',Verdana,'Helvetica Neue',sans-serif"},Vn={sharp:["2px","2px"],soft:["6px","6px"],round:["999px","16px"]},sr=/^#[0-9a-f]{6}$/i,De={theme:"light",primary_color:"#ae0a60",background_color:"#ffffff",text_color:"#1a202c",radius:"soft",font:"system",density:"comfortable"},Kn={background_color:"#0f172a",text_color:"#f1f5f9"};function Xn(n){let[t,o,r]=[1,3,5].map(s=>parseInt(n.slice(s,s+2),16)/255).map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*t+.7152*o+.0722*r}function Jn(n,t){let o=Xn(n),r=Xn(t);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function Zn(n,t,o){let r={...De,...t||{}};for(let _ of["primary_color","background_color","text_color"])(typeof r[_]!="string"||!sr.test(r[_]))&&(r[_]=De[_]);(typeof r.radius!="string"||!Object.prototype.hasOwnProperty.call(Vn,r.radius))&&(r.radius=De.radius),(typeof r.font!="string"||!Object.prototype.hasOwnProperty.call(Yn,r.font))&&(r.font=De.font),["light","dark","system"].includes(r.theme)||(r.theme=De.theme);let s=r.theme==="dark"||r.theme==="system"&&o.matches;s&&(r.background_color.toLowerCase()===De.background_color&&(r.background_color=Kn.background_color),r.text_color.toLowerCase()===De.text_color&&(r.text_color=Kn.text_color));let[d,p]=Vn[r.radius],f=r.density==="compact",u={"--primary":r.primary_color,"--bg":r.background_color,"--text":r.text_color,"--on-primary":Jn(r.primary_color,"#000000")>Jn(r.primary_color,"#ffffff")?"#000000":"#ffffff","--muted":`color-mix(in srgb,${r.text_color} 66%,${r.background_color})`,"--line":`color-mix(in srgb,${r.text_color} 14%,${r.background_color})`,"--line-strong":`color-mix(in srgb,${r.text_color} 26%,${r.background_color})`,"--tint":`color-mix(in srgb,${r.text_color} 8%,${r.background_color})`,"--page":`color-mix(in srgb,${r.text_color} 4%,${r.background_color})`,"--font":Yn[r.font],"--r-btn":d,"--r-card":p,"--pad":f?"16px":"28px","--gap":f?"10px":"20px","--fs":f?"14px":"16px","--btn":f?"42px":"52px","--rowy":f?"4px":"12px","--rowx":f?"12px":"18px"};for(let[_,S]of Object.entries(u))n.style.setProperty(_,S);n.style.colorScheme=s?"dark":"light"}function Qn(n){let t=window.matchMedia("(prefers-color-scheme: dark)"),o,r=()=>{o?.theme==="system"&&Zn(n,o,t)};return t.addEventListener("change",r),{apply(s){o=s,Zn(n,s,t)},destroy(){t.removeEventListener("change",r)}}}function ar(n,t){this.v=n,this.k=t}function eo(n,t){(t==null||t>n.length)&&(t=n.length);for(var o=0,r=Array(t);o<t;o++)r[o]=n[o];return r}function cr(n){if(Array.isArray(n))return n}function lr(n,t){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var r,s,d,p,f=[],u=!0,_=!1;try{if(d=(o=o.call(n)).next,t===0){if(Object(o)!==o)return;u=!1}else for(;!(u=(r=d.call(o)).done)&&(f.push(r.value),f.length!==t);u=!0);}catch(S){_=!0,s=S}finally{try{if(!u&&o.return!=null&&(p=o.return(),Object(p)!==p))return}finally{if(_)throw s}}return f}}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 dr(n,t){return cr(n)||lr(n,t)||ur(n,t)||pr()}function ur(n,t){if(n){if(typeof n=="string")return eo(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)?eo(n,t):void 0}}function vt(n){var t,o;function r(d,p){try{var f=n[d](p),u=f.value,_=u instanceof ar;Promise.resolve(_?u.v:u).then(function(S){if(_){var H=d==="return"&&u.k?d:"next";if(!u.k||S.done)return r(H,S);S=n[H](S).value}s(!!f.done,S)},function(S){r("throw",S)})}catch(S){s(2,S)}}function s(d,p){d===2?t.reject(p):t.resolve({value:p,done:d}),(t=t.next)?r(t.key,t.arg):o=null}this._invoke=function(d,p){return new Promise(function(f,u){var _={key:d,arg:p,resolve:f,reject:u,next:null};o?o=o.next=_:(t=o=_,r(d,p))})},typeof n.return!="function"&&(this.return=void 0)}vt.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},vt.prototype.next=function(n){return this._invoke("next",n)},vt.prototype.throw=function(n){return this._invoke("throw",n)},vt.prototype.return=function(n){return this._invoke("return",n)};var go=Object.entries,to=Object.setPrototypeOf,fr=Object.isFrozen,yo=Object.getPrototypeOf,_o=Object.getOwnPropertyDescriptor,P=Object.freeze,U=Object.seal,Ge=Object.create,bo=typeof Reflect<"u"&&Reflect,ln=bo.apply,pn=bo.construct;P||(P=function(t){return t});U||(U=function(t){return t});ln||(ln=function(t,o){for(var r=arguments.length,s=new Array(r>2?r-2:0),d=2;d<r;d++)s[d-2]=arguments[d];return t.apply(o,s)});pn||(pn=function(t){for(var o=arguments.length,r=new Array(o>1?o-1:0),s=1;s<o;s++)r[s-1]=arguments[s];return new t(...r)});var ye=R(Array.prototype.forEach);Array.prototype.indexOf;var hr=R(Array.prototype.lastIndexOf),no=R(Array.prototype.pop),et=R(Array.prototype.push),mr=R(Array.prototype.slice),gr=R(Array.prototype.splice),We=Array.isArray,Qt=vo(Set),en=R(Set.prototype.add),tt=R(Set.prototype.has),Ie=R(String.prototype.toLowerCase),tn=R(String.prototype.toString),oo=R(String.prototype.match),nt=R(String.prototype.replace),ro=R(String.prototype.indexOf),yr=R(String.prototype.trim),_r=R(Number.prototype.toString),br=R(Boolean.prototype.toString),io=typeof BigInt>"u"?null:R(BigInt.prototype.toString),so=typeof Symbol>"u"?null:R(Symbol.prototype.toString),q=R(Object.prototype.hasOwnProperty),ot=R(Object.prototype.toString),N=R(RegExp.prototype.test),_e=vo(TypeError);function R(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,r=new Array(o>1?o-1:0),s=1;s<o;s++)r[s-1]=arguments[s];return ln(n,t,r)}}function vo(n){return function(){for(var t=arguments.length,o=new Array(t),r=0;r<t;r++)o[r]=arguments[r];return pn(n,o)}}function T(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;if(to&&to(n,null),!We(t))return n;let r=t.length;for(;r--;){let s=t[r];if(typeof s=="string"){let d=o(s);d!==s&&(fr(t)||(t[r]=d),s=d)}n[s]=!0}return n}function vr(n){for(let t=0;t<n.length;t++)q(n,t)||(n[t]=null);return n}function K(n){let t=Ge(null);for(let r of go(n)){var o=dr(r,2);let s=o[0],d=o[1];q(n,s)&&(We(d)?t[s]=vr(d):d&&typeof d=="object"&&d.constructor===Object?t[s]=K(d):t[s]=d)}return t}function Tr(n){switch(typeof n){case"string":return n;case"number":return _r(n);case"boolean":return br(n);case"bigint":return io?io(n):"0";case"symbol":return so?so(n):"Symbol()";case"undefined":return ot(n);case"function":case"object":{if(n===null)return ot(n);let t=n,o=J(t,"toString");if(typeof o=="function"){let r=o(t);return typeof r=="string"?r:ot(r)}return ot(n)}default:return ot(n)}}function J(n,t){for(;n!==null;){let r=_o(n,t);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}n=yo(n)}function o(){return null}return o}function Er(n,t){for(;n!==null;){let o=_o(n,t);if(o)return o.get?R(o.get):null;n=yo(n)}return null}function wr(n){try{return N(n,""),!0}catch{return!1}}var ao=P(["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"]),nn=P(["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"]),on=P(["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"]),Ar=P(["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"]),rn=P(["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"]),Sr=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),co=P(["#text"]),lo=P(["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"]),sn=P(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","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"]),po=P(["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"]),Tt=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),xr=U(/{{[\w\W]*|^[\w\W]*}}/g),kr=U(/<%[\w\W]*|^[\w\W]*%>/g),Rr=U(/\${[\w\W]*/g),Cr=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Or=U(/^aria-[\-\w]+$/),uo=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lr=U(/^(?:\w+script|data):/i),Dr=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ir=U(/^html$/i),Mr=U(/^[a-z][.\w]*(-[.\w]+)+$/i),an=U(/<[/\w!]/g),fo=U(/<[/\w]/g),Pr=U(/<\/no(script|embed|frames)/i),ho=U(/\/>/i),L={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Nr=P(T({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Ur=function(){return typeof window>"u"?null:window},Fr=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";o&&o.hasAttribute(s)&&(r=o.getAttribute(s));let d="dompurify"+(r?"#"+r:"");try{return t.createPolicy(d,{createHTML(p){return p},createScriptURL(p){return p}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},mo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},xe=function(t,o,r,s){return q(t,o)&&We(t[o])?T(s.base?K(s.base):{},t[o],s.transform):r},cn=function(t,o,r){let s=q(t,o)?t[o]:void 0;return s&&typeof s=="object"?K(s):r()};function To(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ur(),t=l=>To(l);if(t.version="3.4.17",t.removed=[],!n||!n.document||n.document.nodeType!==L.document||!n.Element)return t.isSupported=!1,t;let o=n.document,r=o,s=r.currentScript;n.DocumentFragment;let d=n.HTMLTemplateElement,p=n.Node,f=n.Element,u=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let _=n.DOMParser,S=n.trustedTypes,H=f.prototype,ke=J(H,"cloneNode"),Y=J(H,"remove"),Me=J(H,"removeAttributeNode"),ne=J(H,"nextSibling"),le=J(H,"childNodes"),pe=J(H,"parentNode"),de=J(H,"shadowRoot"),Pe=J(H,"attributes"),Z=p&&p.prototype?J(p.prototype,"nodeType"):null,ue=p&&p.prototype?J(p.prototype,"nodeName"):null,ve=p&&p.prototype?J(p.prototype,"ownerDocument"):null,z=function(e){return Z?Z(e):e.nodeType},Te=function(e){return ue?ue(e):e.nodeName},$e=Er(H,"namespaceURI"),Ye=function(e){return $e?$e(e):e.namespaceURI};if(typeof d=="function"){let l=o.createElement("template");l.content&&l.content.ownerDocument&&(o=l.content.ownerDocument)}let F,fe="",Ve,h=!1,v=0,A=function(){if(v>0)throw _e('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.')},I=function(e){A(),v++;try{return F.createHTML(e)}finally{v--}},he=function(e){A(),v++;try{return F.createScriptURL(e)}finally{v--}},oe=function(){return h||(Ve=Fr(S,s),h=!0),Ve},C=o,V=C.implementation,Q=C.createNodeIterator,Ct=C.createDocumentFragment,it=C.getElementsByTagName,st=r.importNode,E=mo();t.isSupported=typeof go=="function"&&typeof pe=="function"&&V&&V.createHTMLDocument!==void 0;let me=xr,at=kr,M=Rr,re=Cr,Ee=Or,Ke=Lr,ie=Dr,ct=Mr,lt=uo,x=null,Ot=T({},[...ao,...nn,...on,...rn,...co]),k=null,Lt=T({},[...lo,...sn,...po,...Tt]),se=Object.seal(Ge(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}})),Xe=null,_n=null,we=Object.seal(Ge(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),bn=!0,Dt=!0,vn=!1,It=!0,ge=!1,Re=!0,Ce=!1,Mt=!1,pt=null,dt=null,Pt=!1,Ne=!1,ut=!1,ft=!1,Tn=!0,En=!1,wn="user-content-",Nt=!0,Ut=!1,Oe=null,Ue={},Le=null,An=T({},["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"]),Sn=null,xn=T({},["audio","video","img","source","image","track"]),kn=null,Rn=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",mt="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",Fe=ae,Ft=!1,Ht=null,zo=T({},[ht,mt,ae],tn),Cn=P(["mi","mo","mn","ms","mtext"]),zt=T({},Cn),On=P(["annotation-xml"]),Bt=T({},On),Bo=T({},["title","style","font","a","script"]),Je=null,jo=["application/xhtml+xml","text/html"],Go="text/html",O=null,He=null,Wo=o.createElement("form"),Ln=function(e){return e instanceof RegExp||e instanceof Function},jt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===e)return;(!e||typeof e!="object")&&(e={}),e=K(e),Je=jo.indexOf(e.PARSER_MEDIA_TYPE)===-1?Go:e.PARSER_MEDIA_TYPE,O=Je==="application/xhtml+xml"?tn:Ie,x=xe(e,"ALLOWED_TAGS",Ot,{transform:O}),k=xe(e,"ALLOWED_ATTR",Lt,{transform:O}),Ht=xe(e,"ALLOWED_NAMESPACES",zo,{transform:tn}),kn=xe(e,"ADD_URI_SAFE_ATTR",Rn,{transform:O,base:Rn}),Sn=xe(e,"ADD_DATA_URI_TAGS",xn,{transform:O,base:xn}),Le=xe(e,"FORBID_CONTENTS",An,{transform:O}),Xe=xe(e,"FORBID_TAGS",K({}),{transform:O}),_n=xe(e,"FORBID_ATTR",K({}),{transform:O}),Ue=q(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?K(e.USE_PROFILES):e.USE_PROFILES:!1,bn=e.ALLOW_ARIA_ATTR!==!1,Dt=e.ALLOW_DATA_ATTR!==!1,vn=e.ALLOW_UNKNOWN_PROTOCOLS||!1,It=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=e.SAFE_FOR_TEMPLATES||!1,Re=e.SAFE_FOR_XML!==!1,Ce=e.WHOLE_DOCUMENT||!1,Ne=e.RETURN_DOM||!1,ut=e.RETURN_DOM_FRAGMENT||!1,ft=e.RETURN_TRUSTED_TYPE||!1,Pt=e.FORCE_BODY||!1,Tn=e.SANITIZE_DOM!==!1,En=e.SANITIZE_NAMED_PROPS||!1,Nt=e.KEEP_CONTENT!==!1,Ut=e.IN_PLACE||!1,lt=wr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:uo,Fe=typeof e.NAMESPACE=="string"?e.NAMESPACE:ae,zt=cn(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>T({},Cn)),Bt=cn(e,"HTML_INTEGRATION_POINTS",()=>T({},On));let i=cn(e,"CUSTOM_ELEMENT_HANDLING",()=>Ge(null));if(se=Ge(null),q(i,"tagNameCheck")&&Ln(i.tagNameCheck)&&(se.tagNameCheck=i.tagNameCheck),q(i,"attributeNameCheck")&&Ln(i.attributeNameCheck)&&(se.attributeNameCheck=i.attributeNameCheck),q(i,"allowCustomizedBuiltInElements")&&typeof i.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),U(se),ge&&(Dt=!1),ut&&(Ne=!0),Ue&&(x=T({},co),k=Ge(null),Ue.html===!0&&(T(x,ao),T(k,lo)),Ue.svg===!0&&(T(x,nn),T(k,sn),T(k,Tt)),Ue.svgFilters===!0&&(T(x,on),T(k,sn),T(k,Tt)),Ue.mathMl===!0&&(T(x,rn),T(k,po),T(k,Tt))),we.tagCheck=null,we.attributeCheck=null,q(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?we.tagCheck=e.ADD_TAGS:We(e.ADD_TAGS)&&(x===Ot&&(x=K(x)),T(x,e.ADD_TAGS,O))),q(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?we.attributeCheck=e.ADD_ATTR:We(e.ADD_ATTR)&&(k===Lt&&(k=K(k)),T(k,e.ADD_ATTR,O))),q(e,"ADD_FORBID_CONTENTS")&&We(e.ADD_FORBID_CONTENTS)&&(Le===An&&(Le=K(Le)),T(Le,e.ADD_FORBID_CONTENTS,O)),Nt&&(x["#text"]=!0),Ce&&T(x,["html","head","body"]),x.table&&(T(x,["tbody"]),delete Xe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=F;F=e.TRUSTED_TYPES_POLICY;try{fe=I("")}catch(c){throw F=a,c}}else e.TRUSTED_TYPES_POLICY===null?(F=void 0,fe=""):(F===void 0&&(F=oe()),F&&typeof fe=="string"&&(fe=I("")));P&&P(e),He=e},Dn=T({},[...nn,...on,...Ar]),In=T({},[...rn,...Sr]),qo=function(e,i,a){return i.namespaceURI===ae?e==="svg":i.namespaceURI===ht?e==="svg"&&(a==="annotation-xml"||zt[a]):!!Dn[e]},$o=function(e,i,a){return i.namespaceURI===ae?e==="math":i.namespaceURI===mt?e==="math"&&Bt[a]:!!In[e]},Yo=function(e,i,a){return i.namespaceURI===mt&&!Bt[a]||i.namespaceURI===ht&&!zt[a]?!1:!In[e]&&(Bo[e]||!Dn[e])},Vo=function(e){let i=Ye(e),a=Ie(Te(e)),c=pe(e),m,g;return c&&z(c)===L.element?(m={namespaceURI:Ye(c)},g=Ie(Te(c))):(m={namespaceURI:Fe},g="template"),Ht[i]?i===mt?qo(a,m,g):i===ht?$o(a,m,g):i===ae?Yo(a,m,g):!!(Je==="application/xhtml+xml"&&Ht[i]):!1},Ae=function(e){et(t.removed,{element:e});try{pe(e).removeChild(e)}catch{if(Y(e),!pe(e))throw _e("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Mn=function(e,i,a){try{Me(e,i)}catch{try{e.removeAttribute(a)}catch{}}},Gt=function(e){qt(e);let i=le(e);i&&ye(mr(i),c=>{try{Y(c)}catch{}});let a=z(e)===L.element?Pe(e):null;if(a)for(let c=a.length-1;c>=0;--c){let m=a[c],g=m&&m.name;typeof g=="string"&&Mn(e,m,g)}},ze=function(e,i,a){if(!a)try{a=i.getAttributeNode(e)}catch{a=null}et(t.removed,{attribute:a||null,from:i});try{a?Me(i,a):i.removeAttribute(e)}catch{try{i.removeAttribute(e)}catch{}}if(e==="is")if(Ne||ut)try{Ae(i)}catch{}else try{i.setAttribute(e,"")}catch{}},Pn=function(e){let i=Pe(e);if(i)for(let a=i.length-1;a>=0;--a){let c=i[a],m=c&&c.name;typeof m!="string"||k[O(m)]||Mn(e,c,m)}},Wt=function(e,i){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=[e];for(;c.length>0;){let m=c.pop();if(i(m)===!1)continue;if(a&&z(m)===L.element){let b=de(m);Se(b)&&c.push(b)}let g=le(m);if(g)for(let b=g.length-1;b>=0;--b)c.push(g[b])}},qt=function(e){Wt(e,i=>{z(i)===L.element&&Pn(i)})},$t=function(e){let i=[];return Wt(e,a=>{i.push(a)},!0),i},Ko=function(e,i){let a=Qt();ye($t(e),c=>{z(c)===L.element&&en(a,c)}),ye(i,c=>{z(c)===L.element&&!tt(a,c)&&Pn(c)})},Nn=function(e,i){let a=!1;return ye(t.removed,c=>{c.element&&(a=a||c.element===e,qt(c.element))}),Ko(e,i),a},Xo=8,Jo=function(e,i){let a=Oe,c=null,m=()=>(c||(c=Qt(),ye(i,g=>{en(c,g)})),c);for(let g=0;;g++){let b=$t(e),D=[e],ce=!1;if(ye(b,B=>{z(B)===L.documentFragment?et(D,B):!ce&&!tt(a,B)&&(ce=tt(m(),B))}),!ce)return;if(g>=Xo)throw _e("the tree kept changing during in-place sanitization; refusing to return it");ye(D,(B,G)=>{Zo(B,G>0,e,m())})}},Zo=function(e,i,a,c){let m=Yt(e),g;for(;g=m.nextNode();)!tt(c,g)||tt(Oe,g)||(i&&ee(E.uponSanitizeShadowNode,g,null),Kt(g,a),Xt(g,a),Se(g.content)&&Qe(g.content))},Qo=function(e){Oe&&en(Oe,e)},Un=function(e,i){return Re?e==="patchsrc"?!0:e==="for"&&i!=="label"&&i!=="output":!1},er=function(e){Re&&Wt(e,i=>{let a=z(i);if(a===L.processingInstruction||a===L.comment&&N(fo,i.data)){try{Y(i)}catch{}return!1}if(a===L.element){let c=i,m=O(Te(i));try{c.hasAttribute&&c.hasAttribute("patchsrc")&&c.removeAttribute("patchsrc"),c.hasAttribute&&c.hasAttribute("for")&&Un("for",m)&&c.removeAttribute("for")}catch{}}return!0})},Fn=function(e){let i=null,a=null;if(Pt)e="<remove></remove>"+e;else{let g=oo(e,/^[\r\n\t ]+/);a=g&&g[0]}Je==="application/xhtml+xml"&&Fe===ae&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let c=F?I(e):e;if(Fe===ae)try{i=new _().parseFromString(c,Je)}catch{}if(!i||!i.documentElement){i=V.createDocument(Fe,"template",null);try{i.documentElement.innerHTML=Ft?fe:c}catch{}}let m=i.body||i.documentElement;return e&&a&&m.insertBefore(o.createTextNode(a),m.childNodes[0]||null),Fe===ae?it.call(i,Ce?"html":"body")[0]:Ce?i.documentElement:m},Yt=function(e){let i=ve?ve(e):e.ownerDocument;return Q.call(i||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},gt=function(e){return e=nt(e,me," "),e=nt(e,at," "),e=nt(e,M," "),e},Vt=function(e){var i;Hn(e);let a=(i=e.querySelectorAll)===null||i===void 0?void 0:i.call(e,"template");a&&ye(a,c=>{Se(c.content)&&Vt(c.content)})},Hn=function(e){e.normalize();let i=ve?ve(e):e.ownerDocument,a=Q.call(i||e,e,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),c=a.nextNode();for(;c;)c.data=gt(c.data),c=a.nextNode()},yt=function(e){let i=ue?ue(e):null;return typeof i!="string"||O(i)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Pe(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==Z(e)||e.childNodes!==le(e)},Se=function(e){if(!Z||typeof e!="object"||e===null)return!1;try{return Z(e)===L.documentFragment}catch{return!1}},Ze=function(e){if(!Z||typeof e!="object"||e===null)return!1;try{return typeof Z(e)=="number"}catch{return!1}};function ee(l,e,i){l.length!==0&&ye(l,a=>{a.call(t,e,i,He)})}let tr=function(e,i){return!!(Re&&e.hasChildNodes()&&!Ze(e.firstElementChild)&&N(an,e.textContent)&&N(an,e.innerHTML)||Re&&Nr[i]&&z(e)===L.element&&Ye(e)===ae&&(Ze(e.firstElementChild)||typeof e.textContent=="string"&&N(an,e.textContent))||e.nodeType===L.processingInstruction||Re&&e.nodeType===L.comment&&N(fo,e.data))},_t=function(e,i){if(e instanceof RegExp)return N(e,i);if(e instanceof Function){for(var a=arguments.length,c=new Array(a>2?a-2:0),m=2;m<a;m++)c[m-2]=arguments[m];return!!e(i,...c)}return!1},nr=function(e,i,a){if(!Xe[i]&&jn(i)&&_t(se.tagNameCheck,i))return!1;if(Nt&&!Le[i]&&!Le[Ie(i)]){let c=pe(e),m=le(e);if(m&&c){let g=m.length;for(let b=g-1;b>=0;--b){let D=e===a?ke(m[b],!0):m[b];c.insertBefore(D,ne(e))}}}return Ae(e),!0},zn=function(e,i,a,c){return e.length===0?i:i===a||i===c?K(i):i},Be=function(e,i){return e===i||pe(e)!==null?!1:(Ut&&qt(e),!0)},Kt=function(e,i){if(Qo(e),ee(E.beforeSanitizeElements,e,null),Be(e,i))return!0;if(yt(e))return Ae(e),!0;let a=O(Te(e));if(x=zn(E.uponSanitizeElement,x,Ot,pt),ee(E.uponSanitizeElement,e,{tagName:a,allowedTags:x}),Be(e,i))return!0;if(tr(e,a))return Ae(e),!0;if(Xe[a]||!(we.tagCheck instanceof Function&&we.tagCheck(a))&&!x[a]){let c=nr(e,a,i);return c===!1&&(ee(E.afterSanitizeElements,e,null),Be(e,i))?!0:c}if(z(e)===L.element&&!Vo(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&N(Pr,e.innerHTML))return Ae(e),!0;if(ge&&e.nodeType===L.text){let c=gt(e.textContent);e.textContent!==c&&(et(t.removed,{element:e.cloneNode()}),e.textContent=c)}return ee(E.afterSanitizeElements,e,null),Be(e,i)},Bn=function(e,i,a){if(_n[i]||Un(i,e)||Tn&&(i==="id"||i==="name")&&(a in o||a in Wo))return!1;let c=k[i]||we.attributeCheck instanceof Function&&we.attributeCheck(i,e);return Dt&&N(re,i)||bn&&N(Ee,i)?!0:c?kn[i]||N(lt,nt(a,ie,""))||(i==="src"||i==="xlink:href"||i==="href")&&e!=="script"&&ro(a,"data:")===0&&Sn[e]||vn&&!N(Ke,nt(a,ie,""))?!0:!a:jn(e)&&_t(se.tagNameCheck,e)&&_t(se.attributeNameCheck,i,e)||i==="is"&&se.allowCustomizedBuiltInElements&&_t(se.tagNameCheck,a)},or=T({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),jn=function(e){return!or[Ie(e)]&&N(ct,e)},rr=function(e,i,a,c){if(F&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!a)switch(S.getAttributeType(e,i)){case"TrustedHTML":return I(c);case"TrustedScriptURL":return he(c)}return c},ir=function(e,i,a,c){try{return a?e.setAttributeNS(a,i,c):e.setAttribute(i,c),yt(e)?(Ae(e),!1):!0}catch{return ze(i,e),!1}},Gn=function(e,i){return Re&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,i)?!0:Ie(e)==="attributename"&&oo(i,"href")!==null},Xt=function(e,i){if(ee(E.beforeSanitizeAttributes,e,null),Be(e,i))return;let a=e.attributes;if(!a||yt(e))return;k=zn(E.uponSanitizeAttribute,k,Lt,dt);let c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0},m=a.length,g=O(e.nodeName);for(;m--;){let b=a[m],D=b.name,ce=b.namespaceURI,B=b.value,G=O(D),je=B,W=D==="value"?je:yr(je),Wn=!1;if(c.attrName=G,c.attrValue=W,c.keepAttr=!0,c.forceKeepAttr=void 0,ee(E.uponSanitizeAttribute,e,c),W=c.attrValue,En&&(G==="id"||G==="name")&&ro(W,wn)!==0&&(ze(D,e,b),W=wn+W,Wn=!0),Gn(D,W)){ze(D,e,b);continue}if(!c.forceKeepAttr){if(!c.keepAttr){ze(D,e,b);continue}if(!It&&N(ho,W)){ze(D,e,b);continue}if(ge&&(W=gt(W)),!Bn(g,G,W)){ze(D,e,b);continue}W=rr(g,G,ce,W),W!==je&&ir(e,D,ce,W)&&Wn&&no(t.removed)}}ee(E.afterSanitizeAttributes,e,null),Be(e,i)},Qe=function(e){let i=null,a=Yt(e);for(ee(E.beforeSanitizeShadowDOM,e,null);i=a.nextNode();)if(ee(E.uponSanitizeShadowNode,i,null),Kt(i,e),Xt(i,e),Se(i.content)&&Qe(i.content),z(i)===L.element){let c=de(i);Se(c)&&(Jt(c),Qe(c))}ge&&Hn(e),ee(E.afterSanitizeShadowDOM,e,null)},Jt=function(e){let i=[{node:e,shadow:null}];for(;i.length>0;){let a=i.pop();if(a.shadow){Qe(a.shadow);continue}let c=a.node,m=z(c)===L.element,g=le(c);if(g)for(let b=g.length-1;b>=0;--b)i.push({node:g[b],shadow:null});if(m){let b=ue?ue(c):null;if(typeof b=="string"&&O(b)==="template"){let D=c.content;Se(D)&&i.push({node:D,shadow:null})}}if(m){let b=de(c);Se(b)&&i.push({node:null,shadow:b},{node:b,shadow:null})}}};return t.sanitize=function(l){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,c=null,m=null;if(Ft=!l,Ft&&(l="<!-->"),typeof l!="string"&&!Ze(l)&&(l=Tr(l),typeof l!="string"))throw _e("dirty is not a string, aborting");if(!t.isSupported)return l;Mt?(x=pt,k=dt):jt(e),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(x=K(x)),E.uponSanitizeAttribute.length>0&&(k=K(k)),t.removed=[];let g=Ut&&typeof l!="string"&&Ze(l),b=[],D=Oe;if(g){er(l);let G=Te(l);if(typeof G=="string"){let je=O(G);if(!x[je]||Xe[je])throw Gt(l),_e("root node is forbidden and cannot be sanitized in-place")}if(yt(l))throw Gt(l),_e("root node is clobbered and cannot be sanitized in-place");b=$t(l),Oe=Qt()}else if(Ze(l))i=Fn("<!---->"),a=i.ownerDocument.importNode(l,!0),a.nodeType===L.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?i=a:i.appendChild(a),Jt(i);else{if(!Ne&&!ge&&!Ce&&l.indexOf("<")===-1)return F&&ft?I(l):l;if(i=Fn(l),!i)return Ne?null:ft?fe:""}i&&Pt&&Ae(i.firstChild);let ce=g?l:i;try{g&&Jt(l);let G=Yt(ce);for(;c=G.nextNode();)Kt(c,ce),Xt(c,ce),Se(c.content)&&Qe(c.content);g&&Jo(l,b)}catch(G){throw g&&(Gt(l),Nn(l,b)),G}finally{Oe=D}if(g){if(Nn(l,b))throw _e("a node selected for removal could not be safely returned; refusing to sanitize in place");return ge&&Vt(l),l}if(Ne){if(ge&&Vt(i),ut)for(m=Ct.call(i.ownerDocument);i.firstChild;)m.appendChild(i.firstChild);else m=i;return(k.shadowroot||k.shadowrootmode)&&(m=st.call(r,m,!0)),m}let B=Ce?i.outerHTML:i.innerHTML;return Ce&&x["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&N(Ir,i.ownerDocument.doctype.name)&&(B="<!DOCTYPE "+i.ownerDocument.doctype.name+`>
|
|
3
|
+
`+B),ge&&(B=gt(B)),F&&ft?I(B):B},t.setConfig=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};jt(l),Mt=!0,pt=x,dt=k},t.clearConfig=function(){He=null,Mt=!1,pt=null,dt=null,F=Ve,fe=""},t.isValidAttribute=function(l,e,i){He||jt({});let a=O(l),c=O(e);return typeof i=="string"&&(Gn(e,i)||!It&&N(ho,i))?!1:Bn(a,c,i)},t.addHook=function(l,e){typeof e=="function"&&q(E,l)&&et(E[l],e)},t.removeHook=function(l,e){if(q(E,l)){if(e!==void 0){let i=hr(E[l],e);return i===-1?void 0:gr(E[l],i,1)[0]}return no(E[l])}},t.removeHooks=function(l){q(E,l)&&(E[l]=[])},t.removeAllHooks=function(){E=mo()},t}var Eo=To();function y(n,t,o){let r=document.createElement(n);return t&&(r.textContent=t),o&&(r.className=o),r}function j(n){return typeof n!="string"?"":(xo(n).textContent||"").trim()}var Ao=new Set(["A","B","BLOCKQUOTE","BR","CODE","EM","I","LI","OL","P","PRE","STRONG","U","UL"]),So=new Set(["H1","H2","H3","H4","H5","H6"]),wo;function xo(n){return wo??(wo=Eo(window)),wo.sanitize(n,{ALLOWED_TAGS:[...Ao,...So].map(t=>t.toLowerCase()),ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,RETURN_DOM_FRAGMENT:!0})}function ko(n){let t=document.createDocumentFragment();if(typeof n!="string")return t;let o=(r,s)=>{for(let d of Array.from(r.childNodes)){if(d.nodeType===Node.TEXT_NODE){s.appendChild(document.createTextNode(d.textContent||""));continue}if(!(d instanceof Element))continue;let p=d.tagName;if(So.has(p)){let f=document.createElement("p"),u=document.createElement("strong");f.appendChild(u),o(d,u),s.appendChild(f)}else if(Ao.has(p)){let f=document.createElement(p.toLowerCase());if(p==="A"){let u=d.getAttribute("href")||"";/^(https?:|mailto:)/i.test(u.trim())&&(f.setAttribute("href",u.trim()),f.setAttribute("target","_blank"),f.setAttribute("rel","noopener noreferrer nofollow"))}o(d,f),s.appendChild(f)}else["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"].includes(p)||o(d,s)}};return o(xo(n),t),t}var dn=4,Ro="http://www.w3.org/2000/svg";function Hr(){let n=document.createElementNS(Ro,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("class","chev"),n.setAttribute("aria-hidden","true");let t=document.createElementNS(Ro,"path");return t.setAttribute("d","M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"),n.append(t),n}function un(n,t){let o=(n||[]).map(u=>j(u.data_item_name)).filter(Boolean);if(!o.length){let u=(t||[]).map(j).filter(Boolean).join(" \xB7 ");return u?y("div",u,"ps"):null}let r=y("div",void 0,"ps"),s=document.createTextNode("");r.append(s);let d=!1,p=()=>{s.data=(d?o:o.slice(0,dn)).join(", "),f.textContent=d?"show less":`+${o.length-dn} more`},f=y("button",void 0,"more");return f.type="button",f.onclick=()=>{d=!d,p()},p(),o.length>dn&&r.append(f),r}function Co(n,t,o){let r=y("div",void 0,"grp"),s=y("button",void 0,"gh");s.type="button",s.setAttribute("aria-expanded","false");let d=y("span",void 0,"gx");d.append(y("span",n,"gt")),t&&d.append(y("span",t,"gd")),s.append(d,Hr()),s.onclick=()=>{let f=!r.classList.contains("open");r.classList.toggle("open",f),s.setAttribute("aria-expanded",String(f))};let p=y("div",void 0,"gb");return o.forEach(f=>p.append(y("span",f,"gi"))),r.append(s,p),r}function fn(n){if(!j(n))return null;let t=y("div",void 0,"text");return t.append(ko(n)),t}function Oo({root:n,config:t,state:o,mode:r,demo:s,onClose:d,onSubmit:p,onChange:f}){n.replaceChildren();for(let h of t.purposes)h.required&&(o.choices[String(h.id)]=!0);let u=t.notice||{},_=[...u.purposes||[]],S=new Set(_.flatMap(h=>(h.sub_items||[]).map(v=>v.purpose_id))),H=t.purposes.filter(h=>!S.has(h.id));H.length&&_.push({purpose_reason:_.length?"Other purposes":"Purposes",sub_items:H.map(h=>({purpose_id:h.id,purpose_name:h.name}))});let ke=u.content?.consent_data?.find(h=>h.section_type==="initial-section")?.section_data,Y=y("section",void 0,"shell"),Me=y("div",void 0,"body");if(r!=="panel"){let h=y("button","\xD7","close");h.type="button",h.setAttribute("aria-label","Close consent form"),h.onclick=()=>d(),Y.append(h)}Me.append(y("h1",j(ke?.title)||t.name||"Your consent preferences"));let ne=y("form",void 0,"sec");ne.id="consent-form",ne.style.padding="0",ne.style.gap="16px";let le=new Map,pe=[],de=()=>{le.forEach((h,v)=>{h.forEach(A=>A.checked=!!o.choices[String(v)])}),pe.forEach(h=>{h.box.checked=h.ids.every(v=>!!o.choices[String(v)])}),fe()},Pe=(h,v)=>{if(o.busy){de();return}for(let A of h)t.purposes.find(I=>I.id===A)?.required||(o.choices[String(A)]=v);f(),de()},Z=ke?.sections?.length?[...ke.sections]:[{section_type:"data_process_section",section_data:{section_title:"How we use it"}}];Z.some(h=>h.section_type==="data_process_section")||Z.push({section_type:"data_process_section",section_data:{section_title:"Purposes"}});let ue=u.sections_language_code&&u.sections_language_code!==t.language_code?u.sections_language_code:void 0;for(let h of Z){let v=h.section_data,A=h.section_type;if(A==="link_section")continue;let I=y("div",void 0,"sec");if(A==="generic_section"){let C=fn(v.section_body);C&&I.append(C),ne.append(I);continue}v.section_title&&I.append(y("p",j(v.section_title),"st"));let he=fn(v.section_body);he&&I.append(he);let oe=y("div",void 0,"grps");if(ue&&(oe.lang=ue),A==="data_collect_section")for(let C of u.collected||[]){let V=C.sub_items||[];oe.append(Co(`${j(C.data_category_name)||"Data"} (${V.length})`,j(C.desc),V.map(j)))}else if(A==="data_process_section")for(let C of _){let V=C.sub_items||[],Q=V.map(M=>M.purpose_id),Ct=Q.length>0&&Q.every(M=>t.purposes.find(re=>re.id===M)?.required);for(let M of Q){let re=!!t.purposes.find(Ee=>Ee.id===M)?.required;o.choices[String(M)]=re||!!o.choices[String(M)]}let it=y("div",void 0,"grp pg"),st=y("div",void 0,"ph"),E=y("span",void 0,"gx");E.append(y("span",j(C.purpose_reason)||"Purposes","gt")),C.desc&&E.append(y("span",j(C.desc),"gd"));let me=y("input");me.type="checkbox",me.disabled=Ct,me.setAttribute("aria-label",`Select all: ${C.purpose_reason||"purposes"}`),me.onchange=()=>Pe(Q,me.checked),pe.push({box:me,ids:Q}),st.append(E,me);let at=y("div",void 0,"pb");for(let M of V){let re=t.purposes.find(lt=>lt.id===M.purpose_id),Ee=y("div",void 0,"pr"),Ke=y("label",void 0,"prh");Ke.append(y("span",j(M.purpose_name||re?.name),"pn"));let ie=y("input");ie.type="checkbox",ie.name=String(M.purpose_id),ie.disabled=!!re?.required,ie.onchange=()=>Pe([M.purpose_id],ie.checked),le.set(M.purpose_id,[...le.get(M.purpose_id)||[],ie]),Ke.append(ie),Ee.append(Ke),re?.description&&Ee.append(y("p",j(re.description),"ps"));let ct=un(M.data_items,M.data_categories);ct&&Ee.append(ct),at.append(Ee)}it.append(st,y("hr",void 0,"hr"),at),oe.append(it)}else if(A==="data_share_section"){for(let C of u.shared||[]){let V=y("div",void 0,"sh");V.append(y("span",j(C.purpose_name)||"Sharing","gt"));let Q=un(C.data_items,C.data_categories);Q&&V.append(Q),oe.append(V)}oe.childElementCount||oe.append(y("p","NIL","st"))}oe.childElementCount&&I.append(oe),ne.append(I)}de();let ve=y("div");ve.id="feedback",ve.setAttribute("aria-live","polite"),ne.append(ve),ne.onsubmit=h=>{h.preventDefault(),p()},Me.append(ne),Y.append(Me);let z=ke?.buttons?.length?ke.buttons:[{button_type:"accept-all",button_text:"Accept All",button_enabled:!0},{button_type:"reject-all",button_text:"Reject All",button_enabled:!0},{button_type:"accept-necessary",button_enabled:!0,button_data:{accept_necessary_text:"Accept Necessary",accept_selected_text:"Accept Selected"}}],Te=y("div",void 0,"foot"),$e=y("div",void 0,"actions"),Ye=h=>{h==="accept-all"?t.purposes.forEach(v=>o.choices[String(v.id)]=!0):h==="reject-all"&&t.purposes.forEach(v=>o.choices[String(v.id)]=v.required),p()},F=[...z.filter(h=>h.button_type!=="accept-necessary"),...z.filter(h=>h.button_type==="accept-necessary")];for(let h of F){if(h.button_enabled===!1)continue;let v=h.button_type==="accept-necessary",A=y("button",void 0,v?"primary":void 0);A.type="button",A.dataset.type=h.button_type,A.textContent=v?h.button_data?.accept_necessary_text||"Accept Necessary":h.button_text||h.button_type,A.onclick=()=>Ye(h.button_type),v&&(A.dataset.necessary=h.button_data?.accept_necessary_text||"Accept Necessary",A.dataset.selected=h.button_data?.accept_selected_text||"Accept Selected"),$e.append(A)}return Te.append($e),Y.append(Te),n.append(Y),de(),(r==="popup"||r==="page")&&Y.addEventListener("keydown",Ve),r!=="panel"&&!s&&(Y.tabIndex=-1,Y.focus({preventScroll:!0})),de;function fe(){let h=n.querySelector("button.primary");if(!h?.dataset.necessary)return;let v=t.purposes.some(A=>!A.required&&o.choices[String(A.id)]);h.textContent=v?h.dataset.selected:h.dataset.necessary}function Ve(h){if(h.key==="Escape"){d();return}if(h.key!=="Tab")return;let v=[...n.querySelectorAll("button:not([disabled]),input:not([disabled]),summary,a[href]")],A=v[0],I=v[v.length-1],he=n.getRootNode().activeElement;h.shiftKey&&(he===A||he===Y)?(h.preventDefault(),I?.focus()):!h.shiftKey&&(he===I||he===Y)&&(h.preventDefault(),A?.focus())}}var hn=`*{box-sizing:border-box}:host{all:initial;display:block}.theme,.root{height:100%}.root{background:var(--page);color:var(--text);font:var(--fs)/1.5 var(--font)}button,input{font:inherit;color:inherit}button{cursor:pointer}button:disabled{cursor:wait;opacity:.65}button:focus-visible,input:focus-visible,a:focus-visible{outline:3px solid var(--primary);outline-offset:2px}.shell:focus{outline:none}.shell{max-width:560px;margin:auto;background:var(--bg);height:100%;display:flex;flex-direction:column;position:relative}.body{flex:1;min-height:0;overflow:auto;padding:var(--pad) var(--pad) 8px;display:flex;flex-direction:column;gap:var(--gap)}h1{font-size:calc(var(--fs) + 2px);line-height:1.4;font-weight:700;margin:0}.sec{display:flex;flex-direction:column;gap:calc(var(--gap) * .5);padding-bottom:var(--gap)}.st{font-weight:700;margin:0}.text{margin:0;white-space:pre-wrap}.text :is(p,ul,ol,pre,blockquote){margin:0 0 .5em}.text>:last-child{margin-bottom:0}.text a{color:var(--primary)}.grps{display:flex;flex-direction:column;gap:calc(var(--gap) * .6)}.grp{border:1.2px solid var(--line);border-radius:var(--r-card)}.gh{display:flex;width:100%;gap:12px;align-items:center;padding:var(--rowy) var(--rowx);background:none;border:0;text-align:left}.gx{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}.gt{font-weight:600}.gd{font-size:12px;font-weight:400;color:var(--muted);display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}@media(min-width:480px){.gd{-webkit-line-clamp:2}}.chev{flex-shrink:0;width:1.25em;height:1.25em;fill:currentColor;transition:transform .2s ease}.open .chev{transform:rotate(180deg)}.gb{display:none;flex-direction:column;gap:4px;padding:0 var(--rowx) var(--rowx)}.open .gb{display:flex}.gi{font-size:16px;font-weight:800}.pg{display:flex;flex-direction:column}.ph{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:var(--rowy) var(--rowx)}.hr{border:0;border-top:1px solid var(--line);margin:0}.pb{display:flex;flex-direction:column;padding:var(--rowy) var(--rowx)}.pr{display:flex;flex-direction:column;gap:2px;padding:4px 0}.prh{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:28px;cursor:pointer}.pn{font-size:15px;font-weight:800;min-width:0;flex:1}.ps{font-size:12px;font-weight:400;color:var(--muted);padding-right:32px}.more{background:none;border:0;padding:0;margin-left:4px;color:var(--muted);text-decoration:underline;font-size:12px}.pg input[type=checkbox]{width:16px;height:16px;margin:0;flex-shrink:0;accent-color:var(--primary)}.sh{display:flex;flex-direction:column;gap:2px;border:1.2px solid var(--line);border-radius:var(--r-card);padding:8px 16px}.foot{position:relative;flex-shrink:0;padding:0 var(--pad) var(--pad)}.foot:before{content:"";position:absolute;left:0;right:0;top:-50px;height:50px;background:linear-gradient(to top,var(--bg),var(--bg),transparent);pointer-events:none}.actions{display:flex;flex-direction:column;gap:calc(var(--gap) * .4)}.actions button{min-height:calc(var(--btn) - 8px);padding:0 16px;border-radius:var(--r-btn);border:1px solid var(--text);background:transparent;color:var(--text);font-weight:600;width:100%}.actions button:hover:not(:disabled){background:color-mix(in srgb,var(--text) 8%,transparent)}.actions .primary{min-height:var(--btn);background:var(--primary);border-color:var(--primary);color:var(--on-primary)}.actions .primary:hover:not(:disabled){background:var(--primary);filter:brightness(.92)}.close{position:absolute;top:10px;right:12px;background:none;border:0;font-size:23px;line-height:1;color:var(--muted);padding:4px 10px;z-index:1}.message{padding:12px 14px;border-radius:8px;background:#eff8f2;color:#19683e}.error{background:#fff0ef;color:#a43328}.root[data-mode=page] .shell{margin:36px auto;height:auto;max-height:calc(100dvh - 72px);border-radius:calc(var(--r-card) + 6px);box-shadow:0 15px 60px #16324c12}.root[data-mode=panel]{background:var(--bg);--fs: 14px}.root[data-mode=panel] .shell{max-width:none}@media(max-width:520px){.root[data-mode=page] .shell{margin:0;border-radius:0;height:100dvh;max-height:none}}
|
|
4
|
+
`;var Lo=new WeakMap;function Do(n){let t=n.ownerDocument,o=t.defaultView;if(o&&"adoptedStyleSheets"in o.Document.prototype&&"replaceSync"in o.CSSStyleSheet.prototype){let s=Lo.get(t);s||(s=new o.CSSStyleSheet,s.replaceSync(hn),Lo.set(t,s)),n.adoptedStyleSheets=[s];return}let r=t.createElement("style");r.textContent=hn,n.append(r)}var te=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),$=n=>n==null||typeof n=="string",be=(n,t)=>n==null||Array.isArray(n)&&n.length<=1e3&&n.every(t),mn=n=>be(n,t=>typeof t=="string"),Io=n=>be(n,t=>te(t)&&$(t.data_item_name));function Et(n,t){if(!te(n)||!$(n.sections_language_code))return!1;let o=new Set(t.map(p=>p.id)),r=new Set,s=p=>te(p)&&["accept-all","reject-all","accept-necessary"].includes(p.button_type)&&$(p.button_text)&&(p.button_enabled===void 0||typeof p.button_enabled=="boolean")&&(p.button_data==null||te(p.button_data)&&$(p.button_data.accept_necessary_text)&&$(p.button_data.accept_selected_text)),d=(p,f=0)=>{if(!te(p)||typeof p.section_type!="string"||!te(p.section_data))return!1;let u=p.section_data;return f<8&&$(u.title)&&$(u.section_title)&&$(u.section_body)&&be(u.buttons,s)&&be(u.sections,_=>d(_,f+1))};return(n.content==null||te(n.content)&&be(n.content.consent_data,p=>d(p)))&&be(n.purposes,p=>te(p)&&$(p.purpose_reason)&&$(p.desc)&&be(p.sub_items,f=>!te(f)||!o.has(f.purpose_id)||r.has(f.purpose_id)?!1:(r.add(f.purpose_id),$(f.purpose_name)&&Io(f.data_items)&&mn(f.data_categories))))&&be(n.collected,p=>te(p)&&$(p.data_category_name)&&$(p.desc)&&mn(p.sub_items))&&be(n.shared,p=>te(p)&&$(p.purpose_name)&&Io(p.data_items)&&mn(p.data_categories))}var wt=class{constructor(t){this.options=t;this.syncChecks=()=>{};this.pendingKey="";this.pendingBody="";this.needsRefresh=!1;let o=t.host.attachShadow({mode:"open"});Do(o);let r=document.createElement("div");r.className="theme",r.lang=t.config.language_code,this.root=document.createElement("div"),this.root.className="root",this.root.dataset.mode=t.mode,r.append(this.root),o.append(r),this.appearance=Qn(r),this.appearance.apply(t.appearance),this.state={choices:{...t.choices},busy:!1}}render(){let{config:t,mode:o,demo:r=!1,onClose:s}=this.options;try{if(!Et(t.notice,t.purposes))throw new Error("Invalid notice");this.syncChecks=Oo({root:this.root,config:t,state:this.state,mode:o,demo:r,onClose:s,onSubmit:()=>this.submit(),onChange:()=>{this.pendingKey=""}})}catch{let d="The consent form could not be displayed. Check the notice configuration and reload.",p=y("section",void 0,"shell"),f=y("p",d,"message error");f.setAttribute("role","alert");let u=y("div",void 0,"body");if(u.append(f),p.append(u),o!=="panel"){let _=y("button","\xD7","close");_.setAttribute("aria-label","Close consent form"),_.type="button",_.onclick=s,p.append(_)}this.root.replaceChildren(p),o!=="panel"&&!r&&p.querySelector("button")?.focus(),this.options.onError(new w(d,"form_error"))}}setAppearance(t){this.appearance.apply(t),this.render()}destroy(){this.appearance.destroy()}message(t,o=!1){let r=this.root.querySelector("#feedback");r&&(r.textContent=t,r.className=o?"message error":"message",r.setAttribute("role",o?"alert":"status"))}async submit(){let{state:t,root:o,options:r}=this;if(t.busy||this.needsRefresh)return;t.busy=!0;let s=[...o.querySelectorAll("input:not(:disabled)")];s.forEach(u=>u.disabled=!0),o.querySelectorAll("button:not(.close)").forEach(u=>u.disabled=!0);let d={config_version:r.config.config_version,language_code:r.config.language_code,answers:r.config.purposes.map(u=>({purpose_id:u.id,given:!!t.choices[String(u.id)]}))},p=JSON.stringify(d);(!this.pendingKey||this.pendingBody!==p)&&(this.pendingKey=$n(),this.pendingBody=p);let f;try{f=await r.save(d,this.pendingKey),t.choices=f.choices,this.message(r.demo?"Demo complete. No record was saved.":"Your choices are saved.")}catch(u){let _=u instanceof Error?u.message:"Your choices could not be saved. Please retry.";if(this.message(_,!0),u instanceof w&&u.code==="notice_changed"&&r.onRefresh){this.needsRefresh=!0;let S=y("button","Reload consent form");S.type="button",S.onclick=()=>void r.onRefresh().catch(()=>{}),o.querySelector("#feedback")?.append(S)}r.onError(u)}finally{t.busy=!1,o.querySelectorAll("button").forEach(u=>u.disabled=!1),s.forEach(u=>u.disabled=!1),this.syncChecks(),this.needsRefresh&&o.querySelectorAll(".actions button").forEach(u=>{u.disabled=!0})}f&&r.onComplete(f)}};function X(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function gn(n,t){if(!X(n))return!1;let o=new Set(t.purposes.map(r=>String(r.id)));return Object.entries(n).every(([r,s])=>o.has(r)&&typeof s=="boolean")}function rt(n,t){if(!X(n)||n.app_id!==t||typeof n.name!="string"||typeof n.level_id!="string"||!n.level_id||typeof n.mode!="string"||!["panel","popup","page"].includes(n.mode)||typeof n.config_version!="string"||!/^[a-f0-9]{64}$/i.test(n.config_version)||typeof n.language_code!="string"||!n.language_code||!Array.isArray(n.purposes)||!n.purposes.length||n.purposes.length>300||!X(n.notice)||n.description!==null&&typeof n.description!="string"||n.template_id!==null&&typeof n.template_id!="string"||typeof n.revision!="number"||!Number.isInteger(n.revision)||n.revision<1||typeof n.sdk_version!="string"||!n.sdk_version||n.appearance!==void 0&&!X(n.appearance))return!1;let o=new Set;return n.purposes.every(r=>!X(r)||typeof r.id!="number"||!Number.isSafeInteger(r.id)||r.id<1||o.has(r.id)||typeof r.name!="string"||typeof r.required!="boolean"||!Array.isArray(r.data_items)||typeof r.description!="string"?!1:(o.add(r.id),!0))&&Et(n.notice,n.purposes)}var At=class{notePointer(t){this.pointerFocus=t.composedPath().find(o=>o instanceof HTMLElement&&o.matches("button,a[href],input,select,textarea,[tabindex]"))}activate(t){let o=document.activeElement;for(;o?.shadowRoot?.activeElement;)o=o.shadowRoot.activeElement;this.previousFocus=o instanceof HTMLElement&&o!==document.body?o:this.pointerFocus?.isConnected?this.pointerFocus:void 0,this.previousOverflow=document.body.style.overflow,document.body.style.overflow="hidden",t.showModal()}release(){this.previousOverflow!==void 0&&(document.body.style.overflow=this.previousOverflow,this.previousOverflow=void 0),this.previousFocus?.isConnected&&this.previousFocus.focus({preventScroll:!0}),this.previousFocus=void 0,this.pointerFocus=void 0}};function Mo(n,t){let o=document.createElement("dialog");return o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-label","Consent preferences"),o.style.cssText="position:fixed;inset:0;margin:0;border:0;padding:0;width:100%;height:100%;max-width:none;max-height:none;z-index:2147483000;display:flex;align-items:center;justify-content:center;box-sizing:border-box",t==="page"?(o.style.cssText+=";background:white",n.style.cssText+=";width:100%;height:100%;border-radius:0"):(o.style.cssText+=";background:#10182888;padding:20px",n.style.cssText+=";width:min(560px,100%);height:min(760px,90dvh);border-radius:16px;overflow:hidden;box-shadow:0 20px 70px #0004"),o}var St;function Po(n){St?.close(),St=n}function No(n){St===n&&(St=void 0)}function Uo(n){let t=new URL(n,window.location.href);if(t.username||t.password||t.search||t.hash)throw new Error("Use an Atlas backend base URL without credentials or query parameters.");if(t.protocol!=="https:"&&!(t.protocol==="http:"&&(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]"||t.hostname.endsWith(".localhost"))))throw new Error("Atlas Consent requires HTTPS. HTTP is only supported for localhost.");return t.href.replace(/\/$/,"")}function yn(n){if(!n)return;let t;try{t=JSON.parse(n)}catch{return}if(!t||typeof t.token!="string"||!t.token||typeof t.expires!="string"||!Number.isFinite(Date.parse(t.expires)))return;let o=t.result;return{token:t.token,expires:t.expires,result:o&&typeof o=="object"&&typeof o.ref_id=="string"?o:void 0}}function xt(n){try{return localStorage.getItem(n)}catch{return}}function Fo(n,t){try{return t?localStorage.setItem(n,JSON.stringify(t)):localStorage.removeItem(n),!0}catch{try{localStorage.removeItem(n)}catch{}return!1}}var kt="atlas-consent:storage";async function Ho(n,t,o,r="Consent is temporarily unavailable."){if(t.aborted)throw new w("This consent instance was destroyed.","destroyed");let s=new AbortController,d=()=>s.abort();t.addEventListener("abort",d);let p=setTimeout(d,15e3),f,u;try{f=await fetch(n,{...o,signal:s.signal,credentials:"omit",headers:{"Content-Type":"application/json",...o?.headers}}),u=await f.json()}catch(_){throw t.aborted?new w("This consent instance was destroyed.","destroyed"):s.signal.aborted?new w("Atlas took too long to respond.","request_timeout"):_ instanceof SyntaxError||_ instanceof DOMException&&_.name==="SyntaxError"?new w(f?.ok?"Atlas returned an invalid response.":r,f&&!f.ok?"request_failed":"invalid_response",f?.status):new w("Atlas could not be reached.","network_error",f?.status)}finally{clearTimeout(p),t.removeEventListener("abort",d)}if(!f.ok||!X(u)||u.data===void 0||u.data===null){let _=X(u)&&X(u.error)?u.error:{};throw new w(typeof _.message=="string"&&_.message?_.message:r,typeof _.code=="string"?_.code:typeof _.type=="string"?_.type:"request_failed",f.status)}return u.data}var Br=60*864e5,qe=n=>({ref_id:n.ref_id,app_id:n.app_id,level_id:n.level_id,config_version:n.config_version,choices:{...n.choices}}),Rt=class{constructor(t){this.options=t;this.controller=new AbortController;this.preferenceSnapshot="null";this.accessibility=new At;this.destroyed=!1;this.generation=0;this.reportedErrors=new WeakSet;this.storageChanged=t=>{(t.key===null||t.key===this.key)&&this.syncSaved()};this.documentStorageChanged=t=>{t.detail===this.key&&this.syncSaved()};this.keydown=t=>{t.key==="Escape"&&this.overlay&&this.close()};this.pointerdown=t=>this.accessibility.notePointer(t);if(!/^ac_app_[A-Za-z0-9_-]{10,40}$/.test(t.appId))throw new w("Use the app ID from Atlas Integrations.","invalid_app");let o=t.apiBaseUrl??qn;if(!o)throw new w("Set apiBaseUrl or use an SDK build with a configured backend URL.","invalid_api_base_url");try{this.api=Uo(o)}catch(s){throw new w(s.message,"invalid_api_base_url")}this.key=`atlas-consent:v2:${encodeURIComponent(this.api)}:${t.appId}`,this.stored=xt(this.key),this.saved=yn(this.stored??null),window.addEventListener("keydown",this.keydown),window.addEventListener("pointerdown",this.pointerdown,!0),window.addEventListener("storage",this.storageChanged),window.addEventListener(kt,this.documentStorageChanged);let r=this.generation;this.ready=this.load().then(s=>{if(this.destroyed)throw new w("This consent instance was destroyed.","destroyed");return this.config=s,this.notifyPreference(),this.renewIfEnding(),r!==this.generation||(t.target?this.mount(t.target).catch(()=>{}):(t.mode||s.mode)==="popup"&&t.autoShow!==!1&&!this.hasChoice()&&this.open().catch(()=>{})),s}),this.ready.catch(s=>{this.loadFailure=s,this.fail(s)})}async load(){let t=await this.request(`/config?language_code=${encodeURIComponent(this.options.language||"en")}`);if(!rt(t,this.options.appId))throw new w("Atlas returned an invalid configuration.","invalid_response");return t}request(t,o,r){return this.assertAlive(),Ho(`${this.api}/consent-sdk/v1/apps/${this.options.appId}${t}`,this.controller.signal,o,r)}persist(){let t=this.stored,o=Fo(this.key,this.saved),r=o?this.saved?JSON.stringify(this.saved):null:xt(this.key);r!==void 0&&(this.stored=r),this.notifyPreference(),(o||t!==this.stored)&&window.dispatchEvent(new CustomEvent(kt,{detail:this.key}))}syncSaved(){if(this.destroyed)return;let t=xt(this.key);if(t===void 0||t===this.stored)return;let o=yn(t),r=o?.token!==this.saved?.token||JSON.stringify(o?.result)!==JSON.stringify(this.saved?.result);this.stored=t,this.saved=o,r&&this.form&&this.close(!0),this.notifyPreference()}notifyPreference(){let t=this.hasChoice()?qe(this.saved.result):null,o=JSON.stringify(t);if(o!==this.preferenceSnapshot){this.preferenceSnapshot=o;try{this.options.onPreferenceChange?.(t?qe(t):null)}catch(r){queueMicrotask(()=>{throw r})}window.dispatchEvent(new CustomEvent("atlas-consent:change",{detail:{appId:this.options.appId,preference:t?qe(t):null}}))}}alive(){return!!this.saved&&Date.parse(this.saved.expires)>Date.now()}hasChoice(){return!!this.config&&this.alive()&&bt(this.saved.result,this.config)}getPreference(){return this.syncSaved(),this.notifyPreference(),this.hasChoice()?qe(this.saved.result):null}getClaim(){return this.syncSaved(),this.alive()&&this.saved.result?.app_id===this.options.appId?{app_id:this.options.appId,ref_id:this.saved.result.ref_id,claim_token:this.saved.token}:null}async session(t){this.syncSaved();let o=this.stored,r=this.saved;if(this.alive())try{let d=await this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${r.token}`}});if(t!==this.generation)return{};if(this.syncSaved(),t!==this.generation)return{};if(o!==this.stored)return this.session(t);if(!X(d)||!rt(d.config,this.options.appId)||!gn(d.choices,d.config))throw new w("Atlas returned an invalid session.","invalid_response");return this.reconcileSession(d,r),typeof d.expires_at=="string"&&Number.isFinite(Date.parse(d.expires_at))&&(r.expires=d.expires_at),this.persist(),d.choices}catch(d){if(t!==this.generation)return{};if(!(d instanceof w)||d.status!==401)throw d;this.saved=void 0,this.persist(),o=this.stored}let s=await this.request("/sessions",{method:"POST",body:JSON.stringify({language_code:this.options.language||"en"})});if(t!==this.generation)return{};if(this.syncSaved(),t!==this.generation)return{};if(o!==this.stored)return this.session(t);if(!X(s)||typeof s.session_token!="string"||!s.session_token||typeof s.expires_at!="string"||!Number.isFinite(Date.parse(s.expires_at))||!rt(s.config,this.options.appId))throw new w("Atlas returned an invalid session.","invalid_response");return this.config=s.config,this.saved={token:s.session_token,expires:s.expires_at},this.persist(),{}}reconcileSession(t,o){let r=t.config,s=o.result;if(s?.config_version===r.config_version){let d={...s,choices:t.choices};o.result=bt(d,r)&&t.ref_id===s.ref_id?d:void 0}this.config=r}renewIfEnding(){if(!this.alive()||Date.parse(this.saved.expires)-Date.now()>Br)return;let t=this.saved,o=this.stored;this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${t.token}`}}).then(r=>{this.syncSaved(),this.saved===t&&this.stored===o&&X(r)&&rt(r.config,this.options.appId)&&gn(r.choices,r.config)&&typeof r.expires_at=="string"&&Number.isFinite(Date.parse(r.expires_at))&&(this.reconcileSession(r,t),t.expires=r.expires_at,this.persist())}).catch(()=>{})}async save(t,o,r,s,d){if(this.syncSaved(),d!==this.generation||this.saved?.token!==s)throw new w("This consent form was closed. Open it again.","form_closed");let p=await this.request("/decisions",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Idempotency-Key":o},body:JSON.stringify({...t,sdk_version:Zt})},"Your choices could not be saved. Please retry.");if(!bt(p,r))throw new w("Atlas returned an invalid consent result. Please retry.","invalid_response");let f=p.expires_at;return d===this.generation&&this.saved?.token===s&&typeof f=="string"&&Number.isFinite(Date.parse(f))&&(this.saved.expires=f),qe(p)}recordView(){this.request("/events",{method:"POST",headers:{Authorization:`Bearer ${this.saved?.token}`},body:JSON.stringify({event:"viewed"})}).catch(()=>{})}async reported(t){try{await t()}catch(o){throw o!==this.loadFailure&&this.fail(o),o}}mount(t){return this.reported(()=>this.mountForm(t))}async mountForm(t){let o=this.generation;if(await this.ready,this.assertAlive(),o!==this.generation)return;let r=typeof t=="string"?document.querySelector(t):t;if(!(r instanceof HTMLElement))throw new w("The consent container was not found.","missing_container");return this.startForm(this.options.mode||this.config?.mode||"panel",r)}open(){return this.reported(async()=>{let t=this.generation;if(await this.ready,this.assertAlive(),t!==this.generation)return;if(this.host&&!this.overlay){this.host.scrollIntoView({block:"nearest"}),this.host.focus({preventScroll:!0});return}let o=this.options.mode||this.config.mode;return this.startForm(o==="panel"?"popup":o)})}refresh(){let t=this.mountTarget;return this.close(!0),t?this.mount(t):this.open()}startForm(t,o){if(this.form)return Promise.resolve();if(this.launchTask)return this.launchTask;let r=this.generation,s=Promise.resolve().then(()=>this.insertForm(t,o,r));this.launchTask=s;let d=()=>{this.launchTask===s&&(this.launchTask=void 0)};return s.then(d,d),s}async insertForm(t,o,r){try{if(this.assertAlive(),r!==this.generation)return;let s=await this.session(r);if(this.assertAlive(),r!==this.generation)return;o||Po(this);let d=this.createForm(t,s);if(o)this.mountTarget=o,this.host.tabIndex=-1,this.host.setAttribute("role","region"),this.host.setAttribute("aria-label","Consent preferences"),o.append(this.host);else{this.overlay=Mo(this.host,t);let p=this.overlay;p.addEventListener("cancel",f=>{f.preventDefault(),this.overlay===p&&this.close()}),p.addEventListener("close",()=>{this.overlay===p&&this.close()}),this.overlay.append(this.host),document.body.append(this.overlay),this.accessibility.activate(this.overlay)}d.render(),this.recordView()}catch(s){if(this.destroyed)throw s;if(r!==this.generation)return;throw this.close(!0),s}}createForm(t,o){let r=this.generation,s=this.saved.token,d=this.config,p=document.createElement("atlas-consent-form");return p.style.cssText="display:block;width:100%;height:650px",this.host=p,this.form=new wt({host:p,config:this.config,choices:o,mode:t,appearance:{...this.config?.appearance,...this.options.appearance},save:(f,u)=>this.save(f,u,d,s,r),onComplete:f=>{this.syncSaved(),r===this.generation&&this.saved?.token===s&&this.complete(f)},onError:f=>{r===this.generation&&this.fail(f)},onClose:()=>{r===this.generation&&this.close()},onRefresh:()=>r===this.generation?this.refresh():Promise.resolve()}),this.form}complete(t){let o=this.overlay,r={app_id:t.app_id,ref_id:t.ref_id,claim_token:this.saved.token};this.saved.result=qe(t),this.persist();try{this.options.onComplete?.(t,r)}finally{o&&this.overlay===o&&this.close()}}assertAlive(){if(this.destroyed)throw new w("This consent instance was destroyed.","destroyed")}fail(t){if(this.destroyed||t instanceof w&&t.code==="destroyed")return;if(t&&typeof t=="object"){if(this.reportedErrors.has(t))return;this.reportedErrors.add(t)}let o=t instanceof w?t:new w(t instanceof Error?t.message:"Consent is unavailable.","unexpected_error");try{this.options.onError?.(o)}catch(r){queueMicrotask(()=>{throw r})}window.dispatchEvent(new CustomEvent("atlas-consent:error",{detail:{appId:this.options.appId,error:o}}))}close(t=!1){this.generation+=1,this.launchTask=void 0,No(this);let o=!!(this.form||this.overlay);this.form?.destroy(),this.form=void 0,this.host?.remove(),this.host=void 0,this.mountTarget=void 0,this.overlay?.close(),this.overlay?.remove(),this.overlay=void 0,this.accessibility.release(),o&&!t&&this.options.onClose?.()}destroy(){this.destroyed=!0,this.controller.abort(),this.close(!0),window.removeEventListener("keydown",this.keydown),window.removeEventListener("pointerdown",this.pointerdown,!0),window.removeEventListener("storage",this.storageChanged),window.removeEventListener(kt,this.documentStorageChanged)}};function Mi(n){return new Rt(n)}export{Rt as ConsentClient,w as ConsentError,Zt as VERSION,Mi as create};
|
|
5
5
|
/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
dompurify/dist/purify.es.mjs:
|