hammer.min.js
19.7 KB
!function(s,a,t,I){"use strict";function h(t,e,i){return setTimeout(r(t,i),e)}function n(t,e,i){return!!Array.isArray(t)&&(o(t,i[e],i),!0)}function o(t,e,i){var n;if(t)if(t.forEach)t.forEach(e,i);else if(t.length!==I)for(n=0;n<t.length;)e.call(i,t[n],n,t),n++;else for(n in t)t.hasOwnProperty(n)&&e.call(i,t[n],n,t)}function e(n,t,e){var r="DEPRECATED METHOD: "+t+"\n"+e+" AT \n";return function(){var t=new Error("get-stack-trace"),e=t&&t.stack?t.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",i=s.console&&(s.console.warn||s.console.log);return i&&i.call(s.console,r,e),n.apply(this,arguments)}}function i(t,e,i){var n,r=e.prototype;(n=t.prototype=Object.create(r)).constructor=t,n._super=r,i&&J(n,i)}function r(t,e){return function(){return t.apply(e,arguments)}}function u(t,e){return typeof t==tt?t.apply(e&&e[0]||I,e):t}function c(t,e){return t===I?e:t}function l(e,t,i){o(d(t),function(t){e.addEventListener(t,i,!1)})}function p(e,t,i){o(d(t),function(t){e.removeEventListener(t,i,!1)})}function A(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function f(t,e){return-1<t.indexOf(e)}function d(t){return t.trim().split(/\s+/g)}function v(t,e,i){if(t.indexOf&&!i)return t.indexOf(e);for(var n=0;n<t.length;){if(i&&t[n][i]==e||!i&&t[n]===e)return n;n++}return-1}function m(t){return Array.prototype.slice.call(t,0)}function g(t,i,e){for(var n=[],r=[],s=0;s<t.length;){var o=i?t[s][i]:t[s];v(r,o)<0&&n.push(t[s]),r[s]=o,s++}return e&&(n=i?n.sort(function(t,e){return t[i]>e[i]}):n.sort()),n}function T(t,e){for(var i,n,r=e[0].toUpperCase()+e.slice(1),s=0;s<K.length;){if((n=(i=K[s])?i+r:e)in t)return n;s++}return I}function y(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||s}function E(e,t){var i=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){u(e.options.enable,[e])&&i.handler(t)},this.init()}function _(t,e,i){var n=i.pointers.length,r=i.changedPointers.length,s=e&ft&&n-r==0,o=e&(dt|vt)&&n-r==0;i.isFirst=!!s,i.isFinal=!!o,s&&(t.session={}),i.eventType=e,function(t,e){var i=t.session,n=e.pointers,r=n.length;i.firstInput||(i.firstInput=C(e)),1<r&&!i.firstMultiple?i.firstMultiple=C(e):1===r&&(i.firstMultiple=!1);var s=i.firstInput,o=i.firstMultiple,a=o?o.center:s.center,h=e.center=S(n);e.timeStamp=nt(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=x(a,h),e.distance=D(a,h),u=i,c=e,l=c.center,p=u.offsetDelta||{},f=u.prevDelta||{},d=u.prevInput||{},c.eventType!==ft&&d.eventType!==dt||(f=u.prevDelta={x:d.deltaX||0,y:d.deltaY||0},p=u.offsetDelta={x:l.x,y:l.y}),c.deltaX=f.x+(l.x-p.x),c.deltaY=f.y+(l.y-p.y),e.offsetDirection=P(e.deltaX,e.deltaY);var u,c,l,p,f,d;var v=b(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=v.x,e.overallVelocityY=v.y,e.overallVelocity=it(v.x)>it(v.y)?v.x:v.y,e.scale=o?(T=o.pointers,y=n,D(y[0],y[1],St)/D(T[0],T[1],St)):1,e.rotation=o?(m=o.pointers,g=n,x(g[1],g[0],St)+x(m[1],m[0],St)):0,e.maxPointers=i.prevInput?e.pointers.length>i.prevInput.maxPointers?e.pointers.length:i.prevInput.maxPointers:e.pointers.length,function(t,e){var i,n,r,s,o=t.lastInterval||e,a=e.timeStamp-o.timeStamp;if(e.eventType!=vt&&(pt<a||o.velocity===I)){var h=e.deltaX-o.deltaX,u=e.deltaY-o.deltaY,c=b(a,h,u);n=c.x,r=c.y,i=it(c.x)>it(c.y)?c.x:c.y,s=P(h,u),t.lastInterval=e}else i=o.velocity,n=o.velocityX,r=o.velocityY,s=o.direction;e.velocity=i,e.velocityX=n,e.velocityY=r,e.direction=s}(i,e);var m,g;var T,y;var E=t.element;A(e.srcEvent.target,E)&&(E=e.srcEvent.target),e.target=E}(t,i),t.emit("hammer.input",i),t.recognize(i),t.session.prevInput=i}function C(t){for(var e=[],i=0;i<t.pointers.length;)e[i]={clientX:et(t.pointers[i].clientX),clientY:et(t.pointers[i].clientY)},i++;return{timeStamp:nt(),pointers:e,center:S(e),deltaX:t.deltaX,deltaY:t.deltaY}}function S(t){var e=t.length;if(1===e)return{x:et(t[0].clientX),y:et(t[0].clientY)};for(var i=0,n=0,r=0;r<e;)i+=t[r].clientX,n+=t[r].clientY,r++;return{x:et(i/e),y:et(n/e)}}function b(t,e,i){return{x:e/t||0,y:i/t||0}}function P(t,e){return t===e?mt:it(t)>=it(e)?t<0?gt:Tt:e<0?yt:Et}function D(t,e,i){i||(i=Ct);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return Math.sqrt(n*n+r*r)}function x(t,e,i){i||(i=Ct);var n=e[i[0]]-t[i[0]],r=e[i[1]]-t[i[1]];return 180*Math.atan2(r,n)/Math.PI}function w(){this.evEl=Pt,this.evWin=Dt,this.pressed=!1,E.apply(this,arguments)}function O(){this.evEl=Ot,this.evWin=Rt,E.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function R(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,E.apply(this,arguments)}function M(){this.evTarget=Nt,this.targetIds={},E.apply(this,arguments)}function z(){E.apply(this,arguments);var t=r(this.handler,this);this.touch=new M(this.manager,t),this.mouse=new w(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function N(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var i={x:e.clientX,y:e.clientY};this.lastTouches.push(i);var n=this.lastTouches;setTimeout(function(){var t=n.indexOf(i);-1<t&&n.splice(t,1)},Xt)}}function X(t,e){this.manager=t,this.set(e)}function Y(t){this.options=J({},this.defaults,t||{}),this.id=ot++,this.manager=null,this.options.enable=c(this.options.enable,!0),this.state=Vt,this.simultaneous={},this.requireFail=[]}function F(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}function W(t){return t==Et?"down":t==yt?"up":t==gt?"left":t==Tt?"right":""}function q(t,e){var i=e.manager;return i?i.get(t):t}function k(){Y.apply(this,arguments)}function H(){k.apply(this,arguments),this.pX=null,this.pY=null}function L(){k.apply(this,arguments)}function U(){Y.apply(this,arguments),this._timer=null,this._input=null}function V(){k.apply(this,arguments)}function j(){k.apply(this,arguments)}function G(){Y.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Z(t,e){return(e=e||{}).recognizers=c(e.recognizers,Z.defaults.preset),new B(t,e)}function B(t,e){var i;this.options=J({},Z.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((i=this).options.inputClass||(ht?O:ut?M:at?z:w))(i,_),this.touchAction=new X(this,this.options.touchAction),$(this,!0),o(this.options.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function $(i,n){var r,s=i.element;s.style&&(o(i.options.cssProps,function(t,e){r=T(s.style,e),s.style[r]=n?(i.oldCssProps[r]=s.style[r],t):i.oldCssProps[r]||""}),n||(i.oldCssProps={}))}var J,K=["","webkit","Moz","MS","ms","o"],Q=a.createElement("div"),tt="function",et=Math.round,it=Math.abs,nt=Date.now;J="function"!=typeof Object.assign?function(t){if(t===I||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(n!==I&&null!==n)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}:Object.assign;var rt=e(function(t,e,i){for(var n=Object.keys(e),r=0;r<n.length;)(!i||i&&t[n[r]]===I)&&(t[n[r]]=e[n[r]]),r++;return t},"extend","Use `assign`."),st=e(function(t,e){return rt(t,e,!0)},"merge","Use `assign`."),ot=1,at="ontouchstart"in s,ht=T(s,"PointerEvent")!==I,ut=at&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),ct="touch",lt="mouse",pt=25,ft=1,dt=4,vt=8,mt=1,gt=2,Tt=4,yt=8,Et=16,It=gt|Tt,At=yt|Et,_t=It|At,Ct=["x","y"],St=["clientX","clientY"];E.prototype={handler:function(){},init:function(){this.evEl&&l(this.element,this.evEl,this.domHandler),this.evTarget&&l(this.target,this.evTarget,this.domHandler),this.evWin&&l(y(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&p(this.element,this.evEl,this.domHandler),this.evTarget&&p(this.target,this.evTarget,this.domHandler),this.evWin&&p(y(this.element),this.evWin,this.domHandler)}};var bt={mousedown:ft,mousemove:2,mouseup:dt},Pt="mousedown",Dt="mousemove mouseup";i(w,E,{handler:function(t){var e=bt[t.type];e&ft&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=dt),this.pressed&&(e&dt&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:lt,srcEvent:t}))}});var xt={pointerdown:ft,pointermove:2,pointerup:dt,pointercancel:vt,pointerout:vt},wt={2:ct,3:"pen",4:lt,5:"kinect"},Ot="pointerdown",Rt="pointermove pointerup pointercancel";s.MSPointerEvent&&!s.PointerEvent&&(Ot="MSPointerDown",Rt="MSPointerMove MSPointerUp MSPointerCancel"),i(O,E,{handler:function(t){var e=this.store,i=!1,n=t.type.toLowerCase().replace("ms",""),r=xt[n],s=wt[t.pointerType]||t.pointerType,o=s==ct,a=v(e,t.pointerId,"pointerId");r&ft&&(0===t.button||o)?a<0&&(e.push(t),a=e.length-1):r&(dt|vt)&&(i=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:s,srcEvent:t}),i&&e.splice(a,1))}});var Mt={touchstart:ft,touchmove:2,touchend:dt,touchcancel:vt};i(R,E,{handler:function(t){var e=Mt[t.type];if(e===ft&&(this.started=!0),this.started){var i=function(t,e){var i=m(t.touches),n=m(t.changedTouches);return e&(dt|vt)&&(i=g(i.concat(n),"identifier",!0)),[i,n]}.call(this,t,e);e&(dt|vt)&&i[0].length-i[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:ct,srcEvent:t})}}});var zt={touchstart:ft,touchmove:2,touchend:dt,touchcancel:vt},Nt="touchstart touchmove touchend touchcancel";i(M,E,{handler:function(t){var e=zt[t.type],i=function(t,e){var i=m(t.touches),n=this.targetIds;if(e&(2|ft)&&1===i.length)return n[i[0].identifier]=!0,[i,i];var r,s,o=m(t.changedTouches),a=[],h=this.target;if(s=i.filter(function(t){return A(t.target,h)}),e===ft)for(r=0;r<s.length;)n[s[r].identifier]=!0,r++;for(r=0;r<o.length;)n[o[r].identifier]&&a.push(o[r]),e&(dt|vt)&&delete n[o[r].identifier],r++;return a.length?[g(s.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);i&&this.callback(this.manager,e,{pointers:i[0],changedPointers:i[1],pointerType:ct,srcEvent:t})}});var Xt=2500;i(z,E,{handler:function(t,e,i){var n=i.pointerType==ct,r=i.pointerType==lt;if(!(r&&i.sourceCapabilities&&i.sourceCapabilities.firesTouchEvents)){if(n)(function(t,e){t&ft?(this.primaryTouch=e.changedPointers[0].identifier,N.call(this,e)):t&(dt|vt)&&N.call(this,e)}).call(this,e,i);else if(r&&function(t){for(var e=t.srcEvent.clientX,i=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var r=this.lastTouches[n],s=Math.abs(e-r.x),o=Math.abs(i-r.y);if(s<=25&&o<=25)return!0}return!1}.call(this,i))return;this.callback(t,e,i)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Yt=T(Q.style,"touchAction"),Ft=Yt!==I,Wt="compute",qt="manipulation",kt="none",Ht="pan-x",Lt="pan-y",Ut=function(){if(!Ft)return!1;var e={},i=s.CSS&&s.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){e[t]=!i||s.CSS.supports("touch-action",t)}),e}();X.prototype={set:function(t){t==Wt&&(t=this.compute()),Ft&&this.manager.element.style&&Ut[t]&&(this.manager.element.style[Yt]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return o(this.manager.recognizers,function(t){u(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(f(t,kt))return kt;var e=f(t,Ht),i=f(t,Lt);return e&&i?kt:e||i?e?Ht:Lt:f(t,qt)?qt:"auto"}(e.join(" "))},preventDefaults:function(t){var e=t.srcEvent,i=t.offsetDirection;if(!this.manager.session.prevented){var n=this.actions,r=f(n,kt)&&!Ut[kt],s=f(n,Lt)&&!Ut[Lt],o=f(n,Ht)&&!Ut[Ht];if(r){var a=1===t.pointers.length,h=t.distance<2,u=t.deltaTime<250;if(a&&h&&u)return}return o&&s?void 0:r||s&&i&It||o&&i&At?this.preventSrc(e):void 0}e.preventDefault()},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var Vt=1;Y.prototype={defaults:{},set:function(t){return J(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(n(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=q(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},dropRecognizeWith:function(t){return n(t,"dropRecognizeWith",this)||(t=q(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(n(t,"requireFailure",this))return this;var e=this.requireFail;return-1===v(e,t=q(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(n(t,"dropRequireFailure",this))return this;t=q(t,this);var e=v(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return 0<this.requireFail.length},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(e){function t(t){i.manager.emit(t,e)}var i=this,n=this.state;n<8&&t(i.options.event+F(n)),t(i.options.event),e.additionalEvent&&t(e.additionalEvent),8<=n&&t(i.options.event+F(n))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=32)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(32|Vt)))return!1;t++}return!0},recognize:function(t){var e=J({},t);return u(this.options.enable,[this,e])?(56&this.state&&(this.state=Vt),this.state=this.process(e),void(30&this.state&&this.tryEmit(e))):(this.reset(),void(this.state=32))},process:function(t){},getTouchAction:function(){},reset:function(){}},i(k,Y,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,i=t.eventType,n=6&e,r=this.attrTest(t);return n&&(i&vt||!r)?16|e:n||r?i&dt?8|e:2&e?4|e:2:32}}),i(H,k,{defaults:{event:"pan",threshold:10,pointers:1,direction:_t},getTouchAction:function(){var t=this.options.direction,e=[];return t&It&&e.push(Lt),t&At&&e.push(Ht),e},directionTest:function(t){var e=this.options,i=!0,n=t.distance,r=t.direction,s=t.deltaX,o=t.deltaY;return r&e.direction||(n=e.direction&It?(r=0===s?mt:s<0?gt:Tt,i=s!=this.pX,Math.abs(t.deltaX)):(r=0===o?mt:o<0?yt:Et,i=o!=this.pY,Math.abs(t.deltaY))),t.direction=r,i&&n>e.threshold&&r&e.direction},attrTest:function(t){return k.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=W(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),i(L,k,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[kt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||2&this.state)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),i(U,Y,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,r=t.deltaTime>e.time;if(this._input=t,!n||!i||t.eventType&(dt|vt)&&!r)this.reset();else if(t.eventType&ft)this.reset(),this._timer=h(function(){this.state=8,this.tryEmit()},e.time,this);else if(t.eventType&dt)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(t){8===this.state&&(t&&t.eventType&dt?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=nt(),this.manager.emit(this.options.event,this._input)))}}),i(V,k,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[kt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||2&this.state)}}),i(j,k,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:It|At,pointers:1},getTouchAction:function(){return H.prototype.getTouchAction.call(this)},attrTest:function(t){var e,i=this.options.direction;return i&(It|At)?e=t.overallVelocity:i&It?e=t.overallVelocityX:i&At&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&i&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&it(e)>this.options.velocity&&t.eventType&dt},emit:function(t){var e=W(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),i(G,Y,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[qt]},process:function(t){var e=this.options,i=t.pointers.length===e.pointers,n=t.distance<e.threshold,r=t.deltaTime<e.time;if(this.reset(),t.eventType&ft&&0===this.count)return this.failTimeout();if(n&&r&&i){if(t.eventType!=dt)return this.failTimeout();var s=!this.pTime||t.timeStamp-this.pTime<e.interval,o=!this.pCenter||D(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,o&&s?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=h(function(){this.state=8,this.tryEmit()},e.interval,this),2):8}return 32},failTimeout:function(){return this._timer=h(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Z.VERSION="2.0.8",Z.defaults={domEvents:!1,touchAction:Wt,enable:!0,inputTarget:null,inputClass:null,preset:[[V,{enable:!1}],[L,{enable:!1},["rotate"]],[j,{direction:It}],[H,{direction:It},["swipe"]],[G],[G,{event:"doubletap",taps:2},["tap"]],[U]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};B.prototype={set:function(t){return J(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var i,n=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var s=0;s<n.length;)i=n[s],2===e.stopped||r&&i!=r&&!i.canRecognizeWith(r)?i.reset():i.recognize(t),!r&&14&i.state&&(r=e.curRecognizer=i),s++}},get:function(t){if(t instanceof Y)return t;for(var e=this.recognizers,i=0;i<e.length;i++)if(e[i].options.event==t)return e[i];return null},add:function(t){if(n(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},remove:function(t){if(n(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,i=v(e,t);-1!==i&&(e.splice(i,1),this.touchAction.update())}return this},on:function(t,e){if(t!==I&&e!==I){var i=this.handlers;return o(d(t),function(t){i[t]=i[t]||[],i[t].push(e)}),this}},off:function(t,e){if(t!==I){var i=this.handlers;return o(d(t),function(t){e?i[t]&&i[t].splice(v(i[t],e),1):delete i[t]}),this}},emit:function(t,e){var i,n,r;this.options.domEvents&&(i=t,n=e,(r=a.createEvent("Event")).initEvent(i,!0,!0),(r.gesture=n).target.dispatchEvent(r));var s=this.handlers[t]&&this.handlers[t].slice();if(s&&s.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var o=0;o<s.length;)s[o](e),o++}},destroy:function(){this.element&&$(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},J(Z,{INPUT_START:ft,INPUT_MOVE:2,INPUT_END:dt,INPUT_CANCEL:vt,STATE_POSSIBLE:Vt,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:mt,DIRECTION_LEFT:gt,DIRECTION_RIGHT:Tt,DIRECTION_UP:yt,DIRECTION_DOWN:Et,DIRECTION_HORIZONTAL:It,DIRECTION_VERTICAL:At,DIRECTION_ALL:_t,Manager:B,Input:E,TouchAction:X,TouchInput:M,MouseInput:w,PointerEventInput:O,TouchMouseInput:z,SingleTouchInput:R,Recognizer:Y,AttrRecognizer:k,Tap:G,Pan:H,Swipe:j,Pinch:L,Rotate:V,Press:U,on:l,off:p,each:o,merge:st,extend:rt,assign:J,inherit:i,bindFn:r,prefixed:T}),(void 0!==s?s:"undefined"!=typeof self?self:{}).Hammer=Z,"function"==typeof define&&define.amd?define(function(){return Z}):"undefined"!=typeof module&&module.exports?module.exports=Z:s.Hammer=Z}(window,document);