let localStorageAvailable;function initializeNewCounter(e){let t=buildEndDate(e),i;i=setInterval(()=>showRemaining(e,t,()=>clearInterval(i)),1e3)}function showRemaining(e,t,i){let n=new Date,a=t-n,o,r,l,s,d=36e5,c=24*d;a<0&&(i(),o=0,r=0,l=0,s=0),a>=0&&(o=Math.floor(a/c),r=Math.floor(a%c/d),l=Math.floor(a%d/6e4),s=Math.floor(a%6e4/1e3)),e.querySelectorAll(".widget-text[data-format]").forEach(function(e){e.textContent=calculateWidgetValue(e,o,r,l,s)})}function calculateWidgetValue(e,t,i,n,a){return t>99&&"%dd"===e.getAttribute("data-format")&&e.setAttribute("data-format","%ddd"),e.getAttribute("data-format").replace("%ddd",("00"+t).slice(-3)).replace("%dd",("0"+t).slice(-2)).replace("%d",t).replace("%hh",("0"+i).slice(-2)).replace("%mm",("0"+n).slice(-2)).replace("%ss",("0"+a).slice(-2)).replace("%h",i).replace("%m",n).replace("%s",a)}function buildEndDate(e){let t=e.getAttribute("data-strategy"),i="1"===e.getAttribute("data-full-js"),n=new Date;if("evergreen_counter"===t){let{days:a=0,hours:o=0,minutes:r=0,seconds:l=0}=getParsedAttribute(e,"data-intervals");n.setTime(n.getTime()+864e5*a),n.setTime(n.getTime()+36e5*o),n.setTime(n.getTime()+6e4*r),n.setTime(n.getTime()+1e3*l)}else if(i&&"repeat_every_week"===t){let s=parseInt(e.getAttribute("data-week-cycle-start-day-of-week")),d=parseInt(e.getAttribute("data-week-cycle-end-day-of-week")),c=e.getAttribute("data-week-cycle-start-time"),u=parseInt(c.split(":")[0]),g=parseInt(c.split(":")[1]),p=e.getAttribute("data-week-cycle-end-time"),m=parseInt(p.split(":")[0]),f=parseInt(p.split(":")[1]),h=e.getAttribute("data-timezone");7===s&&(s=0),7===d&&(d=0);let y;y=h?new Date(new Date().toLocaleString("en-US",{timeZone:h})):new Date;let b=Math.round((new Date().getTime()-y.getTime())/1e3/60),v=y.getDay(),x=new Date(y.getTime());x.setHours(u,g,0,0),x.setDate(x.getDate()+(s-v)),(n=new Date(y.getTime())).setHours(m,f,0,0),n.setDate(n.getDate()+(d-v));let E=x.getTime()>y.getTime(),w=function(e){return e.setMinutes(e.getMinutes()+b),new Date(e.getTime())};return s<d?(E&&n.setTime(n.getTime()-6048e5),w(n)):d<s?(E||n.setTime(n.getTime()+6048e5),w(n)):E?(n.getTime()>x.getTime()&&n.setTime(n.getTime()-6048e5),w(n)):(n.getTime()<x.getTime()&&n.setTime(n.getTime()+6048e5),w(n))}else if(i&&"repeat_every_day"===t){let A=e.getAttribute("data-timezone"),T=new Date(new Date().toLocaleString("en-US",{timeZone:A})),L=Math.round((new Date().getTime()-T.getTime())/1e3/60),M=T.getDay();n=new Date(T.getTime()),0===M&&(M=7);let S=e.getAttribute(`data-daily-cycle-${M}-start-time`),k=e.getAttribute(`data-daily-cycle-${M}-end-time`);if(S&&k){let V=parseInt(S.split(":")[0]),R=parseInt(S.split(":")[1]),_=parseInt(k.split(":")[0]),C=parseInt(k.split(":")[1]);if(V>T.getHours()||V===T.getHours()&&R>T.getMinutes())return n;n.setHours(_,C,0,0)}return n.setMinutes(n.getMinutes()+L),new Date(n.getTime())}else{let B=e.getAttribute("data-date");n=new Date(B)}if("evergreen_counter"===t){let P=e.getAttribute("id"),N=getEndDateFromLocalStorage(e),D=getEndDateFromCookies(e);window&&window.location&&!window.location.href.includes("editor.landingi")&&(N?n=N:D?n=D:saveEndDate(n,P))}return n}function isLocalStorageAvailable(){let e,t="__storage_test__";if(void 0!==localStorageAvailable)return localStorageAvailable;if(!window||!window.localStorage)return!1;try{return(e=window.localStorage).setItem(t,t),e.removeItem(t),!0}catch(i){return i instanceof DOMException&&([22,1014].includes(i.code)||["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"].includes(i.name))&&e&&0!==e.length}}function getEndDateFromCookies(e){let t=e.getAttribute("id"),i=document.cookie?document.cookie.split(";"):[],n={};for(let a in i)if(i.hasOwnProperty(a)&&"string"==typeof a){let o=i[a].split("=");n[o[0].replace(/\s/g,"")]=o[1]}return n[`count-${t}`]?new Date(n[`count-${t}`]):null}function getEndDateFromLocalStorage(e){if(isLocalStorageAvailable()){let t=e.getAttribute("id"),i=window.localStorage.getItem(`count-${t}`);if(i)try{let n=JSON.parse(i);if(!localStorageIsExpired(n))return new Date(n.value);window.localStorage.removeItem(`count-${t}`)}catch(a){}}return null}function localStorageIsExpired(e){if(!e.value||!e.expires)return!0;let t=new Date,i=new Date(e.expires);return t.getTime()>i.getTime()}function saveEndDate(e,t){let i=new Date;if(i.setMonth(i.getMonth()+1),isLocalStorageAvailable()){let n={value:e.getTime(),expires:new Date(i).getTime()};window.localStorage.setItem(`count-${t}`,JSON.stringify(n));return}document.cookie=`count-${t}=${e};expires=${new Date(i)};path=${window.location.pathname}`}function getParsedAttribute(e,t){let i=e.getAttribute(t);return i?JSON.parse(i):{}}const lightboxDefaultCss=`
        .animated-lightbox {
          transition: visibility 0.5s, opacity 0.5s;
          visibility: hidden;
          opacity: 0;
        }
    
        .show-lightbox {
          opacity: 1;
          display: block !important;
          visibility: visible;
        }
    `;"undefined"==typeof youtubeVideos&&(window.youtubeVideos=[]),"undefined"==typeof youtubePlayers&&(window.youtubePlayers=[]);const Common={preventDoubleSubmission:function(e){e.onsubmit=function(t){"1"===e.dataset.submitted?(t.preventDefault(),t.stopImmediatePropagation()):e.dataset.submitted="1"}}},LightboxRender={cssManager:{addCssStyle:function(e){let t=document.createElement("style");t.appendChild(document.createTextNode(e));let i=document.getElementsByTagName("head")[0],n=document.getElementsByTagName("link")[0];i.insertBefore(t,n)}},animationManager:{enableAnimationCapabilities:function(e){e.classList.add("animated-lightbox")},show:function(e){e.classList.add("show-lightbox"),e.querySelectorAll(".show-lightbox .widget-counterv2").forEach(e=>initializeNewCounter(e))},hide:function(e){let t=document.querySelectorAll(".tooltip-lightbox");e.classList.remove("show-lightbox"),t.forEach(e=>e.parentNode.removeChild(e))}},youtubeManager:{loadYoutubeApiScript:function(){let e=document.getElementsByTagName("head").item(0),t=e.getElementsByTagName("script");if(!(()=>{for(let e of t)if(/(youtube.(?:[a-z{2-3}]+)\/iframe_api)/.test(e.getAttribute("src")))return!0;return!1})()){let i=document.createElement("script");i.src="https://www.youtube.com/iframe_api";let n=t[0];n.parentNode.insertBefore(i,n)}},handlePlayVideo:function(e){void 0!==window.youtubeVideos&&window.youtubeVideos.forEach(function(t){let i=document.getElementById(t.hash),n=i.closest(".landingi-popup");n&&n.id===e.id&&1===t.autoplay&&void 0!==window.youtubePlayers[t.hash]&&window.youtubePlayers[t.hash].playVideo()})},handlePauseVideo:function(e){for(let t of(void 0!==window.youtubeVideos&&window.youtubeVideos.forEach(function(t){let i=document.getElementById(t.hash),n=i.closest(".landingi-popup");n&&n.id===e.id&&window.youtubePlayers[t.hash]&&"function"==typeof window.youtubePlayers[t.hash].pauseVideo&&window.youtubePlayers[t.hash].pauseVideo()}),e.querySelectorAll('iframe[data-src*="www.youtube.com/embed/"]')))t.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*");for(let i of e.querySelectorAll("[data-youtube]")){let n=i.getElementsByTagName("iframe");0!==n.length&&n[0].src.startsWith("https://www.youtube.com")&&n[0].contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")}},initializeYoutubeVideos:function(){window.youtubeVideos.forEach(function(e){let t={playerVars:{rel:e.rel,loop:e.loop,showinfo:e.showinfo,controls:e.controls,mute:e.mute},events:{onReady:function(t){e.autoplay&&(document.getElementsByClassName("video-iframe-container").length||!document.getElementsByClassName("landingi-popup").length)&&t.target.playVideo()},onStateChange:function(t){0===t.target.getPlayerState()&&0!==e.loop&&t.target.playVideo()}}};e.id&&(t.videoId=e.id),void 0===window.youtubePlayers[e.hash]&&(window.youtubePlayers[e.hash]=new YT.Player(e.hash,t))})}},vimeoManager:{initializeVimeoVideos:function(){let e=document.getElementsByTagName("head").item(0),t=e.getElementsByTagName("script"),i="https://player.vimeo.com/api/player.js",n=!1;for(let a of t)a.getAttribute("src")===i&&(n=!0);if(!1===n){let o=document.createElement("script"),r=t[0];o.src=i,o.addEventListener("load",function(){window.dispatchEvent(new Event("lightbox-vimeo-ready"))}),r.parentNode.insertBefore(o,r)}},injectVimeo:function(e){let t=e.match(/id="([^"]*?)" class="landingi-popup-body"/)[1],i=document.querySelectorAll("#"+t)[0],n=i.closest(".landingi-popup");e.search(/data-vimeo-url/)>0?(LightboxRender.vimeoManager.initializeVimeoVideos(),window.addEventListener("lightbox-vimeo-ready",function(){LightboxRender.lightboxManager.hookCustomScripts(t),LightboxRender.vimeoManager.handlePauseVideos(n)})):LightboxRender.lightboxManager.hookCustomScripts(t)},handlePauseVideos:function(e){for(let t of this.getVimeoPlayers(e))t.pause();for(let i of e.querySelectorAll('iframe[data-src*="player.vimeo.com/video/"]'))i.src=i.dataset.src;for(let n of e.querySelectorAll("[data-vimeo]")){let a=n.getElementsByTagName("iframe");0!==a.length&&a[0].contentWindow&&a[0].contentWindow.postMessage('{"method":"pause"}',"*")}},handlePlayVideos:function(e){for(let t of this.getVimeoPlayers(e))"1"===t.autoplay&&t.play()},handleMuteVideos:function(e){for(let t of this.getVimeoPlayers(e))t.setVolume(0)},handleUnmuteVideos:function(e){for(let t of this.getVimeoPlayers(e))t.setVolume(1)},getVimeoPlayers:function(e){let t=[];for(let i of e.querySelectorAll("[data-vimeo-url]")){let n=new Vimeo.Player(i.getAttribute("id"),{});n.autoplay=i.getAttribute("data-vimeo-autoplay")||"1",t.push(n)}return t}},datepickerManager:{appendStyle:function(){let e=document.getElementsByTagName("head").item(0),t=e.getElementsByTagName("link");for(let i of t)if("../js/libs/bootstrap-datepicker/dist/css/bootstrap-datepicker.standalone.min.css"===i.getAttribute("href"))return;let n=document.createElement("link"),a=t[0];n.href="../js/libs/bootstrap-datepicker/dist/css/bootstrap-datepicker.standalone.min.css",n.type="text/css",n.rel="stylesheet",e.insertBefore(n,a)},appendScript:function(e){let t="https://old.assets-landingi.com/js/libs/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js",i="https://old.assets-landingi.com/js/libs/bootstrap-datepicker/dist/locales/bootstrap-datepicker."+e+".min.js",n=document.getElementsByTagName("body").item(0),a=n.querySelectorAll("body > script");for(let o of a)if(o.getAttribute("src")===t)return Promise.resolve();return new Promise(function(e,o){let r=document.createElement("script"),l=document.createElement("script"),s=a[0!==a.length?a.length-1:a.length];r.type="text/javascript",l.type="text/javascript",r.src=t,l.src=i,r.onerror=function(e){o(e,r)};let d=!1;r.onload=r.onreadystatechange=function(){d||this.readyState&&"complete"!==this.readyState||(d=!0,n.insertBefore(l,s),e())},n.insertBefore(r,s)})},initializeDatepicker:function(e){LightboxRender.datepickerManager.appendStyle(),LightboxRender.datepickerManager.appendScript(landingiInternalDetails.landing_lang).then(function(){document.querySelectorAll('.landingi-popup input[subtype="date"]').forEach(function(t){let i=$(t).data("date-format"),n=e;"en"===e?n="en-GB":"pt"===e&&(n="pt-BR"),$(t).datepicker({autoclose:!0,clearBtn:!0,format:i||({en:"dd-mm-yyyy",pl:"dd.mm.yyyy",ru:"dd.mm.yyyy",es:"dd/mm/yyyy",pt:"dd/mm/yyyy",fr:"dd-mm-yyyy",it:"dd-mm-yyyy"})[e],language:n,todayBtn:"linked",todayHighlight:!0}),$(t).on("keydown",function(e){-1===[13,37,38,39,40].indexOf(e.keyCode)&&e.preventDefault()})})})}},lightboxManager:{loadYoutube:function(){(!(window.youtubeVideos.length<=0)||!(window.youtubePlayers.length<=0))&&("undefined"==typeof YT||void 0===YT.Player?LightboxRender.youtubeManager.loadYoutubeApiScript():window.onYouTubeIframeAPIReady())},hookCustomScripts:function(e){let t=document.querySelectorAll("#"+e+" script");for(let i of t){let n=i.parentElement,a=i.getAttribute("src"),o=i.innerHTML;if(null!==a){n.removeChild(i);let r=document.createElement("script");r.src=a,n.appendChild(r)}if(""!==o){n.removeChild(i);let l=document.createElement("script");l.text=o,n.appendChild(l)}}},initializeCounter:function(){document.querySelectorAll(".landingi-popup .widget-counter").forEach(function(e){var t,i,n=e.getAttribute("data-repeat"),a=e.getAttribute("data-version"),o=e.getAttribute("data-date"),r=e.getAttribute("id");if("-1"!==n)i=new Date(o);else{var l=document.cookie?document.cookie.split(";"):[],s={};for(var d in l)if(l.hasOwnProperty(d)&&"string"==typeof d){var c=l[d].split("=");s[c[0].replace(/\s/g,"")]=c[1]}if(s["count-"+r])i=new Date(s["count-"+r]);else{i=new Date;var u=new Date;u.setMonth(u.getMonth()+1),document.cookie="count-"+r+"="+i+";expires="+new Date(u)+";path="+window.location.pathname}i.setMinutes(i.getMinutes()+parseInt(o,10))}a||i.setTime(i.getTime()+6e4*i.getTimezoneOffset()),t=setInterval(function o(){var r,l,s,d,c=new Date,u=i-c,g=36e5,p=24*g;if(u<0){if(!a||2>parseInt(a,10)||!n||n<=0)clearInterval(t),r=0,l=0,s=0,d=0;else for(;u<0;)i.setDate(i.getDate()+parseInt(n,10)),u=i-c}if(u>=0&&(r=Math.floor(u/p),l=Math.floor(u%p/g),s=Math.floor(u%g/6e4),d=Math.floor(u%6e4/1e3)),e.querySelectorAll(".widget-text[data-format]").forEach(function(e){var t=e.getAttribute("data-format");t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%dddd",("000"+r).slice(-4))).replace("%ddd",("00"+r).slice(-3))).replace("%dd",("0"+r).slice(-2))).replace("%d",r)).replace("%hh",("0"+l).slice(-2))).replace("%mm",("0"+s).slice(-2))).replace("%ss",("0"+d).slice(-2))).replace("%h",l)).replace("%m",s)).replace("%s",d),e.innerText=t}),0===e.querySelector(".widget-text").length){var m=e.getAttribute("data-format");m=(m=(m=(m=(m=(m=(m=(m=(m=(m=m.replace("%dddd",("000"+r).slice(-4))).replace("%ddd",("00"+r).slice(-3))).replace("%dd",("0"+r).slice(-2))).replace("%d",r)).replace("%hh",("0"+l).slice(-2))).replace("%mm",("0"+s).slice(-2))).replace("%ss",("0"+d).slice(-2))).replace("%h",l)).replace("%m",s)).replace("%s",d),e.innerText(m)}},1e3)})},registerEventHandlers:function(){let e=document.querySelectorAll('[subtype="popup"]');e.forEach(function(e){let t=e.getAttribute("href").substring(1),i=document.getElementById(t);i&&LightboxRender.animationManager.enableAnimationCapabilities(i),e.addEventListener("click",function(e){e.preventDefault(),i&&LightboxRender.animationManager.show(i),LightboxRender.youtubeManager.handlePlayVideo(i),LightboxRender.vimeoManager.handlePlayVideos(i)})});let t=document.querySelectorAll(".widget-popupcloser");t.forEach(function(e){e.onclick=function(e){e.preventDefault();let t=this.closest(".landingi-popup");LightboxRender.vimeoManager.handlePauseVideos(t),LightboxRender.youtubeManager.handlePauseVideo(t),LightboxRender.animationManager.hide(t)}});let i=document.getElementsByClassName("landingi-popup"),n=()=>{window.positionValidationTooltips()};for(let a of i)a.onclick=function(e){e.target===a.getElementsByClassName("landingi-popup-body")[0]&&(LightboxRender.vimeoManager.handlePauseVideos(a),LightboxRender.youtubeManager.handlePauseVideo(a),LightboxRender.animationManager.hide(a))},a.getElementsByClassName("landingi-popup-body")[0].addEventListener("scroll",n),a.getElementsByClassName("widget-section")&&a.getElementsByClassName("widget-section")[0]&&a.getElementsByClassName("widget-section")[0].addEventListener("scroll",n);document.addEventListener("keydown",function(e){if("Escape"===e.key){let t=document.getElementsByClassName("landingi-popup");for(let i of t)LightboxRender.youtubeManager.handlePauseVideo(i),LightboxRender.vimeoManager.handlePauseVideos(i),LightboxRender.animationManager.hide(i)}});let o=document.querySelectorAll(".landingi-popup .widget-form");for(let r of o)Common.preventDoubleSubmission(r)},handleLightboxes:function(){LightboxRender.lightboxManager.registerEventHandlers();let e=document.querySelectorAll(".landingi-popup .widget-form");for(let t of e){let i=function(e){e.preventDefault(),t=document.getElementById(t.id);let i=function(e){if(1===e.indexOf("popuplead//")){let t=e.replace("popuplead//","popuplead/"+landingiInternalDetails.landing_hash+"/"),i=window.location.href+t;return -1!==window.location.href.indexOf("?")&&(i=window.location.href.replace(/(.*)\?(.*)/,`$1${t}?$2`)),i}return e},a=function(e){let i=t.getElementsByClassName("widget-input-button");for(let n of i){let a=n.getElementsByClassName("widget-overlay");e(n,a)}};a(function(e,t){for(let i of t)i.style.color=window.getComputedStyle(e).color,i.innerHTML+='<i class="fa fa-spinner fa-spin"></i>';e.style.color="transparent"});let o=function(e){e.dataset.submitted="0";let t=Array.from(document.getElementsByClassName("form-error-tooltip"));t.forEach(e=>{e.parentNode.removeChild(e)}),a(function(e,t){for(let i of t)i.removeChild(i.firstChild);e.style.color=""})},r=new FormData(t);r.set("_landing-hash",landingiInternalDetails.landing_hash);let l=new XMLHttpRequest;l.open("POST",function(){let e="https://api.landingi.com/validate";return window.location.href.indexOf(".landingi.it")>0&&(e="https://api.landingi.it/validate"),e}(),!0),l.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE){if(200===this.status)window.submitGAformTracking?(window.submitGAformTracking(),setTimeout(function(){t.setAttribute("action",i(t.getAttribute("action"))),t.dataset.submitted="0",document.removeEventListener("submit",n),t.submit()},300)):(t.setAttribute("action",i(t.getAttribute("action"))),t.dataset.submitted="0",document.removeEventListener("submit",n),t.submit());else if(400===this.status){o(t);let e=JSON.parse(l.response),a=e.html;validateCallbacks.forEach(function(e){let t=e(a);t&&(a=t)});let r=document.getElementsByTagName("body").item(0);r.insertAdjacentHTML("beforeend",a),window.positionValidationTooltips(),window.scrollToFirstTooltip()}else console.error("LightboxRender: Unexpected response occurred");LightboxRender.lightboxManager.registerEventHandlers()}},l.onerror=function(){o(t),LightboxRender.lightboxManager.registerEventHandlers(),console.error("LightboxRender: An error occured while sending form validation XHR")},l.send(r)},n=function(e){let n=t.id;e.target.id===n&&i(e)};document.addEventListener("submit",n)}},injectLightboxes:function(e){let t=new XMLHttpRequest;t.onload=function(){let e=JSON.parse(t.response),i=document.getElementsByTagName("body")[0],n=document.getElementsByTagName("head")[0];if(!i)return;let a=[],o=[],r=!1;for(let l of document.getElementsByTagName("link"))a.push(l.href);e.forEach(function(e){i.insertAdjacentHTML("beforeend",e.content),i.insertAdjacentHTML("beforeend",'<link href="'+e.style_url+'" rel="stylesheet" type="text/css">'),e.fonts.forEach(function(e){a.includes(e)||o.includes(e)||(o.push(e),n.insertAdjacentHTML("beforeend",'<link href="'+e+'" rel="stylesheet" type="text/css">'))}),r||-1===e.content.search(/subtype="date"/g)||(r=!0),LightboxRender.vimeoManager.injectVimeo(e.content)});let s=new Event("lightboxes-ready");n.dispatchEvent(s),e.length&&(LightboxRender.lightboxManager.initializeCounter(),LightboxRender.lightboxManager.handleLightboxes(),r&&LightboxRender.datepickerManager.initializeDatepicker(landingiInternalDetails.landing_lang),LightboxRender.lightboxManager.loadYoutube())},t.open("GET",this.getRenderUrl(landingiInternalDetails.apikey,landingiInternalDetails.landing_id,e)),t.send()},getRenderUrl:function(e,t,i){let n="https://lightboxes.landingi.com/api/v1/render?apikey="+e+"&landing_id="+t;return window.location.href.indexOf(".landingi.it")>0&&(n="https://lightboxes.landingi.it/api/v1/render?apikey="+e+"&landing_id="+t),i&&(n+="&aaf="+window.location.pathname),n}},init:function(e={useAaf:!1}){LightboxRender.cssManager.addCssStyle(lightboxDefaultCss),window.onYouTubeIframeAPIReady=function(){LightboxRender.youtubeManager.initializeYoutubeVideos()},LightboxRender.lightboxManager.injectLightboxes(e.useAaf)}};