(function(){"use strict";var a={initAll:function(){let a=document.querySelectorAll(".wp-block-kadence-advancedgallery .kt-blocks-carousel-init");this.bootstrapSliders(a);let b=document.querySelectorAll(".wp-block-kadence-testimonials .kt-blocks-carousel-init");this.bootstrapSliders(b);let c=document.querySelectorAll(".kb-blocks-bg-slider > .kt-blocks-carousel-init");this.bootstrapSliders(c)},bootstrapSliders:function(a){if(a&&0!==a.length)for(let d=0;d<a.length;d++){var b=a[d];if(!b||!b.children||b.classList.contains("is-initialized"))continue;b.classList.add("kb-splide");const e=this.createSplideElements(b);let f=this.parseDataset(b.dataset);const g=!!b.closest(".kadence-menu-mega-enabled");f.sliderDirection=document.querySelector("html[dir=\"rtl\"]")?"rtl":"ltr",b.addEventListener("load",function(a){a.classList.remove("kt-post-carousel-loading")});let h=this.getSplideOptions(f);b.classList.add("splide-initialized"),b.classList.add("splide-slider");let{sliderType:i}=f;if(i&&"fluidcarousel"===i){a[d].querySelectorAll(".kb-slide-item").forEach(function(b){b.style.maxWidth=a[d].clientWidth?Math.floor(80/100*a[d].clientWidth)+"px":"100%"});const e=a[d].querySelectorAll(".kb-slide-item").length,g=new Splide(b,{...h,focus:!1===f.sliderCenterMode?0:"center",autoWidth:!0,arrows:!!(1<e)&&h.arrows,pagination:!!(1<e)&&h.pagination,drag:!!(1<e)&&h.drag,clones:1<e?void 0:0});g.mount();var c;window.addEventListener("resize",function(){clearTimeout(c),c=setTimeout(function(){a[d].querySelectorAll(".kb-slide-item").forEach(function(b){b.style.maxWidth=Math.floor(80/100*a[d].clientWidth)+"px"})},10)})}else if(i&&"slider"===i){h.type=void 0===f.sliderFade?"fade":f.sliderFade?"fade":"slide",h.rewind=!0;let a=new Splide(b,h);a.on("overflow",function(){a.options={arrows:1!==e&&h.arrows,pagination:1!==e&&h.pagination,drag:1!==e&&h.drag}}),a.mount()}else if(i&&"thumbnail"===i){let a=f.sliderNav,c=document.querySelector("#"+a);this.createSplideElements(c);let d=this.parseDataset(c.dataset),e=this.getSplideOptions(d),g=h;g.isNavigation=!0,g.pagination=!1,g.type="loop",g.arrows=!0,e.type=d.sliderFade||null==d.sliderFade?"fade":"slide",e.rewind=!0,e.pagination=!1,e.direction=g.direction,c.classList.add("slick-initialized"),c.classList.add("slick-slider"),c.classList.add("kb-splide");let i=new Splide(b,e),j=new Splide(c,g);j.on("overflow",function(a){j.go(0),j.options={arrows:!!g.arrows&&a,pagination:!!g.pagination&&a,drag:!!g.drag&&a,rewind:!a,type:a?g.type:"slide",clones:a?void 0:0}}),i.sync(j),i.mount(),j.mount()}else if(i&&"rewind"===i){h.type="slide",h.rewind=!0;let a=new Splide(b,h);g||a.on("overflow",function(b){a.go(0),a.options={arrows:!!h.arrows&&b,pagination:!!h.pagination&&b,drag:!!h.drag&&b,clones:b?void 0:0}}),a.mount()}else{let a=new Splide(b,h);g||a.on("overflow",function(b){a.go(0),a.options={arrows:!!h.arrows&&b,pagination:!!h.pagination&&b,drag:!!h.drag&&b,clones:b?void 0:0}}),a.mount()}}},parseDataset:function(a){return Object.keys(a).reduce((b,c)=>{let d=parseInt(a[c]);return Number.isNaN(d)?"true"===a[c]||"false"===a[c]?{...b,[c]:JSON.parse(a[c])}:{...b,[c]:a[c]}:{...b,[c]:d}},{})},createSplideElements:function(a){const b=a.children.length;for(let b of a.children)b.classList.add("splide__slide"),b.classList.contains("last")&&b.classList.remove("last");let c=document.createElement("div");c.classList.add("splide__track");let d=document.createElement("div");return d.classList.add("splide__list"),d.innerHTML=a.innerHTML,c.innerHTML=d.outerHTML,a.innerHTML=c.outerHTML,a.classList.add("splide"),b},getSplideOptions:function(a){const b=1===a.sliderScroll&&1,c={trimSpace:!0,drag:!0,perPage:a.columnsXxl||1,type:a.sliderFade?"fade":"loop",easing:a.sliderAnimSpeed&&1e3<a.sliderAnimSpeed?"linear":"cubic-bezier(0.25, 1, 0.5, 1)",lazyLoad:"nearby",pauseOnHover:a.sliderPause||!1,autoplay:a.sliderAuto||!1,interval:a.sliderSpeed||7e3,speed:a.sliderAnimSpeed||400,arrows:a.sliderArrows||!1,pagination:a.sliderDots||!1,direction:a.sliderDirection,pauseOnHover:a.sliderPauseHover||!1,gap:a.sliderGap||0,breakpoints:{543:{perPage:a.columnsSs||1,perMove:b||a.scrollSs,gap:a.sliderGapMobile||0},767:{perPage:a.columnsXs||1,perMove:b||a.columnsXs,gap:a.sliderGapMobile||0},991:{perPage:a.columnsSm||1,perMove:b||a.columnsSm,gap:a.sliderGapTablet||0},1199:{perPage:a.columnsMd||1,perMove:b||a.columnsMd,gap:a.sliderGapTablet||0},1499:{perPage:a.columnsXl||1,perMove:b||a.columnsXl,gap:a.sliderGap||0}},classes:{prev:"splide__arrow--prev slick-prev",next:"splide__arrow--next slick-next"}};return(1===c.perPage||b)&&(c.focus=0,c.perMove=b||a.columnsXxl||1),c},init:function(){if("function"==typeof Splide)a.initAll();else var b=setInterval(function(){"function"==typeof Splide?(a.initAll(),clearInterval(b)):console.log("No Splide found")},200)}};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",a.init):a.init(),document.addEventListener("kadenceJSInitReload",function(){a.init()})})();