@masth0/cookie-consent
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1007,3 +1007,3 @@ var __accessCheck = (obj, member, msg) => { | ||
btn.addEventListener("click", function(e) { | ||
var _a, _b; | ||
var _a; | ||
e.preventDefault(); | ||
@@ -1016,5 +1016,7 @@ const list = btn.nextElementSibling; | ||
list.addEventListener("animationend", function _func(e2) { | ||
var _a2; | ||
if (e2.animationName === "fadeIn") { | ||
(_a2 = list.querySelector("input")) == null ? void 0 : _a2.classList.remove("cc-disable-anim"); | ||
const choices = Array.from(list.querySelectorAll("input.cc_switch")); | ||
for (const choice of choices) { | ||
choice.classList.remove("cc-disable-anim"); | ||
} | ||
list.removeEventListener("animationend", _func); | ||
@@ -1025,3 +1027,6 @@ } | ||
this.classList.remove("is-open"); | ||
(_b = list.querySelector("input")) == null ? void 0 : _b.classList.add("cc-disable-anim"); | ||
const choices = Array.from(list.querySelectorAll("input.cc_switch")); | ||
for (const choice of choices) { | ||
choice.classList.add("cc-disable-anim"); | ||
} | ||
if (list) { | ||
@@ -1037,3 +1042,4 @@ ConsentUI.hideElement(list); | ||
container.classList.add("cc_cookie"); | ||
const descriptionCol = document.createElement("div"); | ||
const switchContainer = document.createElement("div"); | ||
switchContainer.classList.add("cc_switch_container"); | ||
const description = document.createElement("p"); | ||
@@ -1051,2 +1057,3 @@ description.classList.add("cc_description"); | ||
checkbox.id = cookie.id; | ||
checkbox.classList.add("cc_switch"); | ||
checkbox.ariaLabel = cookie.name; | ||
@@ -1058,5 +1065,4 @@ checkbox.disabled = !cookie.isRevocable; | ||
checkbox.setAttribute("checked", "checked"); | ||
descriptionCol.appendChild(checkbox); | ||
descriptionCol.appendChild(choiceLabel); | ||
descriptionCol.appendChild(description); | ||
switchContainer.appendChild(checkbox); | ||
switchContainer.appendChild(choiceLabel); | ||
checkbox.addEventListener("change", (e) => { | ||
@@ -1072,3 +1078,4 @@ e.preventDefault(); | ||
}); | ||
container.appendChild(descriptionCol); | ||
container.appendChild(switchContainer); | ||
container.appendChild(description); | ||
return container; | ||
@@ -1075,0 +1082,0 @@ } |
@@ -1,10 +0,10 @@ | ||
var le=(h,b,E)=>{if(!b.has(h))throw TypeError("Cannot "+E)};var W=(h,b,E)=>(le(h,b,"read from private field"),E?E.call(h):b.get(h)),ue=(h,b,E)=>{if(b.has(h))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(h):b.set(h,E)},de=(h,b,E,x)=>(le(h,b,"write to private field"),x?x.call(h,E):b.set(h,E),E);(function(h,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(h=typeof globalThis!="undefined"?globalThis:h||self,b(h.CookieConsent={}))})(this,function(h){var F;"use strict";/*! | ||
var le=(h,b,y)=>{if(!b.has(h))throw TypeError("Cannot "+y)};var W=(h,b,y)=>(le(h,b,"read from private field"),y?y.call(h):b.get(h)),ue=(h,b,y)=>{if(b.has(h))throw TypeError("Cannot add the same private member more than once");b instanceof WeakSet?b.add(h):b.set(h,y)},de=(h,b,y,x)=>(le(h,b,"write to private field"),x?x.call(h,y):b.set(h,y),y);(function(h,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(h=typeof globalThis!="undefined"?globalThis:h||self,b(h.CookieConsent={}))})(this,function(h){var F;"use strict";/*! | ||
* tabbable 6.0.0 | ||
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE | ||
*/var b=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],E=b.join(","),x=typeof Element=="undefined",D=x?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,I=!x&&Element.prototype.getRootNode?function(r){return r.getRootNode()}:function(r){return r.ownerDocument},G=function(e,t,n){var a=Array.prototype.slice.apply(e.querySelectorAll(E));return t&&D.call(e,E)&&a.unshift(e),a=a.filter(n),a},V=function r(e,t,n){for(var a=[],i=Array.from(e);i.length;){var s=i.shift();if(s.tagName==="SLOT"){var l=s.assignedElements(),d=l.length?l:s.children,f=r(d,!0,n);n.flatten?a.push.apply(a,f):a.push({scope:s,candidates:f})}else{var T=D.call(s,E);T&&n.filter(s)&&(t||!e.includes(s))&&a.push(s);var m=s.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(s),y=!n.shadowRootFilter||n.shadowRootFilter(s);if(m&&y){var N=r(m===!0?s.children:m.children,!0,n);n.flatten?a.push.apply(a,N):a.push({scope:s,candidates:N})}else i.unshift.apply(i,s.children)}}return a},K=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},fe=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Y=function(e){return e.tagName==="INPUT"},he=function(e){return Y(e)&&e.type==="hidden"},ve=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},be=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},pe=function(e){if(!e.name)return!0;var t=e.form||I(e),n=function(l){return t.querySelectorAll('input[type="radio"][name="'+l+'"]')},a;if(typeof window!="undefined"&&typeof window.CSS!="undefined"&&typeof window.CSS.escape=="function")a=n(window.CSS.escape(e.name));else try{a=n(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=be(a,e.form);return!i||i===e},ge=function(e){return Y(e)&&e.type==="radio"},me=function(e){return ge(e)&&!pe(e)},ye=function(e){for(var t,n=I(e).host,a=!!((t=n)!==null&&t!==void 0&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!a&&n;){var i;n=I(n).host,a=!!((i=n)!==null&&i!==void 0&&i.ownerDocument.contains(n))}return a},Z=function(e){var t=e.getBoundingClientRect(),n=t.width,a=t.height;return n===0&&a===0},Ee=function(e,t){var n=t.displayCheck,a=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var i=D.call(e,"details>summary:first-of-type"),s=i?e.parentElement:e;if(D.call(s,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="legacy-full"){if(typeof a=="function"){for(var l=e;e;){var d=e.parentElement,f=I(e);if(d&&!d.shadowRoot&&a(d)===!0)return Z(e);e.assignedSlot?e=e.assignedSlot:!d&&f!==e.ownerDocument?e=f.host:e=d}e=l}if(ye(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Z(e);return!1},ke=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var a=t.children.item(n);if(a.tagName==="LEGEND")return D.call(t,"fieldset[disabled] *")?!0:!a.contains(e)}return!0}t=t.parentElement}return!1},M=function(e,t){return!(t.disabled||he(t)||Ee(t,e)||ve(t)||ke(t))},q=function(e,t){return!(me(t)||K(t)<0||!M(e,t))},we=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Te=function r(e){var t=[],n=[];return e.forEach(function(a,i){var s=!!a.scope,l=s?a.scope:a,d=K(l,s),f=s?r(a.candidates):l;d===0?s?t.push.apply(t,f):t.push(l):n.push({documentOrder:i,tabIndex:d,item:a,isScope:s,content:f})}),n.sort(fe).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(t)},Se=function(e,t){t=t||{};var n;return t.getShadowRoot?n=V([e],t.includeContainer,{filter:q.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:we}):n=G(e,t.includeContainer,q.bind(null,t)),Te(n)},Ce=function(e,t){t=t||{};var n;return t.getShadowRoot?n=V([e],t.includeContainer,{filter:M.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=G(e,t.includeContainer,M.bind(null,t)),n},j=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return D.call(e,E)===!1?!1:q(t,e)},Ae=b.concat("iframe").join(","),$=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return D.call(e,Ae)===!1?!1:M(t,e)};/*! | ||
*/var b=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"],y=b.join(","),x=typeof Element=="undefined",D=x?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,I=!x&&Element.prototype.getRootNode?function(r){return r.getRootNode()}:function(r){return r.ownerDocument},G=function(e,t,n){var a=Array.prototype.slice.apply(e.querySelectorAll(y));return t&&D.call(e,y)&&a.unshift(e),a=a.filter(n),a},V=function r(e,t,n){for(var a=[],i=Array.from(e);i.length;){var s=i.shift();if(s.tagName==="SLOT"){var l=s.assignedElements(),d=l.length?l:s.children,f=r(d,!0,n);n.flatten?a.push.apply(a,f):a.push({scope:s,candidates:f})}else{var k=D.call(s,y);k&&n.filter(s)&&(t||!e.includes(s))&&a.push(s);var m=s.shadowRoot||typeof n.getShadowRoot=="function"&&n.getShadowRoot(s),w=!n.shadowRootFilter||n.shadowRootFilter(s);if(m&&w){var N=r(m===!0?s.children:m.children,!0,n);n.flatten?a.push.apply(a,N):a.push({scope:s,candidates:N})}else i.unshift.apply(i,s.children)}}return a},K=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},fe=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Y=function(e){return e.tagName==="INPUT"},he=function(e){return Y(e)&&e.type==="hidden"},ve=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(n){return n.tagName==="SUMMARY"});return t},be=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]},pe=function(e){if(!e.name)return!0;var t=e.form||I(e),n=function(l){return t.querySelectorAll('input[type="radio"][name="'+l+'"]')},a;if(typeof window!="undefined"&&typeof window.CSS!="undefined"&&typeof window.CSS.escape=="function")a=n(window.CSS.escape(e.name));else try{a=n(e.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=be(a,e.form);return!i||i===e},ge=function(e){return Y(e)&&e.type==="radio"},me=function(e){return ge(e)&&!pe(e)},ye=function(e){for(var t,n=I(e).host,a=!!((t=n)!==null&&t!==void 0&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!a&&n;){var i;n=I(n).host,a=!!((i=n)!==null&&i!==void 0&&i.ownerDocument.contains(n))}return a},Z=function(e){var t=e.getBoundingClientRect(),n=t.width,a=t.height;return n===0&&a===0},Ee=function(e,t){var n=t.displayCheck,a=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var i=D.call(e,"details>summary:first-of-type"),s=i?e.parentElement:e;if(D.call(s,"details:not([open]) *"))return!0;if(!n||n==="full"||n==="legacy-full"){if(typeof a=="function"){for(var l=e;e;){var d=e.parentElement,f=I(e);if(d&&!d.shadowRoot&&a(d)===!0)return Z(e);e.assignedSlot?e=e.assignedSlot:!d&&f!==e.ownerDocument?e=f.host:e=d}e=l}if(ye(e))return!e.getClientRects().length;if(n!=="legacy-full")return!0}else if(n==="non-zero-area")return Z(e);return!1},ke=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var n=0;n<t.children.length;n++){var a=t.children.item(n);if(a.tagName==="LEGEND")return D.call(t,"fieldset[disabled] *")?!0:!a.contains(e)}return!0}t=t.parentElement}return!1},M=function(e,t){return!(t.disabled||he(t)||Ee(t,e)||ve(t)||ke(t))},q=function(e,t){return!(me(t)||K(t)<0||!M(e,t))},we=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Te=function r(e){var t=[],n=[];return e.forEach(function(a,i){var s=!!a.scope,l=s?a.scope:a,d=K(l,s),f=s?r(a.candidates):l;d===0?s?t.push.apply(t,f):t.push(l):n.push({documentOrder:i,tabIndex:d,item:a,isScope:s,content:f})}),n.sort(fe).reduce(function(a,i){return i.isScope?a.push.apply(a,i.content):a.push(i.content),a},[]).concat(t)},Se=function(e,t){t=t||{};var n;return t.getShadowRoot?n=V([e],t.includeContainer,{filter:q.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:we}):n=G(e,t.includeContainer,q.bind(null,t)),Te(n)},Ce=function(e,t){t=t||{};var n;return t.getShadowRoot?n=V([e],t.includeContainer,{filter:M.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):n=G(e,t.includeContainer,M.bind(null,t)),n},j=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return D.call(e,y)===!1?!1:q(t,e)},Ae=b.concat("iframe").join(","),$=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return D.call(e,Ae)===!1?!1:M(t,e)};/*! | ||
* focus-trap 7.0.0 | ||
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE | ||
*/function J(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Q(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J(Object(t),!0).forEach(function(n){Ne(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ne(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var X=function(){var r=[];return{activateTrap:function(t){if(r.length>0){var n=r[r.length-1];n!==t&&n.pause()}var a=r.indexOf(t);a===-1||r.splice(a,1),r.push(t)},deactivateTrap:function(t){var n=r.indexOf(t);n!==-1&&r.splice(n,1),r.length>0&&r[r.length-1].unpause()}}}(),Le=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Re=function(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27},De=function(e){return e.key==="Tab"||e.keyCode===9},ee=function(e){return setTimeout(e,0)},te=function(e,t){var n=-1;return e.every(function(a,i){return t(a)?(n=i,!1):!0}),n},O=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return typeof e=="function"?e.apply(void 0,n):e},H=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Fe=function(e,t){var n=(t==null?void 0:t.document)||document,a=Q({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},s,l=function(o,c,u){return o&&o[c]!==void 0?o[c]:a[u||c]},d=function(o){return i.containerGroups.findIndex(function(c){var u=c.container,g=c.tabbableNodes;return u.contains(o)||g.find(function(v){return v===o})})},f=function(o){var c=a[o];if(typeof c=="function"){for(var u=arguments.length,g=new Array(u>1?u-1:0),v=1;v<u;v++)g[v-1]=arguments[v];c=c.apply(void 0,g)}if(c===!0&&(c=void 0),!c){if(c===void 0||c===!1)return c;throw new Error("`".concat(o,"` was specified but was not a node, or did not return a node"))}var w=c;if(typeof c=="string"&&(w=n.querySelector(c),!w))throw new Error("`".concat(o,"` as selector refers to no known node"));return w},T=function(){var o=f("initialFocus");if(o===!1)return!1;if(o===void 0)if(d(n.activeElement)>=0)o=n.activeElement;else{var c=i.tabbableGroups[0],u=c&&c.firstTabbableNode;o=u||f("fallbackFocus")}if(!o)throw new Error("Your focus-trap needs to have at least one focusable element");return o},m=function(){if(i.containerGroups=i.containers.map(function(o){var c=Se(o,a.tabbableOptions),u=Ce(o,a.tabbableOptions);return{container:o,tabbableNodes:c,focusableNodes:u,firstTabbableNode:c.length>0?c[0]:null,lastTabbableNode:c.length>0?c[c.length-1]:null,nextTabbableNode:function(v){var w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,L=u.findIndex(function(R){return R===v});if(!(L<0))return w?u.slice(L+1).find(function(R){return j(R,a.tabbableOptions)}):u.slice(0,L).reverse().find(function(R){return j(R,a.tabbableOptions)})}}}),i.tabbableGroups=i.containerGroups.filter(function(o){return o.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},y=function p(o){if(o!==!1&&o!==n.activeElement){if(!o||!o.focus){p(T());return}o.focus({preventScroll:!!a.preventScroll}),i.mostRecentlyFocusedNode=o,Le(o)&&o.select()}},N=function(o){var c=f("setReturnFocus",o);return c||(c===!1?!1:o)},A=function(o){var c=H(o);if(!(d(c)>=0)){if(O(a.clickOutsideDeactivates,o)){s.deactivate({returnFocus:a.returnFocusOnDeactivate&&!$(c,a.tabbableOptions)});return}O(a.allowOutsideClick,o)||o.preventDefault()}},ie=function(o){var c=H(o),u=d(c)>=0;u||c instanceof Document?u&&(i.mostRecentlyFocusedNode=c):(o.stopImmediatePropagation(),y(i.mostRecentlyFocusedNode||T()))},_e=function(o){var c=H(o);m();var u=null;if(i.tabbableGroups.length>0){var g=d(c),v=g>=0?i.containerGroups[g]:void 0;if(g<0)o.shiftKey?u=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:u=i.tabbableGroups[0].firstTabbableNode;else if(o.shiftKey){var w=te(i.tabbableGroups,function(U){var z=U.firstTabbableNode;return c===z});if(w<0&&(v.container===c||$(c,a.tabbableOptions)&&!j(c,a.tabbableOptions)&&!v.nextTabbableNode(c,!1))&&(w=g),w>=0){var L=w===0?i.tabbableGroups.length-1:w-1,R=i.tabbableGroups[L];u=R.lastTabbableNode}}else{var P=te(i.tabbableGroups,function(U){var z=U.lastTabbableNode;return c===z});if(P<0&&(v.container===c||$(c,a.tabbableOptions)&&!j(c,a.tabbableOptions)&&!v.nextTabbableNode(c))&&(P=g),P>=0){var qe=P===i.tabbableGroups.length-1?0:P+1,$e=i.tabbableGroups[qe];u=$e.firstTabbableNode}}}else u=f("fallbackFocus");u&&(o.preventDefault(),y(u))},re=function(o){if(Re(o)&&O(a.escapeDeactivates,o)!==!1){o.preventDefault(),s.deactivate();return}if(De(o)){_e(o);return}},se=function(o){var c=H(o);d(c)>=0||O(a.clickOutsideDeactivates,o)||O(a.allowOutsideClick,o)||(o.preventDefault(),o.stopImmediatePropagation())},oe=function(){if(!!i.active)return X.activateTrap(s),i.delayInitialFocusTimer=a.delayInitialFocus?ee(function(){y(T())}):y(T()),n.addEventListener("focusin",ie,!0),n.addEventListener("mousedown",A,{capture:!0,passive:!1}),n.addEventListener("touchstart",A,{capture:!0,passive:!1}),n.addEventListener("click",se,{capture:!0,passive:!1}),n.addEventListener("keydown",re,{capture:!0,passive:!1}),s},ce=function(){if(!!i.active)return n.removeEventListener("focusin",ie,!0),n.removeEventListener("mousedown",A,!0),n.removeEventListener("touchstart",A,!0),n.removeEventListener("click",se,!0),n.removeEventListener("keydown",re,!0),s};return s={get active(){return i.active},get paused(){return i.paused},activate:function(o){if(i.active)return this;var c=l(o,"onActivate"),u=l(o,"onPostActivate"),g=l(o,"checkCanFocusTrap");g||m(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,c&&c();var v=function(){g&&m(),oe(),u&&u()};return g?(g(i.containers.concat()).then(v,v),this):(v(),this)},deactivate:function(o){if(!i.active)return this;var c=Q({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},o);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,ce(),i.active=!1,i.paused=!1,X.deactivateTrap(s);var u=l(c,"onDeactivate"),g=l(c,"onPostDeactivate"),v=l(c,"checkCanReturnFocus"),w=l(c,"returnFocus","returnFocusOnDeactivate");u&&u();var L=function(){ee(function(){w&&y(N(i.nodeFocusedBeforeActivation)),g&&g()})};return w&&v?(v(N(i.nodeFocusedBeforeActivation)).then(L,L),this):(L(),this)},pause:function(){return i.paused||!i.active?this:(i.paused=!0,ce(),this)},unpause:function(){return!i.paused||!i.active?this:(i.paused=!1,m(),oe(),this)},updateContainerElements:function(o){var c=[].concat(o).filter(Boolean);return i.containers=c.map(function(u){return typeof u=="string"?n.querySelector(u):u}),i.active&&m(),this}},s.updateContainerElements(e),s};class S{constructor(e,t){this.categories=e,this.translations=t,this.container=this.createHTMLElement("div",{class:"cc_container",id:"cc_container","aria-hidden":"true",hidden:"",tabindex:"-1"}),this.locale=document.documentElement.getAttribute("lang")||"fr",this.trap=Fe(this.container,{allowOutsideClick:!0,clickOutsideDeactivates:!0,escapeDeactivates:!0})}init(){return new Promise(e=>{this.render(),this.addParamsEvent(),this.addSaveAllEvent(),this.addSaveEvent(),this.addRejectEvent(),this.hide(),e()})}show(){S.showElement(this.container),setTimeout(()=>{this.trap.activate()},100)}hide(){S.hideElement(this.container),this.trap.deactivate()}update(e){this.categories=e;for(let t=0;t<this.categories.length;t++)for(let n=0;n<this.categories[t].cookies.length;n++){const a=this.categories[t],i=this.categories[t].cookies[n];if(i.isRevocable){const s=this.container.querySelector('input[name="'+i.name+'"][data-category="'+a.name+'"]');s&&(s.checked=i.isAccepted)}}return this}render(){const e=this.createHTMLElement("div",{class:"cc_topbar"}),t=this.createHTMLElement("button",{type:"button",class:"cc_btn","data-cc-reject":""});t.innerText=this.translations.btn.continue[this.locale];const n=this.createHTMLElement("div",{class:"cc_header"}),a=this.createHTMLElement("div",{class:"cc_body",hidden:"","aria-hidden":"true"}),i=this.createHTMLElement("div",{class:"cc_footer"});n.innerHTML=` | ||
*/function J(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),t.push.apply(t,n)}return t}function Q(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?J(Object(t),!0).forEach(function(n){Ne(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):J(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ne(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var X=function(){var r=[];return{activateTrap:function(t){if(r.length>0){var n=r[r.length-1];n!==t&&n.pause()}var a=r.indexOf(t);a===-1||r.splice(a,1),r.push(t)},deactivateTrap:function(t){var n=r.indexOf(t);n!==-1&&r.splice(n,1),r.length>0&&r[r.length-1].unpause()}}}(),Le=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},Re=function(e){return e.key==="Escape"||e.key==="Esc"||e.keyCode===27},De=function(e){return e.key==="Tab"||e.keyCode===9},ee=function(e){return setTimeout(e,0)},te=function(e,t){var n=-1;return e.every(function(a,i){return t(a)?(n=i,!1):!0}),n},O=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),a=1;a<t;a++)n[a-1]=arguments[a];return typeof e=="function"?e.apply(void 0,n):e},H=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Fe=function(e,t){var n=(t==null?void 0:t.document)||document,a=Q({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0},t),i={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,delayInitialFocusTimer:void 0},s,l=function(c,o,u){return c&&c[o]!==void 0?c[o]:a[u||o]},d=function(c){return i.containerGroups.findIndex(function(o){var u=o.container,g=o.tabbableNodes;return u.contains(c)||g.find(function(v){return v===c})})},f=function(c){var o=a[c];if(typeof o=="function"){for(var u=arguments.length,g=new Array(u>1?u-1:0),v=1;v<u;v++)g[v-1]=arguments[v];o=o.apply(void 0,g)}if(o===!0&&(o=void 0),!o){if(o===void 0||o===!1)return o;throw new Error("`".concat(c,"` was specified but was not a node, or did not return a node"))}var T=o;if(typeof o=="string"&&(T=n.querySelector(o),!T))throw new Error("`".concat(c,"` as selector refers to no known node"));return T},k=function(){var c=f("initialFocus");if(c===!1)return!1;if(c===void 0)if(d(n.activeElement)>=0)c=n.activeElement;else{var o=i.tabbableGroups[0],u=o&&o.firstTabbableNode;c=u||f("fallbackFocus")}if(!c)throw new Error("Your focus-trap needs to have at least one focusable element");return c},m=function(){if(i.containerGroups=i.containers.map(function(c){var o=Se(c,a.tabbableOptions),u=Ce(c,a.tabbableOptions);return{container:c,tabbableNodes:o,focusableNodes:u,firstTabbableNode:o.length>0?o[0]:null,lastTabbableNode:o.length>0?o[o.length-1]:null,nextTabbableNode:function(v){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,L=u.findIndex(function(R){return R===v});if(!(L<0))return T?u.slice(L+1).find(function(R){return j(R,a.tabbableOptions)}):u.slice(0,L).reverse().find(function(R){return j(R,a.tabbableOptions)})}}}),i.tabbableGroups=i.containerGroups.filter(function(c){return c.tabbableNodes.length>0}),i.tabbableGroups.length<=0&&!f("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times")},w=function p(c){if(c!==!1&&c!==n.activeElement){if(!c||!c.focus){p(k());return}c.focus({preventScroll:!!a.preventScroll}),i.mostRecentlyFocusedNode=c,Le(c)&&c.select()}},N=function(c){var o=f("setReturnFocus",c);return o||(o===!1?!1:c)},A=function(c){var o=H(c);if(!(d(o)>=0)){if(O(a.clickOutsideDeactivates,c)){s.deactivate({returnFocus:a.returnFocusOnDeactivate&&!$(o,a.tabbableOptions)});return}O(a.allowOutsideClick,c)||c.preventDefault()}},ie=function(c){var o=H(c),u=d(o)>=0;u||o instanceof Document?u&&(i.mostRecentlyFocusedNode=o):(c.stopImmediatePropagation(),w(i.mostRecentlyFocusedNode||k()))},_e=function(c){var o=H(c);m();var u=null;if(i.tabbableGroups.length>0){var g=d(o),v=g>=0?i.containerGroups[g]:void 0;if(g<0)c.shiftKey?u=i.tabbableGroups[i.tabbableGroups.length-1].lastTabbableNode:u=i.tabbableGroups[0].firstTabbableNode;else if(c.shiftKey){var T=te(i.tabbableGroups,function(U){var z=U.firstTabbableNode;return o===z});if(T<0&&(v.container===o||$(o,a.tabbableOptions)&&!j(o,a.tabbableOptions)&&!v.nextTabbableNode(o,!1))&&(T=g),T>=0){var L=T===0?i.tabbableGroups.length-1:T-1,R=i.tabbableGroups[L];u=R.lastTabbableNode}}else{var P=te(i.tabbableGroups,function(U){var z=U.lastTabbableNode;return o===z});if(P<0&&(v.container===o||$(o,a.tabbableOptions)&&!j(o,a.tabbableOptions)&&!v.nextTabbableNode(o))&&(P=g),P>=0){var qe=P===i.tabbableGroups.length-1?0:P+1,$e=i.tabbableGroups[qe];u=$e.firstTabbableNode}}}else u=f("fallbackFocus");u&&(c.preventDefault(),w(u))},re=function(c){if(Re(c)&&O(a.escapeDeactivates,c)!==!1){c.preventDefault(),s.deactivate();return}if(De(c)){_e(c);return}},se=function(c){var o=H(c);d(o)>=0||O(a.clickOutsideDeactivates,c)||O(a.allowOutsideClick,c)||(c.preventDefault(),c.stopImmediatePropagation())},ce=function(){if(!!i.active)return X.activateTrap(s),i.delayInitialFocusTimer=a.delayInitialFocus?ee(function(){w(k())}):w(k()),n.addEventListener("focusin",ie,!0),n.addEventListener("mousedown",A,{capture:!0,passive:!1}),n.addEventListener("touchstart",A,{capture:!0,passive:!1}),n.addEventListener("click",se,{capture:!0,passive:!1}),n.addEventListener("keydown",re,{capture:!0,passive:!1}),s},oe=function(){if(!!i.active)return n.removeEventListener("focusin",ie,!0),n.removeEventListener("mousedown",A,!0),n.removeEventListener("touchstart",A,!0),n.removeEventListener("click",se,!0),n.removeEventListener("keydown",re,!0),s};return s={get active(){return i.active},get paused(){return i.paused},activate:function(c){if(i.active)return this;var o=l(c,"onActivate"),u=l(c,"onPostActivate"),g=l(c,"checkCanFocusTrap");g||m(),i.active=!0,i.paused=!1,i.nodeFocusedBeforeActivation=n.activeElement,o&&o();var v=function(){g&&m(),ce(),u&&u()};return g?(g(i.containers.concat()).then(v,v),this):(v(),this)},deactivate:function(c){if(!i.active)return this;var o=Q({onDeactivate:a.onDeactivate,onPostDeactivate:a.onPostDeactivate,checkCanReturnFocus:a.checkCanReturnFocus},c);clearTimeout(i.delayInitialFocusTimer),i.delayInitialFocusTimer=void 0,oe(),i.active=!1,i.paused=!1,X.deactivateTrap(s);var u=l(o,"onDeactivate"),g=l(o,"onPostDeactivate"),v=l(o,"checkCanReturnFocus"),T=l(o,"returnFocus","returnFocusOnDeactivate");u&&u();var L=function(){ee(function(){T&&w(N(i.nodeFocusedBeforeActivation)),g&&g()})};return T&&v?(v(N(i.nodeFocusedBeforeActivation)).then(L,L),this):(L(),this)},pause:function(){return i.paused||!i.active?this:(i.paused=!0,oe(),this)},unpause:function(){return!i.paused||!i.active?this:(i.paused=!1,m(),ce(),this)},updateContainerElements:function(c){var o=[].concat(c).filter(Boolean);return i.containers=o.map(function(u){return typeof u=="string"?n.querySelector(u):u}),i.active&&m(),this}},s.updateContainerElements(e),s};class S{constructor(e,t){this.categories=e,this.translations=t,this.container=this.createHTMLElement("div",{class:"cc_container",id:"cc_container","aria-hidden":"true",hidden:"",tabindex:"-1"}),this.locale=document.documentElement.getAttribute("lang")||"fr",this.trap=Fe(this.container,{allowOutsideClick:!0,clickOutsideDeactivates:!0,escapeDeactivates:!0})}init(){return new Promise(e=>{this.render(),this.addParamsEvent(),this.addSaveAllEvent(),this.addSaveEvent(),this.addRejectEvent(),this.hide(),e()})}show(){S.showElement(this.container),setTimeout(()=>{this.trap.activate()},100)}hide(){S.hideElement(this.container),this.trap.deactivate()}update(e){this.categories=e;for(let t=0;t<this.categories.length;t++)for(let n=0;n<this.categories[t].cookies.length;n++){const a=this.categories[t],i=this.categories[t].cookies[n];if(i.isRevocable){const s=this.container.querySelector('input[name="'+i.name+'"][data-category="'+a.name+'"]');s&&(s.checked=i.isAccepted)}}return this}render(){const e=this.createHTMLElement("div",{class:"cc_topbar"}),t=this.createHTMLElement("button",{type:"button",class:"cc_btn","data-cc-reject":""});t.innerText=this.translations.btn.continue[this.locale];const n=this.createHTMLElement("div",{class:"cc_header"}),a=this.createHTMLElement("div",{class:"cc_body",hidden:"","aria-hidden":"true"}),i=this.createHTMLElement("div",{class:"cc_footer"});n.innerHTML=` | ||
<h2 class="cc_title">${this.translations.title[this.locale]}</h2> | ||
<p class="cc_description">${this.translations.description[this.locale]}</p> | ||
`;const s=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.Save]:"",hidden:"","aria-hidden":"true"});s.innerText=this.translations.btn.save[this.locale];const l=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.Params]:""});l.innerText=this.translations.btn.params[this.locale];const d=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.Reject]:""});d.innerText=this.translations.btn.reject[this.locale];const f=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.SaveAll]:""});f.innerText=this.translations.btn.saveAll[this.locale],e.appendChild(t),this.container.appendChild(e),this.container.appendChild(n),this.container.appendChild(a),this.container.appendChild(i),i.appendChild(l),i.appendChild(d),i.appendChild(s),i.appendChild(f),this.categories.forEach(T=>{a.appendChild(this.categoryHtml(T))}),document.body.appendChild(this.container)}addParamsEvent(){const e=[].slice.call(document.querySelectorAll("["+C.Params+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",n=>{var l;n.preventDefault();const a=this.container.querySelector("button["+C.Save+"]"),i=this.container.querySelector("button["+C.SaveAll+"]"),s=this.container.querySelector(".cc_body");if(s&&s.hasAttribute("hidden")){t.innerText=this.translations.btn.closeParams[this.locale],S.showElement(s),(l=s.querySelector("button"))==null||l.focus(),a!==null&&S.showElement(a),i!==null&&S.hideElement(i);const d=t.querySelector("button");d==null||d.focus()}else t.innerText=this.translations.btn.params[this.locale],s!==null&&S.hideElement(s),a!==null&&S.hideElement(a),i!==null&&S.showElement(i)})})}addSaveAllEvent(){const e=[].slice.call(document.querySelectorAll("["+C.SaveAll+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",n=>{n.preventDefault();const a=this.createEvent(k.AcceptAll,{});this.container.dispatchEvent(a)})})}addSaveEvent(){const e=[].slice.call(document.querySelectorAll("["+C.Save+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",n=>{n.preventDefault();const a=this.createEvent(k.Save,{});this.container.dispatchEvent(a)})})}addRejectEvent(){const e=[].slice.call(document.querySelectorAll("["+C.Reject+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",()=>{const n=this.createEvent(k.Reject,{});this.container.dispatchEvent(n)})})}categoryHtml(e){const t=this.createHTMLElement("div",{class:"cc_category"}),n=this.createHTMLElement("div",{class:"cc_category_inner",hidden:"","aria-hidden":"true"}),a=this.createHTMLElement("button",{type:"button",class:"cc_category_title","data-cc-category-trigger":"button"});if(a.innerText=e.name,t.appendChild(a),e.description){const s=this.createHTMLElement("div",{class:"cc_description"});s.innerHTML=e.description,n.appendChild(s)}const i=this.createHTMLElement("ul",{});return e.cookies.forEach(s=>{const l=this.createHTMLElement("li",{});l.appendChild(this.cookieDefinitionHtml(s)),i.appendChild(l)}),n.appendChild(i),t.appendChild(n),a.addEventListener("click",function(s){var d,f;s.preventDefault();const l=a.nextElementSibling;l&&l.hasAttribute("hidden")?(this.classList.add("is-open"),S.showElement(l),(d=l.querySelector("input"))==null||d.focus(),l.addEventListener("animationend",function T(m){var y;m.animationName==="fadeIn"&&((y=l.querySelector("input"))==null||y.classList.remove("cc-disable-anim"),l.removeEventListener("animationend",T))},!1)):(this.classList.remove("is-open"),(f=l.querySelector("input"))==null||f.classList.add("cc-disable-anim"),l&&S.hideElement(l))}),t}cookieDefinitionHtml(e){const t=document.createElement("div");t.classList.add("cc_cookie");const n=document.createElement("div"),a=document.createElement("p");a.classList.add("cc_description"),a.innerHTML=e.description;const i=document.createElement("label");i.innerHTML=e.name,i.setAttribute("for",e.id);const s=document.createElement("input");return s.type="checkbox",s.dataset.category=e.categoryName,s.name=e.name,s.value=e.name,s.id=e.id,s.ariaLabel=e.name,s.disabled=!e.isRevocable,s.readOnly=!e.isRevocable,s.classList.add("cc-disable-anim"),(e.isAccepted||!e.isRevocable)&&s.setAttribute("checked","checked"),n.appendChild(s),n.appendChild(i),n.appendChild(a),s.addEventListener("change",l=>{l.preventDefault();const d=new CustomEvent(k.Change,{detail:{checkbox:s,cookie:e}});this.container.dispatchEvent(d)}),t.appendChild(n),t}createHTMLElement(e,t){const n=document.createElement(e);for(const a in t)n.setAttribute(a,t[a]);return n}static hideElement(e){e.setAttribute("hidden",""),e.classList.remove("is-open"),e.setAttribute("aria-hidden","true")}static showElement(e){e.removeAttribute("hidden"),e.classList.add("is-open"),e.setAttribute("aria-hidden","false")}createEvent(e,t){return new CustomEvent(e,{detail:{...t}})}}var k=(r=>(r.Save="on:save",r.AcceptAll="on:acceptAll",r.Reject="on:reject",r.Change="on:change",r))(k||{}),C=(r=>(r.Save="data-cc-save",r.SaveAll="data-cc-save-all",r.Reject="data-cc-reject",r.Params="data-cc-params",r))(C||{});class _{constructor(e){this.config=e,this._enabled=!1,this._accepted=!1,this.config=e}get id(){return`${this.categoryName}_${this.name}`}get isEnabled(){return this._enabled}set enabled(e){this._enabled=e}get isAccepted(){return this.isRevocable?this._accepted:!0}set accepted(e){this._accepted=e}get name(){return this.config.name}get description(){return this.config.description}get isRevocable(){return this.config.revocable}get categoryName(){return this.config.categoryName||"undefined"}set categoryName(e){this.config.categoryName=e}enable(){return new Promise((e,t)=>{this.isAccepted||t("Cookie is not accepted");let n=[];this.config.scripts.forEach(a=>{var s;if(a.type!=="cookie-consent")return;const i=_.copyScriptTag(a);i.dataset.src?i.src=i.dataset.src:i.type=i.dataset.type||"text/javascript",n.push(i),a.insertAdjacentElement("beforebegin",i),(s=a.parentElement)==null||s.removeChild(a)}),this.config.scripts=n,this._enabled=!0,e()})}disable(){return new Promise(e=>{if(this.isRevocable&&this.isEnabled){const t=Oe();for(const n of this.config.tokens){const a=t.find(i=>{if(n.endsWith("*")){const l=new RegExp(n+"[^;]+").exec(i.name.slice(0,-1));return l&&l[0]?i:void 0}return i.name===n});if(a){const i=new Date("1970");let s=location.hostname.replace("www","");document.cookie=`${a.name}=; expires=${i.toUTCString()}; Domain=${s}; Max-Age=0; path=/;`}}this._enabled=!1,this._accepted=!1}e()})}addScripts(e){this.config.scripts=[...this.config.scripts,...e]}addTokens(e){this.config.tokens=[...this.config.tokens,...e]}static copyScriptTag(e){const t=document.createElement("script");for(let n=0;n<e.attributes.length;n++){const a=e.attributes[n];t.setAttribute(a.name,a.value),t.innerHTML=e.innerHTML}return t}}class B{constructor(e){this.config=e}get description(){return this.config.description}get name(){return this.config.name}get cookies(){return this.config.cookies}addCookie(e){var n;const t=new _(e);return t.categoryName=(n=e.categoryName)!=null?n:this.config.name,this.config.cookies.push(t),this}getCookie(e){return this.cookies.find(t=>t.name===e)}}function xe(r){var n;let t=("; "+document.cookie).split("; "+r+"=");return t.length<2||(n=t.pop())==null?void 0:n.split(";").shift()}function Oe(){return document.cookie.split(";").map(r=>{const[e,t]=r.split("=").map(n=>n.trim());return{name:e,value:t}})}function Pe(r){let e=[];const t=[].slice.call(document.querySelectorAll(r));for(let n=0;n<t.length;n++){const a=t[n],i=a.dataset.name,s=a.dataset.description||"",l=a.hasAttribute("data-accepted"),d=!(a.hasAttribute("data-revocable")&&a.dataset.revocable==="false"),f=a.dataset.category||"undefined",T=a.dataset.tokens;let m=[];if(T&&(m=T.split(","),m=m.map(A=>A.trim())),i===void 0){console.error(`Name is missing on: ${a.outerHTML}`);continue}let y=e.find(A=>A.name===f);y===void 0&&(y=new B({name:f,description:"",cookies:[]}),e.push(y));let N=y.cookies.find(A=>A.name===i);N===void 0?y.addCookie({categoryName:f,name:i.trim(),description:s.trim(),scripts:[a],tokens:m,accepted:l,revocable:d}):(N.addScripts([a]),N.addTokens(m))}return e}function Ie(r,e){const t=r.slice();for(let n=0;n<e.length;n++){const a=e[n],i=r.find(s=>s.name===a.name);if(i===void 0){t.push(a);continue}for(let s=0;s<a.cookies.length;s++){const l=a.cookies[s];i.cookies.find(f=>f.name===l.name)===void 0&&(i==null||i.cookies.push(l))}}return t}const Me={title:{fr:"Nous utilisons des cookies",en:"We use cookies",de:"Wir verwenden Cookies"},description:{fr:"Nous utilisons des cookies pour nous assurer du bon fonctionnement de notre site, pour personnaliser notre contenu et nos publicit\xE9s et afin d\u2019analyser notre trafic. En utilisant ce site Internet ou en fermant ce bandeau, vous consentez \xE0 l'utilisation de ces cookies.",en:"We use cookies to ensure that our site functions properly, to personalize our content and advertising, and to analyze our traffic. By using this website or closing this banner, you consent to the use of these cookies.",de:"Wir verwenden Cookies, um sicherzustellen, dass unsere Website ordnungsgem\xE4\xDF funktioniert, um unseren Inhalt und unsere Werbung zu personalisieren und um unseren Datenverkehr zu analysieren. Durch die Nutzung dieser Website oder das Schlie\xDFen dieses Banners stimmen Sie der Verwendung dieser Cookies zu."},btn:{params:{fr:"G\xE9rer les pr\xE9f\xE9rences",en:"Manage my preferences",de:"Pr\xE4ferenzen verwalten"},closeParams:{fr:"Fermer les pr\xE9f\xE9rences",en:"Close preferences",de:"Pr\xE4ferenzen schliessen"},reject:{fr:"Refuser",en:"Deny",de:"Ablehnen"},saveAll:{fr:"Accepter",en:"Accept",de:"Alle akzeptieren"},save:{fr:"Enregistrer la s\xE9lection",en:"Save selection",de:"Auswahl speichern"},continue:{fr:"Continuer sans accepter",en:"Continue without accepting",de:"Ohne Zustimmung fortfahren"}},categories:{mandatory:{title:{fr:"Obligatoire",en:"Mandatory",de:"Erforderlich"},description:{fr:"Cookies requis pour le bon fonctionnement du site.",en:"We use required cookies to perform essential website functions.",de:""}}}};class je{constructor(e){ue(this,F,void 0);this.config=e,de(this,F,"_cookie_consent"),this.needToReload=!1,this.UI=new S(this.config.categories,this.config.translations),this.UI.init()}async init(){const e=this.getUserConsent();return!e||e&&e.version!==this.config.version?this.UI.show():this.updateConsentFromStorage(e),await this.enableAccepted(),this.UI.container.addEventListener(k.Change,t=>{const n=t.detail.cookie,a=this.getCategoryByName(n.categoryName);if(a){const i=a.getCookie(n.name);i&&(this.needToReload||(this.needToReload=!t.detail.checkbox.checked&&i.isEnabled),i.accepted=t.detail.checkbox.checked)}}),this.UI.container.addEventListener(k.Save,async()=>{await this.save(k.Save),this.UI.hide()}),this.UI.container.addEventListener(k.AcceptAll,async()=>{await this.save(k.AcceptAll),this.UI.hide()}),this.UI.container.addEventListener(k.Reject,async()=>{await this.save(k.Reject),this.UI.hide()}),Promise.resolve(this)}show(){this.UI.show()}hide(){this.UI.hide()}async save(e){switch(e){case k.Save:await this.enableAccepted();break;case k.AcceptAll:await this.acceptAll(!0).then(()=>{this.UI.update(this.config.categories)});break;case k.Reject:await this.acceptAll(!1).then(()=>{this.UI.update(this.config.categories)});break}this.saveUserConsent(),this.config.forceReload&&this.needToReload&&(window.location.reload(),this.needToReload=!1)}updateConsentFromStorage(e){e.cookies.forEach(t=>{const n=this.getCategoryByName(t.category);if(n){const a=n.getCookie(t.name);a&&(a.accepted=t.accepted)}}),this.UI.update(this.config.categories)}saveUserConsent(){const e=new Date;e.setMonth(e.getMonth()+12),document.cookie=`${W(this,F)}=${this.serializeUserConsent()}; expires=${e.toUTCString()}; path=/; SameSite=Lax;`}serializeUserConsent(){let e={version:this.config.version,cookies:[]};return this.config.categories.forEach(t=>{t.cookies.forEach(n=>{e.cookies.push({category:t.name,name:n.name,accepted:n.isAccepted})})}),JSON.stringify(e)}getUserConsent(){const e=xe(W(this,F));return e?JSON.parse(e):void 0}getCategoryByName(e){return this.config.categories.find(t=>t.name===e)}acceptAll(e){let t=[];for(let n=0;n<this.config.categories.length;n++)for(let a=0;a<this.config.categories[n].cookies.length;a++){const i=this.config.categories[n].cookies[a];i.isRevocable&&(i.isAccepted&&!e&&(this.needToReload=!0),i.accepted=e,e?t.push(i.enable()):t.push(i.disable()))}return Promise.all(t)}enableAccepted(){let e=[];for(let t=0;t<this.config.categories.length;t++)for(let n=0;n<this.config.categories[t].cookies.length;n++){const a=this.config.categories[t].cookies[n];a.isAccepted?e.push(a.enable()):e.push(a.disable())}return Promise.all(e)}}F=new WeakMap;function ne(r,e='script[type="cookie-consent"]'){const t=Pe(e);r.categories=Ie(t,r.categories);const n=new je(r);return new Promise(a=>{n.init().then(()=>a(n))})}function ae(r,e,t=[]){return new B({name:r,description:e,cookies:t})}const He={setup:ne,createCategory:ae,Category:B,CookieDefinition:_,UITranslationsDefault:Me,UIEvent};h.createCategory=ae,h.default=He,h.setup=ne,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
`;const s=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.Save]:"",hidden:"","aria-hidden":"true"});s.innerText=this.translations.btn.save[this.locale];const l=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.Params]:""});l.innerText=this.translations.btn.params[this.locale];const d=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.Reject]:""});d.innerText=this.translations.btn.reject[this.locale];const f=this.createHTMLElement("button",{type:"button",class:"cc_btn",[C.SaveAll]:""});f.innerText=this.translations.btn.saveAll[this.locale],e.appendChild(t),this.container.appendChild(e),this.container.appendChild(n),this.container.appendChild(a),this.container.appendChild(i),i.appendChild(l),i.appendChild(d),i.appendChild(s),i.appendChild(f),this.categories.forEach(k=>{a.appendChild(this.categoryHtml(k))}),document.body.appendChild(this.container)}addParamsEvent(){const e=[].slice.call(document.querySelectorAll("["+C.Params+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",n=>{var l;n.preventDefault();const a=this.container.querySelector("button["+C.Save+"]"),i=this.container.querySelector("button["+C.SaveAll+"]"),s=this.container.querySelector(".cc_body");if(s&&s.hasAttribute("hidden")){t.innerText=this.translations.btn.closeParams[this.locale],S.showElement(s),(l=s.querySelector("button"))==null||l.focus(),a!==null&&S.showElement(a),i!==null&&S.hideElement(i);const d=t.querySelector("button");d==null||d.focus()}else t.innerText=this.translations.btn.params[this.locale],s!==null&&S.hideElement(s),a!==null&&S.hideElement(a),i!==null&&S.showElement(i)})})}addSaveAllEvent(){const e=[].slice.call(document.querySelectorAll("["+C.SaveAll+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",n=>{n.preventDefault();const a=this.createEvent(E.AcceptAll,{});this.container.dispatchEvent(a)})})}addSaveEvent(){const e=[].slice.call(document.querySelectorAll("["+C.Save+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",n=>{n.preventDefault();const a=this.createEvent(E.Save,{});this.container.dispatchEvent(a)})})}addRejectEvent(){const e=[].slice.call(document.querySelectorAll("["+C.Reject+"]"));e.length>0&&e.forEach(t=>{t.addEventListener("click",()=>{const n=this.createEvent(E.Reject,{});this.container.dispatchEvent(n)})})}categoryHtml(e){const t=this.createHTMLElement("div",{class:"cc_category"}),n=this.createHTMLElement("div",{class:"cc_category_inner",hidden:"","aria-hidden":"true"}),a=this.createHTMLElement("button",{type:"button",class:"cc_category_title","data-cc-category-trigger":"button"});if(a.innerText=e.name,t.appendChild(a),e.description){const s=this.createHTMLElement("div",{class:"cc_description"});s.innerHTML=e.description,n.appendChild(s)}const i=this.createHTMLElement("ul",{});return e.cookies.forEach(s=>{const l=this.createHTMLElement("li",{});l.appendChild(this.cookieDefinitionHtml(s)),i.appendChild(l)}),n.appendChild(i),t.appendChild(n),a.addEventListener("click",function(s){var d;s.preventDefault();const l=a.nextElementSibling;if(l&&l.hasAttribute("hidden"))this.classList.add("is-open"),S.showElement(l),(d=l.querySelector("input"))==null||d.focus(),l.addEventListener("animationend",function f(k){if(k.animationName==="fadeIn"){const m=Array.from(l.querySelectorAll("input.cc_switch"));for(const w of m)w.classList.remove("cc-disable-anim");l.removeEventListener("animationend",f)}},!1);else{this.classList.remove("is-open");const f=Array.from(l.querySelectorAll("input.cc_switch"));for(const k of f)k.classList.add("cc-disable-anim");l&&S.hideElement(l)}}),t}cookieDefinitionHtml(e){const t=document.createElement("div");t.classList.add("cc_cookie");const n=document.createElement("div");n.classList.add("cc_switch_container");const a=document.createElement("p");a.classList.add("cc_description"),a.innerHTML=e.description;const i=document.createElement("label");i.innerHTML=e.name,i.setAttribute("for",e.id);const s=document.createElement("input");return s.type="checkbox",s.dataset.category=e.categoryName,s.name=e.name,s.value=e.name,s.id=e.id,s.classList.add("cc_switch"),s.ariaLabel=e.name,s.disabled=!e.isRevocable,s.readOnly=!e.isRevocable,s.classList.add("cc-disable-anim"),(e.isAccepted||!e.isRevocable)&&s.setAttribute("checked","checked"),n.appendChild(s),n.appendChild(i),s.addEventListener("change",l=>{l.preventDefault();const d=new CustomEvent(E.Change,{detail:{checkbox:s,cookie:e}});this.container.dispatchEvent(d)}),t.appendChild(n),t.appendChild(a),t}createHTMLElement(e,t){const n=document.createElement(e);for(const a in t)n.setAttribute(a,t[a]);return n}static hideElement(e){e.setAttribute("hidden",""),e.classList.remove("is-open"),e.setAttribute("aria-hidden","true")}static showElement(e){e.removeAttribute("hidden"),e.classList.add("is-open"),e.setAttribute("aria-hidden","false")}createEvent(e,t){return new CustomEvent(e,{detail:{...t}})}}var E=(r=>(r.Save="on:save",r.AcceptAll="on:acceptAll",r.Reject="on:reject",r.Change="on:change",r))(E||{}),C=(r=>(r.Save="data-cc-save",r.SaveAll="data-cc-save-all",r.Reject="data-cc-reject",r.Params="data-cc-params",r))(C||{});class _{constructor(e){this.config=e,this._enabled=!1,this._accepted=!1,this.config=e}get id(){return`${this.categoryName}_${this.name}`}get isEnabled(){return this._enabled}set enabled(e){this._enabled=e}get isAccepted(){return this.isRevocable?this._accepted:!0}set accepted(e){this._accepted=e}get name(){return this.config.name}get description(){return this.config.description}get isRevocable(){return this.config.revocable}get categoryName(){return this.config.categoryName||"undefined"}set categoryName(e){this.config.categoryName=e}enable(){return new Promise((e,t)=>{this.isAccepted||t("Cookie is not accepted");let n=[];this.config.scripts.forEach(a=>{var s;if(a.type!=="cookie-consent")return;const i=_.copyScriptTag(a);i.dataset.src?i.src=i.dataset.src:i.type=i.dataset.type||"text/javascript",n.push(i),a.insertAdjacentElement("beforebegin",i),(s=a.parentElement)==null||s.removeChild(a)}),this.config.scripts=n,this._enabled=!0,e()})}disable(){return new Promise(e=>{if(this.isRevocable&&this.isEnabled){const t=Oe();for(const n of this.config.tokens){const a=t.find(i=>{if(n.endsWith("*")){const l=new RegExp(n+"[^;]+").exec(i.name.slice(0,-1));return l&&l[0]?i:void 0}return i.name===n});if(a){const i=new Date("1970");let s=location.hostname.replace("www","");document.cookie=`${a.name}=; expires=${i.toUTCString()}; Domain=${s}; Max-Age=0; path=/;`}}this._enabled=!1,this._accepted=!1}e()})}addScripts(e){this.config.scripts=[...this.config.scripts,...e]}addTokens(e){this.config.tokens=[...this.config.tokens,...e]}static copyScriptTag(e){const t=document.createElement("script");for(let n=0;n<e.attributes.length;n++){const a=e.attributes[n];t.setAttribute(a.name,a.value),t.innerHTML=e.innerHTML}return t}}class B{constructor(e){this.config=e}get description(){return this.config.description}get name(){return this.config.name}get cookies(){return this.config.cookies}addCookie(e){var n;const t=new _(e);return t.categoryName=(n=e.categoryName)!=null?n:this.config.name,this.config.cookies.push(t),this}getCookie(e){return this.cookies.find(t=>t.name===e)}}function xe(r){var n;let t=("; "+document.cookie).split("; "+r+"=");return t.length<2||(n=t.pop())==null?void 0:n.split(";").shift()}function Oe(){return document.cookie.split(";").map(r=>{const[e,t]=r.split("=").map(n=>n.trim());return{name:e,value:t}})}function Pe(r){let e=[];const t=[].slice.call(document.querySelectorAll(r));for(let n=0;n<t.length;n++){const a=t[n],i=a.dataset.name,s=a.dataset.description||"",l=a.hasAttribute("data-accepted"),d=!(a.hasAttribute("data-revocable")&&a.dataset.revocable==="false"),f=a.dataset.category||"undefined",k=a.dataset.tokens;let m=[];if(k&&(m=k.split(","),m=m.map(A=>A.trim())),i===void 0){console.error(`Name is missing on: ${a.outerHTML}`);continue}let w=e.find(A=>A.name===f);w===void 0&&(w=new B({name:f,description:"",cookies:[]}),e.push(w));let N=w.cookies.find(A=>A.name===i);N===void 0?w.addCookie({categoryName:f,name:i.trim(),description:s.trim(),scripts:[a],tokens:m,accepted:l,revocable:d}):(N.addScripts([a]),N.addTokens(m))}return e}function Ie(r,e){const t=r.slice();for(let n=0;n<e.length;n++){const a=e[n],i=r.find(s=>s.name===a.name);if(i===void 0){t.push(a);continue}for(let s=0;s<a.cookies.length;s++){const l=a.cookies[s];i.cookies.find(f=>f.name===l.name)===void 0&&(i==null||i.cookies.push(l))}}return t}const Me={title:{fr:"Nous utilisons des cookies",en:"We use cookies",de:"Wir verwenden Cookies"},description:{fr:"Nous utilisons des cookies pour nous assurer du bon fonctionnement de notre site, pour personnaliser notre contenu et nos publicit\xE9s et afin d\u2019analyser notre trafic. En utilisant ce site Internet ou en fermant ce bandeau, vous consentez \xE0 l'utilisation de ces cookies.",en:"We use cookies to ensure that our site functions properly, to personalize our content and advertising, and to analyze our traffic. By using this website or closing this banner, you consent to the use of these cookies.",de:"Wir verwenden Cookies, um sicherzustellen, dass unsere Website ordnungsgem\xE4\xDF funktioniert, um unseren Inhalt und unsere Werbung zu personalisieren und um unseren Datenverkehr zu analysieren. Durch die Nutzung dieser Website oder das Schlie\xDFen dieses Banners stimmen Sie der Verwendung dieser Cookies zu."},btn:{params:{fr:"G\xE9rer les pr\xE9f\xE9rences",en:"Manage my preferences",de:"Pr\xE4ferenzen verwalten"},closeParams:{fr:"Fermer les pr\xE9f\xE9rences",en:"Close preferences",de:"Pr\xE4ferenzen schliessen"},reject:{fr:"Refuser",en:"Deny",de:"Ablehnen"},saveAll:{fr:"Accepter",en:"Accept",de:"Alle akzeptieren"},save:{fr:"Enregistrer la s\xE9lection",en:"Save selection",de:"Auswahl speichern"},continue:{fr:"Continuer sans accepter",en:"Continue without accepting",de:"Ohne Zustimmung fortfahren"}},categories:{mandatory:{title:{fr:"Obligatoire",en:"Mandatory",de:"Erforderlich"},description:{fr:"Cookies requis pour le bon fonctionnement du site.",en:"We use required cookies to perform essential website functions.",de:""}}}};class je{constructor(e){ue(this,F,void 0);this.config=e,de(this,F,"_cookie_consent"),this.needToReload=!1,this.UI=new S(this.config.categories,this.config.translations),this.UI.init()}async init(){const e=this.getUserConsent();return!e||e&&e.version!==this.config.version?this.UI.show():this.updateConsentFromStorage(e),await this.enableAccepted(),this.UI.container.addEventListener(E.Change,t=>{const n=t.detail.cookie,a=this.getCategoryByName(n.categoryName);if(a){const i=a.getCookie(n.name);i&&(this.needToReload||(this.needToReload=!t.detail.checkbox.checked&&i.isEnabled),i.accepted=t.detail.checkbox.checked)}}),this.UI.container.addEventListener(E.Save,async()=>{await this.save(E.Save),this.UI.hide()}),this.UI.container.addEventListener(E.AcceptAll,async()=>{await this.save(E.AcceptAll),this.UI.hide()}),this.UI.container.addEventListener(E.Reject,async()=>{await this.save(E.Reject),this.UI.hide()}),Promise.resolve(this)}show(){this.UI.show()}hide(){this.UI.hide()}async save(e){switch(e){case E.Save:await this.enableAccepted();break;case E.AcceptAll:await this.acceptAll(!0).then(()=>{this.UI.update(this.config.categories)});break;case E.Reject:await this.acceptAll(!1).then(()=>{this.UI.update(this.config.categories)});break}this.saveUserConsent(),this.config.forceReload&&this.needToReload&&(window.location.reload(),this.needToReload=!1)}updateConsentFromStorage(e){e.cookies.forEach(t=>{const n=this.getCategoryByName(t.category);if(n){const a=n.getCookie(t.name);a&&(a.accepted=t.accepted)}}),this.UI.update(this.config.categories)}saveUserConsent(){const e=new Date;e.setMonth(e.getMonth()+12),document.cookie=`${W(this,F)}=${this.serializeUserConsent()}; expires=${e.toUTCString()}; path=/; SameSite=Lax;`}serializeUserConsent(){let e={version:this.config.version,cookies:[]};return this.config.categories.forEach(t=>{t.cookies.forEach(n=>{e.cookies.push({category:t.name,name:n.name,accepted:n.isAccepted})})}),JSON.stringify(e)}getUserConsent(){const e=xe(W(this,F));return e?JSON.parse(e):void 0}getCategoryByName(e){return this.config.categories.find(t=>t.name===e)}acceptAll(e){let t=[];for(let n=0;n<this.config.categories.length;n++)for(let a=0;a<this.config.categories[n].cookies.length;a++){const i=this.config.categories[n].cookies[a];i.isRevocable&&(i.isAccepted&&!e&&(this.needToReload=!0),i.accepted=e,e?t.push(i.enable()):t.push(i.disable()))}return Promise.all(t)}enableAccepted(){let e=[];for(let t=0;t<this.config.categories.length;t++)for(let n=0;n<this.config.categories[t].cookies.length;n++){const a=this.config.categories[t].cookies[n];a.isAccepted?e.push(a.enable()):e.push(a.disable())}return Promise.all(e)}}F=new WeakMap;function ne(r,e='script[type="cookie-consent"]'){const t=Pe(e);r.categories=Ie(t,r.categories);const n=new je(r);return new Promise(a=>{n.init().then(()=>a(n))})}function ae(r,e,t=[]){return new B({name:r,description:e,cookies:t})}const He={setup:ne,createCategory:ae,Category:B,CookieDefinition:_,UITranslationsDefault:Me,UIEvent};h.createCategory=ae,h.default=He,h.setup=ne,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Cookie consent", | ||
@@ -9,0 +9,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90719
1958