@atlasprivacy/consent-sdk 0.0.1-beta.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/README.md +19 -36
- package/dist/atlas-consent-preview.esm.js +10 -0
- package/dist/atlas-consent.esm.js +4 -4
- package/dist/atlas-consent.js +4 -4
- package/dist/manifest.json +6 -7
- package/dist/preview.d.ts +26 -0
- package/dist/shared/constants.d.ts +1 -1
- package/package.json +8 -5
- package/CONTRIBUTING.md +0 -85
- package/dist/atlas-consent-ui.js +0 -10
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui.html +0 -1
package/dist/atlas-consent-ui.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";(()=>{var ht="atlas-consent:1";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 Gn(n,o){if(!n||typeof n!="object")return!1;let i=n;return i.protocol===ht&&i.channel===o&&typeof i.type=="string"}var Ze=class extends Error{constructor(i,r,p=0){super(i);this.code=r;this.status=p;this.name="ConsentError"}};var Wn={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"},Yn={sharp:["2px","2px"],soft:["6px","6px"],round:["999px","16px"]},Zo=/^#[0-9a-f]{6}$/i,Le={theme:"light",primary_color:"#ae0a60",background_color:"#ffffff",text_color:"#1a202c",radius:"soft",font:"system",density:"comfortable"},$n={background_color:"#0f172a",text_color:"#f1f5f9"};function qn(n){let[o,i,r]=[1,3,5].map(p=>parseInt(n.slice(p,p+2),16)/255).map(p=>p<=.03928?p/12.92:((p+.055)/1.055)**2.4);return .2126*o+.7152*i+.0722*r}function Vn(n,o){let i=qn(n),r=qn(o);return(Math.max(i,r)+.05)/(Math.min(i,r)+.05)}function Kn(n,o,i){let r={...Le,...o||{}};for(let A of["primary_color","background_color","text_color"])(typeof r[A]!="string"||!Zo.test(r[A]))&&(r[A]=Le[A]);(typeof r.radius!="string"||!Object.prototype.hasOwnProperty.call(Yn,r.radius))&&(r.radius=Le.radius),(typeof r.font!="string"||!Object.prototype.hasOwnProperty.call(Wn,r.font))&&(r.font=Le.font),["light","dark","system"].includes(r.theme)||(r.theme=Le.theme);let p=r.theme==="dark"||r.theme==="system"&&i.matches;p&&(r.background_color.toLowerCase()===Le.background_color&&(r.background_color=$n.background_color),r.text_color.toLowerCase()===Le.text_color&&(r.text_color=$n.text_color));let[d,l]=Yn[r.radius],m=r.density==="compact",u={"--primary":r.primary_color,"--bg":r.background_color,"--text":r.text_color,"--on-primary":Vn(r.primary_color,"#000000")>Vn(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":Wn[r.font],"--r-btn":d,"--r-card":l,"--pad":m?"16px":"28px","--gap":m?"10px":"20px","--fs":m?"14px":"16px","--btn":m?"42px":"52px","--rowy":m?"4px":"12px","--rowx":m?"12px":"18px"};for(let[A,S]of Object.entries(u))n.style.setProperty(A,S);n.style.colorScheme=p?"dark":"light"}function Xn(n){let o=window.matchMedia("(prefers-color-scheme: dark)"),i,r=()=>{i?.theme==="system"&&Kn(n,i,o)};return o.addEventListener("change",r),{apply(p){i=p,Kn(n,p,o)},destroy(){o.removeEventListener("change",r)}}}function Qo(n,o){this.v=n,this.k=o}function Zn(n,o){(o==null||o>n.length)&&(o=n.length);for(var i=0,r=Array(o);i<o;i++)r[i]=n[i];return r}function Jo(n){if(Array.isArray(n))return n}function er(n,o){var i=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(i!=null){var r,p,d,l,m=[],u=!0,A=!1;try{if(d=(i=i.call(n)).next,o===0){if(Object(i)!==i)return;u=!1}else for(;!(u=(r=d.call(i)).done)&&(m.push(r.value),m.length!==o);u=!0);}catch(S){A=!0,p=S}finally{try{if(!u&&i.return!=null&&(l=i.return(),Object(l)!==l))return}finally{if(A)throw p}}return m}}function 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 nr(n,o){return Jo(n)||er(n,o)||or(n,o)||tr()}function or(n,o){if(n){if(typeof n=="string")return Zn(n,o);var i={}.toString.call(n).slice(8,-1);return i==="Object"&&n.constructor&&(i=n.constructor.name),i==="Map"||i==="Set"?Array.from(n):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Zn(n,o):void 0}}function _t(n){var o,i;function r(d,l){try{var m=n[d](l),u=m.value,A=u instanceof Qo;Promise.resolve(A?u.v:u).then(function(S){if(A){var F=d==="return"&&u.k?d:"next";if(!u.k||S.done)return r(F,S);S=n[F](S).value}p(!!m.done,S)},function(S){r("throw",S)})}catch(S){p(2,S)}}function p(d,l){d===2?o.reject(l):o.resolve({value:l,done:d}),(o=o.next)?r(o.key,o.arg):i=null}this._invoke=function(d,l){return new Promise(function(m,u){var A={key:d,arg:l,resolve:m,reject:u,next:null};i?i=i.next=A:(o=i=A,r(d,l))})},typeof n.return!="function"&&(this.return=void 0)}_t.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},_t.prototype.next=function(n){return this._invoke("next",n)},_t.prototype.throw=function(n){return this._invoke("throw",n)},_t.prototype.return=function(n){return this._invoke("return",n)};var fo=Object.entries,Qn=Object.setPrototypeOf,rr=Object.isFrozen,mo=Object.getPrototypeOf,go=Object.getOwnPropertyDescriptor,I=Object.freeze,P=Object.seal,Be=Object.create,ho=typeof Reflect<"u"&&Reflect,nn=ho.apply,on=ho.construct;I||(I=function(o){return o});P||(P=function(o){return o});nn||(nn=function(o,i){for(var r=arguments.length,p=new Array(r>2?r-2:0),d=2;d<r;d++)p[d-2]=arguments[d];return o.apply(i,p)});on||(on=function(o){for(var i=arguments.length,r=new Array(i>1?i-1:0),p=1;p<i;p++)r[p-1]=arguments[p];return new o(...r)});var ge=R(Array.prototype.forEach);Array.prototype.indexOf;var ir=R(Array.prototype.lastIndexOf),Jn=R(Array.prototype.pop),Qe=R(Array.prototype.push),sr=R(Array.prototype.slice),ar=R(Array.prototype.splice),je=Array.isArray,qt=_o(Set),Vt=R(Set.prototype.add),Je=R(Set.prototype.has),De=R(String.prototype.toLowerCase),Kt=R(String.prototype.toString),eo=R(String.prototype.match),et=R(String.prototype.replace),to=R(String.prototype.indexOf),cr=R(String.prototype.trim),lr=R(Number.prototype.toString),pr=R(Boolean.prototype.toString),no=typeof BigInt>"u"?null:R(BigInt.prototype.toString),oo=typeof Symbol>"u"?null:R(Symbol.prototype.toString),W=R(Object.prototype.hasOwnProperty),tt=R(Object.prototype.toString),M=R(RegExp.prototype.test),he=_o(TypeError);function R(n){return function(o){o instanceof RegExp&&(o.lastIndex=0);for(var i=arguments.length,r=new Array(i>1?i-1:0),p=1;p<i;p++)r[p-1]=arguments[p];return nn(n,o,r)}}function _o(n){return function(){for(var o=arguments.length,i=new Array(o),r=0;r<o;r++)i[r]=arguments[r];return on(n,i)}}function T(n,o){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:De;if(Qn&&Qn(n,null),!je(o))return n;let r=o.length;for(;r--;){let p=o[r];if(typeof p=="string"){let d=i(p);d!==p&&(rr(o)||(o[r]=d),p=d)}n[p]=!0}return n}function ur(n){for(let o=0;o<n.length;o++)W(n,o)||(n[o]=null);return n}function V(n){let o=Be(null);for(let r of fo(n)){var i=nr(r,2);let p=i[0],d=i[1];W(n,p)&&(je(d)?o[p]=ur(d):d&&typeof d=="object"&&d.constructor===Object?o[p]=V(d):o[p]=d)}return o}function dr(n){switch(typeof n){case"string":return n;case"number":return lr(n);case"boolean":return pr(n);case"bigint":return no?no(n):"0";case"symbol":return oo?oo(n):"Symbol()";case"undefined":return tt(n);case"function":case"object":{if(n===null)return tt(n);let o=n,i=K(o,"toString");if(typeof i=="function"){let r=i(o);return typeof r=="string"?r:tt(r)}return tt(n)}default:return tt(n)}}function K(n,o){for(;n!==null;){let r=go(n,o);if(r){if(r.get)return R(r.get);if(typeof r.value=="function")return R(r.value)}n=mo(n)}function i(){return null}return i}function fr(n,o){for(;n!==null;){let i=go(n,o);if(i)return i.get?R(i.get):null;n=mo(n)}return null}function mr(n){try{return M(n,""),!0}catch{return!1}}var ro=I(["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"]),Xt=I(["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"]),Zt=I(["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"]),gr=I(["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"]),Qt=I(["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"]),hr=I(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),io=I(["#text"]),so=I(["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"]),Jt=I(["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"]),ao=I(["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"]),yt=I(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),_r=P(/{{[\w\W]*|^[\w\W]*}}/g),yr=P(/<%[\w\W]*|^[\w\W]*%>/g),br=P(/\${[\w\W]*/g),Tr=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ar=P(/^aria-[\-\w]+$/),co=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Er=P(/^(?:\w+script|data):/i),xr=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sr=P(/^html$/i),vr=P(/^[a-z][.\w]*(-[.\w]+)+$/i),en=P(/<[/\w!]/g),lo=P(/<[/\w]/g),wr=P(/<\/no(script|embed|frames)/i),po=P(/\/>/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},Rr=I(T({},["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"])),Or=function(){return typeof window>"u"?null:window},Cr=function(o,i){if(typeof o!="object"||typeof o.createPolicy!="function")return null;let r=null,p="data-tt-policy-suffix";i&&i.hasAttribute(p)&&(r=i.getAttribute(p));let d="dompurify"+(r?"#"+r:"");try{return o.createPolicy(d,{createHTML(l){return l},createScriptURL(l){return l}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},uo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Se=function(o,i,r,p){return W(o,i)&&je(o[i])?T(p.base?V(p.base):{},o[i],p.transform):r},tn=function(o,i,r){let p=W(o,i)?o[i]:void 0;return p&&typeof p=="object"?V(p):r()};function yo(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Or(),o=c=>yo(c);if(o.version="3.4.17",o.removed=[],!n||!n.document||n.document.nodeType!==L.document||!n.Element)return o.isSupported=!1,o;let i=n.document,r=i,p=r.currentScript;n.DocumentFragment;let d=n.HTMLTemplateElement,l=n.Node,m=n.Element,u=n.NodeFilter;n.NamedNodeMap===void 0&&(n.NamedNodeMap||n.MozNamedAttrMap),n.HTMLFormElement;let A=n.DOMParser,S=n.trustedTypes,F=m.prototype,ve=K(F,"cloneNode"),$=K(F,"remove"),ke=K(F,"removeAttributeNode"),ee=K(F,"nextSibling"),ae=K(F,"childNodes"),ce=K(F,"parentNode"),le=K(F,"shadowRoot"),Ne=K(F,"attributes"),X=l&&l.prototype?K(l.prototype,"nodeType"):null,pe=l&&l.prototype?K(l.prototype,"nodeName"):null,ye=l&&l.prototype?K(l.prototype,"ownerDocument"):null,z=function(e){return X?X(e):e.nodeType},be=function(e){return pe?pe(e):e.nodeName},Ge=fr(F,"namespaceURI"),We=function(e){return Ge?Ge(e):e.namespaceURI};if(typeof d=="function"){let c=i.createElement("template");c.content&&c.content.ownerDocument&&(i=c.content.ownerDocument)}let U,ue="",Ye,f=!1,b=0,x=function(){if(b>0)throw he('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},k=function(e){x(),b++;try{return U.createHTML(e)}finally{b--}},de=function(e){x(),b++;try{return U.createScriptURL(e)}finally{b--}},te=function(){return f||(Ye=Cr(S,p),f=!0),Ye},O=i,q=O.implementation,Z=O.createNodeIterator,St=O.createDocumentFragment,nt=O.getElementsByTagName,ot=r.importNode,E=uo();o.isSupported=typeof fo=="function"&&typeof ce=="function"&&q&&q.createHTMLDocument!==void 0;let fe=_r,rt=yr,N=br,ne=Tr,Te=Ar,$e=Er,oe=xr,it=vr,st=co,v=null,vt=T({},[...ro,...Xt,...Zt,...Qt,...io]),w=null,wt=T({},[...so,...Jt,...ao,...yt]),re=Object.seal(Be(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}})),qe=null,gn=null,Ae=Object.seal(Be(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),hn=!0,Rt=!0,_n=!1,Ot=!0,me=!1,we=!0,Re=!1,Ct=!1,at=null,ct=null,Lt=!1,Ie=!1,lt=!1,pt=!1,yn=!0,bn=!1,Tn="user-content-",Dt=!0,kt=!1,Oe=null,Me={},Ce=null,An=T({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),En=null,xn=T({},["audio","video","img","source","image","track"]),Sn=null,vn=T({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ut="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",ie="http://www.w3.org/1999/xhtml",Pe=ie,Nt=!1,It=null,Do=T({},[ut,dt,ie],Kt),wn=I(["mi","mo","mn","ms","mtext"]),Mt=T({},wn),Rn=I(["annotation-xml"]),Pt=T({},Rn),ko=T({},["title","style","font","a","script"]),Ve=null,No=["application/xhtml+xml","text/html"],Io="text/html",C=null,Ue=null,Mo=i.createElement("form"),On=function(e){return e instanceof RegExp||e instanceof Function},Ut=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ue&&Ue===e)return;(!e||typeof e!="object")&&(e={}),e=V(e),Ve=No.indexOf(e.PARSER_MEDIA_TYPE)===-1?Io:e.PARSER_MEDIA_TYPE,C=Ve==="application/xhtml+xml"?Kt:De,v=Se(e,"ALLOWED_TAGS",vt,{transform:C}),w=Se(e,"ALLOWED_ATTR",wt,{transform:C}),It=Se(e,"ALLOWED_NAMESPACES",Do,{transform:Kt}),Sn=Se(e,"ADD_URI_SAFE_ATTR",vn,{transform:C,base:vn}),En=Se(e,"ADD_DATA_URI_TAGS",xn,{transform:C,base:xn}),Ce=Se(e,"FORBID_CONTENTS",An,{transform:C}),qe=Se(e,"FORBID_TAGS",V({}),{transform:C}),gn=Se(e,"FORBID_ATTR",V({}),{transform:C}),Me=W(e,"USE_PROFILES")?e.USE_PROFILES&&typeof e.USE_PROFILES=="object"?V(e.USE_PROFILES):e.USE_PROFILES:!1,hn=e.ALLOW_ARIA_ATTR!==!1,Rt=e.ALLOW_DATA_ATTR!==!1,_n=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ot=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,me=e.SAFE_FOR_TEMPLATES||!1,we=e.SAFE_FOR_XML!==!1,Re=e.WHOLE_DOCUMENT||!1,Ie=e.RETURN_DOM||!1,lt=e.RETURN_DOM_FRAGMENT||!1,pt=e.RETURN_TRUSTED_TYPE||!1,Lt=e.FORCE_BODY||!1,yn=e.SANITIZE_DOM!==!1,bn=e.SANITIZE_NAMED_PROPS||!1,Dt=e.KEEP_CONTENT!==!1,kt=e.IN_PLACE||!1,st=mr(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:co,Pe=typeof e.NAMESPACE=="string"?e.NAMESPACE:ie,Mt=tn(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>T({},wn)),Pt=tn(e,"HTML_INTEGRATION_POINTS",()=>T({},Rn));let t=tn(e,"CUSTOM_ELEMENT_HANDLING",()=>Be(null));if(re=Be(null),W(t,"tagNameCheck")&&On(t.tagNameCheck)&&(re.tagNameCheck=t.tagNameCheck),W(t,"attributeNameCheck")&&On(t.attributeNameCheck)&&(re.attributeNameCheck=t.attributeNameCheck),W(t,"allowCustomizedBuiltInElements")&&typeof t.allowCustomizedBuiltInElements=="boolean"&&(re.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),P(re),me&&(Rt=!1),lt&&(Ie=!0),Me&&(v=T({},io),w=Be(null),Me.html===!0&&(T(v,ro),T(w,so)),Me.svg===!0&&(T(v,Xt),T(w,Jt),T(w,yt)),Me.svgFilters===!0&&(T(v,Zt),T(w,Jt),T(w,yt)),Me.mathMl===!0&&(T(v,Qt),T(w,ao),T(w,yt))),Ae.tagCheck=null,Ae.attributeCheck=null,W(e,"ADD_TAGS")&&(typeof e.ADD_TAGS=="function"?Ae.tagCheck=e.ADD_TAGS:je(e.ADD_TAGS)&&(v===vt&&(v=V(v)),T(v,e.ADD_TAGS,C))),W(e,"ADD_ATTR")&&(typeof e.ADD_ATTR=="function"?Ae.attributeCheck=e.ADD_ATTR:je(e.ADD_ATTR)&&(w===wt&&(w=V(w)),T(w,e.ADD_ATTR,C))),W(e,"ADD_FORBID_CONTENTS")&&je(e.ADD_FORBID_CONTENTS)&&(Ce===An&&(Ce=V(Ce)),T(Ce,e.ADD_FORBID_CONTENTS,C)),Dt&&(v["#text"]=!0),Re&&T(v,["html","head","body"]),v.table&&(T(v,["tbody"]),delete qe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw he('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw he('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let s=U;U=e.TRUSTED_TYPES_POLICY;try{ue=k("")}catch(a){throw U=s,a}}else e.TRUSTED_TYPES_POLICY===null?(U=void 0,ue=""):(U===void 0&&(U=te()),U&&typeof ue=="string"&&(ue=k("")));I&&I(e),Ue=e},Cn=T({},[...Xt,...Zt,...gr]),Ln=T({},[...Qt,...hr]),Po=function(e,t,s){return t.namespaceURI===ie?e==="svg":t.namespaceURI===ut?e==="svg"&&(s==="annotation-xml"||Mt[s]):!!Cn[e]},Uo=function(e,t,s){return t.namespaceURI===ie?e==="math":t.namespaceURI===dt?e==="math"&&Pt[s]:!!Ln[e]},Fo=function(e,t,s){return t.namespaceURI===dt&&!Pt[s]||t.namespaceURI===ut&&!Mt[s]?!1:!Ln[e]&&(ko[e]||!Cn[e])},zo=function(e){let t=We(e),s=De(be(e)),a=ce(e),g,h;return a&&z(a)===L.element?(g={namespaceURI:We(a)},h=De(be(a))):(g={namespaceURI:Pe},h="template"),It[t]?t===dt?Po(s,g,h):t===ut?Uo(s,g,h):t===ie?Fo(s,g,h):!!(Ve==="application/xhtml+xml"&&It[t]):!1},Ee=function(e){Qe(o.removed,{element:e});try{ce(e).removeChild(e)}catch{if($(e),!ce(e))throw he("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Dn=function(e,t,s){try{ke(e,t)}catch{try{e.removeAttribute(s)}catch{}}},Ft=function(e){Ht(e);let t=ae(e);t&&ge(sr(t),a=>{try{$(a)}catch{}});let s=z(e)===L.element?Ne(e):null;if(s)for(let a=s.length-1;a>=0;--a){let g=s[a],h=g&&g.name;typeof h=="string"&&Dn(e,g,h)}},Fe=function(e,t,s){if(!s)try{s=t.getAttributeNode(e)}catch{s=null}Qe(o.removed,{attribute:s||null,from:t});try{s?ke(t,s):t.removeAttribute(e)}catch{try{t.removeAttribute(e)}catch{}}if(e==="is")if(Ie||lt)try{Ee(t)}catch{}else try{t.setAttribute(e,"")}catch{}},kn=function(e){let t=Ne(e);if(t)for(let s=t.length-1;s>=0;--s){let a=t[s],g=a&&a.name;typeof g!="string"||w[C(g)]||Dn(e,a,g)}},zt=function(e,t){let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,a=[e];for(;a.length>0;){let g=a.pop();if(t(g)===!1)continue;if(s&&z(g)===L.element){let y=le(g);xe(y)&&a.push(y)}let h=ae(g);if(h)for(let y=h.length-1;y>=0;--y)a.push(h[y])}},Ht=function(e){zt(e,t=>{z(t)===L.element&&kn(t)})},Bt=function(e){let t=[];return zt(e,s=>{t.push(s)},!0),t},Ho=function(e,t){let s=qt();ge(Bt(e),a=>{z(a)===L.element&&Vt(s,a)}),ge(t,a=>{z(a)===L.element&&!Je(s,a)&&kn(a)})},Nn=function(e,t){let s=!1;return ge(o.removed,a=>{a.element&&(s=s||a.element===e,Ht(a.element))}),Ho(e,t),s},Bo=8,jo=function(e,t){let s=Oe,a=null,g=()=>(a||(a=qt(),ge(t,h=>{Vt(a,h)})),a);for(let h=0;;h++){let y=Bt(e),D=[e],se=!1;if(ge(y,H=>{z(H)===L.documentFragment?Qe(D,H):!se&&!Je(s,H)&&(se=Je(g(),H))}),!se)return;if(h>=Bo)throw he("the tree kept changing during in-place sanitization; refusing to return it");ge(D,(H,j)=>{Go(H,j>0,e,g())})}},Go=function(e,t,s,a){let g=jt(e),h;for(;h=g.nextNode();)!Je(a,h)||Je(Oe,h)||(t&&Q(E.uponSanitizeShadowNode,h,null),Wt(h,s),Yt(h,s),xe(h.content)&&Xe(h.content))},Wo=function(e){Oe&&Vt(Oe,e)},In=function(e,t){return we?e==="patchsrc"?!0:e==="for"&&t!=="label"&&t!=="output":!1},Yo=function(e){we&&zt(e,t=>{let s=z(t);if(s===L.processingInstruction||s===L.comment&&M(lo,t.data)){try{$(t)}catch{}return!1}if(s===L.element){let a=t,g=C(be(t));try{a.hasAttribute&&a.hasAttribute("patchsrc")&&a.removeAttribute("patchsrc"),a.hasAttribute&&a.hasAttribute("for")&&In("for",g)&&a.removeAttribute("for")}catch{}}return!0})},Mn=function(e){let t=null,s=null;if(Lt)e="<remove></remove>"+e;else{let h=eo(e,/^[\r\n\t ]+/);s=h&&h[0]}Ve==="application/xhtml+xml"&&Pe===ie&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let a=U?k(e):e;if(Pe===ie)try{t=new A().parseFromString(a,Ve)}catch{}if(!t||!t.documentElement){t=q.createDocument(Pe,"template",null);try{t.documentElement.innerHTML=Nt?ue:a}catch{}}let g=t.body||t.documentElement;return e&&s&&g.insertBefore(i.createTextNode(s),g.childNodes[0]||null),Pe===ie?nt.call(t,Re?"html":"body")[0]:Re?t.documentElement:g},jt=function(e){let t=ye?ye(e):e.ownerDocument;return Z.call(t||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},ft=function(e){return e=et(e,fe," "),e=et(e,rt," "),e=et(e,N," "),e},Gt=function(e){var t;Pn(e);let s=(t=e.querySelectorAll)===null||t===void 0?void 0:t.call(e,"template");s&&ge(s,a=>{xe(a.content)&&Gt(a.content)})},Pn=function(e){e.normalize();let t=ye?ye(e):e.ownerDocument,s=Z.call(t||e,e,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null),a=s.nextNode();for(;a;)a.data=ft(a.data),a=s.nextNode()},mt=function(e){let t=pe?pe(e):null;return typeof t!="string"||C(t)!=="form"?!1:typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||e.attributes!==Ne(e)||typeof e.removeAttribute!="function"||typeof e.removeAttributeNode!="function"||typeof e.getAttributeNode!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function"||e.nodeType!==X(e)||e.childNodes!==ae(e)},xe=function(e){if(!X||typeof e!="object"||e===null)return!1;try{return X(e)===L.documentFragment}catch{return!1}},Ke=function(e){if(!X||typeof e!="object"||e===null)return!1;try{return typeof X(e)=="number"}catch{return!1}};function Q(c,e,t){c.length!==0&&ge(c,s=>{s.call(o,e,t,Ue)})}let $o=function(e,t){return!!(we&&e.hasChildNodes()&&!Ke(e.firstElementChild)&&M(en,e.textContent)&&M(en,e.innerHTML)||we&&Rr[t]&&z(e)===L.element&&We(e)===ie&&(Ke(e.firstElementChild)||typeof e.textContent=="string"&&M(en,e.textContent))||e.nodeType===L.processingInstruction||we&&e.nodeType===L.comment&&M(lo,e.data))},gt=function(e,t){if(e instanceof RegExp)return M(e,t);if(e instanceof Function){for(var s=arguments.length,a=new Array(s>2?s-2:0),g=2;g<s;g++)a[g-2]=arguments[g];return!!e(t,...a)}return!1},qo=function(e,t,s){if(!qe[t]&&zn(t)&>(re.tagNameCheck,t))return!1;if(Dt&&!Ce[t]&&!Ce[De(t)]){let a=ce(e),g=ae(e);if(g&&a){let h=g.length;for(let y=h-1;y>=0;--y){let D=e===s?ve(g[y],!0):g[y];a.insertBefore(D,ee(e))}}}return Ee(e),!0},Un=function(e,t,s,a){return e.length===0?t:t===s||t===a?V(t):t},ze=function(e,t){return e===t||ce(e)!==null?!1:(kt&&Ht(e),!0)},Wt=function(e,t){if(Wo(e),Q(E.beforeSanitizeElements,e,null),ze(e,t))return!0;if(mt(e))return Ee(e),!0;let s=C(be(e));if(v=Un(E.uponSanitizeElement,v,vt,at),Q(E.uponSanitizeElement,e,{tagName:s,allowedTags:v}),ze(e,t))return!0;if($o(e,s))return Ee(e),!0;if(qe[s]||!(Ae.tagCheck instanceof Function&&Ae.tagCheck(s))&&!v[s]){let a=qo(e,s,t);return a===!1&&(Q(E.afterSanitizeElements,e,null),ze(e,t))?!0:a}if(z(e)===L.element&&!zo(e)||(s==="noscript"||s==="noembed"||s==="noframes")&&M(wr,e.innerHTML))return Ee(e),!0;if(me&&e.nodeType===L.text){let a=ft(e.textContent);e.textContent!==a&&(Qe(o.removed,{element:e.cloneNode()}),e.textContent=a)}return Q(E.afterSanitizeElements,e,null),ze(e,t)},Fn=function(e,t,s){if(gn[t]||In(t,e)||yn&&(t==="id"||t==="name")&&(s in i||s in Mo))return!1;let a=w[t]||Ae.attributeCheck instanceof Function&&Ae.attributeCheck(t,e);return Rt&&M(ne,t)||hn&&M(Te,t)?!0:a?Sn[t]||M(st,et(s,oe,""))||(t==="src"||t==="xlink:href"||t==="href")&&e!=="script"&&to(s,"data:")===0&&En[e]||_n&&!M($e,et(s,oe,""))?!0:!s:zn(e)&>(re.tagNameCheck,e)&>(re.attributeNameCheck,t,e)||t==="is"&&re.allowCustomizedBuiltInElements&>(re.tagNameCheck,s)},Vo=T({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zn=function(e){return!Vo[De(e)]&&M(it,e)},Ko=function(e,t,s,a){if(U&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!s)switch(S.getAttributeType(e,t)){case"TrustedHTML":return k(a);case"TrustedScriptURL":return de(a)}return a},Xo=function(e,t,s,a){try{return s?e.setAttributeNS(s,t,a):e.setAttribute(t,a),mt(e)?(Ee(e),!1):!0}catch{return Fe(t,e),!1}},Hn=function(e,t){return we&&M(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:De(e)==="attributename"&&eo(t,"href")!==null},Yt=function(e,t){if(Q(E.beforeSanitizeAttributes,e,null),ze(e,t))return;let s=e.attributes;if(!s||mt(e))return;w=Un(E.uponSanitizeAttribute,w,wt,ct);let a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0},g=s.length,h=C(e.nodeName);for(;g--;){let y=s[g],D=y.name,se=y.namespaceURI,H=y.value,j=C(D),He=H,G=D==="value"?He:cr(He),Bn=!1;if(a.attrName=j,a.attrValue=G,a.keepAttr=!0,a.forceKeepAttr=void 0,Q(E.uponSanitizeAttribute,e,a),G=a.attrValue,bn&&(j==="id"||j==="name")&&to(G,Tn)!==0&&(Fe(D,e,y),G=Tn+G,Bn=!0),Hn(D,G)){Fe(D,e,y);continue}if(!a.forceKeepAttr){if(!a.keepAttr){Fe(D,e,y);continue}if(!Ot&&M(po,G)){Fe(D,e,y);continue}if(me&&(G=ft(G)),!Fn(h,j,G)){Fe(D,e,y);continue}G=Ko(h,j,se,G),G!==He&&Xo(e,D,se,G)&&Bn&&Jn(o.removed)}}Q(E.afterSanitizeAttributes,e,null),ze(e,t)},Xe=function(e){let t=null,s=jt(e);for(Q(E.beforeSanitizeShadowDOM,e,null);t=s.nextNode();)if(Q(E.uponSanitizeShadowNode,t,null),Wt(t,e),Yt(t,e),xe(t.content)&&Xe(t.content),z(t)===L.element){let a=le(t);xe(a)&&($t(a),Xe(a))}me&&Pn(e),Q(E.afterSanitizeShadowDOM,e,null)},$t=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let s=t.pop();if(s.shadow){Xe(s.shadow);continue}let a=s.node,g=z(a)===L.element,h=ae(a);if(h)for(let y=h.length-1;y>=0;--y)t.push({node:h[y],shadow:null});if(g){let y=pe?pe(a):null;if(typeof y=="string"&&C(y)==="template"){let D=a.content;xe(D)&&t.push({node:D,shadow:null})}}if(g){let y=le(a);xe(y)&&t.push({node:null,shadow:y},{node:y,shadow:null})}}};return o.sanitize=function(c){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=null,s=null,a=null,g=null;if(Nt=!c,Nt&&(c="<!-->"),typeof c!="string"&&!Ke(c)&&(c=dr(c),typeof c!="string"))throw he("dirty is not a string, aborting");if(!o.isSupported)return c;Ct?(v=at,w=ct):Ut(e),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(v=V(v)),E.uponSanitizeAttribute.length>0&&(w=V(w)),o.removed=[];let h=kt&&typeof c!="string"&&Ke(c),y=[],D=Oe;if(h){Yo(c);let j=be(c);if(typeof j=="string"){let He=C(j);if(!v[He]||qe[He])throw Ft(c),he("root node is forbidden and cannot be sanitized in-place")}if(mt(c))throw Ft(c),he("root node is clobbered and cannot be sanitized in-place");y=Bt(c),Oe=qt()}else if(Ke(c))t=Mn("<!---->"),s=t.ownerDocument.importNode(c,!0),s.nodeType===L.element&&s.nodeName==="BODY"||s.nodeName==="HTML"?t=s:t.appendChild(s),$t(t);else{if(!Ie&&!me&&!Re&&c.indexOf("<")===-1)return U&&pt?k(c):c;if(t=Mn(c),!t)return Ie?null:pt?ue:""}t&&Lt&&Ee(t.firstChild);let se=h?c:t;try{h&&$t(c);let j=jt(se);for(;a=j.nextNode();)Wt(a,se),Yt(a,se),xe(a.content)&&Xe(a.content);h&&jo(c,y)}catch(j){throw h&&(Ft(c),Nn(c,y)),j}finally{Oe=D}if(h){if(Nn(c,y))throw he("a node selected for removal could not be safely returned; refusing to sanitize in place");return me&&Gt(c),c}if(Ie){if(me&&Gt(t),lt)for(g=St.call(t.ownerDocument);t.firstChild;)g.appendChild(t.firstChild);else g=t;return(w.shadowroot||w.shadowrootmode)&&(g=ot.call(r,g,!0)),g}let H=Re?t.outerHTML:t.innerHTML;return Re&&v["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&M(Sr,t.ownerDocument.doctype.name)&&(H="<!DOCTYPE "+t.ownerDocument.doctype.name+`>
|
|
3
|
-
`+H),me&&(H=ft(H)),U&&pt?k(H):H},o.setConfig=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ut(c),Ct=!0,at=v,ct=w},o.clearConfig=function(){Ue=null,Ct=!1,at=null,ct=null,U=Ye,ue=""},o.isValidAttribute=function(c,e,t){Ue||Ut({});let s=C(c),a=C(e);return typeof t=="string"&&(Hn(e,t)||!Ot&&M(po,t))?!1:Fn(s,a,t)},o.addHook=function(c,e){typeof e=="function"&&W(E,c)&&Qe(E[c],e)},o.removeHook=function(c,e){if(W(E,c)){if(e!==void 0){let t=ir(E[c],e);return t===-1?void 0:ar(E[c],t,1)[0]}return Jn(E[c])}},o.removeHooks=function(c){W(E,c)&&(E[c]=[])},o.removeAllHooks=function(){E=uo()},o}var bo=yo();function _(n,o,i){let r=document.createElement(n);return o&&(r.textContent=o),i&&(r.className=i),r}function B(n){return typeof n!="string"?"":(xo(n).textContent||"").trim()}var Ao=new Set(["A","B","BLOCKQUOTE","BR","CODE","EM","I","LI","OL","P","PRE","STRONG","U","UL"]),Eo=new Set(["H1","H2","H3","H4","H5","H6"]),To;function xo(n){return To??(To=bo(window)),To.sanitize(n,{ALLOWED_TAGS:[...Ao,...Eo].map(o=>o.toLowerCase()),ALLOWED_ATTR:["href"],ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1,RETURN_DOM_FRAGMENT:!0})}function So(n){let o=document.createDocumentFragment();if(typeof n!="string")return o;let i=(r,p)=>{for(let d of Array.from(r.childNodes)){if(d.nodeType===Node.TEXT_NODE){p.appendChild(document.createTextNode(d.textContent||""));continue}if(!(d instanceof Element))continue;let l=d.tagName;if(Eo.has(l)){let m=document.createElement("p"),u=document.createElement("strong");m.appendChild(u),i(d,u),p.appendChild(m)}else if(Ao.has(l)){let m=document.createElement(l.toLowerCase());if(l==="A"){let u=d.getAttribute("href")||"";/^(https?:|mailto:)/i.test(u.trim())&&(m.setAttribute("href",u.trim()),m.setAttribute("target","_blank"),m.setAttribute("rel","noopener noreferrer nofollow"))}i(d,m),p.appendChild(m)}else["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"].includes(l)||i(d,p)}};return i(xo(n),o),o}var rn=4,vo="http://www.w3.org/2000/svg";function Lr(){let n=document.createElementNS(vo,"svg");n.setAttribute("viewBox","0 0 24 24"),n.setAttribute("class","chev"),n.setAttribute("aria-hidden","true");let o=document.createElementNS(vo,"path");return o.setAttribute("d","M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"),n.append(o),n}function sn(n,o){let i=(n||[]).map(u=>B(u.data_item_name)).filter(Boolean);if(!i.length){let u=(o||[]).map(B).filter(Boolean).join(" \xB7 ");return u?_("div",u,"ps"):null}let r=_("div",void 0,"ps"),p=document.createTextNode("");r.append(p);let d=!1,l=()=>{p.data=(d?i:i.slice(0,rn)).join(", "),m.textContent=d?"show less":`+${i.length-rn} more`},m=_("button",void 0,"more");return m.type="button",m.onclick=()=>{d=!d,l()},l(),i.length>rn&&r.append(m),r}function wo(n,o,i){let r=_("div",void 0,"grp"),p=_("button",void 0,"gh");p.type="button",p.setAttribute("aria-expanded","false");let d=_("span",void 0,"gx");d.append(_("span",n,"gt")),o&&d.append(_("span",o,"gd")),p.append(d,Lr()),p.onclick=()=>{let m=!r.classList.contains("open");r.classList.toggle("open",m),p.setAttribute("aria-expanded",String(m))};let l=_("div",void 0,"gb");return i.forEach(m=>l.append(_("span",m,"gi"))),r.append(p,l),r}function an(n){if(!B(n))return null;let o=_("div",void 0,"text");return o.append(So(n)),o}function Ro({root:n,config:o,state:i,mode:r,demo:p,onClose:d,onSubmit:l,onChange:m}){n.replaceChildren();for(let f of o.purposes)f.required&&(i.choices[String(f.id)]=!0);let u=o.notice||{},A=[...u.purposes||[]],S=new Set(A.flatMap(f=>(f.sub_items||[]).map(b=>b.purpose_id))),F=o.purposes.filter(f=>!S.has(f.id));F.length&&A.push({purpose_reason:A.length?"Other purposes":"Purposes",sub_items:F.map(f=>({purpose_id:f.id,purpose_name:f.name}))});let ve=u.content?.consent_data?.find(f=>f.section_type==="initial-section")?.section_data,$=_("section",void 0,"shell"),ke=_("div",void 0,"body");if(r!=="panel"){let f=_("button","\xD7","close");f.type="button",f.setAttribute("aria-label","Close consent form"),f.onclick=()=>d(),$.append(f)}ke.append(_("h1",B(ve?.title)||o.name||"Your consent preferences"));let ee=_("form",void 0,"sec");ee.id="consent-form",ee.style.padding="0",ee.style.gap="16px";let ae=new Map,ce=[],le=()=>{ae.forEach((f,b)=>{f.forEach(x=>x.checked=!!i.choices[String(b)])}),ce.forEach(f=>{f.box.checked=f.ids.every(b=>!!i.choices[String(b)])}),ue()},Ne=(f,b)=>{if(i.busy){le();return}for(let x of f)o.purposes.find(k=>k.id===x)?.required||(i.choices[String(x)]=b);m(),le()},X=ve?.sections?.length?[...ve.sections]:[{section_type:"data_process_section",section_data:{section_title:"How we use it"}}];X.some(f=>f.section_type==="data_process_section")||X.push({section_type:"data_process_section",section_data:{section_title:"Purposes"}});let pe=u.sections_language_code&&u.sections_language_code!==o.language_code?u.sections_language_code:void 0;for(let f of X){let b=f.section_data,x=f.section_type;if(x==="link_section")continue;let k=_("div",void 0,"sec");if(x==="generic_section"){let O=an(b.section_body);O&&k.append(O),ee.append(k);continue}b.section_title&&k.append(_("p",B(b.section_title),"st"));let de=an(b.section_body);de&&k.append(de);let te=_("div",void 0,"grps");if(pe&&(te.lang=pe),x==="data_collect_section")for(let O of u.collected||[]){let q=O.sub_items||[];te.append(wo(`${B(O.data_category_name)||"Data"} (${q.length})`,B(O.desc),q.map(B)))}else if(x==="data_process_section")for(let O of A){let q=O.sub_items||[],Z=q.map(N=>N.purpose_id),St=Z.length>0&&Z.every(N=>o.purposes.find(ne=>ne.id===N)?.required);for(let N of Z){let ne=!!o.purposes.find(Te=>Te.id===N)?.required;i.choices[String(N)]=ne||!!i.choices[String(N)]}let nt=_("div",void 0,"grp pg"),ot=_("div",void 0,"ph"),E=_("span",void 0,"gx");E.append(_("span",B(O.purpose_reason)||"Purposes","gt")),O.desc&&E.append(_("span",B(O.desc),"gd"));let fe=_("input");fe.type="checkbox",fe.disabled=St,fe.setAttribute("aria-label",`Select all: ${O.purpose_reason||"purposes"}`),fe.onchange=()=>Ne(Z,fe.checked),ce.push({box:fe,ids:Z}),ot.append(E,fe);let rt=_("div",void 0,"pb");for(let N of q){let ne=o.purposes.find(st=>st.id===N.purpose_id),Te=_("div",void 0,"pr"),$e=_("label",void 0,"prh");$e.append(_("span",B(N.purpose_name||ne?.name),"pn"));let oe=_("input");oe.type="checkbox",oe.name=String(N.purpose_id),oe.disabled=!!ne?.required,oe.onchange=()=>Ne([N.purpose_id],oe.checked),ae.set(N.purpose_id,[...ae.get(N.purpose_id)||[],oe]),$e.append(oe),Te.append($e),ne?.description&&Te.append(_("p",B(ne.description),"ps"));let it=sn(N.data_items,N.data_categories);it&&Te.append(it),rt.append(Te)}nt.append(ot,_("hr",void 0,"hr"),rt),te.append(nt)}else if(x==="data_share_section"){for(let O of u.shared||[]){let q=_("div",void 0,"sh");q.append(_("span",B(O.purpose_name)||"Sharing","gt"));let Z=sn(O.data_items,O.data_categories);Z&&q.append(Z),te.append(q)}te.childElementCount||te.append(_("p","NIL","st"))}te.childElementCount&&k.append(te),ee.append(k)}le();let ye=_("div");ye.id="feedback",ye.setAttribute("aria-live","polite"),ee.append(ye),ee.onsubmit=f=>{f.preventDefault(),l()},ke.append(ee),$.append(ke);let z=ve?.buttons?.length?ve.buttons:[{button_type:"accept-all",button_text:"Accept All",button_enabled:!0},{button_type:"reject-all",button_text:"Reject All",button_enabled:!0},{button_type:"accept-necessary",button_enabled:!0,button_data:{accept_necessary_text:"Accept Necessary",accept_selected_text:"Accept Selected"}}],be=_("div",void 0,"foot"),Ge=_("div",void 0,"actions"),We=f=>{f==="accept-all"?o.purposes.forEach(b=>i.choices[String(b.id)]=!0):f==="reject-all"&&o.purposes.forEach(b=>i.choices[String(b.id)]=b.required),l()},U=[...z.filter(f=>f.button_type!=="accept-necessary"),...z.filter(f=>f.button_type==="accept-necessary")];for(let f of U){if(f.button_enabled===!1)continue;let b=f.button_type==="accept-necessary",x=_("button",void 0,b?"primary":void 0);x.type="button",x.dataset.type=f.button_type,x.textContent=b?f.button_data?.accept_necessary_text||"Accept Necessary":f.button_text||f.button_type,x.onclick=()=>We(f.button_type),b&&(x.dataset.necessary=f.button_data?.accept_necessary_text||"Accept Necessary",x.dataset.selected=f.button_data?.accept_selected_text||"Accept Selected"),Ge.append(x)}return be.append(Ge),$.append(be),n.append($),le(),(r==="popup"||r==="page")&&$.addEventListener("keydown",Ye),r!=="panel"&&!p&&($.tabIndex=-1,$.focus({preventScroll:!0})),le;function ue(){let f=n.querySelector("button.primary");if(!f?.dataset.necessary)return;let b=o.purposes.some(x=>!x.required&&i.choices[String(x.id)]);f.textContent=b?f.dataset.selected:f.dataset.necessary}function Ye(f){if(f.key==="Escape"){d();return}if(f.key!=="Tab")return;let b=[...n.querySelectorAll("button:not([disabled]),input:not([disabled]),summary,a[href]")],x=b[0],k=b[b.length-1],de=n.getRootNode().activeElement;f.shiftKey&&(de===x||de===$)?(f.preventDefault(),k?.focus()):!f.shiftKey&&(de===k||de===$)&&(f.preventDefault(),x?.focus())}}var cn=`*{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 bt;function Oo(n){if("adoptedStyleSheets"in Document.prototype&&"replaceSync"in CSSStyleSheet.prototype){bt||(bt=new CSSStyleSheet,bt.replaceSync(cn)),n.adoptedStyleSheets=[bt];return}let o=document.createElement("style");o.textContent=cn,n.append(o)}var J=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),Y=n=>n==null||typeof n=="string",_e=(n,o)=>n==null||Array.isArray(n)&&n.length<=1e3&&n.every(o),ln=n=>_e(n,o=>typeof o=="string"),Co=n=>_e(n,o=>J(o)&&Y(o.data_item_name));function Lo(n,o){if(!J(n)||!Y(n.sections_language_code))return!1;let i=new Set(o.map(l=>l.id)),r=new Set,p=l=>J(l)&&["accept-all","reject-all","accept-necessary"].includes(l.button_type)&&Y(l.button_text)&&(l.button_enabled===void 0||typeof l.button_enabled=="boolean")&&(l.button_data==null||J(l.button_data)&&Y(l.button_data.accept_necessary_text)&&Y(l.button_data.accept_selected_text)),d=(l,m=0)=>{if(!J(l)||typeof l.section_type!="string"||!J(l.section_data))return!1;let u=l.section_data;return m<8&&Y(u.title)&&Y(u.section_title)&&Y(u.section_body)&&_e(u.buttons,p)&&_e(u.sections,A=>d(A,m+1))};return(n.content==null||J(n.content)&&_e(n.content.consent_data,l=>d(l)))&&_e(n.purposes,l=>J(l)&&Y(l.purpose_reason)&&Y(l.desc)&&_e(l.sub_items,m=>!J(m)||!i.has(m.purpose_id)||r.has(m.purpose_id)?!1:(r.add(m.purpose_id),Y(m.purpose_name)&&Co(m.data_items)&&ln(m.data_categories))))&&_e(n.collected,l=>J(l)&&Y(l.data_category_name)&&Y(l.desc)&&ln(l.sub_items))&&_e(n.shared,l=>J(l)&&Y(l.purpose_name)&&Co(l.data_items)&&ln(l.data_categories))}var Tt=class{constructor(o){this.options=o;this.syncChecks=()=>{};this.pendingKey="";this.pendingBody="";this.needsRefresh=!1;let i=o.host.attachShadow({mode:"open"});Oo(i);let r=document.createElement("div");r.className="theme",r.lang=o.config.language_code,this.root=document.createElement("div"),this.root.className="root",this.root.dataset.mode=o.mode,r.append(this.root),i.append(r),this.appearance=Xn(r),this.appearance.apply(o.appearance),this.state={choices:{...o.choices},busy:!1}}render(){let{config:o,mode:i,demo:r=!1,onClose:p}=this.options;try{if(!Lo(o.notice,o.purposes))throw new Error("Invalid notice");this.syncChecks=Ro({root:this.root,config:o,state:this.state,mode:i,demo:r,onClose:p,onSubmit:()=>this.submit(),onChange:()=>{this.pendingKey=""}})}catch{let d="The consent form could not be displayed. Check the notice configuration and reload.",l=_("section",void 0,"shell"),m=_("p",d,"message error");m.setAttribute("role","alert");let u=_("div",void 0,"body");if(u.append(m),l.append(u),i!=="panel"){let A=_("button","\xD7","close");A.setAttribute("aria-label","Close consent form"),A.type="button",A.onclick=p,l.append(A)}this.root.replaceChildren(l),i!=="panel"&&!r&&l.querySelector("button")?.focus(),this.options.onError(new Ze(d,"form_error"))}}setAppearance(o){this.appearance.apply(o),this.render()}destroy(){this.appearance.destroy()}message(o,i=!1){let r=this.root.querySelector("#feedback");r&&(r.textContent=o,r.className=i?"message error":"message",r.setAttribute("role",i?"alert":"status"))}async submit(){let{state:o,root:i,options:r}=this;if(o.busy||this.needsRefresh)return;o.busy=!0;let p=[...i.querySelectorAll("input:not(:disabled)")];p.forEach(u=>u.disabled=!0),i.querySelectorAll("button:not(.close)").forEach(u=>u.disabled=!0);let d={config_version:r.config.config_version,language_code:r.config.language_code,answers:r.config.purposes.map(u=>({purpose_id:u.id,given:!!o.choices[String(u.id)]}))},l=JSON.stringify(d);(!this.pendingKey||this.pendingBody!==l)&&(this.pendingKey=jn(),this.pendingBody=l);let m;try{m=await r.save(d,this.pendingKey),o.choices=m.choices,this.message(r.demo?"Demo complete. No record was saved.":"Your choices are saved.")}catch(u){let A=u instanceof Error?u.message:"Your choices could not be saved. Please retry.";if(this.message(A,!0),u instanceof Ze&&u.code==="notice_changed"&&r.onRefresh){this.needsRefresh=!0;let S=_("button","Reload consent form");S.type="button",S.onclick=()=>void r.onRefresh().catch(()=>{}),i.querySelector("#feedback")?.append(S)}r.onError(u)}finally{o.busy=!1,i.querySelectorAll("button").forEach(u=>u.disabled=!1),p.forEach(u=>u.disabled=!1),this.syncChecks(),this.needsRefresh&&i.querySelectorAll(".actions button").forEach(u=>{u.disabled=!0})}m&&r.onComplete(m)}};var xt=new URLSearchParams(location.search),dn=xt.get("channel")||"",fn=xt.get("parent_origin")||"",kr=xt.get("app_id")||"",pn=xt.get("mode"),Nr=pn==="popup"||pn==="page"?pn:"panel",mn=window.parent!==window?window.parent:null,un=document.getElementById("atlas-root"),At,Et=(n,o={})=>mn?.postMessage({protocol:ht,channel:dn,type:n,...o},fn);window.addEventListener("message",n=>{if(n.source!==mn||n.origin!==fn||!Gn(n.data,dn))return;let o=n.data;if(o.type==="appearance"){At?.setAppearance(o.appearance);return}if(o.type!=="init"||At||o.demo!==!0)return;let i=o.config;!i||i.app_id!==kr||!Array.isArray(i.purposes)||(un.textContent="",At=new Tt({host:un,config:i,choices:{},mode:Nr,appearance:i.appearance,demo:!0,save:r=>Promise.resolve({ref_id:"demo-no-record",app_id:i.app_id,level_id:i.level_id,config_version:i.config_version,choices:Object.fromEntries(r.answers.map(p=>[p.purpose_id,p.given]))}),onComplete:r=>Et("complete",{result:r}),onError:r=>Et("error",{message:r instanceof Error?r.message:"Preview failed."}),onClose:()=>Et("close")}),At.render())});mn&&dn&&/^https?:\/\//.test(fn)?Et("ready"):un.textContent="This page is the Atlas dashboard preview of the consent form.";})();
|
|
5
|
-
/*! Bundled license information:
|
|
6
|
-
|
|
7
|
-
dompurify/dist/purify.es.mjs:
|
|
8
|
-
(*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE *)
|
|
9
|
-
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
|
|
10
|
-
*/
|
package/dist/ui/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/ui.html
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Consent preferences</title><style>html,body,#atlas-root{height:100%;margin:0}</style></head><body><main id="atlas-root">Loading consent…</main><script src="./atlas-consent-ui.js" defer></script></body></html>
|