1customElements.get("slideshow-component")||customElements.define("slideshow-component",class extends HTMLElement{constructor(){super(),this.slideshow=this.querySelector(".slideshow"),this.isTransitioning=!1,this.contentAnimationDelay=400,this.contentExitDelay=400,this.flickity=null,this.isAutoTransition=!1,this.handleVisibilityChange=this.handleVisibilityChange.bind(this)}connectedCallback(){const autoplayEnabled=this.getAttribute("data-autoplay")==="true",autoPlaySpeed=parseInt(this.getAttribute("data-speed"),10)*1e3;if(this.animationType=this.getAttribute("data-animation-type")??"slide",this.autoPlayEnabled=autoplayEnabled&&autoPlaySpeed>0,!!this.slideshow){if(this.slideshow.style.display="block",this.initializeContentStates(),"IntersectionObserver"in window&&this.shouldDeferInitialization()){const rect=this.getBoundingClientRect(),viewportHeight=window.innerHeight||document.documentElement.clientHeight;rect.top<viewportHeight&&rect.bottom>0?this.initializeFlickity(autoPlaySpeed):this.deferredInit(autoPlaySpeed);return}this.initializeFlickity(autoPlaySpeed)}}shouldDeferInitialization(){const rect=this.getBoundingClientRect(),viewportHeight=window.innerHeight||document.documentElement.clientHeight;return rect.top>viewportHeight*1.5}deferredInit(autoPlaySpeed){const observer=new IntersectionObserver(entries=>{entries.forEach(entry=>{entry.isIntersecting&&(this.initializeFlickity(autoPlaySpeed),observer.unobserve(this))})},{rootMargin:"500px"});observer.observe(this)}initializeFlickity(autoPlaySpeed){this.flickity=new Flickity(this.slideshow,{autoPlay:!1,cellAlign:"left",percentPosition:!0,fullscreen:!0,contain:!0,resize:!0,draggable:!0,prevNextButtons:!1,fade:this.animationType==="fade",cellSelector:".slideshow-slide",initialIndex:0,pageDots:!1,wrapAround:!0,accessibility:!1,on:{ready:()=>{this.showSlideContent(0),setTimeout(()=>{this.playSlideVideo(0)},50),this.autoPlayEnabled&&(this.startAutoplay(autoPlaySpeed),document.addEventListener("visibilitychange",this.handleVisibilityChange)),setTimeout(()=>{this.preloadSlide(1)},3e3)}}}),this.flickity.on("change",index=>{!this.isAutoTransition&&this.autoPlayEnabled&&this.autoplayInterval&&this.resetAutoplay(),this.handleSlideChange(index);const event=new CustomEvent("slideshow:slide-change",{detail:{id:this.getAttribute("id"),index}});document.dispatchEvent(event)})}disconnectedCallback(){this.autoplayInterval&&clearInterval(this.autoplayInterval),this.tickerInterval&&clearInterval(this.tickerInterval),document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.pauseAllVideos()}handleVisibilityChange(){this.autoPlayEnabled&&(document.hidden?this.pauseAutoplay():this.resumeAutoplay())}pauseAutoplay(){this.autoplayInterval&&(clearInterval(this.autoplayInterval),this.autoplayInterval=null),this.tickerInterval&&(clearInterval(this.tickerInterval),this.tickerInterval=null),this.pauseAllVideos()}resumeAutoplay(){this.autoPlayEnabled&&this.autoplaySpeed&&!this.autoplayInterval&&this.startAutoplay(this.autoplaySpeed),this.flickity&&typeof this.flickity.selectedIndex<"u"&&this.playSlideVideo(this.flickity.selectedIndex)}initializeContentStates(){this.querySelectorAll(".slideshow-content-wrap").forEach((content,index)=>{content.classList.remove("content-visible","content-exit"),content.classList.add("content-enter")})}resetAllContentStates(){this.querySelectorAll(".slideshow-content-wrap").forEach(content=>{content.classList.remove("content-visible","content-exit"),content.classList.add("content-enter")})}showSlideContent(index){this.resetAllContentStates();const slide=this.querySelectorAll(".slideshow-slide")[index];if(slide){const content=slide.querySelector(".slideshow-content-wrap");content&&setTimeout(()=>{content.classList.remove("content-enter","content-exit"),content.classList.add("content-visible")},this.contentAnimationDelay)}}hideSlideContent(index){const slide=this.querySelectorAll(".slideshow-slide")[index];if(slide){const content=slide.querySelector(".slideshow-content-wrap");content&&(content.classList.remove("content-visible"),content.classList.add("content-exit"))}}hideCurrentSlideContent(){this.flickity&&typeof this.flickity.selectedIndex<"u"&&this.hideSlideContent(this.flickity.selectedIndex)}handleSlideChange(index){this.pauseAllVideos(),this.preloadSlide(index+1),this.showSlideContent(index),this.playSlideVideo(index),typeof publish<"u"&&publish(PUB_SUB_EVENTS.slideshowSlideChange,{id:this.getAttribute("id"),index})}startAutoplay(speed){this.autoplaySpeed=speed,this.tickerInterval&&clearInterval(this.tickerInterval),this.autoplayInterval&&clearInterval(this.autoplayInterval),this.autoplayInterval=setInterval(()=>{this.isAutoTransition=!0,this.transitionToNext()},speed)}resetAutoplay(){this.autoplayInterval&&clearInterval(this.autoplayInterval),this.tickerInterval&&clearInterval(this.tickerInterval),this.autoPlayEnabled&&this.autoplaySpeed&&this.startAutoplay(this.autoplaySpeed)}transitionToNext(){this.isTransitioning||!this.flickity||(this.isTransitioning=!0,this.autoPlayEnabled&&this.autoplayInterval&&this.resetAutoplay(),this.hideCurrentSlideContent(),setTimeout(()=>{this.flickity.next(),this.isTransitioning=!1,this.isAutoTransition=!1},this.contentExitDelay))}transitionToPrev(){this.isTransitioning||!this.flickity||(this.isTransitioning=!0,this.autoPlayEnabled&&this.autoplayInterval&&this.resetAutoplay(),this.hideCurrentSlideContent(),setTimeout(()=>{this.flickity.previous(),this.isTransitioning=!1,this.isAutoTransition=!1},this.contentExitDelay))}goToSlide(index){this.isTransitioning||!this.flickity||(this.isTransitioning=!0,this.autoPlayEnabled&&this.autoplayInterval&&this.resetAutoplay(),this.hideCurrentSlideContent(),setTimeout(()=>{this.flickity.select(index),this.isTransitioning=!1,this.isAutoTransition=!1},this.contentExitDelay))}preloadSlide(index){const slide=this.querySelectorAll(".slideshow-slide")[index];if(slide){const media=slide.querySelector(".slideshow-media");media&&(media.style.display="block"),[...slide.querySelectorAll("img")].forEac
1h(image=>{image.loading=""});const video=this.getSlideVideo(index);video&&!video.videoLoaded&&typeof video.loadSources=="function"&&video.loadSources()}}getSlideVideo(index){const slide=this.querySelectorAll(".slideshow-slide")[index];return slide?slide.querySelector("slideshow-video"):null}playSlideVideo(index){const video=this.getSlideVideo(index);video&&(window.innerWidth<750&&video.classList.contains("slideshow-video-mobile-disabled")||typeof video.play=="function"&&video.play())}pauseAllVideos(){this.querySelectorAll("slideshow-video").forEach(video=>{video&&video.isPlaying&&typeof video.pause=="function"&&video.pause()})}pauseVideoAtIndex(index){const video=this.getSlideVideo(index);video&&video.isPlaying&&typeof video.pause=="function"&&video.pause()}}),customElements.get("slideshow-navigation")||customElements.define("slideshow-navigation",class extends HTMLElement{constructor(){super(),this.slideshow=this.closest("slideshow-component"),this.initAttempts=0,this.maxInitAttempts=20}connectedCallback(){this.tryInitialize()}tryInitialize(){if(this.initAttempts++,!this.slideshow||!this.slideshow.flickity){this.initAttempts<this.maxInitAttempts&&setTimeout(()=>this.tryInitialize(),100);return}this.flickity=this.slideshow.flickity,this.setupNavigation()}setupNavigation(){const buttons=this.querySelectorAll(".js-page");buttons.length>0&&(this.flickity.on("select",()=>{buttons.forEach(button=>{button.classList.remove("is-active")}),buttons[this.flickity.selectedIndex]&&buttons[this.flickity.selectedIndex].classList.add("is-active")}),buttons.forEach(button=>{button.addEventListener("click",()=>{const index=[...buttons].findIndex(x=>x===button);this.slideshow.goToSlide(index)})})),this.buttonPrev=this.querySelector(".js-prev"),this.buttonNext=this.querySelector(".js-next"),this.buttonPrev&&this.buttonPrev.addEventListener("click",event=>{event.preventDefault(),this.slideshow.transitionToPrev()}),this.buttonNext&&this.buttonNext.addEventListener("click",event=>{event.preventDefault(),this.slideshow.transitionToNext()})}}); 2//# sourceMappingURL=/cdn/shop/t/18/assets/slideshow.js.map?v=129044702157706408061781608481
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.