@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.
@@ -1,7 +1,7 @@
1
- "use strict";var AtlasConsent=(()=>{var nn=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var ur=Object.getOwnPropertyNames;var fr=Object.prototype.hasOwnProperty;var hr=(n,e)=>{for(var o in e)nn(n,o,{get:e[o],enumerable:!0})},mr=(n,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ur(e))!fr.call(n,s)&&s!==o&&nn(n,s,{get:()=>e[s],enumerable:!(r=dr(e,s))||r.enumerable});return n};var gr=n=>mr(nn({},"__esModule",{value:!0}),n);var Qr={};hr(Qr,{ConsentClient:()=>st,ConsentError:()=>v,VERSION:()=>Ge,create:()=>An});var Tt="https://play.dashboard.atlaskyc.com/v3/api";var Ge="1.0.0";function Zn(){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 Et(n,e){if(!n||typeof n!="object")return!1;let o=n;return typeof o.ref_id!="string"||!o.ref_id||o.app_id!==e.app_id||o.level_id!==e.level_id||o.config_version!==e.config_version||!o.choices||typeof o.choices!="object"||Array.isArray(o.choices)?!1:Object.keys(o.choices).length===e.purposes.length&&e.purposes.every(r=>typeof o.choices[String(r.id)]=="boolean"&&(!r.required||o.choices[String(r.id)]))}var v=class extends Error{constructor(o,r,s=0){super(o);this.code=r;this.status=s;this.name="ConsentError"}};var Qn={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"},eo={sharp:["2px","2px"],soft:["6px","6px"],round:["999px","16px"]},yr=/^#[0-9a-f]{6}$/i,De={theme:"light",primary_color:"#ae0a60",background_color:"#ffffff",text_color:"#1a202c",radius:"soft",font:"system",density:"comfortable"},to={background_color:"#0f172a",text_color:"#f1f5f9"};function no(n){let[e,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*e+.7152*o+.0722*r}function oo(n,e){let o=no(n),r=no(e);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function ro(n,e,o){let r={...De,...e||{}};for(let _ of["primary_color","background_color","text_color"])(typeof r[_]!="string"||!yr.test(r[_]))&&(r[_]=De[_]);(typeof r.radius!="string"||!Object.prototype.hasOwnProperty.call(eo,r.radius))&&(r.radius=De.radius),(typeof r.font!="string"||!Object.prototype.hasOwnProperty.call(Qn,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=to.background_color),r.text_color.toLowerCase()===De.text_color&&(r.text_color=to.text_color));let[p,l]=eo[r.radius],f=r.density==="compact",u={"--primary":r.primary_color,"--bg":r.background_color,"--text":r.text_color,"--on-primary":oo(r.primary_color,"#000000")>oo(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":Qn[r.font],"--r-btn":p,"--r-card":l,"--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 io(n){let e=window.matchMedia("(prefers-color-scheme: dark)"),o,r=()=>{o?.theme==="system"&&ro(n,o,e)};return e.addEventListener("change",r),{apply(s){o=s,ro(n,s,e)},destroy(){e.removeEventListener("change",r)}}}function _r(n,e){this.v=n,this.k=e}function so(n,e){(e==null||e>n.length)&&(e=n.length);for(var o=0,r=Array(e);o<e;o++)r[o]=n[o];return r}function br(n){if(Array.isArray(n))return n}function vr(n,e){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var r,s,p,l,f=[],u=!0,_=!1;try{if(p=(o=o.call(n)).next,e===0){if(Object(o)!==o)return;u=!1}else for(;!(u=(r=p.call(o)).done)&&(f.push(r.value),f.length!==e);u=!0);}catch(S){_=!0,s=S}finally{try{if(!u&&o.return!=null&&(l=o.return(),Object(l)!==l))return}finally{if(_)throw s}}return f}}function Tr(){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 Er(n,e){return br(n)||vr(n,e)||wr(n,e)||Tr()}function wr(n,e){if(n){if(typeof n=="string")return so(n,e);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)?so(n,e):void 0}}function wt(n){var e,o;function r(p,l){try{var f=n[p](l),u=f.value,_=u instanceof _r;Promise.resolve(_?u.v:u).then(function(S){if(_){var H=p==="return"&&u.k?p:"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(p,l){p===2?e.reject(l):e.resolve({value:l,done:p}),(e=e.next)?r(e.key,e.arg):o=null}this._invoke=function(p,l){return new Promise(function(f,u){var _={key:p,arg:l,resolve:f,reject:u,next:null};o?o=o.next=_:(e=o=_,r(p,l))})},typeof n.return!="function"&&(this.return=void 0)}wt.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},wt.prototype.next=function(n){return this._invoke("next",n)},wt.prototype.throw=function(n){return this._invoke("throw",n)},wt.prototype.return=function(n){return this._invoke("return",n)};var Eo=Object.entries,ao=Object.setPrototypeOf,Ar=Object.isFrozen,wo=Object.getPrototypeOf,Ao=Object.getOwnPropertyDescriptor,P=Object.freeze,U=Object.seal,We=Object.create,So=typeof Reflect<"u"&&Reflect,fn=So.apply,hn=So.construct;P||(P=function(e){return e});U||(U=function(e){return e});fn||(fn=function(e,o){for(var r=arguments.length,s=new Array(r>2?r-2:0),p=2;p<r;p++)s[p-2]=arguments[p];return e.apply(o,s)});hn||(hn=function(e){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 e(...r)});var ye=R(Array.prototype.forEach);Array.prototype.indexOf;var Sr=R(Array.prototype.lastIndexOf),co=R(Array.prototype.pop),tt=R(Array.prototype.push),xr=R(Array.prototype.slice),kr=R(Array.prototype.splice),qe=Array.isArray,on=xo(Set),rn=R(Set.prototype.add),nt=R(Set.prototype.has),Ie=R(String.prototype.toLowerCase),sn=R(String.prototype.toString),lo=R(String.prototype.match),ot=R(String.prototype.replace),po=R(String.prototype.indexOf),Rr=R(String.prototype.trim),Cr=R(Number.prototype.toString),Or=R(Boolean.prototype.toString),uo=typeof BigInt>"u"?null:R(BigInt.prototype.toString),fo=typeof Symbol>"u"?null:R(Symbol.prototype.toString),q=R(Object.prototype.hasOwnProperty),rt=R(Object.prototype.toString),N=R(RegExp.prototype.test),_e=xo(TypeError);function R(n){return function(e){e instanceof RegExp&&(e.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 fn(n,e,r)}}function xo(n){return function(){for(var e=arguments.length,o=new Array(e),r=0;r<e;r++)o[r]=arguments[r];return hn(n,o)}}function E(n,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;if(ao&&ao(n,null),!qe(e))return n;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let p=o(s);p!==s&&(Ar(e)||(e[r]=p),s=p)}n[s]=!0}return n}function Lr(n){for(let e=0;e<n.length;e++)q(n,e)||(n[e]=null);return n}function K(n){let e=We(null);for(let r of Eo(n)){var o=Er(r,2);let s=o[0],p=o[1];q(n,s)&&(qe(p)?e[s]=Lr(p):p&&typeof p=="object"&&p.constructor===Object?e[s]=K(p):e[s]=p)}return e}function Dr(n){switch(typeof n){case"string":return n;case"number":return Cr(n);case"boolean":return Or(n);case"bigint":return uo?uo(n):"0";case"symbol":return fo?fo(n):"Symbol()";case"undefined":return rt(n);case"function":case"object":{if(n===null)return rt(n);let e=n,o=J(e,"toString");if(typeof o=="function"){let r=o(e);return typeof r=="string"?r:rt(r)}return rt(n)}default:return rt(n)}}function J(n,e){for(;n!==null;){let r=Ao(n,e);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}n=wo(n)}function o(){return null}return o}function Ir(n,e){for(;n!==null;){let o=Ao(n,e);if(o)return o.get?R(o.get):null;n=wo(n)}return null}function Mr(n){try{return N(n,""),!0}catch{return!1}}var ho=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"]),an=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"]),cn=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"]),Pr=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"]),ln=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"]),Nr=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),mo=P(["#text"]),go=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"]),pn=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"]),yo=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"]),At=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ur=U(/{{[\w\W]*|^[\w\W]*}}/g),Fr=U(/<%[\w\W]*|^[\w\W]*%>/g),Hr=U(/\${[\w\W]*/g),zr=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Br=U(/^aria-[\-\w]+$/),_o=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jr=U(/^(?:\w+script|data):/i),Gr=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wr=U(/^html$/i),qr=U(/^[a-z][.\w]*(-[.\w]+)+$/i),dn=U(/<[/\w!]/g),bo=U(/<[/\w]/g),$r=U(/<\/no(script|embed|frames)/i),vo=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},Yr=P(E({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Vr=function(){return typeof window>"u"?null:window},Kr=function(e,o){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";o&&o.hasAttribute(s)&&(r=o.getAttribute(s));let p="dompurify"+(r?"#"+r:"");try{return e.createPolicy(p,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}},To=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},xe=function(e,o,r,s){return q(e,o)&&qe(e[o])?E(s.base?K(s.base):{},e[o],s.transform):r},un=function(e,o,r){let s=q(e,o)?e[o]:void 0;return s&&typeof s=="object"?K(s):r()};function ko(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vr(),e=d=>ko(d);if(e.version="3.4.17",e.removed=[],!n||!n.document||n.document.nodeType!==L.document||!n.Element)return e.isSupported=!1,e;let o=n.document,r=o,s=r.currentScript;n.DocumentFragment;let p=n.HTMLTemplateElement,l=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=l&&l.prototype?J(l.prototype,"nodeType"):null,ue=l&&l.prototype?J(l.prototype,"nodeName"):null,ve=l&&l.prototype?J(l.prototype,"ownerDocument"):null,z=function(t){return Z?Z(t):t.nodeType},Te=function(t){return ue?ue(t):t.nodeName},Ye=Ir(H,"namespaceURI"),Ve=function(t){return Ye?Ye(t):t.namespaceURI};if(typeof p=="function"){let d=o.createElement("template");d.content&&d.content.ownerDocument&&(o=d.content.ownerDocument)}let F,fe="",Ke,h=!1,T=0,A=function(){if(T>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(t){A(),T++;try{return F.createHTML(t)}finally{T--}},he=function(t){A(),T++;try{return F.createScriptURL(t)}finally{T--}},oe=function(){return h||(Ke=Kr(S,s),h=!0),Ke},C=o,V=C.implementation,Q=C.createNodeIterator,It=C.createDocumentFragment,at=C.getElementsByTagName,ct=r.importNode,w=To();e.isSupported=typeof Eo=="function"&&typeof pe=="function"&&V&&V.createHTMLDocument!==void 0;let me=Ur,lt=Fr,M=Hr,re=zr,Ee=Br,Xe=jr,ie=Gr,pt=qr,dt=_o,x=null,Mt=E({},[...ho,...an,...cn,...ln,...mo]),k=null,Pt=E({},[...go,...pn,...yo,...At]),se=Object.seal(We(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Je=null,Sn=null,we=Object.seal(We(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xn=!0,Nt=!0,kn=!1,Ut=!0,ge=!1,Re=!0,Ce=!1,Ft=!1,ut=null,ft=null,Ht=!1,Ne=!1,ht=!1,mt=!1,Rn=!0,Cn=!1,On="user-content-",zt=!0,Bt=!1,Oe=null,Ue={},Le=null,Ln=E({},["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"]),Dn=null,In=E({},["audio","video","img","source","image","track"]),Mn=null,Pn=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gt="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",Fe=ae,jt=!1,Gt=null,qo=E({},[gt,yt,ae],sn),Nn=P(["mi","mo","mn","ms","mtext"]),Wt=E({},Nn),Un=P(["annotation-xml"]),qt=E({},Un),$o=E({},["title","style","font","a","script"]),Ze=null,Yo=["application/xhtml+xml","text/html"],Vo="text/html",O=null,He=null,Ko=o.createElement("form"),Fn=function(t){return t instanceof RegExp||t instanceof Function},$t=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===t)return;(!t||typeof t!="object")&&(t={}),t=K(t),Ze=Yo.indexOf(t.PARSER_MEDIA_TYPE)===-1?Vo:t.PARSER_MEDIA_TYPE,O=Ze==="application/xhtml+xml"?sn:Ie,x=xe(t,"ALLOWED_TAGS",Mt,{transform:O}),k=xe(t,"ALLOWED_ATTR",Pt,{transform:O}),Gt=xe(t,"ALLOWED_NAMESPACES",qo,{transform:sn}),Mn=xe(t,"ADD_URI_SAFE_ATTR",Pn,{transform:O,base:Pn}),Dn=xe(t,"ADD_DATA_URI_TAGS",In,{transform:O,base:In}),Le=xe(t,"FORBID_CONTENTS",Ln,{transform:O}),Je=xe(t,"FORBID_TAGS",K({}),{transform:O}),Sn=xe(t,"FORBID_ATTR",K({}),{transform:O}),Ue=q(t,"USE_PROFILES")?t.USE_PROFILES&&typeof t.USE_PROFILES=="object"?K(t.USE_PROFILES):t.USE_PROFILES:!1,xn=t.ALLOW_ARIA_ATTR!==!1,Nt=t.ALLOW_DATA_ATTR!==!1,kn=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Ut=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=t.SAFE_FOR_TEMPLATES||!1,Re=t.SAFE_FOR_XML!==!1,Ce=t.WHOLE_DOCUMENT||!1,Ne=t.RETURN_DOM||!1,ht=t.RETURN_DOM_FRAGMENT||!1,mt=t.RETURN_TRUSTED_TYPE||!1,Ht=t.FORCE_BODY||!1,Rn=t.SANITIZE_DOM!==!1,Cn=t.SANITIZE_NAMED_PROPS||!1,zt=t.KEEP_CONTENT!==!1,Bt=t.IN_PLACE||!1,dt=Mr(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:_o,Fe=typeof t.NAMESPACE=="string"?t.NAMESPACE:ae,Wt=un(t,"MATHML_TEXT_INTEGRATION_POINTS",()=>E({},Nn)),qt=un(t,"HTML_INTEGRATION_POINTS",()=>E({},Un));let i=un(t,"CUSTOM_ELEMENT_HANDLING",()=>We(null));if(se=We(null),q(i,"tagNameCheck")&&Fn(i.tagNameCheck)&&(se.tagNameCheck=i.tagNameCheck),q(i,"attributeNameCheck")&&Fn(i.attributeNameCheck)&&(se.attributeNameCheck=i.attributeNameCheck),q(i,"allowCustomizedBuiltInElements")&&typeof i.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),U(se),ge&&(Nt=!1),ht&&(Ne=!0),Ue&&(x=E({},mo),k=We(null),Ue.html===!0&&(E(x,ho),E(k,go)),Ue.svg===!0&&(E(x,an),E(k,pn),E(k,At)),Ue.svgFilters===!0&&(E(x,cn),E(k,pn),E(k,At)),Ue.mathMl===!0&&(E(x,ln),E(k,yo),E(k,At))),we.tagCheck=null,we.attributeCheck=null,q(t,"ADD_TAGS")&&(typeof t.ADD_TAGS=="function"?we.tagCheck=t.ADD_TAGS:qe(t.ADD_TAGS)&&(x===Mt&&(x=K(x)),E(x,t.ADD_TAGS,O))),q(t,"ADD_ATTR")&&(typeof t.ADD_ATTR=="function"?we.attributeCheck=t.ADD_ATTR:qe(t.ADD_ATTR)&&(k===Pt&&(k=K(k)),E(k,t.ADD_ATTR,O))),q(t,"ADD_FORBID_CONTENTS")&&qe(t.ADD_FORBID_CONTENTS)&&(Le===Ln&&(Le=K(Le)),E(Le,t.ADD_FORBID_CONTENTS,O)),zt&&(x["#text"]=!0),Ce&&E(x,["html","head","body"]),x.table&&(E(x,["tbody"]),delete Je.tbody),t.TRUSTED_TYPES_POLICY){if(typeof t.TRUSTED_TYPES_POLICY.createHTML!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof t.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=F;F=t.TRUSTED_TYPES_POLICY;try{fe=I("")}catch(c){throw F=a,c}}else t.TRUSTED_TYPES_POLICY===null?(F=void 0,fe=""):(F===void 0&&(F=oe()),F&&typeof fe=="string"&&(fe=I("")));P&&P(t),He=t},Hn=E({},[...an,...cn,...Pr]),zn=E({},[...ln,...Nr]),Xo=function(t,i,a){return i.namespaceURI===ae?t==="svg":i.namespaceURI===gt?t==="svg"&&(a==="annotation-xml"||Wt[a]):!!Hn[t]},Jo=function(t,i,a){return i.namespaceURI===ae?t==="math":i.namespaceURI===yt?t==="math"&&qt[a]:!!zn[t]},Zo=function(t,i,a){return i.namespaceURI===yt&&!qt[a]||i.namespaceURI===gt&&!Wt[a]?!1:!zn[t]&&($o[t]||!Hn[t])},Qo=function(t){let i=Ve(t),a=Ie(Te(t)),c=pe(t),m,g;return c&&z(c)===L.element?(m={namespaceURI:Ve(c)},g=Ie(Te(c))):(m={namespaceURI:Fe},g="template"),Gt[i]?i===yt?Xo(a,m,g):i===gt?Jo(a,m,g):i===ae?Zo(a,m,g):!!(Ze==="application/xhtml+xml"&&Gt[i]):!1},Ae=function(t){tt(e.removed,{element:t});try{pe(t).removeChild(t)}catch{if(Y(t),!pe(t))throw _e("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Bn=function(t,i,a){try{Me(t,i)}catch{try{t.removeAttribute(a)}catch{}}},Yt=function(t){Kt(t);let i=le(t);i&&ye(xr(i),c=>{try{Y(c)}catch{}});let a=z(t)===L.element?Pe(t):null;if(a)for(let c=a.length-1;c>=0;--c){let m=a[c],g=m&&m.name;typeof g=="string"&&Bn(t,m,g)}},ze=function(t,i,a){if(!a)try{a=i.getAttributeNode(t)}catch{a=null}tt(e.removed,{attribute:a||null,from:i});try{a?Me(i,a):i.removeAttribute(t)}catch{try{i.removeAttribute(t)}catch{}}if(t==="is")if(Ne||ht)try{Ae(i)}catch{}else try{i.setAttribute(t,"")}catch{}},jn=function(t){let i=Pe(t);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)]||Bn(t,c,m)}},Vt=function(t,i){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=[t];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])}},Kt=function(t){Vt(t,i=>{z(i)===L.element&&jn(i)})},Xt=function(t){let i=[];return Vt(t,a=>{i.push(a)},!0),i},er=function(t,i){let a=on();ye(Xt(t),c=>{z(c)===L.element&&rn(a,c)}),ye(i,c=>{z(c)===L.element&&!nt(a,c)&&jn(c)})},Gn=function(t,i){let a=!1;return ye(e.removed,c=>{c.element&&(a=a||c.element===t,Kt(c.element))}),er(t,i),a},tr=8,nr=function(t,i){let a=Oe,c=null,m=()=>(c||(c=on(),ye(i,g=>{rn(c,g)})),c);for(let g=0;;g++){let b=Xt(t),D=[t],ce=!1;if(ye(b,B=>{z(B)===L.documentFragment?tt(D,B):!ce&&!nt(a,B)&&(ce=nt(m(),B))}),!ce)return;if(g>=tr)throw _e("the tree kept changing during in-place sanitization; refusing to return it");ye(D,(B,G)=>{or(B,G>0,t,m())})}},or=function(t,i,a,c){let m=Jt(t),g;for(;g=m.nextNode();)!nt(c,g)||nt(Oe,g)||(i&&ee(w.uponSanitizeShadowNode,g,null),Qt(g,a),en(g,a),Se(g.content)&&et(g.content))},rr=function(t){Oe&&rn(Oe,t)},Wn=function(t,i){return Re?t==="patchsrc"?!0:t==="for"&&i!=="label"&&i!=="output":!1},ir=function(t){Re&&Vt(t,i=>{let a=z(i);if(a===L.processingInstruction||a===L.comment&&N(bo,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")&&Wn("for",m)&&c.removeAttribute("for")}catch{}}return!0})},qn=function(t){let i=null,a=null;if(Ht)t="<remove></remove>"+t;else{let g=lo(t,/^[\r\n\t ]+/);a=g&&g[0]}Ze==="application/xhtml+xml"&&Fe===ae&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");let c=F?I(t):t;if(Fe===ae)try{i=new _().parseFromString(c,Ze)}catch{}if(!i||!i.documentElement){i=V.createDocument(Fe,"template",null);try{i.documentElement.innerHTML=jt?fe:c}catch{}}let m=i.body||i.documentElement;return t&&a&&m.insertBefore(o.createTextNode(a),m.childNodes[0]||null),Fe===ae?at.call(i,Ce?"html":"body")[0]:Ce?i.documentElement:m},Jt=function(t){let i=ve?ve(t):t.ownerDocument;return Q.call(i||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},_t=function(t){return t=ot(t,me," "),t=ot(t,lt," "),t=ot(t,M," "),t},Zt=function(t){var i;$n(t);let a=(i=t.querySelectorAll)===null||i===void 0?void 0:i.call(t,"template");a&&ye(a,c=>{Se(c.content)&&Zt(c.content)})},$n=function(t){t.normalize();let i=ve?ve(t):t.ownerDocument,a=Q.call(i||t,t,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),c=a.nextNode();for(;c;)c.data=_t(c.data),c=a.nextNode()},bt=function(t){let i=ue?ue(t):null;return typeof i!="string"||O(i)!=="form"?!1:typeof t.nodeName!="string"||typeof t.textContent!="string"||typeof t.removeChild!="function"||t.attributes!==Pe(t)||typeof t.removeAttribute!="function"||typeof t.removeAttributeNode!="function"||typeof t.getAttributeNode!="function"||typeof t.setAttribute!="function"||typeof t.namespaceURI!="string"||typeof t.insertBefore!="function"||typeof t.hasChildNodes!="function"||t.nodeType!==Z(t)||t.childNodes!==le(t)},Se=function(t){if(!Z||typeof t!="object"||t===null)return!1;try{return Z(t)===L.documentFragment}catch{return!1}},Qe=function(t){if(!Z||typeof t!="object"||t===null)return!1;try{return typeof Z(t)=="number"}catch{return!1}};function ee(d,t,i){d.length!==0&&ye(d,a=>{a.call(e,t,i,He)})}let sr=function(t,i){return!!(Re&&t.hasChildNodes()&&!Qe(t.firstElementChild)&&N(dn,t.textContent)&&N(dn,t.innerHTML)||Re&&Yr[i]&&z(t)===L.element&&Ve(t)===ae&&(Qe(t.firstElementChild)||typeof t.textContent=="string"&&N(dn,t.textContent))||t.nodeType===L.processingInstruction||Re&&t.nodeType===L.comment&&N(bo,t.data))},vt=function(t,i){if(t instanceof RegExp)return N(t,i);if(t 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!!t(i,...c)}return!1},ar=function(t,i,a){if(!Je[i]&&Kn(i)&&vt(se.tagNameCheck,i))return!1;if(zt&&!Le[i]&&!Le[Ie(i)]){let c=pe(t),m=le(t);if(m&&c){let g=m.length;for(let b=g-1;b>=0;--b){let D=t===a?ke(m[b],!0):m[b];c.insertBefore(D,ne(t))}}}return Ae(t),!0},Yn=function(t,i,a,c){return t.length===0?i:i===a||i===c?K(i):i},Be=function(t,i){return t===i||pe(t)!==null?!1:(Bt&&Kt(t),!0)},Qt=function(t,i){if(rr(t),ee(w.beforeSanitizeElements,t,null),Be(t,i))return!0;if(bt(t))return Ae(t),!0;let a=O(Te(t));if(x=Yn(w.uponSanitizeElement,x,Mt,ut),ee(w.uponSanitizeElement,t,{tagName:a,allowedTags:x}),Be(t,i))return!0;if(sr(t,a))return Ae(t),!0;if(Je[a]||!(we.tagCheck instanceof Function&&we.tagCheck(a))&&!x[a]){let c=ar(t,a,i);return c===!1&&(ee(w.afterSanitizeElements,t,null),Be(t,i))?!0:c}if(z(t)===L.element&&!Qo(t)||(a==="noscript"||a==="noembed"||a==="noframes")&&N($r,t.innerHTML))return Ae(t),!0;if(ge&&t.nodeType===L.text){let c=_t(t.textContent);t.textContent!==c&&(tt(e.removed,{element:t.cloneNode()}),t.textContent=c)}return ee(w.afterSanitizeElements,t,null),Be(t,i)},Vn=function(t,i,a){if(Sn[i]||Wn(i,t)||Rn&&(i==="id"||i==="name")&&(a in o||a in Ko))return!1;let c=k[i]||we.attributeCheck instanceof Function&&we.attributeCheck(i,t);return Nt&&N(re,i)||xn&&N(Ee,i)?!0:c?Mn[i]||N(dt,ot(a,ie,""))||(i==="src"||i==="xlink:href"||i==="href")&&t!=="script"&&po(a,"data:")===0&&Dn[t]||kn&&!N(Xe,ot(a,ie,""))?!0:!a:Kn(t)&&vt(se.tagNameCheck,t)&&vt(se.attributeNameCheck,i,t)||i==="is"&&se.allowCustomizedBuiltInElements&&vt(se.tagNameCheck,a)},cr=E({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Kn=function(t){return!cr[Ie(t)]&&N(pt,t)},lr=function(t,i,a,c){if(F&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!a)switch(S.getAttributeType(t,i)){case"TrustedHTML":return I(c);case"TrustedScriptURL":return he(c)}return c},pr=function(t,i,a,c){try{return a?t.setAttributeNS(a,i,c):t.setAttribute(i,c),bt(t)?(Ae(t),!1):!0}catch{return ze(i,t),!1}},Xn=function(t,i){return Re&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,i)?!0:Ie(t)==="attributename"&&lo(i,"href")!==null},en=function(t,i){if(ee(w.beforeSanitizeAttributes,t,null),Be(t,i))return;let a=t.attributes;if(!a||bt(t))return;k=Yn(w.uponSanitizeAttribute,k,Pt,ft);let c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0},m=a.length,g=O(t.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:Rr(je),Jn=!1;if(c.attrName=G,c.attrValue=W,c.keepAttr=!0,c.forceKeepAttr=void 0,ee(w.uponSanitizeAttribute,t,c),W=c.attrValue,Cn&&(G==="id"||G==="name")&&po(W,On)!==0&&(ze(D,t,b),W=On+W,Jn=!0),Xn(D,W)){ze(D,t,b);continue}if(!c.forceKeepAttr){if(!c.keepAttr){ze(D,t,b);continue}if(!Ut&&N(vo,W)){ze(D,t,b);continue}if(ge&&(W=_t(W)),!Vn(g,G,W)){ze(D,t,b);continue}W=lr(g,G,ce,W),W!==je&&pr(t,D,ce,W)&&Jn&&co(e.removed)}}ee(w.afterSanitizeAttributes,t,null),Be(t,i)},et=function(t){let i=null,a=Jt(t);for(ee(w.beforeSanitizeShadowDOM,t,null);i=a.nextNode();)if(ee(w.uponSanitizeShadowNode,i,null),Qt(i,t),en(i,t),Se(i.content)&&et(i.content),z(i)===L.element){let c=de(i);Se(c)&&(tn(c),et(c))}ge&&$n(t),ee(w.afterSanitizeShadowDOM,t,null)},tn=function(t){let i=[{node:t,shadow:null}];for(;i.length>0;){let a=i.pop();if(a.shadow){et(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 e.sanitize=function(d){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,c=null,m=null;if(jt=!d,jt&&(d="<!-->"),typeof d!="string"&&!Qe(d)&&(d=Dr(d),typeof d!="string"))throw _e("dirty is not a string, aborting");if(!e.isSupported)return d;Ft?(x=ut,k=ft):$t(t),(w.uponSanitizeElement.length>0||w.uponSanitizeAttribute.length>0)&&(x=K(x)),w.uponSanitizeAttribute.length>0&&(k=K(k)),e.removed=[];let g=Bt&&typeof d!="string"&&Qe(d),b=[],D=Oe;if(g){ir(d);let G=Te(d);if(typeof G=="string"){let je=O(G);if(!x[je]||Je[je])throw Yt(d),_e("root node is forbidden and cannot be sanitized in-place")}if(bt(d))throw Yt(d),_e("root node is clobbered and cannot be sanitized in-place");b=Xt(d),Oe=on()}else if(Qe(d))i=qn("<!---->"),a=i.ownerDocument.importNode(d,!0),a.nodeType===L.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?i=a:i.appendChild(a),tn(i);else{if(!Ne&&!ge&&!Ce&&d.indexOf("<")===-1)return F&&mt?I(d):d;if(i=qn(d),!i)return Ne?null:mt?fe:""}i&&Ht&&Ae(i.firstChild);let ce=g?d:i;try{g&&tn(d);let G=Jt(ce);for(;c=G.nextNode();)Qt(c,ce),en(c,ce),Se(c.content)&&et(c.content);g&&nr(d,b)}catch(G){throw g&&(Yt(d),Gn(d,b)),G}finally{Oe=D}if(g){if(Gn(d,b))throw _e("a node selected for removal could not be safely returned; refusing to sanitize in place");return ge&&Zt(d),d}if(Ne){if(ge&&Zt(i),ht)for(m=It.call(i.ownerDocument);i.firstChild;)m.appendChild(i.firstChild);else m=i;return(k.shadowroot||k.shadowrootmode)&&(m=ct.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(Wr,i.ownerDocument.doctype.name)&&(B="<!DOCTYPE "+i.ownerDocument.doctype.name+`>
3
- `+B),ge&&(B=_t(B)),F&&mt?I(B):B},e.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$t(d),Ft=!0,ut=x,ft=k},e.clearConfig=function(){He=null,Ft=!1,ut=null,ft=null,F=Ke,fe=""},e.isValidAttribute=function(d,t,i){He||$t({});let a=O(d),c=O(t);return typeof i=="string"&&(Xn(t,i)||!Ut&&N(vo,i))?!1:Vn(a,c,i)},e.addHook=function(d,t){typeof t=="function"&&q(w,d)&&tt(w[d],t)},e.removeHook=function(d,t){if(q(w,d)){if(t!==void 0){let i=Sr(w[d],t);return i===-1?void 0:kr(w[d],i,1)[0]}return co(w[d])}},e.removeHooks=function(d){q(w,d)&&(w[d]=[])},e.removeAllHooks=function(){w=To()},e}var Ro=ko();function y(n,e,o){let r=document.createElement(n);return e&&(r.textContent=e),o&&(r.className=o),r}function j(n){return typeof n!="string"?"":(Do(n).textContent||"").trim()}var Oo=new Set(["A","B","BLOCKQUOTE","BR","CODE","EM","I","LI","OL","P","PRE","STRONG","U","UL"]),Lo=new Set(["H1","H2","H3","H4","H5","H6"]),Co;function Do(n){return Co??(Co=Ro(window)),Co.sanitize(n,{ALLOWED_TAGS:[...Oo,...Lo].map(e=>e.toLowerCase()),ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,RETURN_DOM_FRAGMENT:!0})}function Io(n){let e=document.createDocumentFragment();if(typeof n!="string")return e;let o=(r,s)=>{for(let p of Array.from(r.childNodes)){if(p.nodeType===Node.TEXT_NODE){s.appendChild(document.createTextNode(p.textContent||""));continue}if(!(p instanceof Element))continue;let l=p.tagName;if(Lo.has(l)){let f=document.createElement("p"),u=document.createElement("strong");f.appendChild(u),o(p,u),s.appendChild(f)}else if(Oo.has(l)){let f=document.createElement(l.toLowerCase());if(l==="A"){let u=p.getAttribute("href")||"";/^(https?:|mailto:)/i.test(u.trim())&&(f.setAttribute("href",u.trim()),f.setAttribute("target","_blank"),f.setAttribute("rel","noopener noreferrer nofollow"))}o(p,f),s.appendChild(f)}else["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"].includes(l)||o(p,s)}};return o(Do(n),e),e}var mn=4,Mo="http://www.w3.org/2000/svg";function Xr(){let n=document.createElementNS(Mo,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("class","chev"),n.setAttribute("aria-hidden","true");let e=document.createElementNS(Mo,"path");return e.setAttribute("d","M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"),n.append(e),n}function gn(n,e){let o=(n||[]).map(u=>j(u.data_item_name)).filter(Boolean);if(!o.length){let u=(e||[]).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 p=!1,l=()=>{s.data=(p?o:o.slice(0,mn)).join(", "),f.textContent=p?"show less":`+${o.length-mn} more`},f=y("button",void 0,"more");return f.type="button",f.onclick=()=>{p=!p,l()},l(),o.length>mn&&r.append(f),r}function Po(n,e,o){let r=y("div",void 0,"grp"),s=y("button",void 0,"gh");s.type="button",s.setAttribute("aria-expanded","false");let p=y("span",void 0,"gx");p.append(y("span",n,"gt")),e&&p.append(y("span",e,"gd")),s.append(p,Xr()),s.onclick=()=>{let f=!r.classList.contains("open");r.classList.toggle("open",f),s.setAttribute("aria-expanded",String(f))};let l=y("div",void 0,"gb");return o.forEach(f=>l.append(y("span",f,"gi"))),r.append(s,l),r}function yn(n){if(!j(n))return null;let e=y("div",void 0,"text");return e.append(Io(n)),e}function No({root:n,config:e,state:o,mode:r,demo:s,onClose:p,onSubmit:l,onChange:f}){n.replaceChildren();for(let h of e.purposes)h.required&&(o.choices[String(h.id)]=!0);let u=e.notice||{},_=[...u.purposes||[]],S=new Set(_.flatMap(h=>(h.sub_items||[]).map(T=>T.purpose_id))),H=e.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=()=>p(),Y.append(h)}Me.append(y("h1",j(ke?.title)||e.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,T)=>{h.forEach(A=>A.checked=!!o.choices[String(T)])}),pe.forEach(h=>{h.box.checked=h.ids.every(T=>!!o.choices[String(T)])}),fe()},Pe=(h,T)=>{if(o.busy){de();return}for(let A of h)e.purposes.find(I=>I.id===A)?.required||(o.choices[String(A)]=T);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!==e.language_code?u.sections_language_code:void 0;for(let h of Z){let T=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=yn(T.section_body);C&&I.append(C),ne.append(I);continue}T.section_title&&I.append(y("p",j(T.section_title),"st"));let he=yn(T.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(Po(`${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),It=Q.length>0&&Q.every(M=>e.purposes.find(re=>re.id===M)?.required);for(let M of Q){let re=!!e.purposes.find(Ee=>Ee.id===M)?.required;o.choices[String(M)]=re||!!o.choices[String(M)]}let at=y("div",void 0,"grp pg"),ct=y("div",void 0,"ph"),w=y("span",void 0,"gx");w.append(y("span",j(C.purpose_reason)||"Purposes","gt")),C.desc&&w.append(y("span",j(C.desc),"gd"));let me=y("input");me.type="checkbox",me.disabled=It,me.setAttribute("aria-label",`Select all: ${C.purpose_reason||"purposes"}`),me.onchange=()=>Pe(Q,me.checked),pe.push({box:me,ids:Q}),ct.append(w,me);let lt=y("div",void 0,"pb");for(let M of V){let re=e.purposes.find(dt=>dt.id===M.purpose_id),Ee=y("div",void 0,"pr"),Xe=y("label",void 0,"prh");Xe.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]),Xe.append(ie),Ee.append(Xe),re?.description&&Ee.append(y("p",j(re.description),"ps"));let pt=gn(M.data_items,M.data_categories);pt&&Ee.append(pt),lt.append(Ee)}at.append(ct,y("hr",void 0,"hr"),lt),oe.append(at)}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=gn(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(),l()},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"),Ye=y("div",void 0,"actions"),Ve=h=>{h==="accept-all"?e.purposes.forEach(T=>o.choices[String(T.id)]=!0):h==="reject-all"&&e.purposes.forEach(T=>o.choices[String(T.id)]=T.required),l()},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 T=h.button_type==="accept-necessary",A=y("button",void 0,T?"primary":void 0);A.type="button",A.dataset.type=h.button_type,A.textContent=T?h.button_data?.accept_necessary_text||"Accept Necessary":h.button_text||h.button_type,A.onclick=()=>Ve(h.button_type),T&&(A.dataset.necessary=h.button_data?.accept_necessary_text||"Accept Necessary",A.dataset.selected=h.button_data?.accept_selected_text||"Accept Selected"),Ye.append(A)}return Te.append(Ye),Y.append(Te),n.append(Y),de(),(r==="popup"||r==="page")&&Y.addEventListener("keydown",Ke),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 T=e.purposes.some(A=>!A.required&&o.choices[String(A.id)]);h.textContent=T?h.dataset.selected:h.dataset.necessary}function Ke(h){if(h.key==="Escape"){p();return}if(h.key!=="Tab")return;let T=[...n.querySelectorAll("button:not([disabled]),input:not([disabled]),summary,a[href]")],A=T[0],I=T[T.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 _n=`*{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 St;function Uo(n){if("adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype){St||(St=new CSSStyleSheet,St.replaceSync(_n)),n.adoptedStyleSheets=[St];return}let e=document.createElement("style");e.textContent=_n,n.append(e)}var te=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),$=n=>n==null||typeof n=="string",be=(n,e)=>n==null||Array.isArray(n)&&n.length<=1e3&&n.every(e),bn=n=>be(n,e=>typeof e=="string"),Fo=n=>be(n,e=>te(e)&&$(e.data_item_name));function xt(n,e){if(!te(n)||!$(n.sections_language_code))return!1;let o=new Set(e.map(l=>l.id)),r=new Set,s=l=>te(l)&&["accept-all","reject-all","accept-necessary"].includes(l.button_type)&&$(l.button_text)&&(l.button_enabled===void 0||typeof l.button_enabled=="boolean")&&(l.button_data==null||te(l.button_data)&&$(l.button_data.accept_necessary_text)&&$(l.button_data.accept_selected_text)),p=(l,f=0)=>{if(!te(l)||typeof l.section_type!="string"||!te(l.section_data))return!1;let u=l.section_data;return f<8&&$(u.title)&&$(u.section_title)&&$(u.section_body)&&be(u.buttons,s)&&be(u.sections,_=>p(_,f+1))};return(n.content==null||te(n.content)&&be(n.content.consent_data,l=>p(l)))&&be(n.purposes,l=>te(l)&&$(l.purpose_reason)&&$(l.desc)&&be(l.sub_items,f=>!te(f)||!o.has(f.purpose_id)||r.has(f.purpose_id)?!1:(r.add(f.purpose_id),$(f.purpose_name)&&Fo(f.data_items)&&bn(f.data_categories))))&&be(n.collected,l=>te(l)&&$(l.data_category_name)&&$(l.desc)&&bn(l.sub_items))&&be(n.shared,l=>te(l)&&$(l.purpose_name)&&Fo(l.data_items)&&bn(l.data_categories))}var kt=class{constructor(e){this.options=e;this.syncChecks=()=>{};this.pendingKey="";this.pendingBody="";this.needsRefresh=!1;let o=e.host.attachShadow({mode:"open"});Uo(o);let r=document.createElement("div");r.className="theme",r.lang=e.config.language_code,this.root=document.createElement("div"),this.root.className="root",this.root.dataset.mode=e.mode,r.append(this.root),o.append(r),this.appearance=io(r),this.appearance.apply(e.appearance),this.state={choices:{...e.choices},busy:!1}}render(){let{config:e,mode:o,demo:r=!1,onClose:s}=this.options;try{if(!xt(e.notice,e.purposes))throw new Error("Invalid notice");this.syncChecks=No({root:this.root,config:e,state:this.state,mode:o,demo:r,onClose:s,onSubmit:()=>this.submit(),onChange:()=>{this.pendingKey=""}})}catch{let p="The consent form could not be displayed. Check the notice configuration and reload.",l=y("section",void 0,"shell"),f=y("p",p,"message error");f.setAttribute("role","alert");let u=y("div",void 0,"body");if(u.append(f),l.append(u),o!=="panel"){let _=y("button","\xD7","close");_.setAttribute("aria-label","Close consent form"),_.type="button",_.onclick=s,l.append(_)}this.root.replaceChildren(l),o!=="panel"&&!r&&l.querySelector("button")?.focus(),this.options.onError(new v(p,"form_error"))}}setAppearance(e){this.appearance.apply(e),this.render()}destroy(){this.appearance.destroy()}message(e,o=!1){let r=this.root.querySelector("#feedback");r&&(r.textContent=e,r.className=o?"message error":"message",r.setAttribute("role",o?"alert":"status"))}async submit(){let{state:e,root:o,options:r}=this;if(e.busy||this.needsRefresh)return;e.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 p={config_version:r.config.config_version,language_code:r.config.language_code,answers:r.config.purposes.map(u=>({purpose_id:u.id,given:!!e.choices[String(u.id)]}))},l=JSON.stringify(p);(!this.pendingKey||this.pendingBody!==l)&&(this.pendingKey=Zn(),this.pendingBody=l);let f;try{f=await r.save(p,this.pendingKey),e.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 v&&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{e.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 vn(n,e){if(!X(n))return!1;let o=new Set(e.purposes.map(r=>String(r.id)));return Object.entries(n).every(([r,s])=>o.has(r)&&typeof s=="boolean")}function it(n,e){if(!X(n)||n.app_id!==e||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))&&xt(n.notice,n.purposes)}var Rt=class{notePointer(e){this.pointerFocus=e.composedPath().find(o=>o instanceof HTMLElement&&o.matches("button,a[href],input,select,textarea,[tabindex]"))}activate(e){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",e.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 Ho(n,e){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",e==="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 Ct;function zo(n){Ct?.close(),Ct=n}function Bo(n){Ct===n&&(Ct=void 0)}function Tn(n){let e=new URL(n,window.location.href);if(e.username||e.password||e.search||e.hash)throw new Error("Use an Atlas backend base URL without credentials or query parameters.");if(e.protocol!=="https:"&&!(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"||e.hostname.endsWith(".localhost"))))throw new Error("Atlas Consent requires HTTPS. HTTP is only supported for localhost.");return e.href.replace(/\/$/,"")}var jo="/consent-sdk/assets/";function En(n){let e=new URL(n,window.location.href).href,o=e.indexOf(jo);if(o<1)throw new Error(`Atlas Consent could not find "${jo}" in the script address. Load the SDK from the URL shown in Atlas, or use AtlasConsent.create({apiBaseUrl}).`);return Tn(e.slice(0,o))}function wn(n){if(!n)return;let e;try{e=JSON.parse(n)}catch{return}if(!e||typeof e.token!="string"||!e.token||typeof e.expires!="string"||!Number.isFinite(Date.parse(e.expires)))return;let o=e.result;return{token:e.token,expires:e.expires,result:o&&typeof o=="object"&&typeof o.ref_id=="string"?o:void 0}}function Ot(n){try{return localStorage.getItem(n)}catch{return}}function Go(n,e){try{return e?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n),!0}catch{try{localStorage.removeItem(n)}catch{}return!1}}var Lt="atlas-consent:storage";async function Wo(n,e,o,r="Consent is temporarily unavailable."){if(e.aborted)throw new v("This consent instance was destroyed.","destroyed");let s=new AbortController,p=()=>s.abort();e.addEventListener("abort",p);let l=setTimeout(p,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 e.aborted?new v("This consent instance was destroyed.","destroyed"):s.signal.aborted?new v("Atlas took too long to respond.","request_timeout"):_ instanceof SyntaxError||_ instanceof DOMException&&_.name==="SyntaxError"?new v(f?.ok?"Atlas returned an invalid response.":r,f&&!f.ok?"request_failed":"invalid_response",f?.status):new v("Atlas could not be reached.","network_error",f?.status)}finally{clearTimeout(l),e.removeEventListener("abort",p)}if(!f.ok||!X(u)||u.data===void 0||u.data===null){let _=X(u)&&X(u.error)?u.error:{};throw new v(typeof _.message=="string"&&_.message?_.message:r,typeof _.code=="string"?_.code:typeof _.type=="string"?_.type:"request_failed",f.status)}return u.data}var Zr=60*864e5,$e=n=>({ref_id:n.ref_id,app_id:n.app_id,level_id:n.level_id,config_version:n.config_version,choices:{...n.choices}}),st=class{constructor(e){this.options=e;this.controller=new AbortController;this.preferenceSnapshot="null";this.accessibility=new Rt;this.destroyed=!1;this.generation=0;this.reportedErrors=new WeakSet;this.storageChanged=e=>{(e.key===null||e.key===this.key)&&this.syncSaved()};this.documentStorageChanged=e=>{e.detail===this.key&&this.syncSaved()};this.keydown=e=>{e.key==="Escape"&&this.overlay&&this.close()};this.pointerdown=e=>this.accessibility.notePointer(e);if(!/^ac_app_[A-Za-z0-9_-]{10,40}$/.test(e.appId))throw new v("Use the app ID from Atlas Integrations.","invalid_app");let o=e.apiBaseUrl??Tt;if(!o)throw new v("Set apiBaseUrl or use an SDK build with a configured backend URL.","invalid_api_base_url");try{this.api=Tn(o)}catch(s){throw new v(s.message,"invalid_api_base_url")}this.key=`atlas-consent:v2:${encodeURIComponent(this.api)}:${e.appId}`,this.stored=Ot(this.key),this.saved=wn(this.stored??null),window.addEventListener("keydown",this.keydown),window.addEventListener("pointerdown",this.pointerdown,!0),window.addEventListener("storage",this.storageChanged),window.addEventListener(Lt,this.documentStorageChanged);let r=this.generation;this.ready=this.load().then(s=>{if(this.destroyed)throw new v("This consent instance was destroyed.","destroyed");return this.config=s,this.notifyPreference(),this.renewIfEnding(),r!==this.generation||(e.target?this.mount(e.target).catch(()=>{}):(e.mode||s.mode)==="popup"&&e.autoShow!==!1&&!this.hasChoice()&&this.open().catch(()=>{})),s}),this.ready.catch(s=>{this.loadFailure=s,this.fail(s)})}async load(){let e=await this.request(`/config?language_code=${encodeURIComponent(this.options.language||"en")}`);if(!it(e,this.options.appId))throw new v("Atlas returned an invalid configuration.","invalid_response");return e}request(e,o,r){return this.assertAlive(),Wo(`${this.api}/consent-sdk/v1/apps/${this.options.appId}${e}`,this.controller.signal,o,r)}persist(){let e=this.stored,o=Go(this.key,this.saved),r=o?this.saved?JSON.stringify(this.saved):null:Ot(this.key);r!==void 0&&(this.stored=r),this.notifyPreference(),(o||e!==this.stored)&&window.dispatchEvent(new CustomEvent(Lt,{detail:this.key}))}syncSaved(){if(this.destroyed)return;let e=Ot(this.key);if(e===void 0||e===this.stored)return;let o=wn(e),r=o?.token!==this.saved?.token||JSON.stringify(o?.result)!==JSON.stringify(this.saved?.result);this.stored=e,this.saved=o,r&&this.form&&this.close(!0),this.notifyPreference()}notifyPreference(){let e=this.hasChoice()?$e(this.saved.result):null,o=JSON.stringify(e);if(o!==this.preferenceSnapshot){this.preferenceSnapshot=o;try{this.options.onPreferenceChange?.(e?$e(e):null)}catch(r){queueMicrotask(()=>{throw r})}window.dispatchEvent(new CustomEvent("atlas-consent:change",{detail:{appId:this.options.appId,preference:e?$e(e):null}}))}}alive(){return!!this.saved&&Date.parse(this.saved.expires)>Date.now()}hasChoice(){return!!this.config&&this.alive()&&Et(this.saved.result,this.config)}getPreference(){return this.syncSaved(),this.notifyPreference(),this.hasChoice()?$e(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(e){this.syncSaved();let o=this.stored,r=this.saved;if(this.alive())try{let p=await this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${r.token}`}});if(e!==this.generation)return{};if(this.syncSaved(),e!==this.generation)return{};if(o!==this.stored)return this.session(e);if(!X(p)||!it(p.config,this.options.appId)||!vn(p.choices,p.config))throw new v("Atlas returned an invalid session.","invalid_response");return this.reconcileSession(p,r),typeof p.expires_at=="string"&&Number.isFinite(Date.parse(p.expires_at))&&(r.expires=p.expires_at),this.persist(),p.choices}catch(p){if(e!==this.generation)return{};if(!(p instanceof v)||p.status!==401)throw p;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(e!==this.generation)return{};if(this.syncSaved(),e!==this.generation)return{};if(o!==this.stored)return this.session(e);if(!X(s)||typeof s.session_token!="string"||!s.session_token||typeof s.expires_at!="string"||!Number.isFinite(Date.parse(s.expires_at))||!it(s.config,this.options.appId))throw new v("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(e,o){let r=e.config,s=o.result;if(s?.config_version===r.config_version){let p={...s,choices:e.choices};o.result=Et(p,r)&&e.ref_id===s.ref_id?p:void 0}this.config=r}renewIfEnding(){if(!this.alive()||Date.parse(this.saved.expires)-Date.now()>Zr)return;let e=this.saved,o=this.stored;this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${e.token}`}}).then(r=>{this.syncSaved(),this.saved===e&&this.stored===o&&X(r)&&it(r.config,this.options.appId)&&vn(r.choices,r.config)&&typeof r.expires_at=="string"&&Number.isFinite(Date.parse(r.expires_at))&&(this.reconcileSession(r,e),e.expires=r.expires_at,this.persist())}).catch(()=>{})}async save(e,o,r,s,p){if(this.syncSaved(),p!==this.generation||this.saved?.token!==s)throw new v("This consent form was closed. Open it again.","form_closed");let l=await this.request("/decisions",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Idempotency-Key":o},body:JSON.stringify({...e,sdk_version:Ge})},"Your choices could not be saved. Please retry.");if(!Et(l,r))throw new v("Atlas returned an invalid consent result. Please retry.","invalid_response");let f=l.expires_at;return p===this.generation&&this.saved?.token===s&&typeof f=="string"&&Number.isFinite(Date.parse(f))&&(this.saved.expires=f),$e(l)}recordView(){this.request("/events",{method:"POST",headers:{Authorization:`Bearer ${this.saved?.token}`},body:JSON.stringify({event:"viewed"})}).catch(()=>{})}async reported(e){try{await e()}catch(o){throw o!==this.loadFailure&&this.fail(o),o}}mount(e){return this.reported(()=>this.mountForm(e))}async mountForm(e){let o=this.generation;if(await this.ready,this.assertAlive(),o!==this.generation)return;let r=typeof e=="string"?document.querySelector(e):e;if(!(r instanceof HTMLElement))throw new v("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 e=this.generation;if(await this.ready,this.assertAlive(),e!==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 e=this.mountTarget;return this.close(!0),e?this.mount(e):this.open()}startForm(e,o){if(this.form)return Promise.resolve();if(this.launchTask)return this.launchTask;let r=this.generation,s=Promise.resolve().then(()=>this.insertForm(e,o,r));this.launchTask=s;let p=()=>{this.launchTask===s&&(this.launchTask=void 0)};return s.then(p,p),s}async insertForm(e,o,r){try{if(this.assertAlive(),r!==this.generation)return;let s=await this.session(r);if(this.assertAlive(),r!==this.generation)return;o||zo(this);let p=this.createForm(e,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=Ho(this.host,e);let l=this.overlay;l.addEventListener("cancel",f=>{f.preventDefault(),this.overlay===l&&this.close()}),l.addEventListener("close",()=>{this.overlay===l&&this.close()}),this.overlay.append(this.host),document.body.append(this.overlay),this.accessibility.activate(this.overlay)}p.render(),this.recordView()}catch(s){if(this.destroyed)throw s;if(r!==this.generation)return;throw this.close(!0),s}}createForm(e,o){let r=this.generation,s=this.saved.token,p=this.config,l=document.createElement("atlas-consent-form");return l.style.cssText="display:block;width:100%;height:650px",this.host=l,this.form=new kt({host:l,config:this.config,choices:o,mode:e,appearance:{...this.config?.appearance,...this.options.appearance},save:(f,u)=>this.save(f,u,p,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(e){let o=this.overlay,r={app_id:e.app_id,ref_id:e.ref_id,claim_token:this.saved.token};this.saved.result=$e(e),this.persist();try{this.options.onComplete?.(e,r)}finally{o&&this.overlay===o&&this.close()}}assertAlive(){if(this.destroyed)throw new v("This consent instance was destroyed.","destroyed")}fail(e){if(this.destroyed||e instanceof v&&e.code==="destroyed")return;if(e&&typeof e=="object"){if(this.reportedErrors.has(e))return;this.reportedErrors.add(e)}let o=e instanceof v?e:new v(e instanceof Error?e.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(e=!1){this.generation+=1,this.launchTask=void 0,Bo(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&&!e&&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(Lt,this.documentStorageChanged)}};function An(n){return new st(n)}var Dt=document.currentScript;if(Dt?.dataset.atlasApp){let n=Dt.dataset,e=n.atlasApp,o=p=>{let l=p instanceof v?p:new v(p instanceof Error?p.message:"Atlas Consent could not start.","unexpected_error");console.error(l.message),window.dispatchEvent(new CustomEvent("atlas-consent:error",{detail:{appId:e,error:l}}))},r=()=>{try{return En(Dt.src)}catch{return""}},s=()=>{let p;try{let l;if(n.appearance)try{l=JSON.parse(n.appearance)}catch{throw new v("data-appearance must be valid JSON.","invalid_appearance")}p=An({appId:e,apiBaseUrl:n.apiBaseUrl||r()||Tt||En(Dt.src),mode:n.mode,target:n.target,language:n.language||"en",autoShow:n.autoShow===void 0?void 0:n.autoShow!=="false",appearance:l})}catch(l){o(l);return}p.ready.then(l=>{window.dispatchEvent(new CustomEvent("atlas-consent:ready",{detail:{client:p,version:Ge}})),!n.target&&(n.mode||l.mode)==="panel"&&o(new v('This integration shows a panel. Add data-target="#element-id" to the script tag, or call client.mount().',"missing_container"))},()=>{})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s,{once:!0}):s()}return gr(Qr);})();
1
+ "use strict";var AtlasConsent=(()=>{var tn=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var ur=Object.getOwnPropertyNames;var fr=Object.prototype.hasOwnProperty;var hr=(n,e)=>{for(var o in e)tn(n,o,{get:e[o],enumerable:!0})},mr=(n,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ur(e))!fr.call(n,s)&&s!==o&&tn(n,s,{get:()=>e[s],enumerable:!(r=dr(e,s))||r.enumerable});return n};var gr=n=>mr(tn({},"__esModule",{value:!0}),n);var Qr={};hr(Qr,{ConsentClient:()=>st,ConsentError:()=>v,VERSION:()=>Ge,create:()=>wn});var Tt="https://play.dashboard.atlaskyc.com/v3/api";var Ge="1.1.0";function Jn(){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 Et(n,e){if(!n||typeof n!="object")return!1;let o=n;return typeof o.ref_id!="string"||!o.ref_id||o.app_id!==e.app_id||o.level_id!==e.level_id||o.config_version!==e.config_version||!o.choices||typeof o.choices!="object"||Array.isArray(o.choices)?!1:Object.keys(o.choices).length===e.purposes.length&&e.purposes.every(r=>typeof o.choices[String(r.id)]=="boolean"&&(!r.required||o.choices[String(r.id)]))}var v=class extends Error{constructor(o,r,s=0){super(o);this.code=r;this.status=s;this.name="ConsentError"}};var Zn={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"},Qn={sharp:["2px","2px"],soft:["6px","6px"],round:["999px","16px"]},yr=/^#[0-9a-f]{6}$/i,De={theme:"light",primary_color:"#ae0a60",background_color:"#ffffff",text_color:"#1a202c",radius:"soft",font:"system",density:"comfortable"},eo={background_color:"#0f172a",text_color:"#f1f5f9"};function to(n){let[e,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*e+.7152*o+.0722*r}function no(n,e){let o=to(n),r=to(e);return(Math.max(o,r)+.05)/(Math.min(o,r)+.05)}function oo(n,e,o){let r={...De,...e||{}};for(let _ of["primary_color","background_color","text_color"])(typeof r[_]!="string"||!yr.test(r[_]))&&(r[_]=De[_]);(typeof r.radius!="string"||!Object.prototype.hasOwnProperty.call(Qn,r.radius))&&(r.radius=De.radius),(typeof r.font!="string"||!Object.prototype.hasOwnProperty.call(Zn,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=eo.background_color),r.text_color.toLowerCase()===De.text_color&&(r.text_color=eo.text_color));let[p,l]=Qn[r.radius],f=r.density==="compact",u={"--primary":r.primary_color,"--bg":r.background_color,"--text":r.text_color,"--on-primary":no(r.primary_color,"#000000")>no(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":Zn[r.font],"--r-btn":p,"--r-card":l,"--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 ro(n){let e=window.matchMedia("(prefers-color-scheme: dark)"),o,r=()=>{o?.theme==="system"&&oo(n,o,e)};return e.addEventListener("change",r),{apply(s){o=s,oo(n,s,e)},destroy(){e.removeEventListener("change",r)}}}function _r(n,e){this.v=n,this.k=e}function io(n,e){(e==null||e>n.length)&&(e=n.length);for(var o=0,r=Array(e);o<e;o++)r[o]=n[o];return r}function br(n){if(Array.isArray(n))return n}function vr(n,e){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var r,s,p,l,f=[],u=!0,_=!1;try{if(p=(o=o.call(n)).next,e===0){if(Object(o)!==o)return;u=!1}else for(;!(u=(r=p.call(o)).done)&&(f.push(r.value),f.length!==e);u=!0);}catch(S){_=!0,s=S}finally{try{if(!u&&o.return!=null&&(l=o.return(),Object(l)!==l))return}finally{if(_)throw s}}return f}}function Tr(){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 Er(n,e){return br(n)||vr(n,e)||wr(n,e)||Tr()}function wr(n,e){if(n){if(typeof n=="string")return io(n,e);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)?io(n,e):void 0}}function wt(n){var e,o;function r(p,l){try{var f=n[p](l),u=f.value,_=u instanceof _r;Promise.resolve(_?u.v:u).then(function(S){if(_){var H=p==="return"&&u.k?p:"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(p,l){p===2?e.reject(l):e.resolve({value:l,done:p}),(e=e.next)?r(e.key,e.arg):o=null}this._invoke=function(p,l){return new Promise(function(f,u){var _={key:p,arg:l,resolve:f,reject:u,next:null};o?o=o.next=_:(e=o=_,r(p,l))})},typeof n.return!="function"&&(this.return=void 0)}wt.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},wt.prototype.next=function(n){return this._invoke("next",n)},wt.prototype.throw=function(n){return this._invoke("throw",n)},wt.prototype.return=function(n){return this._invoke("return",n)};var To=Object.entries,so=Object.setPrototypeOf,Ar=Object.isFrozen,Eo=Object.getPrototypeOf,wo=Object.getOwnPropertyDescriptor,P=Object.freeze,U=Object.seal,We=Object.create,Ao=typeof Reflect<"u"&&Reflect,un=Ao.apply,fn=Ao.construct;P||(P=function(e){return e});U||(U=function(e){return e});un||(un=function(e,o){for(var r=arguments.length,s=new Array(r>2?r-2:0),p=2;p<r;p++)s[p-2]=arguments[p];return e.apply(o,s)});fn||(fn=function(e){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 e(...r)});var ye=R(Array.prototype.forEach);Array.prototype.indexOf;var Sr=R(Array.prototype.lastIndexOf),ao=R(Array.prototype.pop),tt=R(Array.prototype.push),xr=R(Array.prototype.slice),kr=R(Array.prototype.splice),qe=Array.isArray,nn=So(Set),on=R(Set.prototype.add),nt=R(Set.prototype.has),Ie=R(String.prototype.toLowerCase),rn=R(String.prototype.toString),co=R(String.prototype.match),ot=R(String.prototype.replace),lo=R(String.prototype.indexOf),Rr=R(String.prototype.trim),Cr=R(Number.prototype.toString),Or=R(Boolean.prototype.toString),po=typeof BigInt>"u"?null:R(BigInt.prototype.toString),uo=typeof Symbol>"u"?null:R(Symbol.prototype.toString),q=R(Object.prototype.hasOwnProperty),rt=R(Object.prototype.toString),N=R(RegExp.prototype.test),_e=So(TypeError);function R(n){return function(e){e instanceof RegExp&&(e.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 un(n,e,r)}}function So(n){return function(){for(var e=arguments.length,o=new Array(e),r=0;r<e;r++)o[r]=arguments[r];return fn(n,o)}}function E(n,e){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ie;if(so&&so(n,null),!qe(e))return n;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let p=o(s);p!==s&&(Ar(e)||(e[r]=p),s=p)}n[s]=!0}return n}function Lr(n){for(let e=0;e<n.length;e++)q(n,e)||(n[e]=null);return n}function K(n){let e=We(null);for(let r of To(n)){var o=Er(r,2);let s=o[0],p=o[1];q(n,s)&&(qe(p)?e[s]=Lr(p):p&&typeof p=="object"&&p.constructor===Object?e[s]=K(p):e[s]=p)}return e}function Dr(n){switch(typeof n){case"string":return n;case"number":return Cr(n);case"boolean":return Or(n);case"bigint":return po?po(n):"0";case"symbol":return uo?uo(n):"Symbol()";case"undefined":return rt(n);case"function":case"object":{if(n===null)return rt(n);let e=n,o=J(e,"toString");if(typeof o=="function"){let r=o(e);return typeof r=="string"?r:rt(r)}return rt(n)}default:return rt(n)}}function J(n,e){for(;n!==null;){let r=wo(n,e);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}n=Eo(n)}function o(){return null}return o}function Ir(n,e){for(;n!==null;){let o=wo(n,e);if(o)return o.get?R(o.get):null;n=Eo(n)}return null}function Mr(n){try{return N(n,""),!0}catch{return!1}}var fo=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"]),sn=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"]),an=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"]),Pr=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"]),cn=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"]),Nr=P(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ho=P(["#text"]),mo=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"]),ln=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"]),go=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"]),At=P(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ur=U(/{{[\w\W]*|^[\w\W]*}}/g),Fr=U(/<%[\w\W]*|^[\w\W]*%>/g),Hr=U(/\${[\w\W]*/g),zr=U(/^data-[\-\w.\u00B7-\uFFFF]+$/),Br=U(/^aria-[\-\w]+$/),yo=U(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jr=U(/^(?:\w+script|data):/i),Gr=U(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wr=U(/^html$/i),qr=U(/^[a-z][.\w]*(-[.\w]+)+$/i),pn=U(/<[/\w!]/g),_o=U(/<[/\w]/g),$r=U(/<\/no(script|embed|frames)/i),bo=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},Vr=P(E({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Yr=function(){return typeof window>"u"?null:window},Kr=function(e,o){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";o&&o.hasAttribute(s)&&(r=o.getAttribute(s));let p="dompurify"+(r?"#"+r:"");try{return e.createPolicy(p,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}},vo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},xe=function(e,o,r,s){return q(e,o)&&qe(e[o])?E(s.base?K(s.base):{},e[o],s.transform):r},dn=function(e,o,r){let s=q(e,o)?e[o]:void 0;return s&&typeof s=="object"?K(s):r()};function xo(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Yr(),e=d=>xo(d);if(e.version="3.4.17",e.removed=[],!n||!n.document||n.document.nodeType!==L.document||!n.Element)return e.isSupported=!1,e;let o=n.document,r=o,s=r.currentScript;n.DocumentFragment;let p=n.HTMLTemplateElement,l=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"),V=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=l&&l.prototype?J(l.prototype,"nodeType"):null,ue=l&&l.prototype?J(l.prototype,"nodeName"):null,ve=l&&l.prototype?J(l.prototype,"ownerDocument"):null,z=function(t){return Z?Z(t):t.nodeType},Te=function(t){return ue?ue(t):t.nodeName},Ve=Ir(H,"namespaceURI"),Ye=function(t){return Ve?Ve(t):t.namespaceURI};if(typeof p=="function"){let d=o.createElement("template");d.content&&d.content.ownerDocument&&(o=d.content.ownerDocument)}let F,fe="",Ke,h=!1,T=0,A=function(){if(T>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(t){A(),T++;try{return F.createHTML(t)}finally{T--}},he=function(t){A(),T++;try{return F.createScriptURL(t)}finally{T--}},oe=function(){return h||(Ke=Kr(S,s),h=!0),Ke},C=o,Y=C.implementation,Q=C.createNodeIterator,Dt=C.createDocumentFragment,at=C.getElementsByTagName,ct=r.importNode,w=vo();e.isSupported=typeof To=="function"&&typeof pe=="function"&&Y&&Y.createHTMLDocument!==void 0;let me=Ur,lt=Fr,M=Hr,re=zr,Ee=Br,Xe=jr,ie=Gr,pt=qr,dt=yo,x=null,It=E({},[...fo,...sn,...an,...cn,...ho]),k=null,Mt=E({},[...mo,...ln,...go,...At]),se=Object.seal(We(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Je=null,An=null,we=Object.seal(We(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Sn=!0,Pt=!0,xn=!1,Nt=!0,ge=!1,Re=!0,Ce=!1,Ut=!1,ut=null,ft=null,Ft=!1,Ne=!1,ht=!1,mt=!1,kn=!0,Rn=!1,Cn="user-content-",Ht=!0,zt=!1,Oe=null,Ue={},Le=null,On=E({},["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"]),Ln=null,Dn=E({},["audio","video","img","source","image","track"]),In=null,Mn=E({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),gt="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",ae="http://www.w3.org/1999/xhtml",Fe=ae,Bt=!1,jt=null,qo=E({},[gt,yt,ae],rn),Pn=P(["mi","mo","mn","ms","mtext"]),Gt=E({},Pn),Nn=P(["annotation-xml"]),Wt=E({},Nn),$o=E({},["title","style","font","a","script"]),Ze=null,Vo=["application/xhtml+xml","text/html"],Yo="text/html",O=null,He=null,Ko=o.createElement("form"),Un=function(t){return t instanceof RegExp||t instanceof Function},qt=function(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(He&&He===t)return;(!t||typeof t!="object")&&(t={}),t=K(t),Ze=Vo.indexOf(t.PARSER_MEDIA_TYPE)===-1?Yo:t.PARSER_MEDIA_TYPE,O=Ze==="application/xhtml+xml"?rn:Ie,x=xe(t,"ALLOWED_TAGS",It,{transform:O}),k=xe(t,"ALLOWED_ATTR",Mt,{transform:O}),jt=xe(t,"ALLOWED_NAMESPACES",qo,{transform:rn}),In=xe(t,"ADD_URI_SAFE_ATTR",Mn,{transform:O,base:Mn}),Ln=xe(t,"ADD_DATA_URI_TAGS",Dn,{transform:O,base:Dn}),Le=xe(t,"FORBID_CONTENTS",On,{transform:O}),Je=xe(t,"FORBID_TAGS",K({}),{transform:O}),An=xe(t,"FORBID_ATTR",K({}),{transform:O}),Ue=q(t,"USE_PROFILES")?t.USE_PROFILES&&typeof t.USE_PROFILES=="object"?K(t.USE_PROFILES):t.USE_PROFILES:!1,Sn=t.ALLOW_ARIA_ATTR!==!1,Pt=t.ALLOW_DATA_ATTR!==!1,xn=t.ALLOW_UNKNOWN_PROTOCOLS||!1,Nt=t.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=t.SAFE_FOR_TEMPLATES||!1,Re=t.SAFE_FOR_XML!==!1,Ce=t.WHOLE_DOCUMENT||!1,Ne=t.RETURN_DOM||!1,ht=t.RETURN_DOM_FRAGMENT||!1,mt=t.RETURN_TRUSTED_TYPE||!1,Ft=t.FORCE_BODY||!1,kn=t.SANITIZE_DOM!==!1,Rn=t.SANITIZE_NAMED_PROPS||!1,Ht=t.KEEP_CONTENT!==!1,zt=t.IN_PLACE||!1,dt=Mr(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:yo,Fe=typeof t.NAMESPACE=="string"?t.NAMESPACE:ae,Gt=dn(t,"MATHML_TEXT_INTEGRATION_POINTS",()=>E({},Pn)),Wt=dn(t,"HTML_INTEGRATION_POINTS",()=>E({},Nn));let i=dn(t,"CUSTOM_ELEMENT_HANDLING",()=>We(null));if(se=We(null),q(i,"tagNameCheck")&&Un(i.tagNameCheck)&&(se.tagNameCheck=i.tagNameCheck),q(i,"attributeNameCheck")&&Un(i.attributeNameCheck)&&(se.attributeNameCheck=i.attributeNameCheck),q(i,"allowCustomizedBuiltInElements")&&typeof i.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),U(se),ge&&(Pt=!1),ht&&(Ne=!0),Ue&&(x=E({},ho),k=We(null),Ue.html===!0&&(E(x,fo),E(k,mo)),Ue.svg===!0&&(E(x,sn),E(k,ln),E(k,At)),Ue.svgFilters===!0&&(E(x,an),E(k,ln),E(k,At)),Ue.mathMl===!0&&(E(x,cn),E(k,go),E(k,At))),we.tagCheck=null,we.attributeCheck=null,q(t,"ADD_TAGS")&&(typeof t.ADD_TAGS=="function"?we.tagCheck=t.ADD_TAGS:qe(t.ADD_TAGS)&&(x===It&&(x=K(x)),E(x,t.ADD_TAGS,O))),q(t,"ADD_ATTR")&&(typeof t.ADD_ATTR=="function"?we.attributeCheck=t.ADD_ATTR:qe(t.ADD_ATTR)&&(k===Mt&&(k=K(k)),E(k,t.ADD_ATTR,O))),q(t,"ADD_FORBID_CONTENTS")&&qe(t.ADD_FORBID_CONTENTS)&&(Le===On&&(Le=K(Le)),E(Le,t.ADD_FORBID_CONTENTS,O)),Ht&&(x["#text"]=!0),Ce&&E(x,["html","head","body"]),x.table&&(E(x,["tbody"]),delete Je.tbody),t.TRUSTED_TYPES_POLICY){if(typeof t.TRUSTED_TYPES_POLICY.createHTML!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof t.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _e('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let a=F;F=t.TRUSTED_TYPES_POLICY;try{fe=I("")}catch(c){throw F=a,c}}else t.TRUSTED_TYPES_POLICY===null?(F=void 0,fe=""):(F===void 0&&(F=oe()),F&&typeof fe=="string"&&(fe=I("")));P&&P(t),He=t},Fn=E({},[...sn,...an,...Pr]),Hn=E({},[...cn,...Nr]),Xo=function(t,i,a){return i.namespaceURI===ae?t==="svg":i.namespaceURI===gt?t==="svg"&&(a==="annotation-xml"||Gt[a]):!!Fn[t]},Jo=function(t,i,a){return i.namespaceURI===ae?t==="math":i.namespaceURI===yt?t==="math"&&Wt[a]:!!Hn[t]},Zo=function(t,i,a){return i.namespaceURI===yt&&!Wt[a]||i.namespaceURI===gt&&!Gt[a]?!1:!Hn[t]&&($o[t]||!Fn[t])},Qo=function(t){let i=Ye(t),a=Ie(Te(t)),c=pe(t),m,g;return c&&z(c)===L.element?(m={namespaceURI:Ye(c)},g=Ie(Te(c))):(m={namespaceURI:Fe},g="template"),jt[i]?i===yt?Xo(a,m,g):i===gt?Jo(a,m,g):i===ae?Zo(a,m,g):!!(Ze==="application/xhtml+xml"&&jt[i]):!1},Ae=function(t){tt(e.removed,{element:t});try{pe(t).removeChild(t)}catch{if(V(t),!pe(t))throw _e("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},zn=function(t,i,a){try{Me(t,i)}catch{try{t.removeAttribute(a)}catch{}}},$t=function(t){Yt(t);let i=le(t);i&&ye(xr(i),c=>{try{V(c)}catch{}});let a=z(t)===L.element?Pe(t):null;if(a)for(let c=a.length-1;c>=0;--c){let m=a[c],g=m&&m.name;typeof g=="string"&&zn(t,m,g)}},ze=function(t,i,a){if(!a)try{a=i.getAttributeNode(t)}catch{a=null}tt(e.removed,{attribute:a||null,from:i});try{a?Me(i,a):i.removeAttribute(t)}catch{try{i.removeAttribute(t)}catch{}}if(t==="is")if(Ne||ht)try{Ae(i)}catch{}else try{i.setAttribute(t,"")}catch{}},Bn=function(t){let i=Pe(t);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)]||zn(t,c,m)}},Vt=function(t,i){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,c=[t];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])}},Yt=function(t){Vt(t,i=>{z(i)===L.element&&Bn(i)})},Kt=function(t){let i=[];return Vt(t,a=>{i.push(a)},!0),i},er=function(t,i){let a=nn();ye(Kt(t),c=>{z(c)===L.element&&on(a,c)}),ye(i,c=>{z(c)===L.element&&!nt(a,c)&&Bn(c)})},jn=function(t,i){let a=!1;return ye(e.removed,c=>{c.element&&(a=a||c.element===t,Yt(c.element))}),er(t,i),a},tr=8,nr=function(t,i){let a=Oe,c=null,m=()=>(c||(c=nn(),ye(i,g=>{on(c,g)})),c);for(let g=0;;g++){let b=Kt(t),D=[t],ce=!1;if(ye(b,B=>{z(B)===L.documentFragment?tt(D,B):!ce&&!nt(a,B)&&(ce=nt(m(),B))}),!ce)return;if(g>=tr)throw _e("the tree kept changing during in-place sanitization; refusing to return it");ye(D,(B,G)=>{or(B,G>0,t,m())})}},or=function(t,i,a,c){let m=Xt(t),g;for(;g=m.nextNode();)!nt(c,g)||nt(Oe,g)||(i&&ee(w.uponSanitizeShadowNode,g,null),Zt(g,a),Qt(g,a),Se(g.content)&&et(g.content))},rr=function(t){Oe&&on(Oe,t)},Gn=function(t,i){return Re?t==="patchsrc"?!0:t==="for"&&i!=="label"&&i!=="output":!1},ir=function(t){Re&&Vt(t,i=>{let a=z(i);if(a===L.processingInstruction||a===L.comment&&N(_o,i.data)){try{V(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")&&Gn("for",m)&&c.removeAttribute("for")}catch{}}return!0})},Wn=function(t){let i=null,a=null;if(Ft)t="<remove></remove>"+t;else{let g=co(t,/^[\r\n\t ]+/);a=g&&g[0]}Ze==="application/xhtml+xml"&&Fe===ae&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");let c=F?I(t):t;if(Fe===ae)try{i=new _().parseFromString(c,Ze)}catch{}if(!i||!i.documentElement){i=Y.createDocument(Fe,"template",null);try{i.documentElement.innerHTML=Bt?fe:c}catch{}}let m=i.body||i.documentElement;return t&&a&&m.insertBefore(o.createTextNode(a),m.childNodes[0]||null),Fe===ae?at.call(i,Ce?"html":"body")[0]:Ce?i.documentElement:m},Xt=function(t){let i=ve?ve(t):t.ownerDocument;return Q.call(i||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},_t=function(t){return t=ot(t,me," "),t=ot(t,lt," "),t=ot(t,M," "),t},Jt=function(t){var i;qn(t);let a=(i=t.querySelectorAll)===null||i===void 0?void 0:i.call(t,"template");a&&ye(a,c=>{Se(c.content)&&Jt(c.content)})},qn=function(t){t.normalize();let i=ve?ve(t):t.ownerDocument,a=Q.call(i||t,t,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),c=a.nextNode();for(;c;)c.data=_t(c.data),c=a.nextNode()},bt=function(t){let i=ue?ue(t):null;return typeof i!="string"||O(i)!=="form"?!1:typeof t.nodeName!="string"||typeof t.textContent!="string"||typeof t.removeChild!="function"||t.attributes!==Pe(t)||typeof t.removeAttribute!="function"||typeof t.removeAttributeNode!="function"||typeof t.getAttributeNode!="function"||typeof t.setAttribute!="function"||typeof t.namespaceURI!="string"||typeof t.insertBefore!="function"||typeof t.hasChildNodes!="function"||t.nodeType!==Z(t)||t.childNodes!==le(t)},Se=function(t){if(!Z||typeof t!="object"||t===null)return!1;try{return Z(t)===L.documentFragment}catch{return!1}},Qe=function(t){if(!Z||typeof t!="object"||t===null)return!1;try{return typeof Z(t)=="number"}catch{return!1}};function ee(d,t,i){d.length!==0&&ye(d,a=>{a.call(e,t,i,He)})}let sr=function(t,i){return!!(Re&&t.hasChildNodes()&&!Qe(t.firstElementChild)&&N(pn,t.textContent)&&N(pn,t.innerHTML)||Re&&Vr[i]&&z(t)===L.element&&Ye(t)===ae&&(Qe(t.firstElementChild)||typeof t.textContent=="string"&&N(pn,t.textContent))||t.nodeType===L.processingInstruction||Re&&t.nodeType===L.comment&&N(_o,t.data))},vt=function(t,i){if(t instanceof RegExp)return N(t,i);if(t 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!!t(i,...c)}return!1},ar=function(t,i,a){if(!Je[i]&&Yn(i)&&vt(se.tagNameCheck,i))return!1;if(Ht&&!Le[i]&&!Le[Ie(i)]){let c=pe(t),m=le(t);if(m&&c){let g=m.length;for(let b=g-1;b>=0;--b){let D=t===a?ke(m[b],!0):m[b];c.insertBefore(D,ne(t))}}}return Ae(t),!0},$n=function(t,i,a,c){return t.length===0?i:i===a||i===c?K(i):i},Be=function(t,i){return t===i||pe(t)!==null?!1:(zt&&Yt(t),!0)},Zt=function(t,i){if(rr(t),ee(w.beforeSanitizeElements,t,null),Be(t,i))return!0;if(bt(t))return Ae(t),!0;let a=O(Te(t));if(x=$n(w.uponSanitizeElement,x,It,ut),ee(w.uponSanitizeElement,t,{tagName:a,allowedTags:x}),Be(t,i))return!0;if(sr(t,a))return Ae(t),!0;if(Je[a]||!(we.tagCheck instanceof Function&&we.tagCheck(a))&&!x[a]){let c=ar(t,a,i);return c===!1&&(ee(w.afterSanitizeElements,t,null),Be(t,i))?!0:c}if(z(t)===L.element&&!Qo(t)||(a==="noscript"||a==="noembed"||a==="noframes")&&N($r,t.innerHTML))return Ae(t),!0;if(ge&&t.nodeType===L.text){let c=_t(t.textContent);t.textContent!==c&&(tt(e.removed,{element:t.cloneNode()}),t.textContent=c)}return ee(w.afterSanitizeElements,t,null),Be(t,i)},Vn=function(t,i,a){if(An[i]||Gn(i,t)||kn&&(i==="id"||i==="name")&&(a in o||a in Ko))return!1;let c=k[i]||we.attributeCheck instanceof Function&&we.attributeCheck(i,t);return Pt&&N(re,i)||Sn&&N(Ee,i)?!0:c?In[i]||N(dt,ot(a,ie,""))||(i==="src"||i==="xlink:href"||i==="href")&&t!=="script"&&lo(a,"data:")===0&&Ln[t]||xn&&!N(Xe,ot(a,ie,""))?!0:!a:Yn(t)&&vt(se.tagNameCheck,t)&&vt(se.attributeNameCheck,i,t)||i==="is"&&se.allowCustomizedBuiltInElements&&vt(se.tagNameCheck,a)},cr=E({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Yn=function(t){return!cr[Ie(t)]&&N(pt,t)},lr=function(t,i,a,c){if(F&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!a)switch(S.getAttributeType(t,i)){case"TrustedHTML":return I(c);case"TrustedScriptURL":return he(c)}return c},pr=function(t,i,a,c){try{return a?t.setAttributeNS(a,i,c):t.setAttribute(i,c),bt(t)?(Ae(t),!1):!0}catch{return ze(i,t),!1}},Kn=function(t,i){return Re&&N(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,i)?!0:Ie(t)==="attributename"&&co(i,"href")!==null},Qt=function(t,i){if(ee(w.beforeSanitizeAttributes,t,null),Be(t,i))return;let a=t.attributes;if(!a||bt(t))return;k=$n(w.uponSanitizeAttribute,k,Mt,ft);let c={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0},m=a.length,g=O(t.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:Rr(je),Xn=!1;if(c.attrName=G,c.attrValue=W,c.keepAttr=!0,c.forceKeepAttr=void 0,ee(w.uponSanitizeAttribute,t,c),W=c.attrValue,Rn&&(G==="id"||G==="name")&&lo(W,Cn)!==0&&(ze(D,t,b),W=Cn+W,Xn=!0),Kn(D,W)){ze(D,t,b);continue}if(!c.forceKeepAttr){if(!c.keepAttr){ze(D,t,b);continue}if(!Nt&&N(bo,W)){ze(D,t,b);continue}if(ge&&(W=_t(W)),!Vn(g,G,W)){ze(D,t,b);continue}W=lr(g,G,ce,W),W!==je&&pr(t,D,ce,W)&&Xn&&ao(e.removed)}}ee(w.afterSanitizeAttributes,t,null),Be(t,i)},et=function(t){let i=null,a=Xt(t);for(ee(w.beforeSanitizeShadowDOM,t,null);i=a.nextNode();)if(ee(w.uponSanitizeShadowNode,i,null),Zt(i,t),Qt(i,t),Se(i.content)&&et(i.content),z(i)===L.element){let c=de(i);Se(c)&&(en(c),et(c))}ge&&qn(t),ee(w.afterSanitizeShadowDOM,t,null)},en=function(t){let i=[{node:t,shadow:null}];for(;i.length>0;){let a=i.pop();if(a.shadow){et(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 e.sanitize=function(d){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,c=null,m=null;if(Bt=!d,Bt&&(d="<!-->"),typeof d!="string"&&!Qe(d)&&(d=Dr(d),typeof d!="string"))throw _e("dirty is not a string, aborting");if(!e.isSupported)return d;Ut?(x=ut,k=ft):qt(t),(w.uponSanitizeElement.length>0||w.uponSanitizeAttribute.length>0)&&(x=K(x)),w.uponSanitizeAttribute.length>0&&(k=K(k)),e.removed=[];let g=zt&&typeof d!="string"&&Qe(d),b=[],D=Oe;if(g){ir(d);let G=Te(d);if(typeof G=="string"){let je=O(G);if(!x[je]||Je[je])throw $t(d),_e("root node is forbidden and cannot be sanitized in-place")}if(bt(d))throw $t(d),_e("root node is clobbered and cannot be sanitized in-place");b=Kt(d),Oe=nn()}else if(Qe(d))i=Wn("<!---->"),a=i.ownerDocument.importNode(d,!0),a.nodeType===L.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?i=a:i.appendChild(a),en(i);else{if(!Ne&&!ge&&!Ce&&d.indexOf("<")===-1)return F&&mt?I(d):d;if(i=Wn(d),!i)return Ne?null:mt?fe:""}i&&Ft&&Ae(i.firstChild);let ce=g?d:i;try{g&&en(d);let G=Xt(ce);for(;c=G.nextNode();)Zt(c,ce),Qt(c,ce),Se(c.content)&&et(c.content);g&&nr(d,b)}catch(G){throw g&&($t(d),jn(d,b)),G}finally{Oe=D}if(g){if(jn(d,b))throw _e("a node selected for removal could not be safely returned; refusing to sanitize in place");return ge&&Jt(d),d}if(Ne){if(ge&&Jt(i),ht)for(m=Dt.call(i.ownerDocument);i.firstChild;)m.appendChild(i.firstChild);else m=i;return(k.shadowroot||k.shadowrootmode)&&(m=ct.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(Wr,i.ownerDocument.doctype.name)&&(B="<!DOCTYPE "+i.ownerDocument.doctype.name+`>
3
+ `+B),ge&&(B=_t(B)),F&&mt?I(B):B},e.setConfig=function(){let d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qt(d),Ut=!0,ut=x,ft=k},e.clearConfig=function(){He=null,Ut=!1,ut=null,ft=null,F=Ke,fe=""},e.isValidAttribute=function(d,t,i){He||qt({});let a=O(d),c=O(t);return typeof i=="string"&&(Kn(t,i)||!Nt&&N(bo,i))?!1:Vn(a,c,i)},e.addHook=function(d,t){typeof t=="function"&&q(w,d)&&tt(w[d],t)},e.removeHook=function(d,t){if(q(w,d)){if(t!==void 0){let i=Sr(w[d],t);return i===-1?void 0:kr(w[d],i,1)[0]}return ao(w[d])}},e.removeHooks=function(d){q(w,d)&&(w[d]=[])},e.removeAllHooks=function(){w=vo()},e}var ko=xo();function y(n,e,o){let r=document.createElement(n);return e&&(r.textContent=e),o&&(r.className=o),r}function j(n){return typeof n!="string"?"":(Lo(n).textContent||"").trim()}var Co=new Set(["A","B","BLOCKQUOTE","BR","CODE","EM","I","LI","OL","P","PRE","STRONG","U","UL"]),Oo=new Set(["H1","H2","H3","H4","H5","H6"]),Ro;function Lo(n){return Ro??(Ro=ko(window)),Ro.sanitize(n,{ALLOWED_TAGS:[...Co,...Oo].map(e=>e.toLowerCase()),ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,RETURN_DOM_FRAGMENT:!0})}function Do(n){let e=document.createDocumentFragment();if(typeof n!="string")return e;let o=(r,s)=>{for(let p of Array.from(r.childNodes)){if(p.nodeType===Node.TEXT_NODE){s.appendChild(document.createTextNode(p.textContent||""));continue}if(!(p instanceof Element))continue;let l=p.tagName;if(Oo.has(l)){let f=document.createElement("p"),u=document.createElement("strong");f.appendChild(u),o(p,u),s.appendChild(f)}else if(Co.has(l)){let f=document.createElement(l.toLowerCase());if(l==="A"){let u=p.getAttribute("href")||"";/^(https?:|mailto:)/i.test(u.trim())&&(f.setAttribute("href",u.trim()),f.setAttribute("target","_blank"),f.setAttribute("rel","noopener noreferrer nofollow"))}o(p,f),s.appendChild(f)}else["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"].includes(l)||o(p,s)}};return o(Lo(n),e),e}var hn=4,Io="http://www.w3.org/2000/svg";function Xr(){let n=document.createElementNS(Io,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("class","chev"),n.setAttribute("aria-hidden","true");let e=document.createElementNS(Io,"path");return e.setAttribute("d","M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"),n.append(e),n}function mn(n,e){let o=(n||[]).map(u=>j(u.data_item_name)).filter(Boolean);if(!o.length){let u=(e||[]).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 p=!1,l=()=>{s.data=(p?o:o.slice(0,hn)).join(", "),f.textContent=p?"show less":`+${o.length-hn} more`},f=y("button",void 0,"more");return f.type="button",f.onclick=()=>{p=!p,l()},l(),o.length>hn&&r.append(f),r}function Mo(n,e,o){let r=y("div",void 0,"grp"),s=y("button",void 0,"gh");s.type="button",s.setAttribute("aria-expanded","false");let p=y("span",void 0,"gx");p.append(y("span",n,"gt")),e&&p.append(y("span",e,"gd")),s.append(p,Xr()),s.onclick=()=>{let f=!r.classList.contains("open");r.classList.toggle("open",f),s.setAttribute("aria-expanded",String(f))};let l=y("div",void 0,"gb");return o.forEach(f=>l.append(y("span",f,"gi"))),r.append(s,l),r}function gn(n){if(!j(n))return null;let e=y("div",void 0,"text");return e.append(Do(n)),e}function Po({root:n,config:e,state:o,mode:r,demo:s,onClose:p,onSubmit:l,onChange:f}){n.replaceChildren();for(let h of e.purposes)h.required&&(o.choices[String(h.id)]=!0);let u=e.notice||{},_=[...u.purposes||[]],S=new Set(_.flatMap(h=>(h.sub_items||[]).map(T=>T.purpose_id))),H=e.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,V=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=()=>p(),V.append(h)}Me.append(y("h1",j(ke?.title)||e.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,T)=>{h.forEach(A=>A.checked=!!o.choices[String(T)])}),pe.forEach(h=>{h.box.checked=h.ids.every(T=>!!o.choices[String(T)])}),fe()},Pe=(h,T)=>{if(o.busy){de();return}for(let A of h)e.purposes.find(I=>I.id===A)?.required||(o.choices[String(A)]=T);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!==e.language_code?u.sections_language_code:void 0;for(let h of Z){let T=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=gn(T.section_body);C&&I.append(C),ne.append(I);continue}T.section_title&&I.append(y("p",j(T.section_title),"st"));let he=gn(T.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 Y=C.sub_items||[];oe.append(Mo(`${j(C.data_category_name)||"Data"} (${Y.length})`,j(C.desc),Y.map(j)))}else if(A==="data_process_section")for(let C of _){let Y=C.sub_items||[],Q=Y.map(M=>M.purpose_id),Dt=Q.length>0&&Q.every(M=>e.purposes.find(re=>re.id===M)?.required);for(let M of Q){let re=!!e.purposes.find(Ee=>Ee.id===M)?.required;o.choices[String(M)]=re||!!o.choices[String(M)]}let at=y("div",void 0,"grp pg"),ct=y("div",void 0,"ph"),w=y("span",void 0,"gx");w.append(y("span",j(C.purpose_reason)||"Purposes","gt")),C.desc&&w.append(y("span",j(C.desc),"gd"));let me=y("input");me.type="checkbox",me.disabled=Dt,me.setAttribute("aria-label",`Select all: ${C.purpose_reason||"purposes"}`),me.onchange=()=>Pe(Q,me.checked),pe.push({box:me,ids:Q}),ct.append(w,me);let lt=y("div",void 0,"pb");for(let M of Y){let re=e.purposes.find(dt=>dt.id===M.purpose_id),Ee=y("div",void 0,"pr"),Xe=y("label",void 0,"prh");Xe.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]),Xe.append(ie),Ee.append(Xe),re?.description&&Ee.append(y("p",j(re.description),"ps"));let pt=mn(M.data_items,M.data_categories);pt&&Ee.append(pt),lt.append(Ee)}at.append(ct,y("hr",void 0,"hr"),lt),oe.append(at)}else if(A==="data_share_section"){for(let C of u.shared||[]){let Y=y("div",void 0,"sh");Y.append(y("span",j(C.purpose_name)||"Sharing","gt"));let Q=mn(C.data_items,C.data_categories);Q&&Y.append(Q),oe.append(Y)}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(),l()},Me.append(ne),V.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"),Ve=y("div",void 0,"actions"),Ye=h=>{h==="accept-all"?e.purposes.forEach(T=>o.choices[String(T.id)]=!0):h==="reject-all"&&e.purposes.forEach(T=>o.choices[String(T.id)]=T.required),l()},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 T=h.button_type==="accept-necessary",A=y("button",void 0,T?"primary":void 0);A.type="button",A.dataset.type=h.button_type,A.textContent=T?h.button_data?.accept_necessary_text||"Accept Necessary":h.button_text||h.button_type,A.onclick=()=>Ye(h.button_type),T&&(A.dataset.necessary=h.button_data?.accept_necessary_text||"Accept Necessary",A.dataset.selected=h.button_data?.accept_selected_text||"Accept Selected"),Ve.append(A)}return Te.append(Ve),V.append(Te),n.append(V),de(),(r==="popup"||r==="page")&&V.addEventListener("keydown",Ke),r!=="panel"&&!s&&(V.tabIndex=-1,V.focus({preventScroll:!0})),de;function fe(){let h=n.querySelector("button.primary");if(!h?.dataset.necessary)return;let T=e.purposes.some(A=>!A.required&&o.choices[String(A.id)]);h.textContent=T?h.dataset.selected:h.dataset.necessary}function Ke(h){if(h.key==="Escape"){p();return}if(h.key!=="Tab")return;let T=[...n.querySelectorAll("button:not([disabled]),input:not([disabled]),summary,a[href]")],A=T[0],I=T[T.length-1],he=n.getRootNode().activeElement;h.shiftKey&&(he===A||he===V)?(h.preventDefault(),I?.focus()):!h.shiftKey&&(he===I||he===V)&&(h.preventDefault(),A?.focus())}}var yn=`*{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 No=new WeakMap;function Uo(n){let e=n.ownerDocument,o=e.defaultView;if(o&&"adoptedStyleSheets"in o.Document.prototype&&"replaceSync"in o.CSSStyleSheet.prototype){let s=No.get(e);s||(s=new o.CSSStyleSheet,s.replaceSync(yn),No.set(e,s)),n.adoptedStyleSheets=[s];return}let r=e.createElement("style");r.textContent=yn,n.append(r)}var te=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),$=n=>n==null||typeof n=="string",be=(n,e)=>n==null||Array.isArray(n)&&n.length<=1e3&&n.every(e),_n=n=>be(n,e=>typeof e=="string"),Fo=n=>be(n,e=>te(e)&&$(e.data_item_name));function St(n,e){if(!te(n)||!$(n.sections_language_code))return!1;let o=new Set(e.map(l=>l.id)),r=new Set,s=l=>te(l)&&["accept-all","reject-all","accept-necessary"].includes(l.button_type)&&$(l.button_text)&&(l.button_enabled===void 0||typeof l.button_enabled=="boolean")&&(l.button_data==null||te(l.button_data)&&$(l.button_data.accept_necessary_text)&&$(l.button_data.accept_selected_text)),p=(l,f=0)=>{if(!te(l)||typeof l.section_type!="string"||!te(l.section_data))return!1;let u=l.section_data;return f<8&&$(u.title)&&$(u.section_title)&&$(u.section_body)&&be(u.buttons,s)&&be(u.sections,_=>p(_,f+1))};return(n.content==null||te(n.content)&&be(n.content.consent_data,l=>p(l)))&&be(n.purposes,l=>te(l)&&$(l.purpose_reason)&&$(l.desc)&&be(l.sub_items,f=>!te(f)||!o.has(f.purpose_id)||r.has(f.purpose_id)?!1:(r.add(f.purpose_id),$(f.purpose_name)&&Fo(f.data_items)&&_n(f.data_categories))))&&be(n.collected,l=>te(l)&&$(l.data_category_name)&&$(l.desc)&&_n(l.sub_items))&&be(n.shared,l=>te(l)&&$(l.purpose_name)&&Fo(l.data_items)&&_n(l.data_categories))}var xt=class{constructor(e){this.options=e;this.syncChecks=()=>{};this.pendingKey="";this.pendingBody="";this.needsRefresh=!1;let o=e.host.attachShadow({mode:"open"});Uo(o);let r=document.createElement("div");r.className="theme",r.lang=e.config.language_code,this.root=document.createElement("div"),this.root.className="root",this.root.dataset.mode=e.mode,r.append(this.root),o.append(r),this.appearance=ro(r),this.appearance.apply(e.appearance),this.state={choices:{...e.choices},busy:!1}}render(){let{config:e,mode:o,demo:r=!1,onClose:s}=this.options;try{if(!St(e.notice,e.purposes))throw new Error("Invalid notice");this.syncChecks=Po({root:this.root,config:e,state:this.state,mode:o,demo:r,onClose:s,onSubmit:()=>this.submit(),onChange:()=>{this.pendingKey=""}})}catch{let p="The consent form could not be displayed. Check the notice configuration and reload.",l=y("section",void 0,"shell"),f=y("p",p,"message error");f.setAttribute("role","alert");let u=y("div",void 0,"body");if(u.append(f),l.append(u),o!=="panel"){let _=y("button","\xD7","close");_.setAttribute("aria-label","Close consent form"),_.type="button",_.onclick=s,l.append(_)}this.root.replaceChildren(l),o!=="panel"&&!r&&l.querySelector("button")?.focus(),this.options.onError(new v(p,"form_error"))}}setAppearance(e){this.appearance.apply(e),this.render()}destroy(){this.appearance.destroy()}message(e,o=!1){let r=this.root.querySelector("#feedback");r&&(r.textContent=e,r.className=o?"message error":"message",r.setAttribute("role",o?"alert":"status"))}async submit(){let{state:e,root:o,options:r}=this;if(e.busy||this.needsRefresh)return;e.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 p={config_version:r.config.config_version,language_code:r.config.language_code,answers:r.config.purposes.map(u=>({purpose_id:u.id,given:!!e.choices[String(u.id)]}))},l=JSON.stringify(p);(!this.pendingKey||this.pendingBody!==l)&&(this.pendingKey=Jn(),this.pendingBody=l);let f;try{f=await r.save(p,this.pendingKey),e.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 v&&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{e.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 bn(n,e){if(!X(n))return!1;let o=new Set(e.purposes.map(r=>String(r.id)));return Object.entries(n).every(([r,s])=>o.has(r)&&typeof s=="boolean")}function it(n,e){if(!X(n)||n.app_id!==e||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))&&St(n.notice,n.purposes)}var kt=class{notePointer(e){this.pointerFocus=e.composedPath().find(o=>o instanceof HTMLElement&&o.matches("button,a[href],input,select,textarea,[tabindex]"))}activate(e){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",e.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 Ho(n,e){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",e==="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 Rt;function zo(n){Rt?.close(),Rt=n}function Bo(n){Rt===n&&(Rt=void 0)}function vn(n){let e=new URL(n,window.location.href);if(e.username||e.password||e.search||e.hash)throw new Error("Use an Atlas backend base URL without credentials or query parameters.");if(e.protocol!=="https:"&&!(e.protocol==="http:"&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname==="[::1]"||e.hostname.endsWith(".localhost"))))throw new Error("Atlas Consent requires HTTPS. HTTP is only supported for localhost.");return e.href.replace(/\/$/,"")}var jo="/consent-sdk/assets/";function Tn(n){let e=new URL(n,window.location.href).href,o=e.indexOf(jo);if(o<1)throw new Error(`Atlas Consent could not find "${jo}" in the script address. Load the SDK from the URL shown in Atlas, or use AtlasConsent.create({apiBaseUrl}).`);return vn(e.slice(0,o))}function En(n){if(!n)return;let e;try{e=JSON.parse(n)}catch{return}if(!e||typeof e.token!="string"||!e.token||typeof e.expires!="string"||!Number.isFinite(Date.parse(e.expires)))return;let o=e.result;return{token:e.token,expires:e.expires,result:o&&typeof o=="object"&&typeof o.ref_id=="string"?o:void 0}}function Ct(n){try{return localStorage.getItem(n)}catch{return}}function Go(n,e){try{return e?localStorage.setItem(n,JSON.stringify(e)):localStorage.removeItem(n),!0}catch{try{localStorage.removeItem(n)}catch{}return!1}}var Ot="atlas-consent:storage";async function Wo(n,e,o,r="Consent is temporarily unavailable."){if(e.aborted)throw new v("This consent instance was destroyed.","destroyed");let s=new AbortController,p=()=>s.abort();e.addEventListener("abort",p);let l=setTimeout(p,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 e.aborted?new v("This consent instance was destroyed.","destroyed"):s.signal.aborted?new v("Atlas took too long to respond.","request_timeout"):_ instanceof SyntaxError||_ instanceof DOMException&&_.name==="SyntaxError"?new v(f?.ok?"Atlas returned an invalid response.":r,f&&!f.ok?"request_failed":"invalid_response",f?.status):new v("Atlas could not be reached.","network_error",f?.status)}finally{clearTimeout(l),e.removeEventListener("abort",p)}if(!f.ok||!X(u)||u.data===void 0||u.data===null){let _=X(u)&&X(u.error)?u.error:{};throw new v(typeof _.message=="string"&&_.message?_.message:r,typeof _.code=="string"?_.code:typeof _.type=="string"?_.type:"request_failed",f.status)}return u.data}var Zr=60*864e5,$e=n=>({ref_id:n.ref_id,app_id:n.app_id,level_id:n.level_id,config_version:n.config_version,choices:{...n.choices}}),st=class{constructor(e){this.options=e;this.controller=new AbortController;this.preferenceSnapshot="null";this.accessibility=new kt;this.destroyed=!1;this.generation=0;this.reportedErrors=new WeakSet;this.storageChanged=e=>{(e.key===null||e.key===this.key)&&this.syncSaved()};this.documentStorageChanged=e=>{e.detail===this.key&&this.syncSaved()};this.keydown=e=>{e.key==="Escape"&&this.overlay&&this.close()};this.pointerdown=e=>this.accessibility.notePointer(e);if(!/^ac_app_[A-Za-z0-9_-]{10,40}$/.test(e.appId))throw new v("Use the app ID from Atlas Integrations.","invalid_app");let o=e.apiBaseUrl??Tt;if(!o)throw new v("Set apiBaseUrl or use an SDK build with a configured backend URL.","invalid_api_base_url");try{this.api=vn(o)}catch(s){throw new v(s.message,"invalid_api_base_url")}this.key=`atlas-consent:v2:${encodeURIComponent(this.api)}:${e.appId}`,this.stored=Ct(this.key),this.saved=En(this.stored??null),window.addEventListener("keydown",this.keydown),window.addEventListener("pointerdown",this.pointerdown,!0),window.addEventListener("storage",this.storageChanged),window.addEventListener(Ot,this.documentStorageChanged);let r=this.generation;this.ready=this.load().then(s=>{if(this.destroyed)throw new v("This consent instance was destroyed.","destroyed");return this.config=s,this.notifyPreference(),this.renewIfEnding(),r!==this.generation||(e.target?this.mount(e.target).catch(()=>{}):(e.mode||s.mode)==="popup"&&e.autoShow!==!1&&!this.hasChoice()&&this.open().catch(()=>{})),s}),this.ready.catch(s=>{this.loadFailure=s,this.fail(s)})}async load(){let e=await this.request(`/config?language_code=${encodeURIComponent(this.options.language||"en")}`);if(!it(e,this.options.appId))throw new v("Atlas returned an invalid configuration.","invalid_response");return e}request(e,o,r){return this.assertAlive(),Wo(`${this.api}/consent-sdk/v1/apps/${this.options.appId}${e}`,this.controller.signal,o,r)}persist(){let e=this.stored,o=Go(this.key,this.saved),r=o?this.saved?JSON.stringify(this.saved):null:Ct(this.key);r!==void 0&&(this.stored=r),this.notifyPreference(),(o||e!==this.stored)&&window.dispatchEvent(new CustomEvent(Ot,{detail:this.key}))}syncSaved(){if(this.destroyed)return;let e=Ct(this.key);if(e===void 0||e===this.stored)return;let o=En(e),r=o?.token!==this.saved?.token||JSON.stringify(o?.result)!==JSON.stringify(this.saved?.result);this.stored=e,this.saved=o,r&&this.form&&this.close(!0),this.notifyPreference()}notifyPreference(){let e=this.hasChoice()?$e(this.saved.result):null,o=JSON.stringify(e);if(o!==this.preferenceSnapshot){this.preferenceSnapshot=o;try{this.options.onPreferenceChange?.(e?$e(e):null)}catch(r){queueMicrotask(()=>{throw r})}window.dispatchEvent(new CustomEvent("atlas-consent:change",{detail:{appId:this.options.appId,preference:e?$e(e):null}}))}}alive(){return!!this.saved&&Date.parse(this.saved.expires)>Date.now()}hasChoice(){return!!this.config&&this.alive()&&Et(this.saved.result,this.config)}getPreference(){return this.syncSaved(),this.notifyPreference(),this.hasChoice()?$e(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(e){this.syncSaved();let o=this.stored,r=this.saved;if(this.alive())try{let p=await this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${r.token}`}});if(e!==this.generation)return{};if(this.syncSaved(),e!==this.generation)return{};if(o!==this.stored)return this.session(e);if(!X(p)||!it(p.config,this.options.appId)||!bn(p.choices,p.config))throw new v("Atlas returned an invalid session.","invalid_response");return this.reconcileSession(p,r),typeof p.expires_at=="string"&&Number.isFinite(Date.parse(p.expires_at))&&(r.expires=p.expires_at),this.persist(),p.choices}catch(p){if(e!==this.generation)return{};if(!(p instanceof v)||p.status!==401)throw p;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(e!==this.generation)return{};if(this.syncSaved(),e!==this.generation)return{};if(o!==this.stored)return this.session(e);if(!X(s)||typeof s.session_token!="string"||!s.session_token||typeof s.expires_at!="string"||!Number.isFinite(Date.parse(s.expires_at))||!it(s.config,this.options.appId))throw new v("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(e,o){let r=e.config,s=o.result;if(s?.config_version===r.config_version){let p={...s,choices:e.choices};o.result=Et(p,r)&&e.ref_id===s.ref_id?p:void 0}this.config=r}renewIfEnding(){if(!this.alive()||Date.parse(this.saved.expires)-Date.now()>Zr)return;let e=this.saved,o=this.stored;this.request("/session?language_code="+encodeURIComponent(this.options.language||"en"),{headers:{Authorization:`Bearer ${e.token}`}}).then(r=>{this.syncSaved(),this.saved===e&&this.stored===o&&X(r)&&it(r.config,this.options.appId)&&bn(r.choices,r.config)&&typeof r.expires_at=="string"&&Number.isFinite(Date.parse(r.expires_at))&&(this.reconcileSession(r,e),e.expires=r.expires_at,this.persist())}).catch(()=>{})}async save(e,o,r,s,p){if(this.syncSaved(),p!==this.generation||this.saved?.token!==s)throw new v("This consent form was closed. Open it again.","form_closed");let l=await this.request("/decisions",{method:"POST",headers:{Authorization:`Bearer ${s}`,"Idempotency-Key":o},body:JSON.stringify({...e,sdk_version:Ge})},"Your choices could not be saved. Please retry.");if(!Et(l,r))throw new v("Atlas returned an invalid consent result. Please retry.","invalid_response");let f=l.expires_at;return p===this.generation&&this.saved?.token===s&&typeof f=="string"&&Number.isFinite(Date.parse(f))&&(this.saved.expires=f),$e(l)}recordView(){this.request("/events",{method:"POST",headers:{Authorization:`Bearer ${this.saved?.token}`},body:JSON.stringify({event:"viewed"})}).catch(()=>{})}async reported(e){try{await e()}catch(o){throw o!==this.loadFailure&&this.fail(o),o}}mount(e){return this.reported(()=>this.mountForm(e))}async mountForm(e){let o=this.generation;if(await this.ready,this.assertAlive(),o!==this.generation)return;let r=typeof e=="string"?document.querySelector(e):e;if(!(r instanceof HTMLElement))throw new v("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 e=this.generation;if(await this.ready,this.assertAlive(),e!==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 e=this.mountTarget;return this.close(!0),e?this.mount(e):this.open()}startForm(e,o){if(this.form)return Promise.resolve();if(this.launchTask)return this.launchTask;let r=this.generation,s=Promise.resolve().then(()=>this.insertForm(e,o,r));this.launchTask=s;let p=()=>{this.launchTask===s&&(this.launchTask=void 0)};return s.then(p,p),s}async insertForm(e,o,r){try{if(this.assertAlive(),r!==this.generation)return;let s=await this.session(r);if(this.assertAlive(),r!==this.generation)return;o||zo(this);let p=this.createForm(e,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=Ho(this.host,e);let l=this.overlay;l.addEventListener("cancel",f=>{f.preventDefault(),this.overlay===l&&this.close()}),l.addEventListener("close",()=>{this.overlay===l&&this.close()}),this.overlay.append(this.host),document.body.append(this.overlay),this.accessibility.activate(this.overlay)}p.render(),this.recordView()}catch(s){if(this.destroyed)throw s;if(r!==this.generation)return;throw this.close(!0),s}}createForm(e,o){let r=this.generation,s=this.saved.token,p=this.config,l=document.createElement("atlas-consent-form");return l.style.cssText="display:block;width:100%;height:650px",this.host=l,this.form=new xt({host:l,config:this.config,choices:o,mode:e,appearance:{...this.config?.appearance,...this.options.appearance},save:(f,u)=>this.save(f,u,p,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(e){let o=this.overlay,r={app_id:e.app_id,ref_id:e.ref_id,claim_token:this.saved.token};this.saved.result=$e(e),this.persist();try{this.options.onComplete?.(e,r)}finally{o&&this.overlay===o&&this.close()}}assertAlive(){if(this.destroyed)throw new v("This consent instance was destroyed.","destroyed")}fail(e){if(this.destroyed||e instanceof v&&e.code==="destroyed")return;if(e&&typeof e=="object"){if(this.reportedErrors.has(e))return;this.reportedErrors.add(e)}let o=e instanceof v?e:new v(e instanceof Error?e.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(e=!1){this.generation+=1,this.launchTask=void 0,Bo(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&&!e&&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(Ot,this.documentStorageChanged)}};function wn(n){return new st(n)}var Lt=document.currentScript;if(Lt?.dataset.atlasApp){let n=Lt.dataset,e=n.atlasApp,o=p=>{let l=p instanceof v?p:new v(p instanceof Error?p.message:"Atlas Consent could not start.","unexpected_error");console.error(l.message),window.dispatchEvent(new CustomEvent("atlas-consent:error",{detail:{appId:e,error:l}}))},r=()=>{try{return Tn(Lt.src)}catch{return""}},s=()=>{let p;try{let l;if(n.appearance)try{l=JSON.parse(n.appearance)}catch{throw new v("data-appearance must be valid JSON.","invalid_appearance")}p=wn({appId:e,apiBaseUrl:n.apiBaseUrl||r()||Tt||Tn(Lt.src),mode:n.mode,target:n.target,language:n.language||"en",autoShow:n.autoShow===void 0?void 0:n.autoShow!=="false",appearance:l})}catch(l){o(l);return}p.ready.then(l=>{window.dispatchEvent(new CustomEvent("atlas-consent:ready",{detail:{client:p,version:Ge}})),!n.target&&(n.mode||l.mode)==="panel"&&o(new v('This integration shows a panel. Add data-target="#element-id" to the script tag, or call client.mount().',"missing_container"))},()=>{})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s,{once:!0}):s()}return gr(Qr);})();
5
5
  /*! Bundled license information:
6
6
 
7
7
  dompurify/dist/purify.es.mjs:
@@ -1,10 +1,9 @@
1
1
  {
2
- "version": "1.0.0",
2
+ "version": "1.1.0",
3
3
  "files": {
4
- "atlas-consent.js": "1gbGCvUMfC0ainfkRXZbd5RI0y4JxTIq7EVsFKeI3d7t4X+6AH/W8dL90BxXeMnC",
5
- "atlas-consent.esm.js": "wJJZ22AdV+n/zMfShp14mvapLmaWEiNIdrsXywzxu0SWCYMYfTQsdvEYXQ7bSpY1",
6
- "atlas-consent-ui.js": "kiHnJlrweigYAue/aKZvCgt+nGoYSw5VAMSa+ZkVYiEonif/vHuBn54RTTSoEu/O",
7
- "ui.html": "gkXwlOaVjJxvFsh06VvDdbrhZlwvda+y/UOgJpqeNzn8F8j5kGIN7HiUh/PtudLT"
4
+ "atlas-consent.js": "po0LSe+ixQInql64YgBzUomFWVZJtL05ioGvk/xRLr7RcexHGXXDB8UpkjAQc78U",
5
+ "atlas-consent.esm.js": "pSwYQ9ZyupEIWU/FqAc+9ITd0Ik8PMbZz3U5JwV/GFdBKpH4OWTKlJizPFfaQG4G",
6
+ "atlas-consent-preview.esm.js": "Y9NVmUTj7ZfiQ55fdCsQbNbdiyilaa09Q2GIIn45Vf402pwKoiuTIpkccQrwZoAM"
8
7
  },
9
8
  "environment": "production",
10
9
  "api_base_url": "https://play.dashboard.atlaskyc.com/v3/api"
@@ -0,0 +1,26 @@
1
+ import type { Appearance, Configuration, ConsentResult, DisplayMode } from "./types.js";
2
+ export type { Appearance, Configuration, ConsentResult, DisplayMode } from "./types.js";
3
+ export interface PreviewOptions {
4
+ /** The published configuration, as the dashboard's preview endpoint returns it. */
5
+ config: Configuration;
6
+ mode?: DisplayMode;
7
+ /** Overrides config.appearance, for unsaved edits. */
8
+ appearance?: Partial<Appearance>;
9
+ /** The visitor pressed a save button. The result is a stand-in; no record exists. */
10
+ onComplete?: (result: ConsentResult) => void;
11
+ /** The visitor closed a popup or full page. */
12
+ onClose?: () => void;
13
+ onError?: (error: unknown) => void;
14
+ }
15
+ export interface Preview {
16
+ /** Repaints the form with new colors or style at once, keeping the visitor's choices. */
17
+ setAppearance(appearance: Partial<Appearance> | undefined): void;
18
+ /** Removes the form. */
19
+ destroy(): void;
20
+ }
21
+ /**
22
+ * Draws the consent form inside `target`. Popup and full-page modes cover the nearest
23
+ * containing block, so put `target` in an iframe (or a transformed box) to keep them inside
24
+ * the preview. Inside an iframe, the form's layout follows the frame's width, as on a phone.
25
+ */
26
+ export declare function renderPreview(target: HTMLElement, options: PreviewOptions): Preview;
@@ -1,3 +1,3 @@
1
- export declare const VERSION = "1.0.0";
1
+ export declare const VERSION = "1.1.0";
2
2
  export declare const PROTOCOL = "atlas-consent:1";
3
3
  export declare const REQUEST_TIMEOUT_MS = 15000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasprivacy/consent-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Atlas consent UI and browser SDK",
5
5
  "type": "module",
6
6
  "main": "dist/atlas-consent.esm.js",
@@ -19,7 +19,6 @@
19
19
  "build": "npm run typecheck && node scripts/build.mjs && tsc --emitDeclarationOnly",
20
20
  "test": "node --import tsx --test tests/unit/*.test.* tests/integration/*.test.*",
21
21
  "test:browser": "playwright test",
22
- "sync:backend": "node scripts/sync-backend.mjs",
23
22
  "check": "npm run format:check && npm run lint && npm run test && npm run build && npm run test:package",
24
23
  "prepack": "npm run build",
25
24
  "lint": "eslint src tests scripts playwright.config.ts eslint.config.mjs --max-warnings 0",
@@ -54,10 +53,15 @@
54
53
  "import": "./dist/atlas-consent.esm.js",
55
54
  "default": "./dist/atlas-consent.esm.js"
56
55
  },
56
+ "./preview": {
57
+ "types": "./dist/preview.d.ts",
58
+ "import": "./dist/atlas-consent-preview.esm.js",
59
+ "default": "./dist/atlas-consent-preview.esm.js"
60
+ },
57
61
  "./browser": "./dist/atlas-consent.js"
58
62
  },
59
63
  "overrides": {
60
64
  "minimatch": "11.0.1"
61
65
  },
62
- "gitHead": "e7662a3670dffef99077952b1ddd538722d05d06"
66
+ "gitHead": "3b1b94cb42fbc351df8a174eb4c093f57adb694e"
63
67
  }