if(!customElements.get("slide-show")){class SlideShow extends HTMLElement{constructor(){super();const slideshow=this,dataset=slideshow.dataset;let dots=dataset.dots==="true",slideshow_slides=Array.from(slideshow.querySelectorAll(".carousel__slide")),autoplay=dataset.autoplay=="false"?!1:parseInt(dataset.autoplay,10),align=dataset.align=="center"?"center":"left",fade=dataset.fade=="true",prev_button=slideshow.querySelector(".flickity-prev"),next_button=slideshow.querySelector(".flickity-next"),custom_dots=slideshow.querySelector(".flickity-page-dots"),progress_bar=slideshow.parentNode.querySelector(".flickity-progress--bar"),animations=[],rightToLeft=document.dir==="rtl",animations_enabled=document.body.classList.contains("animations-true")&&typeof gsap<"u";if(slideshow_slides.length<1)return;const args={wrapAround:!0,cellAlign:align,pageDots:!1,contain:!0,fade,autoPlay:autoplay,rightToLeft,prevNextButtons:!1,cellSelector:".carousel__slide",on:{}};if(slideshow.classList.contains("image-with-text-slideshow__image")){let main_slideshow=slideshow.parentNode.querySelector(".image-with-text-slideshow__content"),image_slideshow_slides=slideshow.querySelectorAll(".image-with-text-slideshow__image-media");args.draggable=!1,args.asNavFor=main_slideshow,image_slideshow_slides.length&&image_slideshow_slides[0].classList.contains("desktop-height-auto")&&(args.adaptiveHeight=!0)}if(slideshow.classList.contains("customer-reviews__image")){let main_slideshow=slideshow.parentNode.querySelector(".customer-reviews__content");args.draggable=!1,args.asNavFor=main_slideshow}(slideshow.classList.contains("image-with-text-slideshow__content")||slideshow.classList.contains("testimonials__carousel")||slideshow.classList.contains("customer-reviews__content")||slideshow.classList.contains("customer-reviews__image"))&&(args.adaptiveHeight=!0),slideshow.classList.contains("custom-dots")&&(animations_enabled&&slideshow.classList.contains("main-slideshow")&&this.prepareAnimations(slideshow,animations),args.pauseAutoPlayOnHover=!1,args.on={staticClick:function(){this.unpausePlayer()},ready:function(){let flkty2=this;if(animations_enabled&&slideshow.classList.contains("main-slideshow")&&(slideshow.animateSlides(0,animations),gsap.set(slideshow.querySelectorAll(".subheading,.split-text,.button"),{visibility:"visible"})),dots&&custom_dots){let dots2=custom_dots.querySelectorAll("li");dots2.forEach((dot,i)=>{dot.addEventListener("click",e=>{flkty2.select(i)})}),dots2[this.selectedIndex].classList.add("is-selected")}document.fonts.ready.then(function(){flkty2.resize()});let video_container=flkty2.cells[0].element.querySelector(".slideshow__slide-video-bg");video_container&&(video_container.querySelector("iframe")?video_container.querySelector("iframe").onload=function(){slideshow.videoPlay(video_container)}:video_container.querySelector("video")&&(video_container.querySelector("video").onloadstart=function(){slideshow.videoPlay(video_container)}))},change:function(index){flkty.cells[0].element.classList.remove("is-initial-selected");let previousIndex=fizzyUIUtils.modulo(this.selectedIndex-1,this.slides.length),nextIndex=fizzyUIUtils.modulo(this.selectedIndex+1,this.slides.length);if(animations_enabled&&slideshow.classList.contains("main-slideshow")&&(setTimeout(()=>{slideshow.animateReverse(previousIndex,animations)},300),slideshow.animateSlides(index,animations)),dots&&custom_dots){let dots2=custom_dots.querySelectorAll("li");dots2.forEach((dot,i)=>{dot.classList.remove("is-selected")}),dots2[this.selectedIndex].classList.add("is-selected")}autoplay&&(this.stopPlayer(),this.playPlayer());let video_container_prev=flkty.cells[previousIndex].element.querySelector(".slideshow__slide-video-bg");video_container_prev&&slideshow.videoPause(video_container_prev);let video_container_next=flkty.cells[nextIndex].element.querySelector(".slideshow__slide-video-bg");video_container_next&&slideshow.videoPause(video_container_next);let video_container=flkty.cells[index].element.querySelector(".slideshow__slide-video-bg");video_container&&(video_container.querySelector("iframe")?video_container.querySelector("iframe").classList.contains("lazyload")?(video_container.querySelector("iframe").addEventListener("lazybeforeunveil",slideshow.videoPlay(video_container)),lazySizes.loader.checkElems()):slideshow.videoPlay(video_container):video_container.querySelector("video")&&slideshow.videoPlay(video_container))}}),slideshow.classList.contains("shoppable-video-reels--carousel")&&(args.on.staticClick=function(event,pointer,cellElement,cellIndex){typeof cellIndex=="number"&&flkty.select(cellIndex)}),slideshow.classList.contains("main-slideshow")&&(slideshow.classList.contains("desktop-height-image")||slideshow.classList.contains("mobile-height-image"))&&(args.adaptiveHeight=!0),slideshow.classList.contains("products")&&(args.wrapAround=!1,args.on.ready=function(){var flickity=this;next_button&&window.addEventListener("resize",function(){slideshow.centerArrows(flickity,prev_button,next_button)}),window.dispatchEvent(new Event("resize"))}),progress_bar&&(args.wrapAround=!1,args.on.scroll=function(progress){progress=Math.max(0,Math.min(1,progress)),progress_bar.style.width=progress*100+"%"});const flkty=new Flickity(slideshow,args);slideshow.dataset.initiated=!0,prev_button&&(prev_button.addEventListener("click",event=>{flkty.previous()}),prev_button.addEventListener("keyup",event=>{flkty.previous()}),next_button.addEventListener("click",event=>{flkty.next()}),next_button.addEventListener("keyup",event=>{flkty.next()})),Shopify.designMode&&slideshow.addEventListener("shopify:block:select",event=>{let index=slideshow_slides.indexOf(event.target);flkty.select(index)})}videoPause(video_container){setTimeout(()=>{video_container.dataset.provider==="hosted"?video_container.querySelector("video").pause():video_container.dataset.provider==="youtube"?video_container.querySelector("iframe").contentWindow.postMessage(JSON.stringify({event:"command",func:"pauseVideo",args:""}),"*"):video_container.dataset.provider==="vimeo"&&video_container.querySelector("iframe").contentWindow.postMessage(JSON.stringify({method:"pause"}),"*")},10)}videoPlay(video_container){setTimeout(()=>{video_container.dataset.provider==="hosted"?video_container.querySelector("video").play():video_container.dataset.provider==="youtube"?video_container.querySelector("iframe").contentWindow.postMessage(JSON.stringify({event:"command",func:"playVideo",args:""}),"*"):video_container.dataset.provider==="vimeo"&&video_container.querySelector("iframe").contentWindow.postMessage(JSON.stringify({method:"play"}),"*")},10)}prepareAnimations(slideshow,animations){slideshow.dataset.animationsReady||(new SplitText(slideshow.querySelectorAll(".split-text"),{type:"lines, words",linesClass:"line-child"}),slideshow.querySelectorAll(".slideshow__slide").forEach((item,i)=>{let tl=gsap.timeline({paused:!0}),button_offset=0;if(animations[i]=tl,slideshow.dataset.transition=="swipe"&&tl.fromTo(item,{clipPath:"polygon(0 0, 0 0, 0 100%, 0 100%)"},{duration:.7,clipPath:"polygon(0 0, 100% 0, 100% 100%, 0 100%)"},"start"),tl.to(item.querySelector(".slideshow__slide-bg"),{duration:1.5,scale:1},"start"),item.querySelector(".subheading")&&(tl.to(item.querySelector(".subheading"),{duration:.5,autoAlpha:1},0),button_offset+=.5),item.querySelector(".slideshow__slide-content--heading")){let h1_duration=.5+(item.querySelectorAll(".slideshow__slide-content--heading .line-child div").length-1)*.05;tl.from(item.querySelectorAll(".slideshow__slide-content--heading .line-child div"),{duration:h1_duration,yPercent:"100",stagger:.05},0),button_offset+=h1_duration}if(item.querySelector("p:not(.subheading)")){let p_duration=.5+(item.querySelectorAll("p:not(.subheading) .line-child div").length-1)*.02;tl.from(item.querySelectorAll("p:not(.subheading) .line-child div"),{duration:p_duration,yPercent:"100",stagger:.02},0),button_offset+=p_duration}item.querySelectorAll(".button")&&tl.fromTo(item.querySelectorAll(".button"),{y:"100%"},{duration:.5,y:"0%",stagger:.1},button_offset*.2),item.dataset.timeline=tl}),slideshow.dataset.animationsReady=!0)}animateSlides(i,animations){document.fonts.ready.then(function(){animations[i].timeScale(1).restart()})}animateReverse(i,animations){animations[i].timeScale(3).reverse()}centerArrows(flickity,prev_button,next_button){let first_cell=flickity.cells[0],max_height=0,image_height=first_cell.element.querySelector(".product-featured-image").clientHeight;if(flickity.cells.forEach((item,i)=>{item.size.height>max_height&&(max_height=item.size.height)}),max_height>image_height){let difference=(max_height-image_height)/-2;prev_button.style.transform="translateY("+difference+"px)",next_button.style.transform="translateY("+difference+"px)"}}}customElements.define("slide-show",SlideShow)} //# sourceMappingURL=/cdn/shop/t/41/assets/slideshow.js.map?v=77914080626843417591739221809