class LiquidSlideshowBehavior extends LiquidBehavior{static behaviorName="liquidSlideshow";static windowEvents={resize:{func:"onResize",debounce:{wait:100}}};options(){return{slideDelay:3,slideDuration:.85,animationType:"fade"}}get ui(){return{slides:".lqd-slideshow-item",images:"img"}}initialize(){this.proxy=document.createElement("div"),this.slidesCount=this.getUI("slides").length,this.slideAnimation=gsap.to({},{}),this.imageAnimation=gsap.to({},{}),this.slideWidth=0,this.wrapWidth=0,this.playNext()}playNext(){const i=this.getUI("slides"),t=this.getUI("images"),s={duration:1,ease:"none",paused:!0,repeat:-1,modifiers:{xPercent:gsap.utils.wrap(-100,(this.slidesCount-1)*100)}};gsap.set(i,{xPercent:e=>e*100}),gsap.set(t,{xPercent:e=>e*-100}),this.slidesAnimation=gsap.to(i,{...s,xPercent:`+=${this.slidesCount*100}`}),this.imagesAnimation=gsap.to(t,{...s,xPercent:`+=${this.slidesCount*-100}`}),this.timer=gsap.delayedCall(this.getOption("slideDelay"),this.autoplay.bind(this)),this.onResize()}autoplay(){this.animateSlides(-1)}updateProgress(){const i=gsap.utils.wrap(0,1);this.slidesAnimation.progress(i(gsap.getProperty(this.proxy,"x")/this.wrapWidth)),this.imagesAnimation.progress(i(gsap.getProperty(this.proxy,"x")/this.wrapWidth))}animateSlides(i){const a=(s=>gsap.utils.snap(this.slideWidth,s))(gsap.getProperty(this.proxy,"x")+i*this.slideWidth);this.timer.restart(!0),this.slideAnimation.kill(),this.imageAnimation.kill(),this.slideAnimation=gsap.to(this.proxy,{x:a,ease:"power2.out",duration:this.getOption("slideDuration"),onUpdate:this.updateProgress.bind(this)})}onResize(){var i=gsap.getProperty(this.proxy,"x")/this.wrapWidth||0;this.slideWidth=this.getUI("slides")[0].offsetWidth,this.wrapWidth=this.slideWidth*this.slidesCount,gsap.set(this.proxy,{x:i*this.wrapWidth}),this.animateSlides(0),this.slideAnimation.progress(1)}destroy(){this.slidesAnimation.kill(),this.slideAnimation.kill(),this.proxy.remove()}}typeof window<"u"&&(window.liquid?.app?window.liquid?.app?.model?.set("loadedBehaviors",[...window.liquid.app.model.get("loadedBehaviors"),LiquidSlideshowBehavior]):window.liquid?.loadedBehaviors?.push(LiquidSlideshowBehavior));
