/*
 gumgum-ljp_creative_template v1.6.4 2024-04-29 
 */

Premium.template=Premium.template||{},Premium.template.DayThreshForHours=2,Premium.template.SecondsDay=86400,Premium.template.LangMap={days:{fr:"jours",nl:"dagen",de:"tage",es:"dias",sv:"dagar",no:"dager",da:"dage",fi:"päivää",jp:"日"},hours:{fr:"heures",nl:"uren",de:"stunden",es:"horas",sv:"timmar",no:"timer",da:"timer",fi:"tuntia",jp:"時"},minutes:{fr:"minutes",nl:"minuten",de:"minuten",es:"minutos",sv:"minuter",no:"minutter",da:"minutter",fi:"minuutit",jp:"分"},seconds:{fr:"secondes",nl:"seconden",de:"sekunden",es:"segundos",sv:"sekunder",no:"sekunder",da:"sekunder",fi:"sekuntia",jp:"秒"}},Premium.template.convertCountdownTime=function(e){var t,i={wholeWeeks:0},m=e/Premium.template.SecondsDay;m<Premium.template.DayThreshForHours?(i.wholeDays=0,t=24*m):(i.wholeDays=Math.floor(m),t=24*(m-i.wholeDays)),i.wholeHours=Math.floor(t);var n=60*(t-i.wholeHours);return i.wholeMinutes=Math.floor(n),i.wholeSeconds=Math.floor(60*(n-i.wholeMinutes)),i},Premium.template.checkHideCountdownUnits=function(){for(var e,t=document.querySelectorAll(".jpt-countdown .units"),i=0;i<t.length;i++){var m=getComputedStyle(t[i].parentElement);if(t[i].clientWidth>t[i].parentElement.clientWidth+2*parseFloat(m.marginLeft)-1){e=!0;break}}gsap.set(".jpt-countdown .units",{visibility:e?"hidden":"inherit"})},Premium.template.setCountdownLanguage=function(e,t){if("en"!==e)for(var i=(t=t||document.querySelector(".jpt-countdown")).querySelectorAll(".units"),m=0;m<i.length;m++)i[m].textContent=Premium.template.LangMap[i[m].textContent][e]},Premium.template.bgVideoLoop=function(e,t){t=t||3,e.addEventListener("ended",function(){--t>0&&(e.currentTime=0,e.play().catch(function(e){}))})},Premium.template.initCarousel=function(e,t){return Premium.template.fixjpUrls(e),Premium.communicator.api.totalPanels&&(e.showItem(Premium.communicator.sharedObj.carouselFrame,0),e.on("showitem",function(e){Premium.communicator.api.sendMessage({action:"sync-carousel",from:document.body.id,index:e})}),Premium.communicator.api.receiveMessage(function(t){"sync-carousel"===t.action&&t.from!==document.body.id&&t.index!=e._currentIndex?e.showItem(t.index):"sync-carousel-restarttimer"===t.action&&Premium.template.restartTimer&&Premium.template.restartTimer(2)},document.body.id),Premium.communicator.sharedObj.masterCarouselPanel=Premium.communicator.sharedObj.masterCarouselPanel||document.body.id,Premium.template.carouselAutoTimer(e,Premium.communicator.sharedObj.masterCarouselPanel===document.body.id)),t&&t.addEventListener("click",function(e){Premium.communicator.api.sendMessage({action:"sync-carousel-restarttimer"}),Premium.expand.expand("expanded_carousel.html","width:100%;height:100%;")}),e},Premium.template.carouselAutoTimer=function(e,t){if(t){var i,m;Premium.template.restartTimer=function(e){e=void 0===e?4:e,clearTimeout(i),m=!0,Premium.template.timerTween&&Premium.template.timerTween.kill(),Premium.template.timerTween=gsap.delayedCall(e,n)};var n=function(){if(m){var t=e._currentIndex+1;Premium.communicator.sharedObj.carouselFrame=t,e.showItem(t),Premium.template.timerTween=gsap.delayedCall(4,n)}};Premium.communicator.api.receiveMessage(function(e){"restart-timer"===e.action&&Premium.template.restartTimer()},document.body.id),Premium.template.restartTimer(),i=setTimeout(function(){m=!1},Premium.template.CarouselStopTime)}e._targetEl.addEventListener(Premium.jpxApi.isMobile()?"touchstart":"mousedown",function(){Premium.communicator.api.sendMessage({action:"restart-timer"})})},Premium.template.CarouselStopTime=18e4,Premium.template.fixjpUrls=function(e){for(var t=e.getItems(),i=0;i<t.length;i++){var m=t[i].getAttribute("jp-url");m&&!/\S+/.test(m)&&t[i].removeAttribute("jp-url")}},Premium.template.constrainCta=function(e,t,i,m){if(e){m=m||e.offsetParent;var n=Premium.template[document.body.id+"_ctaFontSize"]=Premium.template[document.body.id+"_ctaFontSize"]||parseFloat(window.getComputedStyle(e).fontSize),r=Premium.template[document.body.id+"_ctaSize"]=Premium.template[document.body.id+"_ctaSize"]||parseFloat(window.getComputedStyle(e).width),a=r,o=r/(e.clientWidth/e.clientHeight),u=m.getBoundingClientRect(),l=Math.max(u.right-window.innerWidth,0)-Math.min(u.left,0),s=Math.max(o/(u.height*i),a/((u.width-l)*t));e.style.fontSize=s>1?n/s+"px":""}},Premium.template.constrainLogo=function(e,t,i,m,n){if(e){m=m||e.offsetParent;var r=Premium.template[document.body.id+"_logoSize"]=Premium.template[document.body.id+"_logoSize"]||(n?parseFloat(window.getComputedStyle(e).height):parseFloat(window.getComputedStyle(e).width)),a=e.naturalWidth/e.naturalHeight,o=n?r*a:r,u=n?r:r/a,l=m.getBoundingClientRect(),s=Math.max(l.right-window.innerWidth,0)-Math.min(l.left,0),d=Math.max(u/(l.height*i),o/((l.width-s)*t));d>1?n?(e.style.height=r/d+"px",e.style.minHeight="0"):(e.style.width=r/d+"px",e.style.minWidth="0"):e.style.width=e.style.height=e.style.minWidth=e.style.minHeight=""}},Premium.template.hideScrollBar=function(e){var t=e.offsetWidth-e.clientWidth;e.style.width="calc(100% + "+t+"px)"};