text: !function(t){"use strict";t.jCarousel.plugin("jcarouselSwipe",{_options:{perSwipe:1,draggable:!0,method:"scroll"},_init:function(){var t=this;this.carousel().on("jcarousel:reloadend",function(){t._reload()})},_create:function(){this._instance=this.carousel().data("jcarousel"),this._instance._element.css("touch-action",this._instance.vertical?"pan-x":"pan-y"),this._carouselOffset=this.carousel().offset()[this._instance.lt]+parseInt(this.carousel().css(this._instance.vertical?"border-top-width":"border-left-width"))+parseInt(this.carousel().css(this._instance.vertical?"padding-top":"padding-left")),this._slidesCount=this._instance.items().length,this.carousel().find("img, a").attr("draggable",!1).css("user-select","none").on("dragstart",function(t){t.preventDefault()}),this._destroy(),this._instance.items().length>this._instance.fullyvisible().length&&this._initGestures()},_initGestures:function(){function e(e){var i,o,p;e=e.originalEvent||e||window.event,l=n(e);var f=Math.abs(r[u]-l[u]),d=Math.abs(r[_]-l[_]);h&&e.preventDefault(),d>10&&d>f&&!h?t(document).off("touchmove.jcarouselSwipe mousemove.jcarouselSwipe"):(!c._instance.animating&&f>10||h)&&(i=r[u]-l[u],h||(h=!0,c._addClones(),c._currentLT=c._getListPosition(),p=c._instance.options("items"),a=(t.isFunction(p)?p.call(c._instance):c._instance.list().find(p)).last(),s=c._instance.rtl&&!c._instance.vertical?c._instance.dimension(c._instance.list())-a.position()[c._instance.lt]-c._instance.clipping():-1*(a.position()[c._instance.lt]+c._instance.dimension(a)-c._instance.clipping())),o="circular"===c._instance._options.wrap?c._currentLT-i:c._instance.rtl&&!c._instance.vertical?Math.max(0,Math.min(c._currentLT-i,s)):Math.min(0,Math.max(c._currentLT-i,s)),c._setListPosition(o+"px"))}function i(e){e=e.originalEvent||e||window.event,l=n(e);var i=Math.abs(r[u]-l[u]),s=Math.abs(r[_]-l[_]);if(h||!c._options.draggable&&i>10&&i>s){var a=c._getNewTarget(r[u]-l[u]>0);a="circular"===c._instance._options.wrap?a.relative:a.static,o===e.target&&t(e.target).on("click.disable",function(e){e.stopImmediatePropagation(),e.stopPropagation(),e.preventDefault(),t(e.target).off("click.disable")}),"circular"===c._instance._options.wrap&&(c._removeClones(),c._instance._items=null),h=!1,c._instance[c._options.method](a,function(){"circular"!==c._instance._options.wrap&&(c._removeClones(),c._instance._items=null)})}t(document).off("touchmove.jcarouselSwipe mousemove.jcarouselSwipe"),t(document).off("touchend.jcarouselSwipe touchcancel.jcarouselSwipe mouseup.jcarouselSwipe")}function n(t){return void 0!==t.touches&&t.touches.length>0?{x:t.touches[0].pageX,y:t.touches[0].pageY}:void 0!==t.changedTouches&&t.changedTouches.length>0?{x:t.changedTouches[0].pageX,y:t.changedTouches[0].pageY}:void 0!==t.pageX?{x:t.pageX,y:t.pageY}:{x:t.clientX,y:t.clientY}}var s,a,o,c=this,r={},l={},h=!1,u=this._instance.vertical?"y":"x",_=this._instance.vertical?"x":"y";this._element.on("touchstart.jcarouselSwipe mousedown.jcarouselSwipe",function(s){s=s.originalEvent||s||window.event,r=n(s),o=s.target||s.srcElement,c._options.draggable&&!c._instance.animating&&t(document).on("touchmove.jcarouselSwipe mousemove.jcarouselSwipe",e),t(document).on("touchend.jcarouselSwipe touchcancel.jcarouselSwipe mouseup.jcarouselSwipe",i)})},_getNewTarget:function(t){var e,i=this._instance.target(),n=this._instance.index(i),s=0,a=this._instance.rtl&&!this._instance.vertical?!t:t;if(this._options.draggable)for(;;){if(e=this._instance.rtl&&!this._instance.vertical?i.offset()[this._instance.lt]+this._instance.dimension(i)-(this._carouselOffset+this._instance.clipping()):i.offset()[this._instance.lt]-this._carouselOffset,!i.length||t&&e>=0||!t&&e<=0)break;if(a){if(!(i=i.next()).length)break;n+=1}else{if(!(i=i.prev()).length)break;n-=1}s++}else n=a?n+1:n-1,s=1;return a?n+=Math.abs(s-this._options.perSwipe*Math.ceil(s/this._options.perSwipe)):n-=Math.abs(s-this._options.perSwipe*Math.ceil(s/this._options.perSwipe)),"first"===this._instance._options.wrap?n=Math.min(this._slidesCount-1,n):"last"===this._instance._options.wrap?n=Math.max(0,n):this._instance._options.wrap||(n=Math.max(0,Math.min(this._slidesCount-1,n))),n%=this._slidesCount,s=this._options.perSwipe*Math.ceil(s/this._options.perSwipe),{static:n,relative:(a?"+":"-")+"="+s}},_getListPosition:function(){var t=this._instance.list(),e=t.position();return this._instance.rtl&&(e.left=t.width()+e.left-this._carousel.width()),e[this._instance.lt]},_setListPosition:function(t){var e=this._instance.options("transitions"),i=!!e.transforms,n=!!e.transforms3d,s={},a="left"===this._instance.lt;t=t||0,n?s.transform="translate3d("+(a?t:0)+","+(a?0:t)+",0)":i?s.transform="translate("+(a?t:0)+","+(a?0:t)+")":s[this._instance.lt]=t,this._instance.list().css(s)},_addClones:function(){var e,i,n,s=this,a=this._instance,o=a.items(),c=a.first(),r=a.last(),l=a.dimension(t(window)),h=[],u=[],_=s._getListPosition(),p={};if(!a._options.wrap)return!1;if("last"!==a._options.wrap){for(i=0,n=0,e=c;i<l;)0===(e=e.prev()).length?(n=--n<-o.length?-1:n,i+=a.dimension(o.eq(n)),h.push(o.eq(n).clone().attr("data-jcarousel-clone",!0))):i+=a.dimension(e);_=(a.rtl?Math.max(_,i):Math.min(_,-i))+"px",a._items.first().before(h.reverse()),p[a.lt]=_,a.move(p)}if("first"!==a._options.wrap){for(i=0,n=-1,e=r;i<l;)0===(e=e.next()).length?(n=++n>o.length-1?0:n,i+=a.dimension(o.eq(n)),u.push(o.eq(n).clone().attr("data-jcarousel-clone",!0))):i+=a.dimension(e);a._items.last().after(u)}},_removeClones:function(){var t,e=this._instance.first().position()[this._instance.lt],i={};this._instance.list().find("[data-jcarousel-clone]").remove(),(t=e-this._instance.first().position()[this._instance.lt])&&(i[this._instance.lt]=this._getListPosition()+t+"px",this._instance.move(i))},_destroy:function(){this._element.off("touchstart.jcarouselSwipe mousedown.jcarouselSwipe"),t(document).off("touchmove.jcarouselSwipe mousemove.jcarouselSwipe touchend.jcarouselSwipe touchcancel.jcarouselSwipe mouseup.jcarouselSwipe")},_reload:function(){this._create()}})}(jQuery);