<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/**
 * Copyright since 2002 Creabilis
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License 3.0 (AFL-3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to contact@creabilis.com so we can send you a copy immediately.
 *
 * @author    Creabilis &lt;contact@creabilis.com&gt;
 * @copyright Since 2002 Creabilis
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
 * International Registered Trademark &amp; Property of Creabilis
 */

function toggleTrackerCategoriesCheckboxes() {
    $('.js-popup-ck-checkbox-all').on('change', function () {
      var currentStep = $(this).parents('.js-popup-ck-step');
  
      if ($(this).is(':checked')) {
        currentStep.find('.js-popup-ck-checkbox').prop('checked', true);
      } else {
        currentStep.find('.js-popup-ck-checkbox').prop('checked', false);
      }
    });
  
    $('.js-popup-ck-checkbox').on('change', function () {
      var currentStep = $(this).parents('.js-popup-ck-step');
      var numberOfCheckboxes = currentStep.find('.js-popup-ck-checkbox').length;
      var numberOfCheckboxesChecked = currentStep.find('.js-popup-ck-checkbox:checked').length;
  
      if (numberOfCheckboxes == numberOfCheckboxesChecked) {
        currentStep.find('.js-popup-ck-checkbox-all').prop('checked', true);
      } else {
        currentStep.find('.js-popup-ck-checkbox-all').prop('checked', false);
      }
    });
  }
  
  function launchConsentChoicePopup() {
    /* Set consent to 'Y' if customer click on 'I accept all' */
    $('.js-accept-all-button').on('click', () =&gt; {
      $('.js-popup-ck-checkbox:not(:disabled), .js-popup-ck-checkbox-all').prop('checked', true);
      trackerConsentStorage.registerConsents(getConsentedTrackersFromUser(), getDeniedTrackersFromUser());
      trackerConsentStorage.launchTracking();
      trackerConsentStorage.launchTMTracking();
      closeCookiePopup();
    })
  
    /* Set consent to 'N' if customer click on 'No thanks' */
    $('.js-deny-all-button').on('click', () =&gt; {
      $('.js-popup-ck-checkbox:not(:disabled), .js-popup-ck-checkbox-all').prop('checked', false);
      trackerConsentStorage.registerConsents(getConsentedTrackersFromUser(), getDeniedTrackersFromUser());
      closeCookiePopup();
    })
  
    /* Set different consent values if customer selected some options */
    $('.js-accept-partial-button').on('click', function () {
      trackerConsentStorage.registerConsents(getConsentedTrackersFromUser(), getDeniedTrackersFromUser());
      trackerConsentStorage.launchTracking();
      trackerConsentStorage.launchTMTracking();
      closeCookiePopup();
    })
  
    $('.js-popup-ck-next-button').on('click', function () {
      let parent = $(this).parents('.js-popup-ck-step');
      parent.removeClass('active').next().addClass('active');
    })
  
    $('.js-popup-ck-prev-button').on('click', function () {
      let parent = $(this).parents('.js-popup-ck-step');
      parent.removeClass('active').prev().addClass('active');
    })
  
    /* If the 'crea_cookieconsents' Cookie is not empty or if we add a new tracker, we display the tracker consent popup after 4s */
    if (!trackerConsentStorage.consentRegistered() || trackerConsentStorage.newTrackersDetected()) {
      window.setTimeout(() =&gt; {
        openCookiePopup();
      }, crea_cookiesconsent_display_time);
    }
  }
  
  function openCookiePopup() {
    $('.js-popup-ck').addClass('active');
  }
  
  function closeCookiePopup() {
    $('.js-popup-ck').removeClass('active');
  }
  
  function getConsentedTrackersFromUser() {
    let acceptedTrackers = [];
  
    $('.js-popup-ck-checkbox:checked').each(function () {
      acceptedTrackers.push($(this).val());
    });
  
    return acceptedTrackers;
  }
  
  function getDeniedTrackersFromUser() {
    let deniedTrackers = [];
  
    $('.js-popup-ck-checkbox:not(:checked)').each(function () {
      deniedTrackers.push($(this).val());
    });
  
    return deniedTrackers;
  }
  
  /**
   * Main
   */
  let trackerConsentStorage = new TrackerConsentStorage();
  
  $('ready', () =&gt; {
    trackerConsentStorage.launchTracking();
    trackerConsentStorage.launchTMTracking();
    launchConsentChoicePopup();
    toggleTrackerCategoriesCheckboxes();
  })
  </pre></body></html>