var TfSliderProTouchSwipe;(t=>{"use strict";TfSliderProTouchSwipe=class{slider;touchStartPoint={x:0,y:0};touchDistanceX;touchStartPosition=0;allowOppositeScrolling=!0;isMoved;constructor(t){this.slider=t,t.tfOn("init",(()=>{this.init()}),{passive:!0,once:!0})}init(){const t=this,s=t.slider;s.settings.touchSwipeThreshold??=50,s.slidesMaskEl.tfOn("touchstart",(i=>{s.dispatchEvent("lazyPreload",{index:s.currentIndex+1,preload:!0}),i.isTrusted&&!0!==s.swipeDisable&&t.t(i)}),{passive:!0}).tfOn("dragstart",(t=>{t.preventDefault()}))}t(t){const s=this,i=s.slider,e=t.touches[0],o=t=>{s.i(t)},r=t=>{t.target?.closest("a")&&t.preventDefault()};t.target.classList.contains("sp-selectable")||(s.touchStartPoint.x=e.pageX,s.touchStartPoint.y=e.pageY,s.touchStartPosition=i.getSlidesPosition().left,s.isMoved=!1,s.touchDistanceX=0,i.slidesEl.classList.contains("sp-animated")&&i.stopMovement(),i.slidesMaskEl.tfOn("touchend",(t=>{t.currentTarget.tfOff("touchmove",o,{passive:!0}).tfOff("click",r),s.o()}),{passive:!0,once:!0}).tfOn("touchmove",o,{passive:!0}).tfOn("click",r),i.sliderEl.classList.add("bsp_swiping_start"))}i(s){let i=this,e=i.slider,{currentIndex:o,slidesPosition:r}=e,n=i.touchStartPosition,c=s.touches[0],a=c.pageX-i.touchStartPoint.x,l=e.getTotalSlides();if(i.touchDistanceX=a,t.abs(a)>t.abs(c.pageY-i.touchStartPoint.y))i.allowOppositeScrolling=!1;else if(!0===i.allowOppositeScrolling)return;!1===i.isMoved&&(i.isMoved=!0,e.sliderEl.classList.add("bsp_swiping")),!1===e.settings.loop&&(r>n&&0===o||r<n&&o===l-1)&&(a*=.2);let d=n+a,p=!0!==e.settings.loop&&t.abs(d)-t.abs(n)>0?1:0,h=t.abs(~~(d/e.slideWidth))+p;h>=l&&(h=l),e.slides[h]&&e.lazyLoading.load(e.slides[h],!0),e.moveTo(d,!0)}o(){const s=this,i=s.slider,e=i.sliderEl.classList,o=i.settings,r=s.touchDistanceX,n=-parseInt(i.slides[i.currentIndex].style.left,10);if(s.allowOppositeScrolling=!0,setTimeout((()=>{e.remove("bsp_swiping_start")}),100),!0===s.isMoved)if(e.remove("bsp_swiping"),t.abs(r)<o.touchSwipeThreshold)i.moveTo(n);else{let{slideWidth:t,currentIndex:s,slidesOrder:e}=i,c=o.slideDistance,a=i.getTotalSlides(),l=(!0===o.rightToLeft?-1:1)*r/(t+c);l=parseInt(l,10)+(l>0?1:-1);let d=e.indexOf(s)-l;d<0?d=e.indexOf(0):d>=a&&(d=e.indexOf(a-1));const p=e[d];void 0===p||s===p?i.moveTo(n):i.gotoSlide(p)}}}})(Math);