var TfSliderProAutoplay;((e,t,s)=>{"use strict";TfSliderProAutoplay=class{slider;settings;autoplayTimer=null;isHover=!1;defaults={autoplayDelay:5e3,autoplayDirection:"normal",autoplayOnHover:"pause"};constructor(e){this.slider=e,e.tfOn("init",(()=>{this.t()}),{passive:!0,once:!0}).autoplay=this}t(){const e=this,t=e.slider;if(e.settings={...e.defaults,...t.settings},e.timer_bar=t.sliderEl.tfClass("bsp-timer-bar")[0],t.tfOn("gotoSlide",(()=>{e.o()}),{passive:!0}).tfOn("gotoSlideComplete",(()=>{e.i()})),"none"!==e.autoplayOnHover){const s=()=>{e.l()};t.sliderEl.tfOn("pointerenter",(t=>{!0!==e.disable&&(e.u(),t.currentTarget.tfOff("pointerleave",s,{passive:!0,once:!0}).tfOn("pointerleave",s,{passive:!0,once:!0}))}),{passive:!0})}e.timer_bar&&(e.anim=e.timer_bar.animate([{transform:"scaleX(0)"},{transform:"scaleX(1)"}],{duration:e.settings.autoplayDelay}));let s=setInterval((()=>{t.sliderEl?.isConnected&&t.getTotalSlides()!==t.currentIndex+1?t.dispatchEvent("lazyPreload",{index:t.currentIndex+1}):(clearInterval(s),s=null)}),parseInt(e.settings.autoplayDelay/3));e.start()}o(){const e=this;e.anim?.cancel(),null!==e.autoplayTimer&&!0!==e.disable&&e.stop()}i(){const e=this,t=e.slider;if(!0!==e.isHover&&null===e.autoplayTimer&&!0!==e.disable){if(!1===e.settings.loop&&t.currentIndex===t.getTotalSlides()-1)return void e.stop();e.start()}}u(){const e=this;!0!==e.disable&&"none"!==e.settings.autoplayOnHover&&(e.isHover=!0,null!==e.autoplayTimer&&(e.stop(),e.anim?.pause()))}l(){const e=this;!0!==e.disable&&(e.isHover=!1,null===e.autoplayTimer&&"stop"!==e.settings.autoplayOnHover&&e.start())}start(){const e=this,t=()=>{if(e.p=null,!e.isHover){const t=e.settings.autoplayDirection,s=e.slider;"normal"===t?s.nextSlide():"backwards"===t&&s.previousSlide()}};e.anim?(e.autoplayTimer=1,e.p&&e.anim.tfOff("finish",e.p,{passive:!0,once:!0}),e.p=t,e.anim.tfOn("finish",t,{passive:!0,once:!0}).play()):e.autoplayTimer=setTimeout(t,e.settings.autoplayDelay)}stop(){const e=this;1!==e.autoplayTimer&&clearTimeout(e.autoplayTimer),e.autoplayTimer=null}}})(Themify,document,window);