document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".wp-block-zolo-slider").forEach(e=>{const t=e.querySelector(".swiper"),o=JSON.parse(e.dataset?.swiperOptions||"{}"),l=e.querySelectorAll("video.zolo-html5-video"),{speed:i=800,autoplay:s=!1,autoplayDelay:a=3e3,pauseOnMouseEnter:n=!1,loop:p=!1,navigation:r=!0,effect:d="slide",pagination:c=!0,paginationType:u="bullets"}=o;l.forEach(e=>{Object.assign(e,{autoplay:!1,muted:!0,loop:!1}),e.pause()});const y={loop:p||!1,autoplay:!!s&&{delay:a||3,disableOnInteraction:!1,pauseOnMouseEnter:n||!1},speed:i||800,effect:d||"slide",navigation:!!r&&{nextEl:e.querySelector(".swiper-button-next"),prevEl:e.querySelector(".swiper-button-prev")},pagination:!!c&&{el:".swiper-pagination",type:u||"bullets",clickable:!0},on:{init(){const e=this.slides[0].querySelector("video.zolo-html5-video");e&&(this.autoplay.stop(),e.play().catch(e=>console.log("Autoplay prevented for first slide:",e)))},slideChangeTransitionEnd(){const e=this.slides[this.activeIndex].querySelector("video.zolo-html5-video");l.forEach(e=>{e.pause(),e.currentTime=0}),e&&(e.play().catch(e=>console.log("Autoplay prevented:",e)),this.autoplay.stop(),e.onended=()=>{this.autoplay.start()})},slideChange(){const e=this.slides[this.activeIndex].querySelector("video.zolo-html5-video");e&&!e.paused&&this.slideTo(this.previousIndex)}}};new Swiper(t,y)})});