1if(!customElements.get("mkcustom-scheduled-slide-show")){class MkcustomScheduledSlideShow extends HTMLElement{connectedCallback(){this.initialized||(this.initialized=!0,this.sectionEl=this.closest(".slideshow-section"),this.slideshow=this.querySelector(".slideshow"),this.allSlides=Array.from(this.querySelectorAll(".slideshow__slide")),this.nav=this.querySelector(".slideshow-nav"),this.pagination=this.querySelector(".slideshow-pagination"),this.allPageBtns=Array.from(this.querySelectorAll(".page-btn")),this.controls=this.querySelector(".slideshow-ctrl"),this.counterCurrent=this.querySelector(".slideshow-nav__counter-current"),this.counterTotal=this.querySelector(".slideshow-nav__counter-total"),this.rtl=document.dir==="rtl",this.designMode=this.dataset.designMode==="true",this.userAutoplay=this.dataset.autoplay==="true",this.autoplaySpeed=Number(this.dataset.speed)*1e3,this.currentIndex=0,this.slides=[],this.pageBtns=[],this.swipeThreshold=80,this.wheelTriggerWait=800,this.inView=!0,this.onNavClick=this.handleNavClick.bind(this),this.onPaginationClick=this.handlePaginationClick.bind(this),this.onTouchStart=this.handleTouchStart.bind(this),this.onTouchMove=debounce(this.handleTouchMove.bind(this),200),this.onWheel=this.handleWheel.bind(this),this.onPause=this.pauseAutoplay.bind(this),this.onResume=this.resumeAutoplay.bind(this),this.onVisibility=this.refreshSchedule.bind(this),this.onBlockSelect=this.handleBlockSelect.bind(this),this.nav&&this.nav.addEventListener("click",this.onNavClick),this.pagination&&this.pagination.addEventListener("click",this.onPaginationClick),theme.device.hasTouch&&(this.slideshow.addEventListener("touchstart",this.onTouchStart,{passive:!0}),this.slideshow.addEventListener("touchmove",this.onTouchMove,{passive:!0})),this.slideshow.addEventListener("wheel",this.onWheel,{passive:!1}),this.slideshow.addEventListener("transitionend",MkcustomScheduledSlideShow.handleTransitionend),this.addEventListener("mouseover",this.onPause),this.addEventListener("mouseleave",this.onResume),this.slideshow.addEventListener("focusin",this.onPause),this.slideshow.addEventListener("focusout",this.onResume),document.addEventListener("visibilitychange",this.onVisibility),this.designMode&&this.addEventListener("shopify:block:select",this.onBlockSelect),window.addEventListener("pageshow",this.onVisibility),"IntersectionObserver"in window&&(this.observer=new IntersectionObserver(entries=>{this.inView=entries[0].isIntersecting,this.syncAutoplay()}),this.observer.observe(this)),this.refreshSchedule())}disconnectedCallback(){clearTimeout(this.scheduleTimer),clearTimeout(this.autoplayTimer),clearTimeout(this.setActiveSlideTimeoutId),clearTimeout(this.wheelTimer),this.observer&&this.observer.disconnect(),this.nav&&this.nav.removeEventListener("click",this.onNavClick),this.pagination&&this.pagination.removeEventListener("click",this.onPaginationClick),theme.device.hasTouch&&(this.slideshow.removeEventListener("touchstart",this.onTouchStart),this.slideshow.removeEventListener("touchmove",this.onTouchMove)),this.slideshow.removeEventListener("wheel",this.onWheel),this.slideshow.removeEventListener("transitionend",MkcustomScheduledSlideShow.handleTransitionend),this.removeEventListener("mouseover",this.onPause),this.removeEventListener("mouseleave",this.onResume),this.slideshow.removeEventListener("focusin",this.onPause),this.slideshow.removeEventListener("focusout",this.onResume),document.removeEventListener("visibilitychange",this.onVisibility),this.designMode&&this.removeEventListener("shopify:block:select",this.onBlockSelect),window.removeEventListener("pageshow",this.onVisibility),this.initialized=!1}boundary(slide,key){const value=slide.dataset[key];return value?/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:[+-]\d{4}|Z)$/.test(value)?Date.parse(value.replace(/([+-]\d{2})(\d{2})$/,"$1:$2")):NaN:null}refreshSchedule(){if(!this.isConnected)return;clearTimeout(this.scheduleTimer),clearTimeout(this.setActiveSlideTimeoutId),clearTimeout(this.autoplayTimer);const activeId=this.slides[this.currentIndex]?.dataset.blockId,now=Date.now();let nextBoundary=1/0;this.slides=this.allSlides.filter(slide=>{const start=this.boundary(slide,"startAt"),end=this.boundary(slide,"endAt");if(!this.designMode){if(Number.isNaN(start)||Number.isNaN(end))return!1;start!==null&&start>now&&(nextBoundary=Math.min(nextBoundary,start)),end!==null&&end>now&&(nextBoundary=Math.min(nextBoundary,end))}return this.designMode||(start===null||now>=start)&&(end===null||now<end)}
1),this.allSlides.forEach(slide=>{slide.hidden=!this.slides.includes(slide),slide.classList.remove("is-active","transition-out"),slide.querySelectorAll(".has-motion").forEach(el=>el.classList.remove("transition-out"))}),this.sectionEl.hidden=this.slides.length===0,this.currentIndex=Math.max(0,this.slides.findIndex(slide=>slide.dataset.blockId===activeId)),this.slides[this.currentIndex]&&(this.slides[this.currentIndex].classList.add("is-active"),this.updateImageHeight(this.slides[0]),this.slideshow.scrollTo({left:this.slides[this.currentIndex].offsetLeft,behavior:"auto"})),this.slides.forEach((slide,index)=>{slide.setAttribute("aria-label",`${index+1} ${this.dataset.ofLabel} ${this.slides.length}`)}),this.setSlideVisibility(),this.pageBtns=this.slides.map((slide,index)=>{const button=this.allPageBtns.find(el=>el.dataset.blockId===slide.dataset.blockId);if(button){button.hidden=!1,button.dataset.index=String(index);const label=button.querySelector(".visually-hidden");label&&(label.textContent=`${this.dataset.loadLabel} ${index+1} ${this.dataset.ofLabel} ${this.slides.length}`)}return button}).filter(Boolean),this.allPageBtns.forEach(button=>{this.pageBtns.includes(button)||(button.hidden=!0,button.removeAttribute("aria-current"))}),this.controls&&(this.controls.hidden=this.slides.length<2),this.counterCurrent&&(this.counterCurrent.textContent=String(this.currentIndex+1)),this.counterTotal&&(this.counterTotal.textContent=String(this.slides.length)),this.updatePagination(),this.syncAutoplay(),!this.designMode&&Number.isFinite(nextBoundary)&&(this.scheduleTimer=setTimeout(()=>this.refreshSchedule(),Math.min(Math.max(1,nextBoundary-now),2147483647)))}updateImageHeight(slide){const desktop=Number(slide.dataset.desktopRatio),mobile=Number(slide.dataset.mobileRatio);desktop>0&&this.sectionEl.style.setProperty("--mkcustom-image-padding",`${100/desktop}%`),mobile>0&&this.sectionEl.style.setProperty("--mkcustom-mobile-image-padding",`${100/mobile}%`)}syncAutoplay(){const enabled=this.userAutoplay&&this.slides.length>1;this.dataset.autoplay=String(enabled),clearTimeout(this.autoplayTimer),enabled&&this.inView&&!document.hidden&&!this.matches(":hover")&&!this.contains(document.activeElement)?(this.autoplayStartTime=Date.now(),this.autoplayTimer=setTimeout(()=>this.showNextSlide(),this.autoplaySpeed),this.setSlideshowState("running")):this.setSlideshowState("paused")}pauseAutoplay(){!this.userAutoplay||!this.autoplayTimer||(clearTimeout(this.autoplayTimer),this.autoplayTimer=null,this.autoplayTimeLeft=Math.max(0,this.autoplaySpeed-(Date.now()-this.autoplayStartTime)),this.setSlideshowState("paused"))}resumeAutoplay(){!this.userAutoplay||this.slides.length<2||!this.inView||document.hidden||(clearTimeout(this.autoplayTimer),this.autoplayStartTime=Date.now()-(this.autoplaySpeed-(this.autoplayTimeLeft||this.autoplaySpeed)),this.autoplayTimer=setTimeout(()=>this.showNextSlide(),this.autoplayTimeLeft||this.autoplaySpeed),this.autoplayTimeLeft=null,this.setSlideshowState("running"))}handleNavClick(evt){const button=evt.target.closest("button");button&&(button.matches(".autoplay-btn")?(this.userAutoplay=!this.userAutoplay,button.classList.toggle("is-paused",!this.userAutoplay),this.syncAutoplay()):button.name==="next"?this.showNextSlide():button.name==="prev"&&this.showPrevSlide())}handleBlockSelect(evt){const slide=evt.target.closest(".slideshow__slide"),index=this.slides.indexOf(slide);index>=0&&this.setActiveSlide(index)}handlePaginationClick(evt){const button=evt.target.closest(".page-btn");button&&!button.hidden&&this.setActiveSlide(Number(button.dataset.index))}handleWheel(evt){this.blockWheelTrigger||(evt.deltaX>20||evt.deltaX<-20)&&(evt.preventDefault(),evt.deltaX>20?this.showNextSlide():this.showPrevSlide(),this.blockWheelTrigger=!0,this.wheelTimer=setTimeout(()=>{this.blockWheelTrigger=!1},this.wheelTriggerWait))}handleTouchStart(evt){this.touchStart=evt.changedTouches[0].screenX}handleTouchMove(evt){const touchEnd=evt.changedTouches[0].screenX;touchEnd<this.touchStart-this.swipeThreshold&&(this.rtl?this.showPrevSlide():this.showNextSlide()),touchEnd>this.touchStart+this.swipeThreshold&&(this.rtl?this.showNextSlide():this.showPrevSlide())}static handleTransitionend(evt){evt.target.matches(".has-motion")&&evt.target.classList.remove("transition-out")}showNextSlide(){this.slides.length<2||this.setActiveSlide((this.currentIndex+1)%this.slides.length,"next")}showPrevSlide(){this.slides.length<2||this.setActiveSlide((this.currentIndex-1+this.slides.length)%this.slides.length,"prev")}setActiveSlide(slideIndex,slideDirection){if(!this.slides[slideIndex]||slideIndex===this.currentIndex)return;clearTimeout(this.setActiveSlideTimeoutId),clearTimeout(this.autoplayTimer);let direction=slideDirection||(slideIndex<this.currentIndex?"prev":"next");this.rtl&&(direction=direction==="next"?"prev":"next"),this.dataset.direction=direction,this.slides[this.currentIndex].classList.add("transition-out"),this.setActiveSlideTimeoutId=setTimeout(()=>{const previous=this.slides[this.currentIndex],next=this.slides[slideIndex];this.slideshow.scrollTo({left:next.offsetLeft,behavior:"auto"}),next.classList.add("is-active"),previous.classList.remove("is-active","transition-out");const transitioned=previous.querySelector(".has-motion");transitioned&&transitioned.classList.add("transition-out"),this.currentIndex=sli
1deIndex,this.counterCurrent&&(this.counterCurrent.textContent=String(slideIndex+1)),this.setSlideVisibility(),this.updatePagination(),this.syncAutoplay()},200)}updatePagination(){this.pageBtns.forEach((button,index)=>{index===this.currentIndex?button.setAttribute("aria-current","true"):button.removeAttribute("aria-current")})}setSlideVisibility(){this.allSlides.forEach(slide=>{const active=!slide.hidden&&slide===this.slides[this.currentIndex];slide.setAttribute("aria-hidden",String(!active)),active?slide.removeAttribute("tabindex"):slide.setAttribute("tabindex","-1"),slide.querySelectorAll("a").forEach(link=>{active?link.removeAttribute("tabindex"):link.setAttribute("tabindex","-1")})})}setSlideshowState(state){this.style.setProperty("--play-state",state),this.slideshow.setAttribute("aria-live",state==="running"?"off":"polite")}}customElements.define("mkcustom-scheduled-slide-show",MkcustomScheduledSlideShow)} 2//# sourceMappingURL=/cdn/shop/t/4/assets/mkcustom-scheduled-slideshow.js.map?v=62203063169049573981790265635
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.