// source --> https://saasenheim.fr/wp-content/plugins/document-emberdder/build/public.js?ver=2.1.0 
(()=>{"use strict";document.addEventListener("DOMContentLoaded",function(){const e=document.querySelectorAll(".ppv_container");function t(e){if(!e)return!1;const n=e.querySelector("iframe:not(.pdfp_library)"),o=e.querySelector(".ppv-lightbox-loading"),l=e.querySelector(".ppv-loading");if(n&&null!==n.contentDocument){const o=n.src;n.src=o,setTimeout(()=>{t(e)},1200)}else o&&(o.style.display="none"),l&&(l.style.display="none")}Object.values(e).map(e=>{const n=Boolean(e.dataset.lightbox),o=document.querySelector(".ppv-lightbox-overlay"),l=e.querySelector(".bplde-lightbox-close");if(n){const n=e.querySelector(".ppv-lightbox-btn");n&&n.addEventListener("click",function(){o.classList.add("open"),t(e)}),l&&l.addEventListener("click",function(){o.classList.remove("open")})}else t(e)}),document.querySelectorAll(".ppv-email-gate-btn").forEach(e=>{e.addEventListener("click",function(e){e.preventDefault();const t=this.dataset.docId,n=document.getElementById("ppv-gate-modal-"+t);n&&(n.style.display="flex")})}),document.querySelectorAll(".ppv-close-modal").forEach(e=>{e.addEventListener("click",function(e){e.preventDefault(),this.closest(".ppv-email-gate-modal-wrapper").style.display="none"})}),document.querySelectorAll(".ppv-email-gate-form").forEach(e=>{e.addEventListener("submit",function(e){e.preventDefault();const t=this.querySelector('button[type="submit"]'),n=t.innerText;t.innerText="Processing...",t.disabled=!0;const o=new FormData(this),l={name:o.get("name"),email:o.get("email"),document_id:o.get("document_id")};fetch(bplde_obj.rest_url+"gate-download",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(e=>e.json()).then(e=>{e.success&&e.url?(this.closest(".ppv-email-gate-modal-wrapper").style.display="none",window.location.href=e.url):alert(e.message||"Error processing request")}).catch(e=>{alert("Error connecting to server.")}).finally(()=>{t.innerText=n,t.disabled=!1})})}),document.querySelectorAll(".ppv-direct-download").forEach(e=>{e.addEventListener("click",function(e){if("undefined"==typeof bplde_obj)return;e.preventDefault();const t=this.dataset.docId,n=this,o=n.innerHTML;n.innerHTML="Downloading...";let l=null;"newtab"===n.dataset.behavior&&(l=window.open("about:blank","_blank")),jQuery.ajax({url:bplde_obj.ajax_url,type:"POST",data:{action:"de_track_download",nonce:bplde_obj.track_nonce,document_id:t},success:function(e){if(e.success){const r=n.closest("p, div").querySelector(".ppv-download-count");r&&(r.innerText=e.data.count+" downloads");const a=bplde_obj.rest_url+"download/"+t+"?de_nonce="+e.data.nonce;"newtab"===n.dataset.behavior&&l?l.location.href=a:window.location.href=a,setTimeout(()=>{n.innerHTML=o},1e3)}else alert("Tracking error: "+(e.data||"Unknown error")),n.innerHTML=o,l&&l.close()},error:function(){n.innerHTML=o,l&&l.close()}})})})})})();
// source --> https://saasenheim.fr/wp-content/plugins/email-encoder-bundle/assets/js/custom.js?ver=2c542c9989f589cd5318f5cef6a9ecd7 
/* Email Encoder */
/*global jQuery, window*/
jQuery(function ($) {

    'use strict';

    // encoding method
    function rot13(s) {
        // source: http://jsfromhell.com/string/rot13
        return s.replace(/[a-zA-Z]/g, function (c) {
            return String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26);
        });
    }

    /**
     * EMAIL RELATED LOGIC
     */

    // fetch email from data attribute
    function fetchEmail(el) {
        var email = el.getAttribute('data-enc-email');

        if (!email) {
            return null;
        }

        // replace [at] sign
        email = email.replace(/\[at\]/g, '@');

        // encode
        email = rot13(email);

        return email;
    }

    // replace email in title attribute
    function parseTitle(el) {
        var title = el.getAttribute('title');
        var email = fetchEmail(el);

        if (title && email) {
            title = title.replace('{{email}}', email);
            el.setAttribute('title', title);
        }
    }

    // set input value attribute
    function setInputValue(el) {
        var email = fetchEmail(el);

        if (email) {
            el.setAttribute('value', email);
        }
    }

    // open mailto link
    function mailto(el) {
        var email = fetchEmail(el);

        if (email) {
            window.location.href = 'mailto:' + email;
        }
    }
    
    // revert
    function revert(el, rtl) {
        var email = fetchEmail(el);

        if (email) {
           rtl.text(email);
           rtl.removeClass('eeb-rtl');
        }
    }

    // prepare for copying email
    document.addEventListener('copy', function(e){
        $('a[data-enc-email]').each(function () {
            var rtl = $(this).find('.eeb-rtl');

            if (rtl.text()) {
                revert(this, rtl);
            }
        });
        console.log('copy');
    });

    // set mailto click
    $('body').on('click', 'a[data-enc-email]', function () {
        mailto(this);
    });

    // parse title attirbute
    $('a[data-enc-email]').each(function () {
        parseTitle(this);
    });

    // parse input fields
    $('input[data-enc-email]').each(function () {
        setInputValue(this);
    });

});
// source --> https://saasenheim.fr/wp-content/plugins/wpfront-notification-bar/js/wpfront-notification-bar.min.js?ver=3.5.1.05102 
window.wpfront_notification_bar=function(i,t){var e=function(t){i.log&&console.log(i.log_prefix+" "+t)};if("undefined"==typeof jQuery||i.keep_closed&&"undefined"==typeof Cookies||i.set_max_views&&"undefined"==typeof Cookies)return e("Waiting for "+("undefined"==typeof jQuery?"jQuery.":"Cookies.")),void setTimeout((function(){wpfront_notification_bar(i,t)}),100);if(2!=i.position||!0===t){var o=function(t){return t+i.id_suffix},n=jQuery,s=i.keep_closed_cookie,a=0,r=i.max_views_cookie,c=n(o("#wpfront-notification-bar-spacer")).removeClass("hidden"),f=n(o("#wpfront-notification-bar")),p=n(o("#wpfront-notification-bar-open-button"));if(1==i.position){e("Setting notification bar at top.");var l=0;i.fixed_position&&i.is_admin_bar_showing&&("0px"==(l=n("html").css("margin-top"))&&(l=n("html").css("padding-top")),l=parseInt(l)),i.fixed_position&&(l+=i.position_offset),f.css("top",l+"px"),p.css("top",l+"px"),c.css("top",i.position_offset+"px");var d=(u=n("body")).children().first();if(d.hasClass("wpfront-notification-bar-spacer"))for(;;){var _=d.next();if(!_.hasClass("wpfront-notification-bar-spacer")){d.after(c);break}d=_}else u.prepend(c);n((function(){u.children().first().hasClass("wpfront-notification-bar-spacer")||i.fixed_position&&!u.children().first().is(c)&&u.prepend(c)}))}else{var u;e("Setting notification bar at bottom."),(u=n("body")).children().last().is(c)||u.append(c),n((function(){u.children().last().is(c)||u.append(c)}))}var h=f.height();i.height>0&&(h=i.height,f.find("table, tbody, tr").css("height","100%")),f.height(0).css({position:i.fixed_position?"fixed":"relative",visibility:"visible"}),p.css({position:i.fixed_position?"fixed":"absolute"});var b=!1,v=!1,g=null,m=0,x=i.fixed_position&&""!=i.theme_sticky_selector;if(x&&n(window).on("scroll resize",(function(){k()})),i.close_button&&c.on("click",".wpfront-close",(function(){w(0,null,!0)})),i.button_action_close_bar&&c.on("click",".wpfront-button",(function(){w(0,null,!0)})),i.display_open_button&&c.on("click",o("#wpfront-notification-bar-open-button"),(function(){w(h)})),i.keep_closed&&Cookies.get(s))return e("Keep closed enabled and keep closed cookie exists. Hiding notification bar."),void w(0,(function(){f.removeClass("keep-closed")}));if(f.removeClass("keep-closed"),i.set_max_views&&(void 0===(a=Cookies.get(r))&&(a=0),a>=i.max_views))return e("Reached max views, hiding notification bar."),void w(0,(function(){f.removeClass("max-views-reached")}));f.removeClass("max-views-reached"),b=!0,i.display_scroll?(e("Display on scroll enabled. Hiding notification bar."),w(0),n(window).on("scroll",(function(){v||(n(this).scrollTop()>i.display_scroll_offset?w(h):w(0))}))):(e("Setting notification bar open event after "+i.display_after+" second(s)."),setTimeout((function(){w(h,(function(){i.auto_close_after>0&&(e("Setting notification bar auto close event after "+i.auto_close_after+" second(s)."),setTimeout((function(){w(0,null,!0)}),1e3*i.auto_close_after))}))}),1e3*i.display_after))}else jQuery((function(){wpfront_notification_bar(i,!0)}));function w(t,o,l){if(o=o||n.noop,l&&(v=!0),0==t){if(b)return;b=!0}else{if(!b)return;b=!1}0==t&&i.keep_closed&&l&&(i.keep_closed_for>0?Cookies.set(s,1,{path:"/",expires:i.keep_closed_for,sameSite:"strict"}):Cookies.set(s,1,{path:"/",sameSite:"strict"})),0!==t&&i.set_max_views&&(a=void 0===(a=Cookies.get(r))?0:parseInt(a),i.max_views_for>0?Cookies.set(r,a+1,{path:"/",expires:i.max_views_for,sameSite:"strict"}):Cookies.set(r,a+1,{path:"/",sameSite:"strict"}),e("Setting view count to "+(a+1)+"."));var d=o;o=function(){d(),t>0&&(0==i.height&&f.height("auto"),i.display_open_button&&(e("Setting reopen button state to hidden."),p.addClass("hidden")),b=!1),0==t&&i.display_open_button&&(e("Setting reopen button state to visible."),p.removeClass("hidden")),t>0?f.removeClass("hidden"):f.addClass("hidden")},e(t>0?"Setting notification bar state to visible.":"Setting notification bar state to hidden."),i.animate_delay>0?f.stop().show().animate({height:t+"px"},{duration:1e3*i.animate_delay,easing:"swing",complete:function(){i.fixed_position&&c.height(t),k(t),o()},step:function(t){i.fixed_position&&c.height(t),k(t)}}):(f.height(t),i.fixed_position&&c.height(t),k(t),o())}function k(t){if(!x)return 0;if(!0!==t){clearInterval(m);var e=0;m=setInterval((function(){k(!0),++e>100&&clearInterval(m)}),10)}var o=n(i.theme_sticky_selector);if(0==o.length||"fixed"!==o.css("position"))return 0;1==i.position&&(null===g&&(g=o.position().top),f.is(":visible")?o.css("top",f.height()+f.position().top+"px"):o.css("top",g+"px")),2==i.position&&(null===g&&(g=o.height()+parseFloat(o.css("bottom"))),f.is(":visible")?o.css("bottom",f.height()+parseFloat(f.css("bottom"))+"px"):o.css("bottom",g+"px"))}};