!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(a,e){var d=6,u=a.event.add,i=a.event.remove,c=function(t,e,n){a.event.trigger(e,n,t)},o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t,e){return window.setTimeout(function(){t()},25)},n={textarea:!0,input:!0,select:!0,button:!0},m={move:"mousemove",cancel:"mouseup dragstart",end:"mouseup"},s="touchmove";function t(t){var n=t,a=!1,i=!1;function e(t){a?(n(),o(e),a=!(i=!0)):i=!1}this.kick=function(t){a=!0,i||e()},this.end=function(t){var e=n;t&&(i?(n=a?function(){e(),t()}:t,a=!0):t())}}function r(){return!0}function f(){return!1}function p(t){t.preventDefault()}function g(t){n[t.target.tagName.toLowerCase()]||t.preventDefault()}function v(t,e){var n,a;if(t.identifiedTouch)return t.identifiedTouch(e);for(n=-1,a=t.length;++n<a;)if(t[n].identifier===e)return t[n]}function h(t,e){t=v(t.changedTouches,e.identifier);if(t&&(t.pageX!==e.pageX||t.pageY!==e.pageY))return t}function l(t){S(t,t.data,t,Y)}function X(t){Y()}function Y(){i(document,m.move,l),i(document,m.cancel,X)}function w(t){var e=t.data,n=h(t,e);n&&S(t,e,n,T)}function y(t){var e=t.data;v(t.changedTouches,e.identifier)&&T(e.identifier)}function T(t){i(document,"."+t,w),i(document,"."+t,y)}function S(t,e,n,a){var i,o,r=n.pageX-e.startX,u=n.pageY-e.startY;r*r+u*u<d*d||(i=t,t=n,n=r,r=u,u=a,(a=e).target,e=i.targetTouches,o=i.timeStamp-a.timeStamp,a.type="movestart",a.distX=n,a.distY=r,a.deltaX=n,a.deltaY=r,a.pageX=t.pageX,a.pageY=t.pageY,a.velocityX=n/o,a.velocityY=r/o,a.targetTouches=e,a.finger=e?e.length:1,a._handled=k,a._preventTouchmoveDefault=function(){i.preventDefault()},c(a.target,a),u(a.identifier))}function k(){return this._handled=r,!1}function _(t){t._handled()}function q(t){var e=t.data.timer;(t.data.touch=t).data.timeStamp=t.timeStamp,e.kick()}function A(t){var e=t.data.event,t=t.data.timer;i(document,m.move,q),i(document,m.end,A),R(e,t,function(){setTimeout(function(){i(e.target,"click",f)},0)})}function D(t){var e=t.data.event,n=t.data.timer,a=h(t,e);a&&(t.preventDefault(),e.targetTouches=t.targetTouches,t.data.touch=a,t.data.timeStamp=t.timeStamp,n.kick())}function F(t){var e=t.data.event,n=t.data.timer;v(t.changedTouches,e.identifier)&&(t=e,i(document,"."+t.identifier,D),i(document,"."+t.identifier,F),R(e,n))}function R(t,e,n){e.end(function(){return t.type="moveend",c(t.target,t),n&&n()})}if(a.event.special.movestart={setup:function(t,e,n){return u(this,"movestart.move",_),!0},teardown:function(t){return i(this,"dragstart drag",p),i(this,"mousedown touchstart",g),i(this,"movestart",_),!0},add:function(t){"move"!==t.namespace&&"moveend"!==t.namespace&&(u(this,"dragstart."+t.guid+" drag."+t.guid,p,e,t.selector),u(this,"mousedown."+t.guid,g,e,t.selector))},remove:function(t){"move"!==t.namespace&&"moveend"!==t.namespace&&(i(this,"dragstart."+t.guid+" drag."+t.guid),i(this,"mousedown."+t.guid))},_default:function(i){var o,r;i._handled()&&(o={target:i.target,startX:i.startX,startY:i.startY,pageX:i.pageX,pageY:i.pageY,distX:i.distX,distY:i.distY,deltaX:i.deltaX,deltaY:i.deltaY,velocityX:i.velocityX,velocityY:i.velocityY,timeStamp:i.timeStamp,identifier:i.identifier,targetTouches:i.targetTouches,finger:i.finger},r={event:o,timer:new t(function(t){var e=o,n=r.touch,a=r.timeStamp-e.timeStamp;e.type="move",e.distX=n.pageX-e.startX,e.distY=n.pageY-e.startY,e.deltaX=n.pageX-e.pageX,e.deltaY=n.pageY-e.pageY,e.velocityX=.3*e.velocityX+.7*e.deltaX/a,e.velocityY=.3*e.velocityY+.7*e.deltaY/a,e.pageX=n.pageX,e.pageY=n.pageY,c(i.target,o)}),touch:e,timeStamp:e},i.identifier===e?(u(i.target,"click",f),u(document,m.move,q,r),u(document,m.end,A,r)):(i._preventTouchmoveDefault(),u(document,s+"."+i.identifier,D,r),u(document,"touchend."+i.identifier,F,r)))}},a.event.special.move={setup:function(){u(this,"movestart.move",a.noop)},teardown:function(){i(this,"movestart.move",a.noop)}},a.event.special.moveend={setup:function(){u(this,"movestart.moveend",a.noop)},teardown:function(){i(this,"movestart.moveend",a.noop)}},u(document,"mousedown.move",function(t){1!==t.which||t.ctrlKey||t.altKey||(t={target:t.target,startX:t.pageX,startY:t.pageY,timeStamp:t.timeStamp},u(document,m.move,l,t),u(document,m.cancel,X,t))}),u(document,"touchstart.move",function(t){var e;n[t.target.tagName.toLowerCase()]||(t={target:(e=t.changedTouches[0]).target,startX:e.pageX,startY:e.pageY,timeStamp:t.timeStamp,identifier:e.identifier},u(document,s+"."+e.identifier,w,t),u(document,"touchend."+e.identifier,y,t))}),"function"==typeof Array.prototype.indexOf)for(var x=a,b=["changedTouches","targetTouches"],j=b.length;j--;)-1===x.event.props.indexOf(b[j])&&x.event.props.push(b[j])});