| 1 |
(()=>{"use strict";const{GHOSTKIT:{screenSizes:e,events:t}}=window;t.on(document,"init.blocks.gkt",(()=>{void 0!==window.Swiper&&document.querySelectorAll(".ghostkit-carousel:not(.ghostkit-carousel-ready)").forEach((a=>{const r=a.querySelector(":scope > .ghostkit-carousel-items"),o=a.getAttribute("data-effect")||"slide",s=parseInt(a.getAttribute("data-slides-per-view"),10),i={speed:1e3*(parseFloat(a.getAttribute("data-speed"))||0),effect:o,fadeEffect:{crossFade:!0},spaceBetween:parseFloat(a.getAttribute("data-gap"))||0,centeredSlides:"true"===a.getAttribute("data-centered-slides"),freeMode:{enabled:"true"===a.getAttribute("data-free-scroll")},loop:"true"===a.getAttribute("data-loop"),autoplay:parseFloat(a.getAttribute("data-autoplay"))>0&&{delay:1e3*parseFloat(a.getAttribute("data-autoplay")),disableOnInteraction:!1},navigation:"true"===a.getAttribute("data-show-arrows")&&{nextEl:".ghostkit-carousel-arrow-next",prevEl:".ghostkit-carousel-arrow-prev"},pagination:"true"===a.getAttribute("data-show-bullets")&&{el:".ghostkit-carousel-bullets",clickable:!0,dynamicBullets:"true"===a.getAttribute("data-dynamic-bullets")},slidesPerView:1,keyboard:!0,grabCursor:!0,preloadImages:!1,touchEventsTarget:"container",noSwipingSelector:"input, textarea, .ghostkit-image-compare"};if(a.classList.add("ghostkit-carousel-ready","swiper"),r.classList.add("swiper-wrapper"),r.querySelectorAll(":scope > .ghostkit-carousel-slide").forEach((e=>{e.classList.add("swiper-slide")})),i.navigation){const e=a.querySelector(".ghostkit-carousel-arrow-prev-icon"),t=a.querySelector(".ghostkit-carousel-arrow-next-icon"),r=document.createElement("div");r.classList.add("ghostkit-carousel-arrow","ghostkit-carousel-arrow-prev"),r.innerHTML=e.innerHTML,a.append(r);const o=document.createElement("div");o.classList.add("ghostkit-carousel-arrow","ghostkit-carousel-arrow-next"),o.innerHTML=t.innerHTML,a.append(o)}if(i.pagination){const e=document.createElement("div");e.classList.add("ghostkit-carousel-bullets"),a.append(e)}const n={};if("fade"!==o&&!Number.isNaN(s)){let t=s,a=Math.min(e.length-1,t-1);for(;a>=0;a-=1)t>0&&void 0!==e[a]&&(n[e[a]+1]={slidesPerView:t}),t-=1;i.slidesPerView=t||1}i.breakpoints=n,i.on={touchStart(e,r){t.trigger(a,"touchStart.carousel.gkt",{originalEvent:r})},touchMove(e,r){t.trigger(a,"touchMove.carousel.gkt",{originalEvent:r})},touchEnd(e,r){t.trigger(a,"touchEnd.carousel.gkt",{originalEvent:r})}},(()=>{const e=function(e){let t=8;return void 0===e.defaults.maxBackfaceHiddenSlides&&(t=7),void 0===e.defaults.rewind&&(t=6),void 0===e.defaults.loopPreventsSlide&&(t=5),t}(window.Swiper);e<7&&a.classList.add("swiper-container"),e<7&&(i.freeMode=i.freeMode.enabled),e>=5&&(i.breakpointsInverse=!0)})(),t.trigger(a,"init.carousel.gkt",{options:i}),new window.Swiper(a,i),t.trigger(a,"inited.carousel.gkt",{options:i})}))})),t.on(document,"mouseenter",'.ghostkit-carousel-ready[data-autoplay-hover-pause="true"]',(e=>{const t=e.delegateTarget;t?.swiper?.autoplay&&t?.swiper?.params?.autoplay?.enabled&&t.swiper.autoplay.stop()})),t.on(document,"mouseleave",'.ghostkit-carousel-ready[data-autoplay-hover-pause="true"]',(e=>{const t=e.delegateTarget;t?.swiper?.autoplay&&t?.swiper?.params?.autoplay?.enabled&&t.swiper.autoplay.start()})),t.on(document,"shown.tab.gkt shown.accordion.gkt move.image-compare.gkt closed.alert.gkt animated.counter.gkt",(e=>{const t=e.delegateTarget;(function(e){const t=[];for(let a=e&&e.parentElement;a;a=a.parentElement)t.push(a);return t})(t).forEach((e=>{if(e.classList.contains("ghostkit-carousel-ready")&&"true"===e.getAttribute("data-loop")&&e.swiper){const r=t.closest(".swiper-slide");r&&r.classList.contains("swiper-slide-duplicate")?(a=r,[...a.parentNode.children].filter((e=>e!==a))).forEach((e=>{e.getAttribute("data-swiper-slide-index")===r.getAttribute("data-swiper-slide-index")&&e.classList.contains(":not(.swiper-slide-duplicate):first-child")&&(e.innerHTML=r.innerHTML)})):(e.swiper.loopDestroy(),e.swiper.loopCreate())}var a}))}))})(); |