diff --git a/CHANGELOG.md b/CHANGELOG.md index a2a6d67..c3c40d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - Add documentation for i18n (first approach) +### Added +- Add classes to override default settings banner style ## [1.2.1] - 2023-09-25 ### Fixed diff --git a/README.md b/README.md index a26f2e5..bb94375 100644 --- a/README.md +++ b/README.md @@ -264,15 +264,20 @@ You can theme Leckerli with the following CSS custom properties (variables): To override any other style, you can use the following classes: -| Class | Description | -| ----------------------- | ----------------------------------- | -| `.banner-wrapper` | Override the banner display style | -| `.banner-title` | Override the title style | -| `.banner-description` | Override the description style | -| `.banner-btns` | Override the buttons display style | -| `.banner-btn-customise` | Override the customize button style | -| `.banner-btn-accept` | Override the accept button style | -| `.banner-btn-reject` | Override the reject button style | +| Class | Description | +| ----------------------- | -------------------------------------------------| +| `.banner-wrapper` | Override the banner display style | +| `.banner-title` | Override the title style | +| `.banner-description` | Override the description style | +| `.banner-btns` | Override the buttons display style | +| `.banner-btn-customise` | Override the customize button style | +| `.banner-btn-accept` | Override the accept button style | +| `.banner-btn-reject` | Override the reject button style | +| `.banner-settings-title` | Override the custom settings title style | +| `.banner-settings-toggle` | Override the custom settings toggle button style | +| `.banner-settings-description`| Override the custom settings description style | +| `.banner-settings-save` | Override the custom settings save button style | +| `.banner-settings-close` | Override the custom settings close button style | ## 🧑‍💻 Contribute diff --git a/dist/assets/leckerli.min.js b/dist/assets/leckerli.min.js index 6beb05e..f154593 100644 --- a/dist/assets/leckerli.min.js +++ b/dist/assets/leckerli.min.js @@ -7,4 +7,4 @@ * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var bn="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},En=gn.useSyncExternalStore,kn=vn.useRef,Sn=vn.useEffect,Tn=vn.useMemo,xn=vn.useDebugValue;an.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=kn(null);if(null===i.current){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=Tn((function(){function e(e){if(!c){if(c=!0,i=e,e=r(e),void 0!==o&&a.hasValue){var t=a.value;if(o(t,e))return l=t}return l=e}if(t=l,bn(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(i=e,l=n)}var i,l,c=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]}),[t,n,r,o]);var l=En(e,i[0],i[1]);return Sn((function(){a.hasValue=!0,a.value=l}),[l]),xn(l),l},on.exports=an;var An=nn(on.exports);const{useSyncExternalStoreWithSelector:Nn}=An;let wn=!1;const Cn=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?Je(e):Je)(e):e,n=(e,n)=>function(e,t=e.getState,n){n&&!wn&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),wn=!0);const r=Nn(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return fe(r),r}(t,e,n);return Object.assign(n,t),n},On=Ze({name:"leckerli",banner:{title:"This website uses cookies.",description:'We use cookies to improve your browsing experience, deliver personalised advertising or content and analyse our traffic. By clicking on "Accept all", you consent to our use of cookies.',accept:"Accept all",reject:"Deny",customise:"Customize",save:"Save",settings:[{slug:"analytics_storage",title:"Statistics",description:"Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously."},{slug:"ad_storage",title:"Marketing",description:"Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers."}]},permissions:["analytics_storage","ad_storage"],baseData:{},cookie:{},choiceMade:!1,settingsOpen:!1,domain:window.location.hostname,enableGtmAutoLoad:!1},window.leckerliSettings??{}),Rn=new Date;Rn.setMonth(Rn.getMonth()+1);const Dn={sameSite:"strict",domain:On.domain,expires:Rn},Ln=Ee.get(On.name);On.cookie=$e(Ln)?JSON.parse(Ln):On.permissions.reduce(((e,t)=>({...e,[t]:!1})),On.baseData),On.choiceMade=$e(Ln);const Mn=(In=(e,t)=>({...On,init:()=>{const e=t();Be(Ln)&&e.choiceMade&&Ee.set(e.name,JSON.stringify(e.cookie),Dn),document.dispatchEvent(new CustomEvent("leckerli:initialised",{detail:{cookie:e.choiceMade?e.cookie:null}})),document.addEventListener("leckerli:open-banner",(()=>t().setChoice(!1))),document.addEventListener("leckerli:close-banner",(()=>t().setChoice(!0))),document.addEventListener("leckerli:open-modal",(()=>t().setModal(!0))),document.addEventListener("leckerli:close-modal",(()=>t().setModal(!1)))},propagate(e){const n=t();Ee.set(n.name,JSON.stringify(e),Dn),document.dispatchEvent(new CustomEvent("leckerli:permissions-updated",{detail:{cookie:e}}))},setChoice:t=>e((e=>({...e,choiceMade:t}))),setModal:t=>e((e=>(document.dispatchEvent(new CustomEvent("leckerli:modal-"+(t?"opened":"closed"))),{...e,settingsOpen:t}))),setPermissions:t=>e((e=>{const n=e.permissions.reduce(((e,n)=>({...e,[n]:t[n]??!1})),e.baseData);return e.propagate(n),{...e,choiceMade:!0,cookie:n}})),togglePermission:t=>e((e=>{const n=e.permissions.reduce(((n,r)=>(n[r]=t===r?!$e(e.cookie[r])||!e.cookie[r]:e.cookie[r]??!1,n)),e.baseData);return e.propagate(n),{...e,choiceMade:!0,cookie:n}})),acceptAll:()=>{t().setPermissions(t().permissions.reduce(((e,t)=>({...e,[t]:!0})),{}))},rejectAll:()=>{t().setPermissions(t().permissions.reduce(((e,t)=>({...e,[t]:!1})),{}))}}))?Cn(In):Cn;/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */var In;const{entries:Pn,setPrototypeOf:Un,isFrozen:jn,getPrototypeOf:Hn,getOwnPropertyDescriptor:Fn}=Object;let{freeze:zn,seal:Wn,create:Bn}=Object,{apply:Vn,construct:qn}="undefined"!=typeof Reflect&&Reflect;Vn||(Vn=function(e,t,n){return e.apply(t,n)}),zn||(zn=function(e){return e}),Wn||(Wn=function(e){return e}),qn||(qn=function(e,t){return new e(...t)});const Gn=or(Array.prototype.forEach),Yn=or(Array.prototype.pop),$n=or(Array.prototype.push),Xn=or(String.prototype.toLowerCase),Kn=or(String.prototype.toString),Zn=or(String.prototype.match),Jn=or(String.prototype.replace),Qn=or(String.prototype.indexOf),er=or(String.prototype.trim),tr=or(RegExp.prototype.test),nr=(rr=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),o=1;o/gm),Er=Wn(/\${[\w\W]*}/gm),kr=Wn(/^data-[\-\w.\u00B7-\uFFFF]/),Sr=Wn(/^aria-[\-\w]+$/),Tr=Wn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xr=Wn(/^(?:\w+script|data):/i),Ar=Wn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Nr=Wn(/^html$/i);var wr=Object.freeze({__proto__:null,MUSTACHE_EXPR:gr,ERB_EXPR:br,TMPLIT_EXPR:Er,DATA_ATTR:kr,ARIA_ATTR:Sr,IS_ALLOWED_URI:Tr,IS_SCRIPT_OR_DATA:xr,ATTR_WHITESPACE:Ar,DOCTYPE_NAME:Nr});const Cr=()=>"undefined"==typeof window?null:window;var Or=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Cr();const n=t=>e(t);if(n.version="3.0.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;const r=t.document,o=r.currentScript;let{document:i}=t;const{DocumentFragment:a,HTMLTemplateElement:l,Node:c,Element:u,NodeFilter:s,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:_,DOMParser:p,trustedTypes:d}=t,m=u.prototype,h=lr(m,"cloneNode"),y=lr(m,"nextSibling"),v=lr(m,"childNodes"),g=lr(m,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let b,E="";const{implementation:k,createNodeIterator:S,createDocumentFragment:T,getElementsByTagName:x}=i,{importNode:A}=r;let N={};n.isSupported="function"==typeof Pn&&"function"==typeof g&&k&&void 0!==k.createHTMLDocument;const{MUSTACHE_EXPR:w,ERB_EXPR:C,TMPLIT_EXPR:O,DATA_ATTR:R,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:M}=wr;let{IS_ALLOWED_URI:I}=wr,P=null;const U=ir({},[...cr,...ur,...sr,..._r,...dr]);let j=null;const H=ir({},[...mr,...hr,...yr,...vr]);let F=Object.seal(Object.create(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}})),z=null,W=null,B=!0,V=!0,q=!1,G=!0,Y=!1,$=!1,X=!1,K=!1,Z=!1,J=!1,Q=!1,ee=!0,te=!1,ne=!0,re=!1,oe={},ie=null;const ae=ir({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const ce=ir({},["audio","video","img","source","image","track"]);let ue=null;const se=ir({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",_e="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml";let de=pe,me=!1,he=null;const ye=ir({},[fe,_e,pe],Kn);let ve;const ge=["application/xhtml+xml","text/html"];let be,Ee=null;const ke=i.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Te=function(e){if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=ar(e),ve=ve=-1===ge.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,be="application/xhtml+xml"===ve?Kn:Xn,P="ALLOWED_TAGS"in e?ir({},e.ALLOWED_TAGS,be):U,j="ALLOWED_ATTR"in e?ir({},e.ALLOWED_ATTR,be):H,he="ALLOWED_NAMESPACES"in e?ir({},e.ALLOWED_NAMESPACES,Kn):ye,ue="ADD_URI_SAFE_ATTR"in e?ir(ar(se),e.ADD_URI_SAFE_ATTR,be):se,le="ADD_DATA_URI_TAGS"in e?ir(ar(ce),e.ADD_DATA_URI_TAGS,be):ce,ie="FORBID_CONTENTS"in e?ir({},e.FORBID_CONTENTS,be):ae,z="FORBID_TAGS"in e?ir({},e.FORBID_TAGS,be):{},W="FORBID_ATTR"in e?ir({},e.FORBID_ATTR,be):{},oe="USE_PROFILES"in e&&e.USE_PROFILES,B=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,$=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,ne=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||Tr,de=e.NAMESPACE||pe,F=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(F.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(F.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(F.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(V=!1),J&&(Z=!0),oe&&(P=ir({},[...dr]),j=[],!0===oe.html&&(ir(P,cr),ir(j,mr)),!0===oe.svg&&(ir(P,ur),ir(j,hr),ir(j,vr)),!0===oe.svgFilters&&(ir(P,sr),ir(j,hr),ir(j,vr)),!0===oe.mathMl&&(ir(P,_r),ir(j,yr),ir(j,vr))),e.ADD_TAGS&&(P===U&&(P=ar(P)),ir(P,e.ADD_TAGS,be)),e.ADD_ATTR&&(j===H&&(j=ar(j)),ir(j,e.ADD_ATTR,be)),e.ADD_URI_SAFE_ATTR&&ir(ue,e.ADD_URI_SAFE_ATTR,be),e.FORBID_CONTENTS&&(ie===ae&&(ie=ar(ie)),ir(ie,e.FORBID_CONTENTS,be)),ne&&(P["#text"]=!0),$&&ir(P,["html","head","body"]),P.table&&(ir(P,["tbody"]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw nr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw nr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=e.TRUSTED_TYPES_POLICY,E=b.createHTML("")}else void 0===b&&(b=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(d,o)),null!==b&&"string"==typeof E&&(E=b.createHTML(""));zn&&zn(e),Ee=e}},xe=ir({},["mi","mo","mn","ms","mtext"]),Ae=ir({},["foreignobject","desc","title","annotation-xml"]),Ne=ir({},["title","style","font","a","script"]),we=ir({},ur);ir(we,sr),ir(we,fr);const Ce=ir({},_r);ir(Ce,pr);const Oe=function(e){$n(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Re=function(e,t){try{$n(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){$n(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!j[e])if(Z||J)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},De=function(e){let t,n;if(K)e=""+e;else{const t=Zn(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ve&&de===pe&&(e=''+e+"");const r=b?b.createHTML(e):e;if(de===pe)try{t=(new p).parseFromString(r,ve)}catch(e){}if(!t||!t.documentElement){t=k.createDocument(de,"template",null);try{t.documentElement.innerHTML=me?E:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),de===pe?x.call(t,$?"html":"body")[0]:$?t.documentElement:o},Le=function(e){return S.call(e.ownerDocument||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT,null,!1)},Me=function(e){return"object"==typeof c?e instanceof c:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Ie=function(e,t,r){N[e]&&Gn(N[e],(e=>{e.call(n,t,r,Ee)}))},Pe=function(e){let t;if(Ie("beforeSanitizeElements",e,null),(r=e)instanceof _&&("string"!=typeof r.nodeName||"string"!=typeof r.textContent||"function"!=typeof r.removeChild||!(r.attributes instanceof f)||"function"!=typeof r.removeAttribute||"function"!=typeof r.setAttribute||"string"!=typeof r.namespaceURI||"function"!=typeof r.insertBefore||"function"!=typeof r.hasChildNodes))return Oe(e),!0;var r;const o=be(e.nodeName);if(Ie("uponSanitizeElement",e,{tagName:o,allowedTags:P}),e.hasChildNodes()&&!Me(e.firstElementChild)&&(!Me(e.content)||!Me(e.content.firstElementChild))&&tr(/<[/\w]/g,e.innerHTML)&&tr(/<[/\w]/g,e.textContent))return Oe(e),!0;if(!P[o]||z[o]){if(!z[o]&&je(o)){if(F.tagNameCheck instanceof RegExp&&tr(F.tagNameCheck,o))return!1;if(F.tagNameCheck instanceof Function&&F.tagNameCheck(o))return!1}if(ne&&!ie[o]){const t=g(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r)t.insertBefore(h(n[r],!0),y(e))}}return Oe(e),!0}return e instanceof u&&!function(e){let t=g(e);t&&t.tagName||(t={namespaceURI:de,tagName:"template"});const n=Xn(e.tagName),r=Xn(t.tagName);return!!he[e.namespaceURI]&&(e.namespaceURI===_e?t.namespaceURI===pe?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||xe[r]):Boolean(we[n]):e.namespaceURI===fe?t.namespaceURI===pe?"math"===n:t.namespaceURI===_e?"math"===n&&Ae[r]:Boolean(Ce[n]):e.namespaceURI===pe?!(t.namespaceURI===_e&&!Ae[r])&&!(t.namespaceURI===fe&&!xe[r])&&!Ce[n]&&(Ne[n]||!we[n]):!("application/xhtml+xml"!==ve||!he[e.namespaceURI]))}(e)?(Oe(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!tr(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&3===e.nodeType&&(t=e.textContent,t=Jn(t,w," "),t=Jn(t,C," "),t=Jn(t,O," "),e.textContent!==t&&($n(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ie("afterSanitizeElements",e,null),!1):(Oe(e),!0)},Ue=function(e,t,n){if(ee&&("id"===t||"name"===t)&&(n in i||n in ke))return!1;if(V&&!W[t]&&tr(R,t));else if(B&&tr(D,t));else if(!j[t]||W[t]){if(!(je(e)&&(F.tagNameCheck instanceof RegExp&&tr(F.tagNameCheck,e)||F.tagNameCheck instanceof Function&&F.tagNameCheck(e))&&(F.attributeNameCheck instanceof RegExp&&tr(F.attributeNameCheck,t)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(t))||"is"===t&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&tr(F.tagNameCheck,n)||F.tagNameCheck instanceof Function&&F.tagNameCheck(n))))return!1}else if(ue[t]);else if(tr(I,Jn(n,M,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Qn(n,"data:")||!le[e]){if(q&&!tr(L,Jn(n,M,"")));else if(n)return!1}else;return!0},je=function(e){return e.indexOf("-")>0},He=function(e){let t,r,o,i;Ie("beforeSanitizeAttributes",e,null);const{attributes:a}=e;if(!a)return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j};for(i=a.length;i--;){t=a[i];const{name:c,namespaceURI:u}=t;if(r="value"===c?t.value:er(t.value),o=be(c),l.attrName=o,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,Ie("uponSanitizeAttribute",e,l),r=l.attrValue,l.forceKeepAttr)continue;if(Re(c,e),!l.keepAttr)continue;if(!G&&tr(/\/>/i,r)){Re(c,e);continue}Y&&(r=Jn(r,w," "),r=Jn(r,C," "),r=Jn(r,O," "));const s=be(e.nodeName);if(Ue(s,o,r)){if(!te||"id"!==o&&"name"!==o||(Re(c,e),r="user-content-"+r),b&&"object"==typeof d&&"function"==typeof d.getAttributeType)if(u);else switch(d.getAttributeType(s,o)){case"TrustedHTML":r=b.createHTML(r);break;case"TrustedScriptURL":r=b.createScriptURL(r)}try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),Yn(n.removed)}catch(e){}}}Ie("afterSanitizeAttributes",e,null)},Fe=function e(t){let n;const r=Le(t);for(Ie("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Ie("uponSanitizeShadowNode",n,null),Pe(n)||(n.content instanceof a&&e(n.content),He(n));Ie("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t,o,i,l,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(me=!e,me&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Me(e)){if("function"!=typeof e.toString)throw nr("toString is not a function");if("string"!=typeof(e=e.toString()))throw nr("dirty is not a string, aborting")}if(!n.isSupported)return e;if(X||Te(u),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=be(e.nodeName);if(!P[t]||z[t])throw nr("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)t=De("\x3c!----\x3e"),o=t.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?t=o:t.appendChild(o);else{if(!Z&&!Y&&!$&&-1===e.indexOf("<"))return b&&Q?b.createHTML(e):e;if(t=De(e),!t)return Z?null:Q?E:""}t&&K&&Oe(t.firstChild);const s=Le(re?e:t);for(;i=s.nextNode();)Pe(i)||(i.content instanceof a&&Fe(i.content),He(i));if(re)return e;if(Z){if(J)for(l=T.call(t.ownerDocument);t.firstChild;)l.appendChild(t.firstChild);else l=t;return(j.shadowroot||j.shadowrootmode)&&(l=A.call(r,l,!0)),l}let f=$?t.outerHTML:t.innerHTML;return $&&P["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&tr(Nr,t.ownerDocument.doctype.name)&&(f="\n"+f),Y&&(f=Jn(f,w," "),f=Jn(f,C," "),f=Jn(f,O," ")),b&&Q?b.createHTML(f):f},n.setConfig=function(e){Te(e),X=!0},n.clearConfig=function(){Ee=null,X=!1},n.isValidAttribute=function(e,t,n){Ee||Te({});const r=be(e),o=be(t);return Ue(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],$n(N[e],t))},n.removeHook=function(e){if(N[e])return Yn(N[e])},n.removeHooks=function(e){N[e]&&(N[e]=[])},n.removeAllHooks=function(){N={}},n}();const Rr=()=>{const{banner:e,acceptAll:t,rejectAll:n,setModal:r}=Mn();return W("div",{className:"fixed bottom-0 left-0 max-w-md px-5 py-4 m-2 shadow-md shadow-black/25 z-[9998] bg-background space-y-4 font-primary text-foreground rounded-md banner-wrapper",children:[e.title&&W("h3",{className:"m-0 text-lg font-semibold font-primary md:text-xl banner-title",children:e.title}),e.description&&W("p",{className:"m-0 text-sm leading-snug font-primary md:text-base banner-description",dangerouslySetInnerHTML:{__html:Or.sanitize(e.description,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["b","i","em","strong","p","ul","li","ol","span","h2","h3","h4","h5","h6","a","div"],ALLOWED_ATTR:["href","target"]})}}),W("div",{className:"pt-2 space-y-2 banner-btns",children:[!Ge(e.settings)&&W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-background font-primary text-primary md:px-3.5 py-1.5 md:py-2.5 border-primary hover:border-primary-hover hover:text-primary-hover active:border-primary-active active:text-primary-active transition-colors banner-btn-customise",onClick:()=>r(!0),children:e.customise}),W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-background font-primary text-primary md:px-3.5 py-1.5 md:py-2.5 border-primary hover:border-primary-hover hover:text-primary-hover active:border-primary-active active:text-primary-active transition-colors banner-btn-reject",onClick:n,children:e.reject}),W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-primary font-primary text-background md:px-3.5 py-1.5 md:py-2.5 border-primary hover:bg-primary-hover hover:border-primary-hover active:bg-primary-active active:border-primary-active transition-colors banner-btn-accept",onClick:t,children:e.accept})]})]})},Dr=()=>{const{cookie:e,setPermissions:t,banner:n,setModal:r}=Mn(),[o,i]=ne(e);return W("div",{className:"fixed bottom-0 left-0 w-full max-w-lg max-h-full px-5 py-4 m-2 overflow-y-auto text-black shadow-md shadow-black/25 z-[9999] bg-background text-foreground font-primary rounded-md",children:[W("div",{className:"space-y-6",children:[W("h3",{className:"w-10/12 m-0 text-xl font-semibold font-primary md:text-2xl",children:n.customise}),n.settings.map((({slug:e,title:t,description:n})=>W("div",{children:[W("div",{className:"flex items-start justify-between",children:[W("h3",{className:"m-0 text-lg font-semibold font-primary",children:t}),W("button",{type:"button",className:(o[e]?"bg-primary":"bg-gray-200")+" relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 mt-0.5",role:"switch","aria-checked":"false",onClick:()=>i({...o,[e]:!o[e]}),children:[W("span",{className:"sr-only",children:"Toggle"}),W("span",{"aria-hidden":"true",className:(o[e]?"translate-x-5":"translate-x-0")+" pointer-events-none inline-block h-5 w-5 transform rounded-full bg-background shadow ring-0 transition duration-200 ease-in-out"})]})]}),W("p",{className:"m-0 mt-2 text-sm leading-snug font-primary md:text-base",children:n})]},`setting-${e}`))),W("div",{className:"pt-4",children:W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-primary font-primary text-background md:px-3.5 py-1.5 md:py-2.5 border-primary hover:bg-primary-hover hover:border-primary-hover active:bg-primary-active active:border-primary-active transition-colors",onClick:()=>{t(o),r(!1)},children:n.save})})]}),W("button",{type:"button",className:"absolute top-0 right-0 w-8 h-8 mt-0 text-xl rounded-full",onClick:()=>r(!1),children:"×"})]})},Lr=document.createElement("div");Lr.id="lkrl-wrapper",document.body.appendChild(Lr),U(W((()=>{const{choiceMade:e,init:t,settingsOpen:n}=Mn();return oe((()=>{t()}),[]),W(y,{children:[!e&&!n&&W(Rr,{}),n&&W(Dr,{})]})}),{}),Lr)}(); \ No newline at end of file + */var bn="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},En=gn.useSyncExternalStore,kn=vn.useRef,Sn=vn.useEffect,Tn=vn.useMemo,xn=vn.useDebugValue;an.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=kn(null);if(null===i.current){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=Tn((function(){function e(e){if(!c){if(c=!0,i=e,e=r(e),void 0!==o&&a.hasValue){var t=a.value;if(o(t,e))return l=t}return l=e}if(t=l,bn(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(i=e,l=n)}var i,l,c=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]}),[t,n,r,o]);var l=En(e,i[0],i[1]);return Sn((function(){a.hasValue=!0,a.value=l}),[l]),xn(l),l},on.exports=an;var An=nn(on.exports);const{useSyncExternalStoreWithSelector:Nn}=An;let wn=!1;const Cn=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?Je(e):Je)(e):e,n=(e,n)=>function(e,t=e.getState,n){n&&!wn&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),wn=!0);const r=Nn(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return fe(r),r}(t,e,n);return Object.assign(n,t),n},On=Ze({name:"leckerli",banner:{title:"This website uses cookies.",description:'We use cookies to improve your browsing experience, deliver personalised advertising or content and analyse our traffic. By clicking on "Accept all", you consent to our use of cookies.',accept:"Accept all",reject:"Deny",customise:"Customize",save:"Save",settings:[{slug:"analytics_storage",title:"Statistics",description:"Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously."},{slug:"ad_storage",title:"Marketing",description:"Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers."}]},permissions:["analytics_storage","ad_storage"],baseData:{},cookie:{},choiceMade:!1,settingsOpen:!1,domain:window.location.hostname,enableGtmAutoLoad:!1},window.leckerliSettings??{}),Rn=new Date;Rn.setMonth(Rn.getMonth()+1);const Dn={sameSite:"strict",domain:On.domain,expires:Rn},Ln=Ee.get(On.name);On.cookie=$e(Ln)?JSON.parse(Ln):On.permissions.reduce(((e,t)=>({...e,[t]:!1})),On.baseData),On.choiceMade=$e(Ln);const Mn=(In=(e,t)=>({...On,init:()=>{const e=t();Be(Ln)&&e.choiceMade&&Ee.set(e.name,JSON.stringify(e.cookie),Dn),document.dispatchEvent(new CustomEvent("leckerli:initialised",{detail:{cookie:e.choiceMade?e.cookie:null}})),document.addEventListener("leckerli:open-banner",(()=>t().setChoice(!1))),document.addEventListener("leckerli:close-banner",(()=>t().setChoice(!0))),document.addEventListener("leckerli:open-modal",(()=>t().setModal(!0))),document.addEventListener("leckerli:close-modal",(()=>t().setModal(!1)))},propagate(e){const n=t();Ee.set(n.name,JSON.stringify(e),Dn),document.dispatchEvent(new CustomEvent("leckerli:permissions-updated",{detail:{cookie:e}}))},setChoice:t=>e((e=>({...e,choiceMade:t}))),setModal:t=>e((e=>(document.dispatchEvent(new CustomEvent("leckerli:modal-"+(t?"opened":"closed"))),{...e,settingsOpen:t}))),setPermissions:t=>e((e=>{const n=e.permissions.reduce(((e,n)=>({...e,[n]:t[n]??!1})),e.baseData);return e.propagate(n),{...e,choiceMade:!0,cookie:n}})),togglePermission:t=>e((e=>{const n=e.permissions.reduce(((n,r)=>(n[r]=t===r?!$e(e.cookie[r])||!e.cookie[r]:e.cookie[r]??!1,n)),e.baseData);return e.propagate(n),{...e,choiceMade:!0,cookie:n}})),acceptAll:()=>{t().setPermissions(t().permissions.reduce(((e,t)=>({...e,[t]:!0})),{}))},rejectAll:()=>{t().setPermissions(t().permissions.reduce(((e,t)=>({...e,[t]:!1})),{}))}}))?Cn(In):Cn;/*! @license DOMPurify 3.0.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.5/LICENSE */var In;const{entries:Pn,setPrototypeOf:Un,isFrozen:jn,getPrototypeOf:Hn,getOwnPropertyDescriptor:Fn}=Object;let{freeze:zn,seal:Wn,create:Bn}=Object,{apply:Vn,construct:qn}="undefined"!=typeof Reflect&&Reflect;Vn||(Vn=function(e,t,n){return e.apply(t,n)}),zn||(zn=function(e){return e}),Wn||(Wn=function(e){return e}),qn||(qn=function(e,t){return new e(...t)});const Gn=or(Array.prototype.forEach),Yn=or(Array.prototype.pop),$n=or(Array.prototype.push),Xn=or(String.prototype.toLowerCase),Kn=or(String.prototype.toString),Zn=or(String.prototype.match),Jn=or(String.prototype.replace),Qn=or(String.prototype.indexOf),er=or(String.prototype.trim),tr=or(RegExp.prototype.test),nr=(rr=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n1?n-1:0),o=1;o/gm),Er=Wn(/\${[\w\W]*}/gm),kr=Wn(/^data-[\-\w.\u00B7-\uFFFF]/),Sr=Wn(/^aria-[\-\w]+$/),Tr=Wn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xr=Wn(/^(?:\w+script|data):/i),Ar=Wn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Nr=Wn(/^html$/i);var wr=Object.freeze({__proto__:null,MUSTACHE_EXPR:gr,ERB_EXPR:br,TMPLIT_EXPR:Er,DATA_ATTR:kr,ARIA_ATTR:Sr,IS_ALLOWED_URI:Tr,IS_SCRIPT_OR_DATA:xr,ATTR_WHITESPACE:Ar,DOCTYPE_NAME:Nr});const Cr=()=>"undefined"==typeof window?null:window;var Or=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Cr();const n=t=>e(t);if(n.version="3.0.5",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;const r=t.document,o=r.currentScript;let{document:i}=t;const{DocumentFragment:a,HTMLTemplateElement:l,Node:c,Element:u,NodeFilter:s,NamedNodeMap:f=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:_,DOMParser:p,trustedTypes:d}=t,m=u.prototype,h=lr(m,"cloneNode"),y=lr(m,"nextSibling"),v=lr(m,"childNodes"),g=lr(m,"parentNode");if("function"==typeof l){const e=i.createElement("template");e.content&&e.content.ownerDocument&&(i=e.content.ownerDocument)}let b,E="";const{implementation:k,createNodeIterator:S,createDocumentFragment:T,getElementsByTagName:x}=i,{importNode:A}=r;let N={};n.isSupported="function"==typeof Pn&&"function"==typeof g&&k&&void 0!==k.createHTMLDocument;const{MUSTACHE_EXPR:w,ERB_EXPR:C,TMPLIT_EXPR:O,DATA_ATTR:R,ARIA_ATTR:D,IS_SCRIPT_OR_DATA:L,ATTR_WHITESPACE:M}=wr;let{IS_ALLOWED_URI:I}=wr,P=null;const U=ir({},[...cr,...ur,...sr,..._r,...dr]);let j=null;const H=ir({},[...mr,...hr,...yr,...vr]);let F=Object.seal(Object.create(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}})),z=null,W=null,B=!0,V=!0,q=!1,G=!0,Y=!1,$=!1,X=!1,K=!1,Z=!1,J=!1,Q=!1,ee=!0,te=!1,ne=!0,re=!1,oe={},ie=null;const ae=ir({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const ce=ir({},["audio","video","img","source","image","track"]);let ue=null;const se=ir({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),fe="http://www.w3.org/1998/Math/MathML",_e="http://www.w3.org/2000/svg",pe="http://www.w3.org/1999/xhtml";let de=pe,me=!1,he=null;const ye=ir({},[fe,_e,pe],Kn);let ve;const ge=["application/xhtml+xml","text/html"];let be,Ee=null;const ke=i.createElement("form"),Se=function(e){return e instanceof RegExp||e instanceof Function},Te=function(e){if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=ar(e),ve=ve=-1===ge.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,be="application/xhtml+xml"===ve?Kn:Xn,P="ALLOWED_TAGS"in e?ir({},e.ALLOWED_TAGS,be):U,j="ALLOWED_ATTR"in e?ir({},e.ALLOWED_ATTR,be):H,he="ALLOWED_NAMESPACES"in e?ir({},e.ALLOWED_NAMESPACES,Kn):ye,ue="ADD_URI_SAFE_ATTR"in e?ir(ar(se),e.ADD_URI_SAFE_ATTR,be):se,le="ADD_DATA_URI_TAGS"in e?ir(ar(ce),e.ADD_DATA_URI_TAGS,be):ce,ie="FORBID_CONTENTS"in e?ir({},e.FORBID_CONTENTS,be):ae,z="FORBID_TAGS"in e?ir({},e.FORBID_TAGS,be):{},W="FORBID_ATTR"in e?ir({},e.FORBID_ATTR,be):{},oe="USE_PROFILES"in e&&e.USE_PROFILES,B=!1!==e.ALLOW_ARIA_ATTR,V=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,$=e.WHOLE_DOCUMENT||!1,Z=e.RETURN_DOM||!1,J=e.RETURN_DOM_FRAGMENT||!1,Q=e.RETURN_TRUSTED_TYPE||!1,K=e.FORCE_BODY||!1,ee=!1!==e.SANITIZE_DOM,te=e.SANITIZE_NAMED_PROPS||!1,ne=!1!==e.KEEP_CONTENT,re=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||Tr,de=e.NAMESPACE||pe,F=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(F.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(F.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(F.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(V=!1),J&&(Z=!0),oe&&(P=ir({},[...dr]),j=[],!0===oe.html&&(ir(P,cr),ir(j,mr)),!0===oe.svg&&(ir(P,ur),ir(j,hr),ir(j,vr)),!0===oe.svgFilters&&(ir(P,sr),ir(j,hr),ir(j,vr)),!0===oe.mathMl&&(ir(P,_r),ir(j,yr),ir(j,vr))),e.ADD_TAGS&&(P===U&&(P=ar(P)),ir(P,e.ADD_TAGS,be)),e.ADD_ATTR&&(j===H&&(j=ar(j)),ir(j,e.ADD_ATTR,be)),e.ADD_URI_SAFE_ATTR&&ir(ue,e.ADD_URI_SAFE_ATTR,be),e.FORBID_CONTENTS&&(ie===ae&&(ie=ar(ie)),ir(ie,e.FORBID_CONTENTS,be)),ne&&(P["#text"]=!0),$&&ir(P,["html","head","body"]),P.table&&(ir(P,["tbody"]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw nr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw nr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');b=e.TRUSTED_TYPES_POLICY,E=b.createHTML("")}else void 0===b&&(b=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(d,o)),null!==b&&"string"==typeof E&&(E=b.createHTML(""));zn&&zn(e),Ee=e}},xe=ir({},["mi","mo","mn","ms","mtext"]),Ae=ir({},["foreignobject","desc","title","annotation-xml"]),Ne=ir({},["title","style","font","a","script"]),we=ir({},ur);ir(we,sr),ir(we,fr);const Ce=ir({},_r);ir(Ce,pr);const Oe=function(e){$n(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){e.remove()}},Re=function(e,t){try{$n(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){$n(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!j[e])if(Z||J)try{Oe(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},De=function(e){let t,n;if(K)e=""+e;else{const t=Zn(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===ve&&de===pe&&(e=''+e+"");const r=b?b.createHTML(e):e;if(de===pe)try{t=(new p).parseFromString(r,ve)}catch(e){}if(!t||!t.documentElement){t=k.createDocument(de,"template",null);try{t.documentElement.innerHTML=me?E:r}catch(e){}}const o=t.body||t.documentElement;return e&&n&&o.insertBefore(i.createTextNode(n),o.childNodes[0]||null),de===pe?x.call(t,$?"html":"body")[0]:$?t.documentElement:o},Le=function(e){return S.call(e.ownerDocument||e,e,s.SHOW_ELEMENT|s.SHOW_COMMENT|s.SHOW_TEXT,null,!1)},Me=function(e){return"object"==typeof c?e instanceof c:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Ie=function(e,t,r){N[e]&&Gn(N[e],(e=>{e.call(n,t,r,Ee)}))},Pe=function(e){let t;if(Ie("beforeSanitizeElements",e,null),(r=e)instanceof _&&("string"!=typeof r.nodeName||"string"!=typeof r.textContent||"function"!=typeof r.removeChild||!(r.attributes instanceof f)||"function"!=typeof r.removeAttribute||"function"!=typeof r.setAttribute||"string"!=typeof r.namespaceURI||"function"!=typeof r.insertBefore||"function"!=typeof r.hasChildNodes))return Oe(e),!0;var r;const o=be(e.nodeName);if(Ie("uponSanitizeElement",e,{tagName:o,allowedTags:P}),e.hasChildNodes()&&!Me(e.firstElementChild)&&(!Me(e.content)||!Me(e.content.firstElementChild))&&tr(/<[/\w]/g,e.innerHTML)&&tr(/<[/\w]/g,e.textContent))return Oe(e),!0;if(!P[o]||z[o]){if(!z[o]&&je(o)){if(F.tagNameCheck instanceof RegExp&&tr(F.tagNameCheck,o))return!1;if(F.tagNameCheck instanceof Function&&F.tagNameCheck(o))return!1}if(ne&&!ie[o]){const t=g(e)||e.parentNode,n=v(e)||e.childNodes;if(n&&t){for(let r=n.length-1;r>=0;--r)t.insertBefore(h(n[r],!0),y(e))}}return Oe(e),!0}return e instanceof u&&!function(e){let t=g(e);t&&t.tagName||(t={namespaceURI:de,tagName:"template"});const n=Xn(e.tagName),r=Xn(t.tagName);return!!he[e.namespaceURI]&&(e.namespaceURI===_e?t.namespaceURI===pe?"svg"===n:t.namespaceURI===fe?"svg"===n&&("annotation-xml"===r||xe[r]):Boolean(we[n]):e.namespaceURI===fe?t.namespaceURI===pe?"math"===n:t.namespaceURI===_e?"math"===n&&Ae[r]:Boolean(Ce[n]):e.namespaceURI===pe?!(t.namespaceURI===_e&&!Ae[r])&&!(t.namespaceURI===fe&&!xe[r])&&!Ce[n]&&(Ne[n]||!we[n]):!("application/xhtml+xml"!==ve||!he[e.namespaceURI]))}(e)?(Oe(e),!0):"noscript"!==o&&"noembed"!==o&&"noframes"!==o||!tr(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&3===e.nodeType&&(t=e.textContent,t=Jn(t,w," "),t=Jn(t,C," "),t=Jn(t,O," "),e.textContent!==t&&($n(n.removed,{element:e.cloneNode()}),e.textContent=t)),Ie("afterSanitizeElements",e,null),!1):(Oe(e),!0)},Ue=function(e,t,n){if(ee&&("id"===t||"name"===t)&&(n in i||n in ke))return!1;if(V&&!W[t]&&tr(R,t));else if(B&&tr(D,t));else if(!j[t]||W[t]){if(!(je(e)&&(F.tagNameCheck instanceof RegExp&&tr(F.tagNameCheck,e)||F.tagNameCheck instanceof Function&&F.tagNameCheck(e))&&(F.attributeNameCheck instanceof RegExp&&tr(F.attributeNameCheck,t)||F.attributeNameCheck instanceof Function&&F.attributeNameCheck(t))||"is"===t&&F.allowCustomizedBuiltInElements&&(F.tagNameCheck instanceof RegExp&&tr(F.tagNameCheck,n)||F.tagNameCheck instanceof Function&&F.tagNameCheck(n))))return!1}else if(ue[t]);else if(tr(I,Jn(n,M,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Qn(n,"data:")||!le[e]){if(q&&!tr(L,Jn(n,M,"")));else if(n)return!1}else;return!0},je=function(e){return e.indexOf("-")>0},He=function(e){let t,r,o,i;Ie("beforeSanitizeAttributes",e,null);const{attributes:a}=e;if(!a)return;const l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:j};for(i=a.length;i--;){t=a[i];const{name:c,namespaceURI:u}=t;if(r="value"===c?t.value:er(t.value),o=be(c),l.attrName=o,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,Ie("uponSanitizeAttribute",e,l),r=l.attrValue,l.forceKeepAttr)continue;if(Re(c,e),!l.keepAttr)continue;if(!G&&tr(/\/>/i,r)){Re(c,e);continue}Y&&(r=Jn(r,w," "),r=Jn(r,C," "),r=Jn(r,O," "));const s=be(e.nodeName);if(Ue(s,o,r)){if(!te||"id"!==o&&"name"!==o||(Re(c,e),r="user-content-"+r),b&&"object"==typeof d&&"function"==typeof d.getAttributeType)if(u);else switch(d.getAttributeType(s,o)){case"TrustedHTML":r=b.createHTML(r);break;case"TrustedScriptURL":r=b.createScriptURL(r)}try{u?e.setAttributeNS(u,c,r):e.setAttribute(c,r),Yn(n.removed)}catch(e){}}}Ie("afterSanitizeAttributes",e,null)},Fe=function e(t){let n;const r=Le(t);for(Ie("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)Ie("uponSanitizeShadowNode",n,null),Pe(n)||(n.content instanceof a&&e(n.content),He(n));Ie("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e){let t,o,i,l,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(me=!e,me&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Me(e)){if("function"!=typeof e.toString)throw nr("toString is not a function");if("string"!=typeof(e=e.toString()))throw nr("dirty is not a string, aborting")}if(!n.isSupported)return e;if(X||Te(u),n.removed=[],"string"==typeof e&&(re=!1),re){if(e.nodeName){const t=be(e.nodeName);if(!P[t]||z[t])throw nr("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof c)t=De("\x3c!----\x3e"),o=t.ownerDocument.importNode(e,!0),1===o.nodeType&&"BODY"===o.nodeName||"HTML"===o.nodeName?t=o:t.appendChild(o);else{if(!Z&&!Y&&!$&&-1===e.indexOf("<"))return b&&Q?b.createHTML(e):e;if(t=De(e),!t)return Z?null:Q?E:""}t&&K&&Oe(t.firstChild);const s=Le(re?e:t);for(;i=s.nextNode();)Pe(i)||(i.content instanceof a&&Fe(i.content),He(i));if(re)return e;if(Z){if(J)for(l=T.call(t.ownerDocument);t.firstChild;)l.appendChild(t.firstChild);else l=t;return(j.shadowroot||j.shadowrootmode)&&(l=A.call(r,l,!0)),l}let f=$?t.outerHTML:t.innerHTML;return $&&P["!doctype"]&&t.ownerDocument&&t.ownerDocument.doctype&&t.ownerDocument.doctype.name&&tr(Nr,t.ownerDocument.doctype.name)&&(f="\n"+f),Y&&(f=Jn(f,w," "),f=Jn(f,C," "),f=Jn(f,O," ")),b&&Q?b.createHTML(f):f},n.setConfig=function(e){Te(e),X=!0},n.clearConfig=function(){Ee=null,X=!1},n.isValidAttribute=function(e,t,n){Ee||Te({});const r=be(e),o=be(t);return Ue(r,o,n)},n.addHook=function(e,t){"function"==typeof t&&(N[e]=N[e]||[],$n(N[e],t))},n.removeHook=function(e){if(N[e])return Yn(N[e])},n.removeHooks=function(e){N[e]&&(N[e]=[])},n.removeAllHooks=function(){N={}},n}();const Rr=()=>{const{banner:e,acceptAll:t,rejectAll:n,setModal:r}=Mn();return W("div",{className:"fixed bottom-0 left-0 max-w-md px-5 py-4 m-2 shadow-md shadow-black/25 z-[9998] bg-background space-y-4 font-primary text-foreground rounded-md banner-wrapper",children:[e.title&&W("h3",{className:"m-0 text-lg font-semibold font-primary md:text-xl banner-title",children:e.title}),e.description&&W("p",{className:"m-0 text-sm leading-snug font-primary md:text-base banner-description",dangerouslySetInnerHTML:{__html:Or.sanitize(e.description,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["b","i","em","strong","p","ul","li","ol","span","h2","h3","h4","h5","h6","a","div"],ALLOWED_ATTR:["href","target"]})}}),W("div",{className:"pt-2 space-y-2 banner-btns",children:[!Ge(e.settings)&&W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-background font-primary text-primary md:px-3.5 py-1.5 md:py-2.5 border-primary hover:border-primary-hover hover:text-primary-hover active:border-primary-active active:text-primary-active transition-colors banner-btn-customise",onClick:()=>r(!0),children:e.customise}),W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-background font-primary text-primary md:px-3.5 py-1.5 md:py-2.5 border-primary hover:border-primary-hover hover:text-primary-hover active:border-primary-active active:text-primary-active transition-colors banner-btn-reject",onClick:n,children:e.reject}),W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-primary font-primary text-background md:px-3.5 py-1.5 md:py-2.5 border-primary hover:bg-primary-hover hover:border-primary-hover active:bg-primary-active active:border-primary-active transition-colors banner-btn-accept",onClick:t,children:e.accept})]})]})},Dr=()=>{const{cookie:e,setPermissions:t,banner:n,setModal:r}=Mn(),[o,i]=ne(e);return W("div",{className:"fixed bottom-0 left-0 w-full max-w-lg max-h-full px-5 py-4 m-2 overflow-y-auto text-black shadow-md shadow-black/25 z-[9999] bg-background text-foreground font-primary rounded-md banner-wrapper",children:[W("div",{className:"space-y-6",children:[W("h3",{className:"w-10/12 m-0 text-xl font-semibold font-primary md:text-2xl banner-title",children:n.customise}),n.settings.map((({slug:e,title:t,description:n})=>W("div",{children:[W("div",{className:"flex items-start justify-between",children:[W("h3",{className:"m-0 text-lg font-semibold font-primary banner-settings-title",children:t}),W("button",{type:"button",className:(o[e]?"bg-primary":"bg-gray-200")+" relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 mt-0.5 banner-settings-toggle",role:"switch","aria-checked":"false",onClick:()=>i({...o,[e]:!o[e]}),children:[W("span",{className:"sr-only",children:"Toggle"}),W("span",{"aria-hidden":"true",className:(o[e]?"translate-x-5":"translate-x-0")+" pointer-events-none inline-block h-5 w-5 transform rounded-full bg-background shadow ring-0 transition duration-200 ease-in-out"})]})]}),W("p",{className:"m-0 mt-2 text-sm leading-snug font-primary md:text-base banner-settings-description",children:n})]},`setting-${e}`))),W("div",{className:"pt-4",children:W("button",{type:"button",className:"px-2 mr-2 text-sm font-semibold border-2 border-solid rounded bg-primary font-primary text-background md:px-3.5 py-1.5 md:py-2.5 border-primary hover:bg-primary-hover hover:border-primary-hover active:bg-primary-active active:border-primary-active transition-colors banner-settings-save",onClick:()=>{t(o),r(!1)},children:n.save})})]}),W("button",{type:"button",className:"absolute top-0 right-0 w-8 h-8 mt-0 text-xl rounded-full banner-settings-close",onClick:()=>r(!1),children:"×"})]})},Lr=document.createElement("div");Lr.id="lkrl-wrapper",document.body.appendChild(Lr),U(W((()=>{const{choiceMade:e,init:t,settingsOpen:n}=Mn();return oe((()=>{t()}),[]),W(y,{children:[!e&&!n&&W(Rr,{}),n&&W(Dr,{})]})}),{}),Lr)}(); \ No newline at end of file diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index b4cd44d..f5dada3 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -7,16 +7,16 @@ const Settings = () => { const [cookieProxy, setCookieProxy] = useState(cookie); return ( -
+
-

+

{banner.customise}

{banner.settings.map(({ slug, title, description }) => (
-

+

{title}

@@ -24,7 +24,7 @@ const Settings = () => { type="button" className={`${ cookieProxy[slug] ? 'bg-primary' : 'bg-gray-200' - } relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 mt-0.5`} + } relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 mt-0.5 banner-settings-toggle`} role="switch" aria-checked="false" onClick={() => @@ -41,7 +41,7 @@ const Settings = () => {
-

+

{description}

@@ -50,7 +50,7 @@ const Settings = () => {