@egjs/axes
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -9,2 +9,5 @@ export declare const DIRECTION_NONE = 1; | ||
export declare const DIRECTION_ALL: number; | ||
export declare const MOUSE_LEFT = "left"; | ||
export declare const MOUSE_RIGHT = "right"; | ||
export declare const MOUSE_MIDDLE = "middle"; | ||
export declare const IOS_EDGE_THRESHOLD = 30; | ||
@@ -11,0 +14,0 @@ export declare const IS_IOS_SAFARI: boolean; |
@@ -11,2 +11,3 @@ import { ExtendedEvent, InputEventType } from "../types"; | ||
abstract onEventEnd(event: InputEventType): void; | ||
abstract onRelease(event: InputEventType): void; | ||
abstract getTouches(event: InputEventType): number; | ||
@@ -13,0 +14,0 @@ protected abstract _getScale(event: InputEventType): number; |
@@ -10,2 +10,3 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
onEventEnd(): void; | ||
onRelease(): void; | ||
getTouches(): number; | ||
@@ -12,0 +13,0 @@ protected _getScale(): number; |
@@ -12,2 +12,3 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
onEventEnd(event: InputEventType): void; | ||
onRelease(): void; | ||
getTouches(): number; | ||
@@ -14,0 +15,0 @@ protected _getScale(): number; |
@@ -11,2 +11,3 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
onEventEnd(event: InputEventType): void; | ||
onRelease(): void; | ||
getTouches(event: InputEventType): number; | ||
@@ -13,0 +14,0 @@ protected _getScale(event: TouchEvent): number; |
@@ -11,2 +11,3 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
onEventEnd(event: InputEventType): void; | ||
onRelease(): void; | ||
getTouches(event: InputEventType): number; | ||
@@ -13,0 +14,0 @@ protected _getScale(event: MouseEvent | TouchEvent): number; |
import { Axis } from "../AxisManager"; | ||
import { AxesOption } from "../Axes"; | ||
import { ActiveInput } from "../types"; | ||
import { ActiveEvent } from "../types"; | ||
export interface InputType { | ||
@@ -23,2 +23,2 @@ axes: string[]; | ||
export declare const toAxis: (source: string[], offset: number[]) => Axis; | ||
export declare const convertInputType: (inputType?: string[]) => ActiveInput; | ||
export declare const convertInputType: (inputType?: string[]) => ActiveEvent; |
@@ -1,2 +0,2 @@ | ||
import { ActiveInput, InputEventType } from "../types"; | ||
import { ActiveEvent, InputEventType } from "../types"; | ||
import { InputType, InputTypeObserver } from "./InputType"; | ||
@@ -21,3 +21,3 @@ export interface PanInputOption { | ||
protected _enabled: boolean; | ||
protected _activeInput: ActiveInput; | ||
protected _activeEvent: ActiveEvent; | ||
private _originalCssProps; | ||
@@ -37,7 +37,8 @@ private _atRightEdge; | ||
protected _onPanend(event: InputEventType): void; | ||
protected _attachWindowEvent(activeInput: ActiveInput): void; | ||
protected _detachWindowEvent(activeInput: ActiveInput): void; | ||
protected _attachWindowEvent(activeEvent: ActiveEvent): void; | ||
protected _detachWindowEvent(activeEvent: ActiveEvent): void; | ||
private _attachElementEvent; | ||
private _detachElementEvent; | ||
private _getOffset; | ||
private _forceRelease; | ||
} |
@@ -15,3 +15,3 @@ import { InputType, InputTypeObserver } from "./InputType"; | ||
private _originalCssProps; | ||
private _activeInput; | ||
private _activeEvent; | ||
private _baseValue; | ||
@@ -18,0 +18,0 @@ constructor(el: string | HTMLElement, options?: PinchInputOption); |
@@ -9,3 +9,3 @@ import { Axis } from "./AxisManager"; | ||
export declare type InputEventType = PointerEvent | MouseEvent | TouchEvent; | ||
export declare type ActiveInput = MouseEventInput | TouchEventInput | TouchMouseEventInput | PointerEventInput; | ||
export declare type ActiveEvent = MouseEventInput | TouchEventInput | TouchMouseEventInput | PointerEventInput; | ||
export interface AxesEvents { | ||
@@ -12,0 +12,0 @@ hold: OnHold; |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-axes | ||
version: 3.0.1-snapshot | ||
version: 3.1.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.eg.agent,t.eg.Component))}(this,function(t,_){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function p(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function h(t,e){return t<e[0]||t>e[1]}function c(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function v(t,e,n){var i=t,r=e[0],s=e[1],a=s-r;return n[1]&&s<t&&(i=(i-s)%a+r),n[0]&&t<r&&(i=(i-r)%a+s),i}function r(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var a,o,g=function(){return(g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},u="undefined"==typeof window?{navigator:{userAgent:""}}:window,l="ontouchstart"in u&&"safari"===t().browser.name,n=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),d={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},f=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,r(n.childNodes)):r(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==u&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in u&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return f(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},m=u.requestAnimationFrame||u.webkitRequestAnimationFrame,E=u.cancelAnimationFrame||u.webkitCancelAnimationFrame;m&&!E?(a={},o=m,m=function(e){var n=o(function(t){a[n]&&e(t)});return a[n]=!0,n},E=function(t){delete a[t]}):m&&E||(m=function(t){return u.setTimeout(function(){t(u.performance&&u.performance.now&&u.performance.now()||(new Date).getTime())},16)},E=u.clearTimeout);function x(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function M(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function b(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function y(t,n){return b(t,function(t,e){return t===n[e]})}function P(t,e){return R[e]||(R[e]=B(e)),R[e](t)}function T(t,n){return t&&n?x(t,function(t,e){return P(t,"number"==typeof n?n:n[e])}):t}function w(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function I(t,e){return 180*Math.atan2(e,t)/Math.PI}function O(e,t){var n,i={};return e&&e.style&&(n=t||d,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function D(t,e,n){return Math.max(Math.min(t,n),e)}function A(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function C(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=F;break;case"pointer":i=N}}),i?new U:e&&n?new q:e?new V:n?new K:null}function S(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var R={},B=function(e){var n=e<1?Math.pow(10,w(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},L=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,a=this;return i=void 0!==e?e:(n=x(t,function(t,e){return n=Math.abs(t-s[e]),i=a._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),D(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t){var n,e,i;this._animateParam&&(n=this.axisManager.get(),e=this.axisManager.map(n,function(t,e){return v(t,e.range,e.circular)}),b(e,function(t,e){return n[e]===t})||this.eventManager.triggerChange(e,n,t,!!t),this._animateParam=null,this._raf&&(i=this._raf,E(i)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==t||!t.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return c(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return v(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=D(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this;this.stopAnimation();var r,s=this._createAnimationParam(t,e,n),a=g({},s.depaPos),o=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!o&&this.axisManager.every(u.destPos,function(t,e){return c(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!y(u.destPos,a)&&(r=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:a,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(a,u.destPos),isTrusted:!!r,inputEvent:r,input:(null==n?void 0:n.input)||null},function(){return i.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t),i=this.axisManager.get(n);if(y(t,i))return this;this.interruptManager.setInterrupt(!0);var r=M(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:p(t,n,i)}),y(r,i)||(0<e?this.animateTo(r,e):(this.stopAnimation(),this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(x(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,a=this._animateParam;a&&(e=(new Date).getTime()-a.startTime,n=(null==t?void 0:t.destPos)||a.destPos,i=(null==t?void 0:t.duration)||a.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,a.delta=this.axisManager.getDelta(r,n),a.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/a.duration,this._durationOffset=s*i-e,a.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:D(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,l=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=g(g({},n),{startTime:(new Date).getTime()}),c=x(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=x(n.destPos,function(t){return t}),(s=function(){var a=l._animateParam,o=((new Date).getTime()-a.startTime+l._durationOffset)/a.duration,u=l.easing(o);l._raf=null;var t=l.axisManager.map(h,function(t,e,n){var i,r=1<=o?a.destPos[n]:t+a.delta[n]*(u-l._prevEasingPer)/(1-l._initialEasingPer),s=v(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),a.destPos[n]-=i,h[n]-=i),s}),e=!l.eventManager.triggerChange(t,h);if(h=t,1<=(l._prevEasingPer=u))return a.destPos=l._getFinalPos(a.destPos,r),y(a.destPos,l.axisManager.get(Object.keys(a.destPos)))||l.eventManager.triggerChange(a.destPos,h),void i();e?l.finish(!1):l._raf=m(s)})()):(this.eventManager.triggerChange(n.destPos),i())},e._getFinalPos=function(t,i){var r=this;return x(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return P(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(w(n.range[0]),w(n.range[1]),w(t)),s=1/Math.pow(10,i)),s||r},t}(),Y=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new _.ComponentEvent("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new _.ComponentEvent("release",g(g({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i){void 0===i&&(i=!1);var r=this.animationManager,s=r.axisManager,a=r.getEventInfo(),o=this._getRoundPos(t,e),u=o.roundPos,h=o.roundDepa,c=s.moveTo(u,h),l=(null==n?void 0:n.event)||(null==a?void 0:a.event)||null,v={pos:c.pos,delta:c.delta,bounceRatio:this._getBounceRatio(c.pos),holding:i,inputEvent:l,isTrusted:!!l,input:(null==n?void 0:n.input)||(null==a?void 0:a.input)||null,set:l?this._createUserControll(c.pos):function(){}},d=new _.ComponentEvent("change",v);return this._axes.trigger(d),l&&s.set(v.set().destPos),!d.isCanceled()},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration);var r=new _.ComponentEvent("animationStart",t);return this._axes.trigger(r),!r.isCanceled()},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new _.ComponentEvent("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new _.ComponentEvent("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:g({},t),duration:e};return function(t,e){return t&&(n.destPos=g({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:T(t,n),roundDepa:T(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),k=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),X=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return x(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):g(g({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=x(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?v(t,e.range,e.circular):0})),{pos:g({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return b(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return M(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return x(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!h(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=g({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),F="ontouchstart"in u,j="PointerEvent"in u,e="MSPointerEvent"in u,N=j||e,W=function(){function t(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),u.removeEventListener("contextmenu",e._stopContextMenu)}}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?I(n.x-e.center.x,n.y-e.center.y):0,a=e?e.deltaX+i.x:i.x,o=e?e.deltaY+i.y:i.y,u=e?a-e.deltaX:0,h=e?o-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:a,deltaY:o,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},e._getButton=function(t){if(this._isTouchEvent(t))return"left";switch(t.buttons){case 1:return"left";case 2:return"right";case 4:return"middle";default:return null}},e._isTouchEvent=function(t){return-1<t.type.indexOf("touch")},e._isValidButton=function(t,e){return-1<e.indexOf(t)},e._preventMouseButton=function(t,e){"right"===e?u.addEventListener("contextmenu",this._stopContextMenu):"middle"===e&&t.preventDefault()},t}(),K=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(W),V=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._baseTouches=t.touches,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(t){this._baseTouches=t.touches},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length||this._baseTouches.length<2?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(W),U=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=j?["pointerdown"]:["MSPointerDown"],t.move=j?["pointermove"]:["MSPointerMove"],t.end=j?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this._updatePointerEvent(t),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:(this._updatePointerEvent(t),this.extendEvent(t))},n.onEventEnd=function(t){this._removePointerEvent(t)},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(W),q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return this._isTouchEvent(t)&&(this._baseTouches=t.touches),e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(t){this._isTouchEvent(t)&&(this._baseTouches=t.touches)},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return this._isTouchEvent(t)?2!==t.touches.length||this._baseTouches.length<2?1:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},t}(W),Q=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,a,o,u;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||((r=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyChanged||(s=this._moveDistance||this._axisManager.get(t.axes),a=x(s,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(a,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?v(t,i,n):t})),this._isOutside&&this._axisManager.every(s,function(t,e){return!h(t,e.range)})&&(this._isOutside=!1),s=this._atOutside(s),a=this._atOutside(a),this.options.nested&&this._isEndofAxis(n,s,a)||(r.__childrenAxesAlreadyChanged=!0),o={input:t,event:e},i?(u=this._animationManager.getDuration(a,s),this._animationManager.animateTo(a,u,o)):this._eventManager.triggerChange(a,s,o,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))))},e.release=function(t,e,n,i){var r,s,a,o,u,h,c,l,v,d,_;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&((r=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyReleased&&(n=n.map(function(){return 0})),s=this._axisManager.get(t.axes),a=this._axisManager.get(),o=this._animationManager.getDisplacement(n),u=A(t.axes,o),h=this._axisManager.get(this._axisManager.map(u,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?s[n]+t:p(s[n]+t,e.range,e.circular,e.bounce)})),r.__childrenAxesAlreadyReleased=!0,0===(c=this._animationManager.getDuration(h,s,i))&&(h=g({},a)),l={depaPos:a,destPos:h,duration:c,delta:this._axisManager.getDelta(a,h),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(l),this._moveDistance=null,v=this._animationManager.getUserControl(l),_={input:t,event:e},(d=y(v.destPos,a))||0===v.duration?(d||this._eventManager.triggerChange(v.destPos,a,_,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(_):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(v.destPos,v.duration,_))},e._atOutside=function(t){var a=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-a._animationManager.interpolate(n-t,r[0]):i<t?i+a._animationManager.interpolate(t-i,r[1]):t})},e._isEndofAxis=function(o,u,h){return this._axisManager.every(u,function(t,e,n){return 0===o[n]||u[n]===h[n]&&(i=t,r=e.range,s=e.bounce,!(a=e.circular)[0]&&i===r[0]-s[0]||!a[1]&&i===r[1]+s[1]);var i,r,s,a})},t}(),z=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=g({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},e),i.interruptManager=new k(i.options),i.axisManager=new X(i.axis),i.eventManager=new Y(i),i.animationManager=new L(i),i.inputObserver=new Q(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.0.1-snapshot",t.TRANSFORM=n,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(_),H=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._activeInput=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this.element=f(t),this.options=g({inputType:["touch","mouse","pointer"],inputButton:["left"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeInput&&(this._detachElementEvent(),this._detachWindowEvent(this._activeInput)),this._attachElementEvent(t),this._originalCssProps=O(this.element),this},e.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeInput),this._originalCssProps!==d&&O(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n=this._activeInput,i=n.onEventStart(t,this.options.inputButton);!i||!this._enabled||1<n.getTouches(t)||!1!==i.srcEvent.cancelable&&(e=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,i),this._atRightEdge=l&&i.center.x>window.innerWidth-e,this._attachWindowEvent(n),n.prevEvent=i)},e._onPanmove=function(t){var e=this,n=this._activeInput,i=n.onEventMove(t,this.options.inputButton);if(i&&this._enabled&&!(1<n.getTouches(t))){var r=this.options,s=r.iOSEdgeSwipeThreshold,a=r.releaseOnScroll,o=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(i.angle,this.options.thresholdAngle);if(!a||i.srcEvent.cancelable){if(n.prevEvent&&l){if(i.center.x<0)return this._detachWindowEvent(n),void this._observer.release(this,n.prevEvent,[0,0]);this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),i.deltaX<-s?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){e._detachWindowEvent(n),e._observer.release(e,n.prevEvent,[0,0])},100))}var u=this._getOffset([i.offsetX,i.offsetY],[S(6,this._direction,o),S(24,this._direction,o)]),h=u.some(function(t){return 0!==t});h&&(!1!==i.srcEvent.cancelable&&i.srcEvent.preventDefault(),i.srcEvent.stopPropagation()),(i.preventSystemEvent=h)&&this._observer.change(this,i,A(this.axes,u)),n.prevEvent=i}else this._onPanend(t)}},e._onPanend=function(t){var e,n,i=this._activeInput;i.onEventEnd(t),this._enabled&&0===i.getTouches(t)&&(this._detachWindowEvent(i),clearTimeout(this._rightEdgeTimer),e=i.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[S(6,this._direction),S(24,this._direction)]),this._observer.release(this,e,n),i.prevEvent=null)},e._attachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.addEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.addEventListener(t,e._onPanend)})},e._detachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend)})},e._attachElementEvent=function(t){var n=this,e=C(this.options.inputType);if(!e)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeInput=e)&&e.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.addEventListener(t,n._onPanstart)})},e._detachElementEvent=function(){var n=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.removeEventListener(t,n._onPanstart)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),G=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=z.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n=this._activeInput,i=n.onEventStart(t,this.options.inputButton);i&&this.isEnabled()&&(e=this.element.getBoundingClientRect(),this._observer.hold(this,i),this._attachWindowEvent(n),this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(i),n.prevEvent=i)},e._onPanmove=function(t){var e=this._activeInput,n=e.onEventMove(t,this.options.inputButton);n&&this.isEnabled()&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation(),this._triggerChange(n),e.prevEvent=n)},e._onPanend=function(t){var e,n,i,r,s=this._activeInput;s.onEventEnd(t),this.isEnabled()&&(e=s.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),s.prevEvent=null,this._detachWindowEvent(s))},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=I(n,i),s=r<0?360+r:r,a=this._getQuadrant(t.center.x,t.center.y),o=this._getDifference(this._prevAngle,s,this._prevQuadrant,a);this._prevAngle=s,this._prevQuadrant=a,0!==o&&(this._lastDiff=o,this._observer.change(this,t,A(this.axes,[-o])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(H),Z=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeInput=null,this.element=f(t),this.options=g({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=O(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==d&&O(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e=this._activeInput,n=e.onEventStart(t);n&&this._enabled&&2===e.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e.prevEvent=n)},e._onPinchMove=function(t){var e,n=this._activeInput,i=n.onEventMove(t);i&&this._pinchFlag&&this._enabled&&2===n.getTouches(t)&&(e=this._getOffset(i.scale,n.prevEvent.scale),this._observer.change(this,t,A(this.axes,[e])),n.prevEvent=i)},e._onPinchEnd=function(t){var e=this._activeInput;e.onEventEnd(t),!this._pinchFlag||!this._enabled||2<=e.getTouches(t)||(this._observer.release(this,t,[0],0),this._baseValue=null,this._pinchFlag=!1,e.prevEvent=null)},e._attachEvent=function(t){var e=this,n=C(this.options.inputType);if(!n)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),J=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=f(t),this.options=g({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,A(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),$=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=f(t),this.options=g({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,A(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return z.PanInput=H,z.RotatePanInput=G,z.PinchInput=Z,z.WheelInput=J,z.MoveKeyInput=$,z}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/agent"),require("@egjs/component")):"function"==typeof define&&define.amd?define(["@egjs/agent","@egjs/component"],e):(t.eg=t.eg||{},t.eg.Axes=e(t.eg.agent,t.eg.Component))}(this,function(t,d){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function f(t,e,n,i){var s=t,r=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],s=Math.max(r[0],s);return Math.min(r[1],s)}function h(t,e){return t<e[0]||t>e[1]}function c(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function v(t,e,n){var i=t,s=e[0],r=e[1],a=r-s;return n[1]&&r<t&&(i=(i-r)%a+s),n[0]&&t<s&&(i=(i-s)%a+r),i}function s(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var a,o,g=function(){return(g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},u="undefined"==typeof window?{navigator:{userAgent:""}}:window,l="left",_="right",p="middle",m="ontouchstart"in u&&"safari"===t().browser.name,n=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),E={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},x=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,s(n.childNodes)):s(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==u&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in u&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return x(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},b=u.requestAnimationFrame||u.webkitRequestAnimationFrame,M=u.cancelAnimationFrame||u.webkitCancelAnimationFrame;b&&!M?(a={},o=b,b=function(e){var n=o(function(t){a[n]&&e(t)});return a[n]=!0,n},M=function(t){delete a[t]}):b&&M||(b=function(t){return u.setTimeout(function(){t(u.performance&&u.performance.now&&u.performance.now()||(new Date).getTime())},16)},M=u.clearTimeout);function y(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function P(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function T(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function w(t,n){return T(t,function(t,e){return t===n[e]})}function O(t,e){return Y[e]||(Y[e]=k(e)),Y[e](t)}function D(t,n){return t&&n?y(t,function(t,e){return O(t,"number"==typeof n?n:n[e])}):t}function I(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function A(t,e){return 180*Math.atan2(e,t)/Math.PI}function C(e,t){var n,i={};return e&&e.style&&(n=t||E,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function R(t,e,n){return Math.max(Math.min(t,n),e)}function S(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function B(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=W;break;case"pointer":i=V}}),i?new z:e&&n?new H:e?new Q:n?new q:null}function L(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var Y={},k=function(e){var n=e<1?Math.pow(10,I(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},X=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,s=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=s,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(r,t,e){var n,i,a=this;return i=void 0!==e?e:(n=y(t,function(t,e){return n=Math.abs(t-r[e]),i=a._options.deceleration,(s=Math.sqrt(n/i*2))<100?0:s;var n,i,s}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),R(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t){var n,e,i;this._animateParam&&(n=this.axisManager.get(),e=this.axisManager.map(n,function(t,e){return v(t,e.range,e.circular)}),T(e,function(t,e){return n[e]===t})||this.eventManager.triggerChange(e,n,t,!!t),this._animateParam=null,this._raf&&(i=this._raf,M(i)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==t||!t.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return c(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return v(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=R(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this;this.stopAnimation();var s,r=this._createAnimationParam(t,e,n),a=g({},r.depaPos),o=this.eventManager.triggerAnimationStart(r),u=this.getUserControl(r);!o&&this.axisManager.every(u.destPos,function(t,e){return c(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),o&&!w(u.destPos,a)&&(s=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:a,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(a,u.destPos),isTrusted:!!s,inputEvent:s,input:(null==n?void 0:n.input)||null},function(){return i.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t),i=this.axisManager.get(n);if(w(t,i))return this;this.interruptManager.setInterrupt(!0);var s=P(t,function(t,e){return i[e]!==t});return Object.keys(s).length?(s=this.axisManager.map(s,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:f(t,n,i)}),w(s,i)||(0<e?this.animateTo(s,e):(this.stopAnimation(),this.eventManager.triggerChange(s),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(y(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,s,r,a=this._animateParam;a&&(e=(new Date).getTime()-a.startTime,n=(null==t?void 0:t.destPos)||a.destPos,i=(null==t?void 0:t.duration)||a.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(s=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,a.delta=this.axisManager.getDelta(s,n),a.destPos=n),null!=t&&t.duration&&(r=(e+this._durationOffset)/a.duration,this._durationOffset=r*i-e,a.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),s=t,r=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:s,duration:R(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,s),inputEvent:r,input:(null==n?void 0:n.input)||null,isTrusted:!!r,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,s,r,l=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=g(g({},n),{startTime:(new Date).getTime()}),c=y(h,function(t,e){return t<=n.destPos[e]?1:-1}),s=y(n.destPos,function(t){return t}),(r=function(){var a=l._animateParam,o=((new Date).getTime()-a.startTime+l._durationOffset)/a.duration,u=l.easing(o);l._raf=null;var t=l.axisManager.map(h,function(t,e,n){var i,s=1<=o?a.destPos[n]:t+a.delta[n]*(u-l._prevEasingPer)/(1-l._initialEasingPer),r=v(s,e.range,e.circular);return s!==r&&(i=c[n]*(e.range[1]-e.range[0]),a.destPos[n]-=i,h[n]-=i),r}),e=!l.eventManager.triggerChange(t,h);if(h=t,1<=(l._prevEasingPer=u))return a.destPos=l._getFinalPos(a.destPos,s),w(a.destPos,l.axisManager.get(Object.keys(a.destPos)))||l.eventManager.triggerChange(a.destPos,h),void i();e?l.finish(!1):l._raf=b(r)})()):(this.eventManager.triggerChange(n.destPos),i())},e._getFinalPos=function(t,i){var s=this;return y(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=s._getRoundUnit(t,e);return O(t,n)})},e._getRoundUnit=function(t,e){var n,i,s=this._options.round,r=null;return s||(n=this.axisManager.getAxisOptions(e),i=Math.max(I(n.range[0]),I(n.range[1]),I(t)),r=1/Math.pow(10,i)),r||s},t}(),F=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new d.ComponentEvent("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new d.ComponentEvent("release",g(g({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i){void 0===i&&(i=!1);var s=this.animationManager,r=s.axisManager,a=s.getEventInfo(),o=this._getRoundPos(t,e),u=o.roundPos,h=o.roundDepa,c=r.moveTo(u,h),l=(null==n?void 0:n.event)||(null==a?void 0:a.event)||null,v={pos:c.pos,delta:c.delta,bounceRatio:this._getBounceRatio(c.pos),holding:i,inputEvent:l,isTrusted:!!l,input:(null==n?void 0:n.input)||(null==a?void 0:a.input)||null,set:l?this._createUserControll(c.pos):function(){}},_=new d.ComponentEvent("change",v);return this._axes.trigger(_),l&&r.set(v.set().destPos),!_.isCanceled()},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration);var s=new d.ComponentEvent("animationStart",t);return this._axes.trigger(s),!s.isCanceled()},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new d.ComponentEvent("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new d.ComponentEvent("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:g({},t),duration:e};return function(t,e){return t&&(n.destPos=g({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:D(t,n),roundDepa:D(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),j=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),N=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return y(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):g(g({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=y(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?v(t,e.range,e.circular):0})),{pos:g({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return T(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return P(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return y(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!h(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var s=this;Object.keys(this._axis).forEach(function(i){s._axis[i]=g({range:[0,100],bounce:[0,0],circular:[!1,!1]},s._axis[i]),["bounce","circular"].forEach(function(t){var e=s._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),W="ontouchstart"in u,K="PointerEvent"in u,e="MSPointerEvent"in u,V=K||e,U=function(){function t(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),u.removeEventListener("contextmenu",e._stopContextMenu)}}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},s=e?this._getScale(t):1,r=e?A(n.x-e.center.x,n.y-e.center.y):0,a=e?e.deltaX+i.x:i.x,o=e?e.deltaY+i.y:i.y,u=e?a-e.deltaX:0,h=e?o-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:s,angle:r,center:n,deltaX:a,deltaY:o,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},e._getButton=function(t){var e={1:l,2:_,4:p},n=this._isTouchEvent(t)?l:e[t.buttons];return n||null},e._isTouchEvent=function(t){return-1<t.type.indexOf("touch")},e._isValidButton=function(t,e){return-1<e.indexOf(t)},e._preventMouseButton=function(t,e){e===_?u.addEventListener("contextmenu",this._stopContextMenu):e===p&&t.preventDefault()},t}(),q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}r(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(){},n.onRelease=function(){this.prevEvent=null},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(U),Q=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}r(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._baseTouches=t.touches,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(t){this._baseTouches=t.touches},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length||this._baseTouches.length<2?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(U),z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=K?["pointerdown"]:["MSPointerDown"],t.move=K?["pointermove"]:["MSPointerMove"],t.end=K?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}r(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this._updatePointerEvent(t),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:(this._updatePointerEvent(t),this.extendEvent(t))},n.onEventEnd=function(t){this._removePointerEvent(t)},n.onRelease=function(){this.prevEvent=null,this._firstInputs=[],this._recentInputs=[]},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,s=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(s=!0,i._recentInputs[e]=n)}),s||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(U),H=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}r(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return this._isTouchEvent(t)&&(this._baseTouches=t.touches),e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(t){this._isTouchEvent(t)&&(this._baseTouches=t.touches)},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return this._isTouchEvent(t)?2!==t.touches.length||this._baseTouches.length<2?1:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),s=i[0],r=i[1];return s.id===r.id?{x:s.x-r.x,y:s.y-r.y}:{x:0,y:0}},t}(U),G=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,s=t.axisManager,r=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=s,this._animationManager=r}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var s,r,a,o,u;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||((s=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyChanged||(r=this._moveDistance||this._axisManager.get(t.axes),a=y(r,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(a,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?v(t,i,n):t})),this._isOutside&&this._axisManager.every(r,function(t,e){return!h(t,e.range)})&&(this._isOutside=!1),r=this._atOutside(r),a=this._atOutside(a),this.options.nested&&this._isEndofAxis(n,r,a)||(s.__childrenAxesAlreadyChanged=!0),o={input:t,event:e},i?(u=this._animationManager.getDuration(a,r),this._animationManager.animateTo(a,u,o)):this._eventManager.triggerChange(a,r,o,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))))},e.release=function(t,e,n,i){var s,r,a,o,u,h,c,l,v,_,d;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&((s=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyReleased&&(n=n.map(function(){return 0})),r=this._axisManager.get(t.axes),a=this._axisManager.get(),o=this._animationManager.getDisplacement(n),u=S(t.axes,o),h=this._axisManager.get(this._axisManager.map(u,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?r[n]+t:f(r[n]+t,e.range,e.circular,e.bounce)})),s.__childrenAxesAlreadyReleased=!0,0===(c=this._animationManager.getDuration(h,r,i))&&(h=g({},a)),l={depaPos:a,destPos:h,duration:c,delta:this._axisManager.getDelta(a,h),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(l),this._moveDistance=null,v=this._animationManager.getUserControl(l),d={input:t,event:e},(_=w(v.destPos,a))||0===v.duration?(_||this._eventManager.triggerChange(v.destPos,a,d,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(d):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(v.destPos,v.duration,d))},e._atOutside=function(t){var a=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],s=e.bounce,r=e.circular;return r&&(r[0]||r[1])?t:t<n?n-a._animationManager.interpolate(n-t,s[0]):i<t?i+a._animationManager.interpolate(t-i,s[1]):t})},e._isEndofAxis=function(o,u,h){return this._axisManager.every(u,function(t,e,n){return 0===o[n]||u[n]===h[n]&&(i=t,s=e.range,r=e.bounce,!(a=e.circular)[0]&&i===s[0]-r[0]||!a[1]&&i===s[1]+r[1]);var i,s,r,a})},t}(),Z=function(s){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=s.call(this)||this;return i.axis=t,i._inputs=[],i.options=g({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},e),i.interruptManager=new j(i.options),i.axisManager=new N(i.axis),i.eventManager=new F(i),i.animationManager=new X(i),i.inputObserver=new G(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}r(t,s);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.1.1",t.TRANSFORM=n,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(d),J=function(){function t(t,e){var n=this;this.axes=[],this.element=null,this._enabled=!1,this._activeEvent=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this._forceRelease=function(){var t=n._activeEvent;n._detachWindowEvent(t),n._observer.release(n,t.prevEvent,[0,0]),t.onRelease()},this.element=x(t),this.options=g({inputType:["touch","mouse","pointer"],inputButton:[l],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeEvent&&(this._detachElementEvent(),this._detachWindowEvent(this._activeEvent)),this._attachElementEvent(t),this._originalCssProps=C(this.element),this},e.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeEvent),this._originalCssProps!==E&&C(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n=this._activeEvent,i=n.onEventStart(t,this.options.inputButton);!i||!this._enabled||1<n.getTouches(t)||!1!==i.srcEvent.cancelable&&(e=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,i),this._atRightEdge=m&&i.center.x>window.innerWidth-e,this._attachWindowEvent(n),n.prevEvent=i)},e._onPanmove=function(t){var e=this,n=this._activeEvent,i=n.onEventMove(t,this.options.inputButton);if(i&&this._enabled&&!(1<n.getTouches(t))){var s=this.options,r=s.iOSEdgeSwipeThreshold,a=s.releaseOnScroll,o=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(i.angle,this.options.thresholdAngle);if(!a||i.srcEvent.cancelable){if(n.prevEvent&&m){if(i.center.x<0)return void this._forceRelease();this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),i.deltaX<-r?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){return e._forceRelease()},100))}var u=this._getOffset([i.offsetX,i.offsetY],[L(6,this._direction,o),L(24,this._direction,o)]),h=u.some(function(t){return 0!==t});h&&(!1!==i.srcEvent.cancelable&&i.srcEvent.preventDefault(),i.srcEvent.stopPropagation()),(i.preventSystemEvent=h)&&this._observer.change(this,i,S(this.axes,u)),n.prevEvent=i}else this._onPanend(t)}},e._onPanend=function(t){var e,n,i=this._activeEvent;i.onEventEnd(t),this._enabled&&0===i.getTouches(t)&&(this._detachWindowEvent(i),clearTimeout(this._rightEdgeTimer),e=i.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[L(6,this._direction),L(24,this._direction)]),this._observer.release(this,e,n),i.onRelease())},e._attachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.addEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.addEventListener(t,e._onPanend)})},e._detachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend)})},e._attachElementEvent=function(t){var n=this,e=B(this.options.inputType);if(!e)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeEvent=e)&&e.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.addEventListener(t,n._onPanstart)})},e._detachElementEvent=function(){var n=this,t=this._activeEvent;null!=t&&t.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.removeEventListener(t,n._onPanstart)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),$=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}r(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=Z.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n=this._activeEvent,i=n.onEventStart(t,this.options.inputButton);i&&this.isEnabled()&&(e=this.element.getBoundingClientRect(),this._observer.hold(this,i),this._attachWindowEvent(n),this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(i),n.prevEvent=i)},e._onPanmove=function(t){var e=this._activeEvent,n=e.onEventMove(t,this.options.inputButton);n&&this.isEnabled()&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation(),this._triggerChange(n),e.prevEvent=n)},e._onPanend=function(t){var e,n,i,s,r=this._activeEvent;r.onEventEnd(t),this.isEnabled()&&(e=r.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,s=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[s*this._coefficientForDistanceToAngle]),r.onRelease(),this._detachWindowEvent(r))},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,s=A(n,i),r=s<0?360+s:s,a=this._getQuadrant(t.center.x,t.center.y),o=this._getDifference(this._prevAngle,r,this._prevQuadrant,a);this._prevAngle=r,this._prevQuadrant=a,0!==o&&(this._lastDiff=o,this._observer.change(this,t,S(this.axes,[-o])))},e._getDifference=function(t,e,n,i){var s=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return s},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,s=n.y,r=0;return 0<=i&&0<=s?r=1:i<0&&0<=s?r=2:i<0&&s<0?r=3:0<=i&&s<0&&(r=4),r},t}(J),tt=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeEvent=null,this.element=x(t),this.options=g({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeEvent&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=C(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==E&&C(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e=this._activeEvent,n=e.onEventStart(t);n&&this._enabled&&2===e.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e.prevEvent=n)},e._onPinchMove=function(t){var e,n=this._activeEvent,i=n.onEventMove(t);i&&this._pinchFlag&&this._enabled&&2===n.getTouches(t)&&(e=this._getOffset(i.scale,n.prevEvent.scale),this._observer.change(this,t,S(this.axes,[e])),n.prevEvent=i)},e._onPinchEnd=function(t){var e=this._activeEvent;e.onEventEnd(t),!this._pinchFlag||!this._enabled||2<=e.getTouches(t)||(this._observer.release(this,t,[0],0),e.onRelease(),this._baseValue=null,this._pinchFlag=!1)},e._attachEvent=function(t){var e=this,n=B(this.options.inputType);if(!n)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeEvent=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeEvent;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),et=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=x(t),this.options=g({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,S(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),nt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=x(t),this.options=g({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,s=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,s=1;break;case 38:case 87:s=1;break;default:n=!1}(-1===s&&!this.axes[0]||1===s&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===s?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,S(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return Z.PanInput=J,Z.RotatePanInput=$,Z.PinchInput=tt,Z.WheelInput=et,Z.MoveKeyInput=nt,Z}); | ||
//# sourceMappingURL=axes.min.js.map |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-axes | ||
version: 3.0.1-snapshot | ||
version: 3.1.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var _=function(){return(_=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),o=[];try{for(;(void 0===e||0<e--)&&!(i=s.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}(arguments[e]));return t}function l(t){return void 0===t}function p(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function h(t,e){return t<e[0]||t>e[1]}function v(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function d(t,e,n){var i=t,r=e[0],s=e[1],o=s-r;return n[1]&&s<t&&(i=(i-s)%o+r),n[0]&&t<r&&(i=(i-r)%o+s),i}var r,a=function(){function t(t,e){var n,i;if(this._canceled=!1,e)try{for(var r=c(Object.keys(e)),s=r.next();!s.done;s=r.next()){var o=s.value;this[o]=e[o]}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.eventType=t}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),t=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof a?e.eventType:e,r=o(this._eventHandler[i]||[]);return r.length<=0||(e instanceof a?(e.currentTarget=this,r.forEach(function(t){t(e)})):r.forEach(function(t){t.apply(void 0,o(n))})),this},e.once=function(n,i){var r,s=this;if("object"==typeof n&&l(i)){var t=n;for(var e in t)this.once(e,t[e]);return this}return"string"==typeof n&&"function"==typeof i&&(r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,o(t)),s.off(n,r)},this.on(n,r)),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&l(e)){var n=t;for(var i in n)this.on(i,n[i]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(r=this._eventHandler[t],l(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(l(t))return this._eventHandler={},this;if(l(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r=t;for(var s in r)this.off(s,r[s]);return this}var o=this._eventHandler[t];if(o){var a=0;try{for(var u=c(o),h=u.next();!h.done;h=u.next()){if(h.value===e){o.splice(a,1),o.length<=0&&delete this._eventHandler[t];break}a++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="3.0.2",t}(),f=a;function e(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return!0;return!1}function u(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return t[i];return null}function g(t,e){try{return new RegExp(t,"g").exec(e)}catch(t){return null}}function m(t){return t.replace(/_/g,".")}function E(t,r){var s=null,o="-1";return e(t,function(t){var e,n,i=g("("+t.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r);return i&&!t.brand&&(s=t,o=i[3]||"-1",t.versionAlias?o=t.versionAlias:t.versionTest&&(e=t.versionTest.toLowerCase(),n=g("("+e+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r),o=(n?n[3]:"")||o),o=m(o),1)}),{preset:s,version:o}}function n(t,n){return u(t,function(t){var e=t.brand;return g(""+n.test,e.toLowerCase())})}r="undefined"==typeof window?{navigator:{userAgent:""}}:window;var b=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],y=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",brand:!0}],x=[{test:"applewebkit",id:"webkit"}],M=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],w=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"mac os x",id:"mac"},{test:"android",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function P(t){var e=function(t){var e=t;if(void 0===e){if("undefined"==typeof navigator||!navigator)return"";e=navigator.userAgent||""}return e.toLowerCase()}(t),n=!!/mobi/g.exec(e),i={name:"unknown",version:"-1",majorVersion:-1,webview:!!E(M,e).preset,chromium:!!E(y,e).preset,webkit:!1},r={name:"unknown",version:"-1",majorVersion:-1},s=E(b,e),o=s.preset,a=s.version,u=E(w,e),h=u.preset,c=u.version;return i.webkit=!i.chromium&&!!E(x,e).preset,h&&(r.name=h.id,r.version=c,r.majorVersion=parseInt(c,10)),o&&(i.name=o.id,i.version=a,i.webview&&"ios"===r.name&&"safari"!==i.name&&(i.webview=!1)),i.majorVersion=parseInt(i.version,10),{browser:i,os:r,isMobile:n,isHints:!1}}function T(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var I,O,A,D,C,S,R,k,L,B,j,Y,X="ontouchstart"in r&&"safari"===(void 0===I&&function(){if("undefined"!=typeof navigator&&navigator&&navigator.userAgentData){var t=navigator.userAgentData,e=t.brands||t.uaList;return e&&e.length}}()?(C=navigator.userAgentData,S=(C.uaList||C.brands).slice(),R=C.mobile||!1,k=S[0],L={name:k.brand,version:k.version,majorVersion:-1,webkit:!1,webview:e(M,function(t){return n(S,t)}),chromium:e(y,function(t){return n(S,t)})},B={name:"unknown",version:"-1",majorVersion:-1},L.webkit=!L.chromium&&e(x,function(t){return n(S,t)}),O&&(A=O.platform.toLowerCase(),D=u(w,function(t){return new RegExp(""+t.test,"g").exec(A)}),B.name=D?D.id:A,B.version=O.platformVersion),e(b,function(t){var e=n(S,t);return e&&(L.name=t.id,L.version=O?O.uaFullVersion:e.version,1)}),"Linux armv8l"===navigator.platform?B.name="android":L.webkit&&(B.name=R?"ios":"mac"),"ios"===B.name&&L.webview&&(L.version="-1"),B.version=m(B.version),L.version=m(L.version),B.majorVersion=parseInt(B.version,10),L.majorVersion=parseInt(L.version,10),{browser:L,os:B,isMobile:R,isHints:!0}):P(I)).browser.name,F=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),V={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},N=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,T(n.childNodes)):T(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==r&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return N(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},W=r.requestAnimationFrame||r.webkitRequestAnimationFrame,H=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;W&&!H?(j={},Y=W,W=function(e){var n=Y(function(t){j[n]&&e(t)});return j[n]=!0,n},H=function(t){delete j[t]}):W&&H||(W=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},H=r.clearTimeout);function K(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function U(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function q(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function Q(t,n){return q(t,function(t,e){return t===n[e]})}function z(t,e){return rt[e]||(rt[e]=st(e)),rt[e](t)}function G(t,n){return t&&n?K(t,function(t,e){return z(t,"number"==typeof n?n:n[e])}):t}function Z(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function J(t,e){return 180*Math.atan2(e,t)/Math.PI}function $(e,t){var n,i={};return e&&e.style&&(n=t||V,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function tt(t,e,n){return Math.max(Math.min(t,n),e)}function et(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function nt(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=ct;break;case"pointer":i=dt}}),i?new gt:e&&n?new mt:e?new pt:n?new _t:null}function it(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var rt={},st=function(e){var n=e<1?Math.pow(10,Z(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},ot=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,o=this;return i=void 0!==e?e:(n=K(t,function(t,e){return n=Math.abs(t-s[e]),i=o._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),tt(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t){var n,e,i;this._animateParam&&(n=this.axisManager.get(),e=this.axisManager.map(n,function(t,e){return d(t,e.range,e.circular)}),q(e,function(t,e){return n[e]===t})||this.eventManager.triggerChange(e,n,t,!!t),this._animateParam=null,this._raf&&(i=this._raf,H(i)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==t||!t.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return v(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return d(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=tt(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this;this.stopAnimation();var r,s=this._createAnimationParam(t,e,n),o=_({},s.depaPos),a=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!a&&this.axisManager.every(u.destPos,function(t,e){return v(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),a&&!Q(u.destPos,o)&&(r=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:o,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(o,u.destPos),isTrusted:!!r,inputEvent:r,input:(null==n?void 0:n.input)||null},function(){return i.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t),i=this.axisManager.get(n);if(Q(t,i))return this;this.interruptManager.setInterrupt(!0);var r=U(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:p(t,n,i)}),Q(r,i)||(0<e?this.animateTo(r,e):(this.stopAnimation(),this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(K(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,o=this._animateParam;o&&(e=(new Date).getTime()-o.startTime,n=(null==t?void 0:t.destPos)||o.destPos,i=(null==t?void 0:t.duration)||o.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,o.delta=this.axisManager.getDelta(r,n),o.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/o.duration,this._durationOffset=s*i-e,o.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:tt(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,l=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=_(_({},n),{startTime:(new Date).getTime()}),c=K(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=K(n.destPos,function(t){return t}),(s=function(){var o=l._animateParam,a=((new Date).getTime()-o.startTime+l._durationOffset)/o.duration,u=l.easing(a);l._raf=null;var t=l.axisManager.map(h,function(t,e,n){var i,r=1<=a?o.destPos[n]:t+o.delta[n]*(u-l._prevEasingPer)/(1-l._initialEasingPer),s=d(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),o.destPos[n]-=i,h[n]-=i),s}),e=!l.eventManager.triggerChange(t,h);if(h=t,1<=(l._prevEasingPer=u))return o.destPos=l._getFinalPos(o.destPos,r),Q(o.destPos,l.axisManager.get(Object.keys(o.destPos)))||l.eventManager.triggerChange(o.destPos,h),void i();e?l.finish(!1):l._raf=W(s)})()):(this.eventManager.triggerChange(n.destPos),i())},e._getFinalPos=function(t,i){var r=this;return K(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return z(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(Z(n.range[0]),Z(n.range[1]),Z(t)),s=1/Math.pow(10,i)),s||r},t}(),at=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new f("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new f("release",_(_({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i){void 0===i&&(i=!1);var r=this.animationManager,s=r.axisManager,o=r.getEventInfo(),a=this._getRoundPos(t,e),u=a.roundPos,h=a.roundDepa,c=s.moveTo(u,h),l=(null==n?void 0:n.event)||(null==o?void 0:o.event)||null,v={pos:c.pos,delta:c.delta,bounceRatio:this._getBounceRatio(c.pos),holding:i,inputEvent:l,isTrusted:!!l,input:(null==n?void 0:n.input)||(null==o?void 0:o.input)||null,set:l?this._createUserControll(c.pos):function(){}},d=new f("change",v);return this._axes.trigger(d),l&&s.set(v.set().destPos),!d.isCanceled()},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration);var r=new f("animationStart",t);return this._axes.trigger(r),!r.isCanceled()},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new f("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new f("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:_({},t),duration:e};return function(t,e){return t&&(n.destPos=_({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:G(t,n),roundDepa:G(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),ut=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),ht=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return K(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):_(_({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=K(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?d(t,e.range,e.circular):0})),{pos:_({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return q(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return U(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return K(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!h(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=_({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),ct="ontouchstart"in r,lt="PointerEvent"in r,vt="MSPointerEvent"in r,dt=lt||vt,ft=function(){function t(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),r.removeEventListener("contextmenu",e._stopContextMenu)}}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?J(n.x-e.center.x,n.y-e.center.y):0,o=e?e.deltaX+i.x:i.x,a=e?e.deltaY+i.y:i.y,u=e?o-e.deltaX:0,h=e?a-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:o,deltaY:a,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},e._getButton=function(t){if(this._isTouchEvent(t))return"left";switch(t.buttons){case 1:return"left";case 2:return"right";case 4:return"middle";default:return null}},e._isTouchEvent=function(t){return-1<t.type.indexOf("touch")},e._isValidButton=function(t,e){return-1<e.indexOf(t)},e._preventMouseButton=function(t,e){"right"===e?r.addEventListener("contextmenu",this._stopContextMenu):"middle"===e&&t.preventDefault()},t}(),_t=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(){},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(ft),pt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._baseTouches=t.touches,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(t){this._baseTouches=t.touches},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length||this._baseTouches.length<2?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(ft),gt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=lt?["pointerdown"]:["MSPointerDown"],t.move=lt?["pointermove"]:["MSPointerMove"],t.end=lt?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this._updatePointerEvent(t),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:(this._updatePointerEvent(t),this.extendEvent(t))},n.onEventEnd=function(t){this._removePointerEvent(t)},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(ft),mt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return this._isTouchEvent(t)&&(this._baseTouches=t.touches),e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(t){this._isTouchEvent(t)&&(this._baseTouches=t.touches)},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return this._isTouchEvent(t)?2!==t.touches.length||this._baseTouches.length<2?1:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},t}(ft),Et=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,o,a,u;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||((r=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyChanged||(s=this._moveDistance||this._axisManager.get(t.axes),o=K(s,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(o,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?d(t,i,n):t})),this._isOutside&&this._axisManager.every(s,function(t,e){return!h(t,e.range)})&&(this._isOutside=!1),s=this._atOutside(s),o=this._atOutside(o),this.options.nested&&this._isEndofAxis(n,s,o)||(r.__childrenAxesAlreadyChanged=!0),a={input:t,event:e},i?(u=this._animationManager.getDuration(o,s),this._animationManager.animateTo(o,u,a)):this._eventManager.triggerChange(o,s,a,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))))},e.release=function(t,e,n,i){var r,s,o,a,u,h,c,l,v,d,f;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&((r=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyReleased&&(n=n.map(function(){return 0})),s=this._axisManager.get(t.axes),o=this._axisManager.get(),a=this._animationManager.getDisplacement(n),u=et(t.axes,a),h=this._axisManager.get(this._axisManager.map(u,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?s[n]+t:p(s[n]+t,e.range,e.circular,e.bounce)})),r.__childrenAxesAlreadyReleased=!0,0===(c=this._animationManager.getDuration(h,s,i))&&(h=_({},o)),l={depaPos:o,destPos:h,duration:c,delta:this._axisManager.getDelta(o,h),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(l),this._moveDistance=null,v=this._animationManager.getUserControl(l),f={input:t,event:e},(d=Q(v.destPos,o))||0===v.duration?(d||this._eventManager.triggerChange(v.destPos,o,f,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(f):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(v.destPos,v.duration,f))},e._atOutside=function(t){var o=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-o._animationManager.interpolate(n-t,r[0]):i<t?i+o._animationManager.interpolate(t-i,r[1]):t})},e._isEndofAxis=function(a,u,h){return this._axisManager.every(u,function(t,e,n){return 0===a[n]||u[n]===h[n]&&(i=t,r=e.range,s=e.bounce,!(o=e.circular)[0]&&i===r[0]-s[0]||!o[1]&&i===r[1]+s[1]);var i,r,s,o})},t}(),bt=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=_({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},e),i.interruptManager=new ut(i.options),i.axisManager=new ht(i.axis),i.eventManager=new at(i),i.animationManager=new ot(i),i.inputObserver=new Et(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.0.1-snapshot",t.TRANSFORM=F,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(t),yt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._activeInput=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this.element=N(t),this.options=_({inputType:["touch","mouse","pointer"],inputButton:["left"],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeInput&&(this._detachElementEvent(),this._detachWindowEvent(this._activeInput)),this._attachElementEvent(t),this._originalCssProps=$(this.element),this},e.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeInput),this._originalCssProps!==V&&$(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n=this._activeInput,i=n.onEventStart(t,this.options.inputButton);!i||!this._enabled||1<n.getTouches(t)||!1!==i.srcEvent.cancelable&&(e=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,i),this._atRightEdge=X&&i.center.x>window.innerWidth-e,this._attachWindowEvent(n),n.prevEvent=i)},e._onPanmove=function(t){var e=this,n=this._activeInput,i=n.onEventMove(t,this.options.inputButton);if(i&&this._enabled&&!(1<n.getTouches(t))){var r=this.options,s=r.iOSEdgeSwipeThreshold,o=r.releaseOnScroll,a=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(i.angle,this.options.thresholdAngle);if(!o||i.srcEvent.cancelable){if(n.prevEvent&&X){if(i.center.x<0)return this._detachWindowEvent(n),void this._observer.release(this,n.prevEvent,[0,0]);this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),i.deltaX<-s?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){e._detachWindowEvent(n),e._observer.release(e,n.prevEvent,[0,0])},100))}var u=this._getOffset([i.offsetX,i.offsetY],[it(6,this._direction,a),it(24,this._direction,a)]),h=u.some(function(t){return 0!==t});h&&(!1!==i.srcEvent.cancelable&&i.srcEvent.preventDefault(),i.srcEvent.stopPropagation()),(i.preventSystemEvent=h)&&this._observer.change(this,i,et(this.axes,u)),n.prevEvent=i}else this._onPanend(t)}},e._onPanend=function(t){var e,n,i=this._activeInput;i.onEventEnd(t),this._enabled&&0===i.getTouches(t)&&(this._detachWindowEvent(i),clearTimeout(this._rightEdgeTimer),e=i.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[it(6,this._direction),it(24,this._direction)]),this._observer.release(this,e,n),i.prevEvent=null)},e._attachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.addEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.addEventListener(t,e._onPanend)})},e._detachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend)})},e._attachElementEvent=function(t){var n=this,e=nt(this.options.inputType);if(!e)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeInput=e)&&e.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.addEventListener(t,n._onPanstart)})},e._detachElementEvent=function(){var n=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.removeEventListener(t,n._onPanstart)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),xt=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=bt.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n=this._activeInput,i=n.onEventStart(t,this.options.inputButton);i&&this.isEnabled()&&(e=this.element.getBoundingClientRect(),this._observer.hold(this,i),this._attachWindowEvent(n),this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(i),n.prevEvent=i)},e._onPanmove=function(t){var e=this._activeInput,n=e.onEventMove(t,this.options.inputButton);n&&this.isEnabled()&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation(),this._triggerChange(n),e.prevEvent=n)},e._onPanend=function(t){var e,n,i,r,s=this._activeInput;s.onEventEnd(t),this.isEnabled()&&(e=s.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),s.prevEvent=null,this._detachWindowEvent(s))},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=J(n,i),s=r<0?360+r:r,o=this._getQuadrant(t.center.x,t.center.y),a=this._getDifference(this._prevAngle,s,this._prevQuadrant,o);this._prevAngle=s,this._prevQuadrant=o,0!==a&&(this._lastDiff=a,this._observer.change(this,t,et(this.axes,[-a])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(yt),Mt=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeInput=null,this.element=N(t),this.options=_({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeInput&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=$(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==V&&$(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e=this._activeInput,n=e.onEventStart(t);n&&this._enabled&&2===e.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e.prevEvent=n)},e._onPinchMove=function(t){var e,n=this._activeInput,i=n.onEventMove(t);i&&this._pinchFlag&&this._enabled&&2===n.getTouches(t)&&(e=this._getOffset(i.scale,n.prevEvent.scale),this._observer.change(this,t,et(this.axes,[e])),n.prevEvent=i)},e._onPinchEnd=function(t){var e=this._activeInput;e.onEventEnd(t),!this._pinchFlag||!this._enabled||2<=e.getTouches(t)||(this._observer.release(this,t,[0],0),this._baseValue=null,this._pinchFlag=!1,e.prevEvent=null)},e._attachEvent=function(t){var e=this,n=nt(this.options.inputType);if(!n)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeInput=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeInput;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),wt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=N(t),this.options=_({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,et(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),Pt=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=N(t),this.options=_({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,et(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return bt.PanInput=yt,bt.RotatePanInput=xt,bt.PinchInput=Mt,bt.WheelInput=wt,bt.MoveKeyInput=Pt,bt}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t.eg=t.eg||{},t.eg.Axes=e())}(this,function(){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function s(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var _=function(){return(_=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};function c(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),o=[];try{for(;(void 0===e||0<e--)&&!(i=s.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}(arguments[e]));return t}function l(t){return void 0===t}function p(t,e,n,i){var r=t,s=[!n[0]&&i?e[0]-i[0]:e[0],!n[1]&&i?e[1]+i[1]:e[1]],r=Math.max(s[0],r);return Math.min(s[1],r)}function h(t,e){return t<e[0]||t>e[1]}function v(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function d(t,e,n){var i=t,r=e[0],s=e[1],o=s-r;return n[1]&&s<t&&(i=(i-s)%o+r),n[0]&&t<r&&(i=(i-r)%o+s),i}var r,a=function(){function t(t,e){var n,i;if(this._canceled=!1,e)try{for(var r=c(Object.keys(e)),s=r.next();!s.done;s=r.next()){var o=s.value;this[o]=e[o]}}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}this.eventType=t}var e=t.prototype;return e.stop=function(){this._canceled=!0},e.isCanceled=function(){return this._canceled},t}(),t=function(){function t(){this._eventHandler={}}var e=t.prototype;return e.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof a?e.eventType:e,r=o(this._eventHandler[i]||[]);return r.length<=0||(e instanceof a?(e.currentTarget=this,r.forEach(function(t){t(e)})):r.forEach(function(t){t.apply(void 0,o(n))})),this},e.once=function(n,i){var r,s=this;if("object"==typeof n&&l(i)){var t=n;for(var e in t)this.once(e,t[e]);return this}return"string"==typeof n&&"function"==typeof i&&(r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];i.apply(void 0,o(t)),s.off(n,r)},this.on(n,r)),this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&l(e)){var n=t;for(var i in n)this.on(i,n[i]);return this}var r;return"string"==typeof t&&"function"==typeof e&&(r=this._eventHandler[t],l(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)),this},e.off=function(t,e){var n,i;if(l(t))return this._eventHandler={},this;if(l(e)){if("string"==typeof t)return delete this._eventHandler[t],this;var r=t;for(var s in r)this.off(s,r[s]);return this}var o=this._eventHandler[t];if(o){var a=0;try{for(var u=c(o),h=u.next();!h.done;h=u.next()){if(h.value===e){o.splice(a,1),o.length<=0&&delete this._eventHandler[t];break}a++}}catch(t){n={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}return this},t.VERSION="3.0.2",t}(),f=a;function e(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return!0;return!1}function u(t,e){for(var n=t.length,i=0;i<n;++i)if(e(t[i],i))return t[i];return null}function g(t,e){try{return new RegExp(t,"g").exec(e)}catch(t){return null}}function m(t){return t.replace(/_/g,".")}function E(t,r){var s=null,o="-1";return e(t,function(t){var e,n,i=g("("+t.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r);return i&&!t.brand&&(s=t,o=i[3]||"-1",t.versionAlias?o=t.versionAlias:t.versionTest&&(e=t.versionTest.toLowerCase(),n=g("("+e+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",r),o=(n?n[3]:"")||o),o=m(o),1)}),{preset:s,version:o}}function n(t,n){return u(t,function(t){var e=t.brand;return g(""+n.test,e.toLowerCase())})}r="undefined"==typeof window?{navigator:{userAgent:""}}:window;var b=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],y=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",brand:!0}],x=[{test:"applewebkit",id:"webkit"}],M=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],w=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"mac os x",id:"mac"},{test:"android",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function P(t){var e=function(t){var e=t;if(void 0===e){if("undefined"==typeof navigator||!navigator)return"";e=navigator.userAgent||""}return e.toLowerCase()}(t),n=!!/mobi/g.exec(e),i={name:"unknown",version:"-1",majorVersion:-1,webview:!!E(M,e).preset,chromium:!!E(y,e).preset,webkit:!1},r={name:"unknown",version:"-1",majorVersion:-1},s=E(b,e),o=s.preset,a=s.version,u=E(w,e),h=u.preset,c=u.version;return i.webkit=!i.chromium&&!!E(x,e).preset,h&&(r.name=h.id,r.version=c,r.majorVersion=parseInt(c,10)),o&&(i.name=o.id,i.version=a,i.webview&&"ios"===r.name&&"safari"!==i.name&&(i.webview=!1)),i.majorVersion=parseInt(i.version,10),{browser:i,os:r,isMobile:n,isHints:!1}}function T(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var O,I,A,D,C,R,S,k,L,B,j,Y,X="left",F="right",V="middle",N="ontouchstart"in r&&"safari"===(void 0===O&&function(){if("undefined"!=typeof navigator&&navigator&&navigator.userAgentData){var t=navigator.userAgentData,e=t.brands||t.uaList;return e&&e.length}}()?(C=navigator.userAgentData,R=(C.uaList||C.brands).slice(),S=C.mobile||!1,k=R[0],L={name:k.brand,version:k.version,majorVersion:-1,webkit:!1,webview:e(M,function(t){return n(R,t)}),chromium:e(y,function(t){return n(R,t)})},B={name:"unknown",version:"-1",majorVersion:-1},L.webkit=!L.chromium&&e(x,function(t){return n(R,t)}),I&&(A=I.platform.toLowerCase(),D=u(w,function(t){return new RegExp(""+t.test,"g").exec(A)}),B.name=D?D.id:A,B.version=I.platformVersion),e(b,function(t){var e=n(R,t);return e&&(L.name=t.id,L.version=I?I.uaFullVersion:e.version,1)}),"Linux armv8l"===navigator.platform?B.name="android":L.webkit&&(B.name=S?"ios":"mac"),"ios"===B.name&&L.webview&&(L.version="-1"),B.version=m(B.version),L.version=m(L.version),B.majorVersion=parseInt(B.version,10),L.majorVersion=parseInt(L.version,10),{browser:L,os:B,isMobile:S,isHints:!0}):P(O)).browser.name,W=function(){if("undefined"==typeof document)return"";for(var t=(document.head||document.getElementsByTagName("head")[0]).style,e=["transform","webkitTransform","msTransform","mozTransform"],n=0,i=e.length;n<i;n++)if(e[n]in t)return e[n];return""}(),H={"touch-action":"none","user-select":"none","-webkit-user-drag":"none"},K=function(t,e){var n,i;return void 0===e&&(e=!1),"string"==typeof t?(i=t.match(/^<([a-z]+)\s*([^>]*)>/)?((n=document.createElement("div")).innerHTML=t,T(n.childNodes)):T(document.querySelectorAll(t)),e||(i=1<=i.length?i[0]:void 0)):t!==r&&(!t.nodeName||1!==t.nodeType&&9!==t.nodeType)?"jQuery"in r&&t instanceof jQuery||t.constructor.prototype.jquery?i=e?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return K(t)}),e||(i=1<=i.length?i[0]:void 0)):i=t,i},U=r.requestAnimationFrame||r.webkitRequestAnimationFrame,q=r.cancelAnimationFrame||r.webkitCancelAnimationFrame;U&&!q?(j={},Y=U,U=function(e){var n=Y(function(t){j[n]&&e(t)});return j[n]=!0,n},q=function(t){delete j[t]}):U&&q||(U=function(t){return r.setTimeout(function(){t(r.performance&&r.performance.now&&r.performance.now()||(new Date).getTime())},16)},q=r.clearTimeout);function Q(t,e){var n={};for(var i in t)i&&(n[i]=e(t[i],i));return n}function z(t,e){var n={};for(var i in t)i&&e(t[i],i)&&(n[i]=t[i]);return n}function G(t,e){for(var n in t)if(n&&!e(t[n],n))return!1;return!0}function Z(t,n){return G(t,function(t,e){return t===n[e]})}function J(t,e){return at[e]||(at[e]=ut(e)),at[e](t)}function $(t,n){return t&&n?Q(t,function(t,e){return J(t,"number"==typeof n?n:n[e])}):t}function tt(t){if(!isFinite(t))return 0;var e=""+t;if(0<=e.indexOf("e")){for(var n=0,i=1;Math.round(t*i)/i!==t;)i*=10,n++;return n}return 0<=e.indexOf(".")?e.length-e.indexOf(".")-1:0}function et(t,e){return 180*Math.atan2(e,t)/Math.PI}function nt(e,t){var n,i={};return e&&e.style&&(n=t||H,Object.keys(n).forEach(function(t){i[t]=e.style[t],e.style[t]=n[t]})),i}function it(t,e,n){return Math.max(Math.min(t,n),e)}function rt(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function st(t){void 0===t&&(t=[]);var e=!1,n=!1,i=!1;return t.forEach(function(t){switch(t){case"mouse":n=!0;break;case"touch":e=dt;break;case"pointer":i=pt}}),i?new bt:e&&n?new yt:e?new Et:n?new mt:null}function ot(t,e,n){return n?!!(30===e||e&t&&n&t):!!(e&t)}var at={},ut=function(e){var n=e<1?Math.pow(10,tt(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},ht=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager;this._options=e,this.interruptManager=n,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(s,t,e){var n,i,o=this;return i=void 0!==e?e:(n=Q(t,function(t,e){return n=Math.abs(t-s[e]),i=o._options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r}),Object.keys(n).reduce(function(t,e){return Math.max(t,n[e])},-1/0)),it(i,this._options.minimumDuration,this._options.maximumDuration)},e.getDisplacement=function(t){var e=Math.pow(t.reduce(function(t,e){return t+e*e},0),1/t.length),n=Math.abs(e/-this._options.deceleration);return t.map(function(t){return t/2*n})},e.interpolate=function(t,e){var n=this.easing(1e-5)/1e-5;return this.easing(t/(e*n))*e},e.stopAnimation=function(t){var n,e,i;this._animateParam&&(n=this.axisManager.get(),e=this.axisManager.map(n,function(t,e){return d(t,e.range,e.circular)}),G(e,function(t,e){return n[e]===t})||this.eventManager.triggerChange(e,n,t,!!t),this._animateParam=null,this._raf&&(i=this._raf,q(i)),this._raf=null,this.eventManager.triggerAnimationEnd(!(null==t||!t.event)))},e.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},e.restore=function(t){var e=this.axisManager.get(),n=this.axisManager.map(e,function(t,e){return Math.min(e.range[1],Math.max(e.range[0],t))});this.stopAnimation(),this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axisManager.filter(this.axisManager.get(),function(t,e){return v(t,e.range,e.circular)});0<Object.keys(e).length&&this.setTo(this.axisManager.map(e,function(t,e){return d(t,e.range,e.circular)})),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!t),this.axisManager.isOutside()?this.restore(t):this.finish(!!t)},e.finish=function(t){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(t)},e.getUserControl=function(t){var e=t.setTo();return e.destPos=this.axisManager.get(e.destPos),e.duration=it(e.duration,this._options.minimumDuration,this._options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this;this.stopAnimation();var r,s=this._createAnimationParam(t,e,n),o=_({},s.depaPos),a=this.eventManager.triggerAnimationStart(s),u=this.getUserControl(s);!a&&this.axisManager.every(u.destPos,function(t,e){return v(t,e.range,e.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),a&&!Z(u.destPos,o)&&(r=(null==n?void 0:n.event)||null,this._animateLoop({depaPos:o,destPos:u.destPos,duration:u.duration,delta:this.axisManager.getDelta(o,u.destPos),isTrusted:!!r,inputEvent:r,input:(null==n?void 0:n.input)||null},function(){return i.animationEnd()}))},e.easing=function(t){return 1<t?1:this._options.easing(t)},e.setTo=function(t,e){void 0===e&&(e=0);var n=Object.keys(t),i=this.axisManager.get(n);if(Z(t,i))return this;this.interruptManager.setInterrupt(!0);var r=z(t,function(t,e){return i[e]!==t});return Object.keys(r).length?(r=this.axisManager.map(r,function(t,e){var n=e.range,i=e.circular;return i&&(i[0]||i[1])?t:p(t,n,i)}),Z(r,i)||(0<e?this.animateTo(r,e):(this.stopAnimation(),this.eventManager.triggerChange(r),this.finish(!1))),this):this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(Q(this.axisManager.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},e.updateAnimation=function(t){var e,n,i,r,s,o=this._animateParam;o&&(e=(new Date).getTime()-o.startTime,n=(null==t?void 0:t.destPos)||o.destPos,i=(null==t?void 0:t.duration)||o.duration,null!=t&&t.restart||i<=e?this.setTo(n,i-e):(null!=t&&t.destPos&&(r=this.axisManager.get(),this._initialEasingPer=this._prevEasingPer,o.delta=this.axisManager.getDelta(r,n),o.destPos=n),null!=t&&t.duration&&(s=(e+this._durationOffset)/o.duration,this._durationOffset=s*i-e,o.duration=i)))},e._createAnimationParam=function(t,e,n){var i=this.axisManager.get(),r=t,s=(null==n?void 0:n.event)||null;return{depaPos:i,destPos:r,duration:it(e,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:s,input:(null==n?void 0:n.input)||null,isTrusted:!!s,done:this.animationEnd}},e._animateLoop=function(n,i){var h,c,r,s,l=this;n.duration?(h=n.depaPos,this._initialEasingPer=0,this._prevEasingPer=0,this._durationOffset=0,this._animateParam=_(_({},n),{startTime:(new Date).getTime()}),c=Q(h,function(t,e){return t<=n.destPos[e]?1:-1}),r=Q(n.destPos,function(t){return t}),(s=function(){var o=l._animateParam,a=((new Date).getTime()-o.startTime+l._durationOffset)/o.duration,u=l.easing(a);l._raf=null;var t=l.axisManager.map(h,function(t,e,n){var i,r=1<=a?o.destPos[n]:t+o.delta[n]*(u-l._prevEasingPer)/(1-l._initialEasingPer),s=d(r,e.range,e.circular);return r!==s&&(i=c[n]*(e.range[1]-e.range[0]),o.destPos[n]-=i,h[n]-=i),s}),e=!l.eventManager.triggerChange(t,h);if(h=t,1<=(l._prevEasingPer=u))return o.destPos=l._getFinalPos(o.destPos,r),Z(o.destPos,l.axisManager.get(Object.keys(o.destPos)))||l.eventManager.triggerChange(o.destPos,h),void i();e?l.finish(!1):l._raf=U(s)})()):(this.eventManager.triggerChange(n.destPos),i())},e._getFinalPos=function(t,i){var r=this;return Q(t,function(t,e){if(t>=i[e]-1e-6&&t<=i[e]+1e-6)return i[e];var n=r._getRoundUnit(t,e);return J(t,n)})},e._getRoundUnit=function(t,e){var n,i,r=this._options.round,s=null;return r||(n=this.axisManager.getAxisOptions(e),i=Math.max(tt(n.range[0]),tt(n.range[1]),tt(t)),s=1/Math.pow(10,i)),s||r},t}(),ct=function(){function t(t){this._axes=t}var e=t.prototype;return e.hold=function(t,e){var n=this._getRoundPos(t).roundPos;this._axes.trigger(new f("hold",{pos:n,input:e.input||null,inputEvent:e.event||null,isTrusted:!0}))},e.triggerRelease=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration),this._axes.trigger(new f("release",_(_({},t),{bounceRatio:this._getBounceRatio(n)})))},e.triggerChange=function(t,e,n,i){void 0===i&&(i=!1);var r=this.animationManager,s=r.axisManager,o=r.getEventInfo(),a=this._getRoundPos(t,e),u=a.roundPos,h=a.roundDepa,c=s.moveTo(u,h),l=(null==n?void 0:n.event)||(null==o?void 0:o.event)||null,v={pos:c.pos,delta:c.delta,bounceRatio:this._getBounceRatio(c.pos),holding:i,inputEvent:l,isTrusted:!!l,input:(null==n?void 0:n.input)||(null==o?void 0:o.input)||null,set:l?this._createUserControll(c.pos):function(){}},d=new f("change",v);return this._axes.trigger(d),l&&s.set(v.set().destPos),!d.isCanceled()},e.triggerAnimationStart=function(t){var e=this._getRoundPos(t.destPos,t.depaPos),n=e.roundPos,i=e.roundDepa;t.destPos=n,t.depaPos=i,t.setTo=this._createUserControll(t.destPos,t.duration);var r=new f("animationStart",t);return this._axes.trigger(r),!r.isCanceled()},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this._axes.trigger(new f("animationEnd",{isTrusted:t}))},e.triggerFinish=function(t){void 0===t&&(t=!1),this._axes.trigger(new f("finish",{isTrusted:t}))},e.setAnimationManager=function(t){this.animationManager=t},e.destroy=function(){this._axes.off()},e._createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:_({},t),duration:e};return function(t,e){return t&&(n.destPos=_({},t)),void 0!==e&&(n.duration=e),n}},e._getRoundPos=function(t,e){var n=this._axes.options.round;return{roundPos:$(t,n),roundDepa:$(e,n)}},e._getBounceRatio=function(t){return this._axes.axisManager.map(t,function(t,e){return t<e.range[0]&&0!==e.bounce[0]?(e.range[0]-t)/e.bounce[0]:t>e.range[1]&&0!==e.bounce[1]?(t-e.range[1])/e.bounce[1]:0})},t}(),lt=function(){function t(t){this._options=t,this._prevented=!1}var e=t.prototype;return e.isInterrupting=function(){return this._options.interruptable||this._prevented},e.isInterrupted=function(){return!this._options.interruptable&&this._prevented},e.setInterrupt=function(t){this._options.interruptable||(this._prevented=t)},t}(),vt=function(){function t(t){var n=this;this._axis=t,this._complementOptions(),this._pos=Object.keys(this._axis).reduce(function(t,e){return t[e]=n._axis[e].range[0],t},{})}var e=t.prototype;return e.getDelta=function(t,e){var n=this.get(t);return Q(this.get(e),function(t,e){return t-n[e]})},e.get=function(t){var n=this;return t&&Array.isArray(t)?t.reduce(function(t,e){return e&&e in n._pos&&(t[e]=n._pos[e]),t},{}):_(_({},this._pos),t||{})},e.moveTo=function(n,i){void 0===i&&(i=this._pos);var t=Q(this._pos,function(t,e){return e in n&&e in i?n[e]-i[e]:0});return this.set(this.map(n,function(t,e){return e?d(t,e.range,e.circular):0})),{pos:_({},this._pos),delta:t}},e.set=function(t){for(var e in t)e&&e in this._pos&&(this._pos[e]=t[e])},e.every=function(t,n){var i=this._axis;return G(t,function(t,e){return n(t,i[e],e)})},e.filter=function(t,n){var i=this._axis;return z(t,function(t,e){return n(t,i[e],e)})},e.map=function(t,n){var i=this._axis;return Q(t,function(t,e){return n(t,i[e],e)})},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e){return!h(t,e.range)})},e.getAxisOptions=function(t){return this._axis[t]},e._complementOptions=function(){var r=this;Object.keys(this._axis).forEach(function(i){r._axis[i]=_({range:[0,100],bounce:[0,0],circular:[!1,!1]},r._axis[i]),["bounce","circular"].forEach(function(t){var e=r._axis,n=e[i][t];/string|number|boolean/.test(typeof n)&&(e[i][t]=[n,n])})})},t}(),dt="ontouchstart"in r,ft="PointerEvent"in r,_t="MSPointerEvent"in r,pt=ft||_t,gt=function(){function t(){var e=this;this._stopContextMenu=function(t){t.preventDefault(),r.removeEventListener("contextmenu",e._stopContextMenu)}}var e=t.prototype;return e.extendEvent=function(t){var e=this.prevEvent,n=this._getCenter(t),i=e?this._getMovement(t):{x:0,y:0},r=e?this._getScale(t):1,s=e?et(n.x-e.center.x,n.y-e.center.y):0,o=e?e.deltaX+i.x:i.x,a=e?e.deltaY+i.y:i.y,u=e?o-e.deltaX:0,h=e?a-e.deltaY:0,c=e?t.timeStamp-e.srcEvent.timeStamp:0;return{srcEvent:t,scale:r,angle:s,center:n,deltaX:o,deltaY:a,offsetX:u,offsetY:h,velocityX:e&&0!=c?u/c:0,velocityY:e&&0!=c?h/c:0,preventSystemEvent:!0}},e._getDistance=function(t,e){var n=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(n*n+i*i)},e._getButton=function(t){var e={1:X,2:F,4:V},n=this._isTouchEvent(t)?X:e[t.buttons];return n||null},e._isTouchEvent=function(t){return-1<t.type.indexOf("touch")},e._isValidButton=function(t,e){return-1<e.indexOf(t)},e._preventMouseButton=function(t,e){e===F?r.addEventListener("contextmenu",this._stopContextMenu):e===V&&t.preventDefault()},t}(),mt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown"],t.move=["mousemove"],t.end=["mouseup"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(){},n.onRelease=function(){this.prevEvent=null},n.getTouches=function(){return 0},n._getScale=function(){return 1},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},t}(gt),Et=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["touchstart"],t.move=["touchmove"],t.end=["touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t){return this._baseTouches=t.touches,this.extendEvent(t)},n.onEventMove=function(t){return this.extendEvent(t)},n.onEventEnd=function(t){this._baseTouches=t.touches},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(t){return t.touches.length},n._getScale=function(t){return 2!==t.touches.length||this._baseTouches.length<2?null:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},n._getCenter=function(t){return{x:t.touches[0].clientX,y:t.touches[0].clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.touches[0].identifier!==e.touches[0].identifier?{x:0,y:0}:{x:t.touches[0].pageX-e.touches[0].pageX,y:t.touches[0].pageY-e.touches[0].pageY}},t}(gt),bt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=ft?["pointerdown"]:["MSPointerDown"],t.move=ft?["pointermove"]:["MSPointerMove"],t.end=ft?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],t._firstInputs=[],t._recentInputs=[],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this._updatePointerEvent(t),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:(this._updatePointerEvent(t),this.extendEvent(t))},n.onEventEnd=function(t){this._removePointerEvent(t)},n.onRelease=function(){this.prevEvent=null,this._firstInputs=[],this._recentInputs=[]},n.getTouches=function(){return this._recentInputs.length},n._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},n._getCenter=function(t){return{x:t.clientX,y:t.clientY}},n._getMovement=function(t){var e=this.prevEvent.srcEvent;return t.pointerId!==e.pointerId?{x:0,y:0}:{x:t.pageX-e.pageX,y:t.pageY-e.pageY}},n._updatePointerEvent=function(n){var i=this,r=!1;this._recentInputs.forEach(function(t,e){t.pointerId===n.pointerId&&(r=!0,i._recentInputs[e]=n)}),r||(this._firstInputs.push(n),this._recentInputs.push(n))},n._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter(function(t){return t.pointerId!==e.pointerId}),this._recentInputs=this._recentInputs.filter(function(t){return t.pointerId!==e.pointerId})},t}(gt),yt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.start=["mousedown","touchstart"],t.move=["mousemove","touchmove"],t.end=["mouseup","touchend","touchcancel"],t}s(t,e);var n=t.prototype;return n.onEventStart=function(t,e){var n=this._getButton(t);return this._isTouchEvent(t)&&(this._baseTouches=t.touches),e&&!this._isValidButton(n,e)?null:(this._preventMouseButton(t,n),this.extendEvent(t))},n.onEventMove=function(t,e){return e&&!this._isValidButton(this._getButton(t),e)?null:this.extendEvent(t)},n.onEventEnd=function(t){this._isTouchEvent(t)&&(this._baseTouches=t.touches)},n.onRelease=function(){this.prevEvent=null,this._baseTouches=null},n.getTouches=function(t){return this._isTouchEvent(t)?t.touches.length:0},n._getScale=function(t){return this._isTouchEvent(t)?2!==t.touches.length||this._baseTouches.length<2?1:this._getDistance(t.touches[0],t.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},n._getCenter=function(t){return this._isTouchEvent(t)?{x:t.touches[0].clientX,y:t.touches[0].clientY}:{x:t.clientX,y:t.clientY}},n._getMovement=function(e){var n=this,t=this.prevEvent.srcEvent,i=[e,t].map(function(t){return n._isTouchEvent(e)?{id:t.touches[0].identifier,x:t.touches[0].pageX,y:t.touches[0].pageY}:{id:null,x:t.pageX,y:t.pageY}}),r=i[0],s=i[1];return r.id===s.id?{x:r.x-s.x,y:r.y-s.y}:{x:0,y:0}},t}(gt),xt=function(){function t(t){var e=t.options,n=t.interruptManager,i=t.eventManager,r=t.axisManager,s=t.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=e,this._interruptManager=n,this._eventManager=i,this._axisManager=r,this._animationManager=s}var e=t.prototype;return e.get=function(t){return this._axisManager.get(t.axes)},e.hold=function(t,e){var n;!this._interruptManager.isInterrupted()&&t.axes.length&&(n={input:t,event:e},this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(n),this._moveDistance||this._eventManager.hold(this._axisManager.get(),n),this._isOutside=this._axisManager.isOutside(t.axes),this._moveDistance=this._axisManager.get(t.axes))},e.change=function(t,e,n,i){var r,s,o,a,u;this._isStopped||!this._interruptManager.isInterrupting()||this._axisManager.every(n,function(t){return 0===t})||((r=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyChanged||(s=this._moveDistance||this._axisManager.get(t.axes),o=Q(s,function(t,e){return t+(n[e]||0)}),this._moveDistance&&(this._moveDistance=this._axisManager.map(o,function(t,e){var n=e.circular,i=e.range;return n&&(n[0]||n[1])?d(t,i,n):t})),this._isOutside&&this._axisManager.every(s,function(t,e){return!h(t,e.range)})&&(this._isOutside=!1),s=this._atOutside(s),o=this._atOutside(o),this.options.nested&&this._isEndofAxis(n,s,o)||(r.__childrenAxesAlreadyChanged=!0),a={input:t,event:e},i?(u=this._animationManager.getDuration(o,s),this._animationManager.animateTo(o,u,a)):this._eventManager.triggerChange(o,s,a,!0)||(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))))},e.release=function(t,e,n,i){var r,s,o,a,u,h,c,l,v,d,f;!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance&&((r=e.srcEvent?e.srcEvent:e).__childrenAxesAlreadyReleased&&(n=n.map(function(){return 0})),s=this._axisManager.get(t.axes),o=this._axisManager.get(),a=this._animationManager.getDisplacement(n),u=rt(t.axes,a),h=this._axisManager.get(this._axisManager.map(u,function(t,e,n){return e.circular&&(e.circular[0]||e.circular[1])?s[n]+t:p(s[n]+t,e.range,e.circular,e.bounce)})),r.__childrenAxesAlreadyReleased=!0,0===(c=this._animationManager.getDuration(h,s,i))&&(h=_({},o)),l={depaPos:o,destPos:h,duration:c,delta:this._axisManager.getDelta(o,h),inputEvent:e,input:t,isTrusted:!0},this._eventManager.triggerRelease(l),this._moveDistance=null,v=this._animationManager.getUserControl(l),f={input:t,event:e},(d=Z(v.destPos,o))||0===v.duration?(d||this._eventManager.triggerChange(v.destPos,o,f,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(f):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(v.destPos,v.duration,f))},e._atOutside=function(t){var o=this;return this._isOutside?this._axisManager.map(t,function(t,e){var n=e.range[0]-e.bounce[0],i=e.range[1]+e.bounce[1];return i<t?i:t<n?n:t}):this._axisManager.map(t,function(t,e){var n=e.range[0],i=e.range[1],r=e.bounce,s=e.circular;return s&&(s[0]||s[1])?t:t<n?n-o._animationManager.interpolate(n-t,r[0]):i<t?i+o._animationManager.interpolate(t-i,r[1]):t})},e._isEndofAxis=function(a,u,h){return this._axisManager.every(u,function(t,e,n){return 0===a[n]||u[n]===h[n]&&(i=t,r=e.range,s=e.bounce,!(o=e.circular)[0]&&i===r[0]-s[0]||!o[1]&&i===r[1]+s[1]);var i,r,s,o})},t}(),Mt=function(r){function t(t,e,n){void 0===t&&(t={}),void 0===e&&(e={}),void 0===n&&(n=null);var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=_({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4,round:null,nested:!1},e),i.interruptManager=new lt(i.options),i.axisManager=new vt(i.axis),i.eventManager=new ct(i),i.animationManager=new ht(i),i.inputObserver=new xt(i),i.eventManager.setAnimationManager(i.animationManager),n&&i.eventManager.triggerChange(n),i}s(t,r);var e=t.prototype;return e.connect=function(t,e){var n="string"==typeof t?t.split(" "):t.concat();return~this._inputs.indexOf(e)&&this.disconnect(e),e.mapAxes(n),e.connect(this.inputObserver),this._inputs.push(e),this},e.disconnect=function(t){var e;return t?0<=(e=this._inputs.indexOf(t))&&(this._inputs[e].disconnect(),this._inputs.splice(e,1)):(this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[]),this},e.get=function(t){return this.axisManager.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.animationManager.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.animationManager.setBy(t,e),this},e.stopAnimation=function(){return this.animationManager.stopAnimation(),this},e.updateAnimation=function(t){return this.animationManager.updateAnimation(t),this},e.isBounceArea=function(t){return this.axisManager.isOutside(t)},e.destroy=function(){this.disconnect(),this.eventManager.destroy()},t.VERSION="3.1.1",t.TRANSFORM=W,t.DIRECTION_NONE=1,t.DIRECTION_LEFT=2,t.DIRECTION_RIGHT=4,t.DIRECTION_UP=8,t.DIRECTION_DOWN=16,t.DIRECTION_HORIZONTAL=6,t.DIRECTION_VERTICAL=24,t.DIRECTION_ALL=30,t}(t),wt=function(){function t(t,e){var n=this;this.axes=[],this.element=null,this._enabled=!1,this._activeEvent=null,this._atRightEdge=!1,this._rightEdgeTimer=0,this._forceRelease=function(){var t=n._activeEvent;n._detachWindowEvent(t),n._observer.release(n,t.prevEvent,[0,0]),t.onRelease()},this.element=K(t),this.options=_({inputType:["touch","mouse","pointer"],inputButton:[X],scale:[1,1],thresholdAngle:45,threshold:0,iOSEdgeSwipeThreshold:30,releaseOnScroll:!1},e),this._onPanstart=this._onPanstart.bind(this),this._onPanmove=this._onPanmove.bind(this),this._onPanend=this._onPanend.bind(this)}var e=t.prototype;return e.mapAxes=function(t){var e=!!t[0],n=!!t[1];this._direction=e&&n?30:e?6:n?24:1,this.axes=t},e.connect=function(t){return this._activeEvent&&(this._detachElementEvent(),this._detachWindowEvent(this._activeEvent)),this._attachElementEvent(t),this._originalCssProps=nt(this.element),this},e.disconnect=function(){return this._detachElementEvent(),this._detachWindowEvent(this._activeEvent),this._originalCssProps!==H&&nt(this.element,this._originalCssProps),this._direction=1,this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPanstart=function(t){var e,n=this._activeEvent,i=n.onEventStart(t,this.options.inputButton);!i||!this._enabled||1<n.getTouches(t)||!1!==i.srcEvent.cancelable&&(e=this.options.iOSEdgeSwipeThreshold,this._observer.hold(this,i),this._atRightEdge=N&&i.center.x>window.innerWidth-e,this._attachWindowEvent(n),n.prevEvent=i)},e._onPanmove=function(t){var e=this,n=this._activeEvent,i=n.onEventMove(t,this.options.inputButton);if(i&&this._enabled&&!(1<n.getTouches(t))){var r=this.options,s=r.iOSEdgeSwipeThreshold,o=r.releaseOnScroll,a=function(t,e){if(e<0||90<e)return 1;var n=Math.abs(t);return e<n&&n<180-e?24:6}(i.angle,this.options.thresholdAngle);if(!o||i.srcEvent.cancelable){if(n.prevEvent&&N){if(i.center.x<0)return void this._forceRelease();this._atRightEdge&&(clearTimeout(this._rightEdgeTimer),i.deltaX<-s?this._atRightEdge=!1:this._rightEdgeTimer=window.setTimeout(function(){return e._forceRelease()},100))}var u=this._getOffset([i.offsetX,i.offsetY],[ot(6,this._direction,a),ot(24,this._direction,a)]),h=u.some(function(t){return 0!==t});h&&(!1!==i.srcEvent.cancelable&&i.srcEvent.preventDefault(),i.srcEvent.stopPropagation()),(i.preventSystemEvent=h)&&this._observer.change(this,i,rt(this.axes,u)),n.prevEvent=i}else this._onPanend(t)}},e._onPanend=function(t){var e,n,i=this._activeEvent;i.onEventEnd(t),this._enabled&&0===i.getTouches(t)&&(this._detachWindowEvent(i),clearTimeout(this._rightEdgeTimer),e=i.prevEvent,n=this._getOffset([Math.abs(e.velocityX)*(e.offsetX<0?-1:1),Math.abs(e.velocityY)*(e.offsetY<0?-1:1)],[ot(6,this._direction),ot(24,this._direction)]),this._observer.release(this,e,n),i.onRelease())},e._attachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.addEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.addEventListener(t,e._onPanend)})},e._detachWindowEvent=function(t){var e=this;null!=t&&t.move.forEach(function(t){window.removeEventListener(t,e._onPanmove)}),null!=t&&t.end.forEach(function(t){window.removeEventListener(t,e._onPanend)})},e._attachElementEvent=function(t){var n=this,e=st(this.options.inputType);if(!e)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeEvent=e)&&e.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.addEventListener(t,n._onPanstart)})},e._detachElementEvent=function(){var n=this,t=this._activeEvent;null!=t&&t.start.forEach(function(t){var e;null!==(e=n.element)&&void 0!==e&&e.removeEventListener(t,n._onPanstart)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){var n=[0,0],i=this.options.scale;return e[0]&&(n[0]=t[0]*i[0]),e[1]&&(n[1]=t[1]*i[1]),n},t}(),Pt=function(i){function t(t,e){var n=i.call(this,t,e)||this;return n._prevQuadrant=null,n._lastDiff=0,n}s(t,i);var e=t.prototype;return e.mapAxes=function(t){this._direction=Mt.DIRECTION_ALL,this.axes=t},e._onPanstart=function(t){var e,n=this._activeEvent,i=n.onEventStart(t,this.options.inputButton);i&&this.isEnabled()&&(e=this.element.getBoundingClientRect(),this._observer.hold(this,i),this._attachWindowEvent(n),this._coefficientForDistanceToAngle=360/(e.width*Math.PI),this._rotateOrigin=[e.left+(e.width-1)/2,e.top+(e.height-1)/2],this._prevAngle=null,this._triggerChange(i),n.prevEvent=i)},e._onPanmove=function(t){var e=this._activeEvent,n=e.onEventMove(t,this.options.inputButton);n&&this.isEnabled()&&(!1!==n.srcEvent.cancelable&&n.srcEvent.preventDefault(),n.srcEvent.stopPropagation(),this._triggerChange(n),e.prevEvent=n)},e._onPanend=function(t){var e,n,i,r,s=this._activeEvent;s.onEventEnd(t),this.isEnabled()&&(e=s.prevEvent,this._triggerChange(e),n=e.velocityX,i=e.velocityY,r=Math.sqrt(n*n+i*i)*(0<this._lastDiff?-1:1),this._observer.release(this,e,[r*this._coefficientForDistanceToAngle]),s.onRelease(),this._detachWindowEvent(s))},e._triggerChange=function(t){var e=this._getPosFromOrigin(t.center.x,t.center.y),n=e.x,i=e.y,r=et(n,i),s=r<0?360+r:r,o=this._getQuadrant(t.center.x,t.center.y),a=this._getDifference(this._prevAngle,s,this._prevQuadrant,o);this._prevAngle=s,this._prevQuadrant=o,0!==a&&(this._lastDiff=a,this._observer.change(this,t,rt(this.axes,[-a])))},e._getDifference=function(t,e,n,i){var r=null===t?0:1===n&&4===i?-t-(360-e):4===n&&1===i?360-t+e:e-t;return r},e._getPosFromOrigin=function(t,e){return{x:t-this._rotateOrigin[0],y:this._rotateOrigin[1]-e}},e._getQuadrant=function(t,e){var n=this._getPosFromOrigin(t,e),i=n.x,r=n.y,s=0;return 0<=i&&0<=r?s=1:i<0&&0<=r?s=2:i<0&&r<0?s=3:0<=i&&r<0&&(s=4),s},t}(wt),Tt=function(){function t(t,e){this.axes=[],this.element=null,this._pinchFlag=!1,this._enabled=!1,this._activeEvent=null,this.element=K(t),this.options=_({scale:1,threshold:0,inputType:["touch","pointer"]},e),this._onPinchStart=this._onPinchStart.bind(this),this._onPinchMove=this._onPinchMove.bind(this),this._onPinchEnd=this._onPinchEnd.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._activeEvent&&this._detachEvent(),this._attachEvent(t),this._originalCssProps=nt(this.element),this},e.disconnect=function(){return this._detachEvent(),this._originalCssProps!==H&&nt(this.element,this._originalCssProps),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onPinchStart=function(t){var e=this._activeEvent,n=e.onEventStart(t);n&&this._enabled&&2===e.getTouches(t)&&(this._baseValue=this._observer.get(this)[this.axes[0]],this._observer.hold(this,t),this._pinchFlag=!0,e.prevEvent=n)},e._onPinchMove=function(t){var e,n=this._activeEvent,i=n.onEventMove(t);i&&this._pinchFlag&&this._enabled&&2===n.getTouches(t)&&(e=this._getOffset(i.scale,n.prevEvent.scale),this._observer.change(this,t,rt(this.axes,[e])),n.prevEvent=i)},e._onPinchEnd=function(t){var e=this._activeEvent;e.onEventEnd(t),!this._pinchFlag||!this._enabled||2<=e.getTouches(t)||(this._observer.release(this,t,[0],0),e.onRelease(),this._baseValue=null,this._pinchFlag=!1)},e._attachEvent=function(t){var e=this,n=st(this.options.inputType);if(!n)throw new Error("There is currently no inputType available for current device. There must be at least one available inputType.");this._observer=t,this._enabled=!0,null!=(this._activeEvent=n)&&n.start.forEach(function(t){e.element.addEventListener(t,e._onPinchStart,!1)}),null!=n&&n.move.forEach(function(t){e.element.addEventListener(t,e._onPinchMove,!1)}),null!=n&&n.end.forEach(function(t){e.element.addEventListener(t,e._onPinchEnd,!1)})},e._detachEvent=function(){var e=this,t=this._activeEvent;null!=t&&t.start.forEach(function(t){e.element.removeEventListener(t,e._onPinchStart,!1)}),null!=t&&t.move.forEach(function(t){e.element.removeEventListener(t,e._onPinchMove,!1)}),null!=t&&t.end.forEach(function(t){e.element.removeEventListener(t,e._onPinchEnd,!1)}),this._enabled=!1,this._observer=null},e._getOffset=function(t,e){return void 0===e&&(e=1),this._baseValue*(t-e)*this.options.scale},t}(),Ot=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=K(t),this.options=_({scale:1,releaseDelay:300,useNormalized:!0},e),this._onWheel=this._onWheel.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onWheel=function(t){var e,n=this;this._enabled&&(t.preventDefault(),0!==t.deltaY&&(this._holding||(this._observer.hold(this,t),this._holding=!0),e=(0<t.deltaY?-1:1)*this.options.scale*(this.options.useNormalized?1:Math.abs(t.deltaY)),this._observer.change(this,t,rt(this.axes,[e]),!0),clearTimeout(this._timer),this._timer=setTimeout(function(){n._holding&&(n._holding=!1,n._observer.release(n,t,[0]))},this.options.releaseDelay)))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("wheel",this._onWheel),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("wheel",this._onWheel),this._enabled=!1,this._observer=null,this._timer&&(clearTimeout(this._timer),this._timer=null)},t}(),It=function(){function t(t,e){this.axes=[],this.element=null,this._enabled=!1,this._holding=!1,this._timer=null,this.element=K(t),this.options=_({scale:[1,1]},e),this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this)}var e=t.prototype;return e.mapAxes=function(t){this.axes=t},e.connect=function(t){return this._detachEvent(),"0"!==this.element.getAttribute("tabindex")&&this.element.setAttribute("tabindex","0"),this._attachEvent(t),this},e.disconnect=function(){return this._detachEvent(),this},e.destroy=function(){this.disconnect(),this.element=null},e.enable=function(){return this._enabled=!0,this},e.disable=function(){return this._enabled=!1,this},e.isEnabled=function(){return this._enabled},e._onKeydown=function(t){if(this._enabled){var e,n=!0,i=1,r=-1;switch(t.keyCode){case 37:case 65:i=-1;break;case 39:case 68:break;case 40:case 83:i=-1,r=1;break;case 38:case 87:r=1;break;default:n=!1}(-1===r&&!this.axes[0]||1===r&&!this.axes[1])&&(n=!1),n&&(t.preventDefault(),e=-1===r?[this.options.scale[0]*i,0]:[0,this.options.scale[1]*i],this._holding||(this._observer.hold(this,t),this._holding=!0),clearTimeout(this._timer),this._observer.change(this,t,rt(this.axes,e)))}},e._onKeyup=function(t){var e=this;this._holding&&(clearTimeout(this._timer),this._timer=setTimeout(function(){e._observer.release(e,t,[0,0]),e._holding=!1},80))},e._attachEvent=function(t){this._observer=t,this.element.addEventListener("keydown",this._onKeydown,!1),this.element.addEventListener("keypress",this._onKeydown,!1),this.element.addEventListener("keyup",this._onKeyup,!1),this._enabled=!0},e._detachEvent=function(){this.element.removeEventListener("keydown",this._onKeydown,!1),this.element.removeEventListener("keypress",this._onKeydown,!1),this.element.removeEventListener("keyup",this._onKeyup,!1),this._enabled=!1,this._observer=null},t}();return Mt.PanInput=wt,Mt.RotatePanInput=Pt,Mt.PinchInput=Tt,Mt.WheelInput=Ot,Mt.MoveKeyInput=It,Mt}); | ||
//# sourceMappingURL=axes.pkgd.min.js.map |
@@ -9,2 +9,5 @@ export var DIRECTION_NONE = 1; | ||
export var DIRECTION_ALL = 2 | 4 | 8 | 16; | ||
export var MOUSE_LEFT = "left"; | ||
export var MOUSE_RIGHT = "right"; | ||
export var MOUSE_MIDDLE = "middle"; | ||
import getAgent from "@egjs/agent"; | ||
@@ -11,0 +14,0 @@ import { window } from "./browser"; |
import { getAngle } from "../utils"; | ||
import { window } from "../browser"; | ||
import { MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT } from "../const"; | ||
export var SUPPORT_TOUCH = "ontouchstart" in window; | ||
@@ -52,15 +53,7 @@ export var SUPPORT_POINTER = "PointerEvent" in window; | ||
EventInput.prototype._getButton = function (event) { | ||
if (this._isTouchEvent(event)) { | ||
return "left"; | ||
} | ||
switch (event.buttons) { | ||
case 1: | ||
return "left"; | ||
case 2: | ||
return "right"; | ||
case 4: | ||
return "middle"; | ||
default: | ||
return null; | ||
} | ||
var buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE }; | ||
var button = this._isTouchEvent(event) | ||
? MOUSE_LEFT | ||
: buttonCodeMap[event.buttons]; | ||
return button ? button : null; | ||
}; | ||
@@ -74,6 +67,6 @@ EventInput.prototype._isTouchEvent = function (event) { | ||
EventInput.prototype._preventMouseButton = function (event, button) { | ||
if (button === "right") { | ||
if (button === MOUSE_RIGHT) { | ||
window.addEventListener("contextmenu", this._stopContextMenu); | ||
} | ||
else if (button === "middle") { | ||
else if (button === MOUSE_MIDDLE) { | ||
event.preventDefault(); | ||
@@ -80,0 +73,0 @@ } |
@@ -42,2 +42,6 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
MouseEventInput.prototype.onRelease = function () { | ||
this.prevEvent = null; | ||
return; | ||
}; | ||
MouseEventInput.prototype.getTouches = function () { | ||
@@ -44,0 +48,0 @@ return 0; |
@@ -48,2 +48,8 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
PointerEventInput.prototype.onRelease = function () { | ||
this.prevEvent = null; | ||
this._firstInputs = []; | ||
this._recentInputs = []; | ||
return; | ||
}; | ||
PointerEventInput.prototype.getTouches = function () { | ||
@@ -50,0 +56,0 @@ return this._recentInputs.length; |
@@ -35,2 +35,7 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
TouchEventInput.prototype.onRelease = function () { | ||
this.prevEvent = null; | ||
this._baseTouches = null; | ||
return; | ||
}; | ||
TouchEventInput.prototype.getTouches = function (event) { | ||
@@ -37,0 +42,0 @@ return event.touches.length; |
@@ -48,2 +48,7 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
TouchMouseEventInput.prototype.onRelease = function () { | ||
this.prevEvent = null; | ||
this._baseTouches = null; | ||
return; | ||
}; | ||
TouchMouseEventInput.prototype.getTouches = function (event) { | ||
@@ -50,0 +55,0 @@ return this._isTouchEvent(event) ? event.touches.length : 0; |
@@ -13,3 +13,3 @@ var __assign = (this && this.__assign) || function () { | ||
import { $, setCssProps } from "../utils"; | ||
import { IS_IOS_SAFARI, IOS_EDGE_THRESHOLD, DIRECTION_NONE, DIRECTION_VERTICAL, DIRECTION_HORIZONTAL, DIRECTION_ALL, PREVENT_SCROLL_CSSPROPS, } from "../const"; | ||
import { IS_IOS_SAFARI, IOS_EDGE_THRESHOLD, DIRECTION_NONE, DIRECTION_VERTICAL, DIRECTION_HORIZONTAL, DIRECTION_ALL, PREVENT_SCROLL_CSSPROPS, MOUSE_LEFT, } from "../const"; | ||
import { convertInputType, toAxis, } from "./InputType"; | ||
@@ -36,10 +36,17 @@ export var getDirectionByAngle = function (angle, thresholdAngle) { | ||
function PanInput(el, options) { | ||
var _this = this; | ||
this.axes = []; | ||
this.element = null; | ||
this._enabled = false; | ||
this._activeInput = null; | ||
this._activeEvent = null; | ||
this._atRightEdge = false; | ||
this._rightEdgeTimer = 0; | ||
this._forceRelease = function () { | ||
var activeEvent = _this._activeEvent; | ||
_this._detachWindowEvent(activeEvent); | ||
_this._observer.release(_this, activeEvent.prevEvent, [0, 0]); | ||
activeEvent.onRelease(); | ||
}; | ||
this.element = $(el); | ||
this.options = __assign({ inputType: ["touch", "mouse", "pointer"], inputButton: ["left"], scale: [1, 1], thresholdAngle: 45, threshold: 0, iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, releaseOnScroll: false }, options); | ||
this.options = __assign({ inputType: ["touch", "mouse", "pointer"], inputButton: [MOUSE_LEFT], scale: [1, 1], thresholdAngle: 45, threshold: 0, iOSEdgeSwipeThreshold: IOS_EDGE_THRESHOLD, releaseOnScroll: false }, options); | ||
this._onPanstart = this._onPanstart.bind(this); | ||
@@ -67,5 +74,5 @@ this._onPanmove = this._onPanmove.bind(this); | ||
PanInput.prototype.connect = function (observer) { | ||
if (this._activeInput) { | ||
if (this._activeEvent) { | ||
this._detachElementEvent(); | ||
this._detachWindowEvent(this._activeInput); | ||
this._detachWindowEvent(this._activeEvent); | ||
} | ||
@@ -78,3 +85,3 @@ this._attachElementEvent(observer); | ||
this._detachElementEvent(); | ||
this._detachWindowEvent(this._activeInput); | ||
this._detachWindowEvent(this._activeEvent); | ||
if (this._originalCssProps !== PREVENT_SCROLL_CSSPROPS) { | ||
@@ -102,5 +109,5 @@ setCssProps(this.element, this._originalCssProps); | ||
PanInput.prototype._onPanstart = function (event) { | ||
var activeInput = this._activeInput; | ||
var panEvent = activeInput.onEventStart(event, this.options.inputButton); | ||
if (!panEvent || !this._enabled || activeInput.getTouches(event) > 1) { | ||
var activeEvent = this._activeEvent; | ||
var panEvent = activeEvent.onEventStart(event, this.options.inputButton); | ||
if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { | ||
return; | ||
@@ -113,4 +120,4 @@ } | ||
IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold; | ||
this._attachWindowEvent(activeInput); | ||
activeInput.prevEvent = panEvent; | ||
this._attachWindowEvent(activeEvent); | ||
activeEvent.prevEvent = panEvent; | ||
} | ||
@@ -120,5 +127,5 @@ }; | ||
var _this = this; | ||
var activeInput = this._activeInput; | ||
var panEvent = activeInput.onEventMove(event, this.options.inputButton); | ||
if (!panEvent || !this._enabled || activeInput.getTouches(event) > 1) { | ||
var activeEvent = this._activeEvent; | ||
var panEvent = activeEvent.onEventMove(event, this.options.inputButton); | ||
if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { | ||
return; | ||
@@ -132,7 +139,6 @@ } | ||
} | ||
if (activeInput.prevEvent && IS_IOS_SAFARI) { | ||
if (activeEvent.prevEvent && IS_IOS_SAFARI) { | ||
var swipeLeftToRight = panEvent.center.x < 0; | ||
if (swipeLeftToRight) { | ||
this._detachWindowEvent(activeInput); | ||
this._observer.release(this, activeInput.prevEvent, [0, 0]); | ||
this._forceRelease(); | ||
return; | ||
@@ -147,6 +153,3 @@ } | ||
else { | ||
this._rightEdgeTimer = window.setTimeout(function () { | ||
_this._detachWindowEvent(activeInput); | ||
_this._observer.release(_this, activeInput.prevEvent, [0, 0]); | ||
}, 100); | ||
this._rightEdgeTimer = window.setTimeout(function () { return _this._forceRelease(); }, 100); | ||
} | ||
@@ -170,13 +173,13 @@ } | ||
} | ||
activeInput.prevEvent = panEvent; | ||
activeEvent.prevEvent = panEvent; | ||
}; | ||
PanInput.prototype._onPanend = function (event) { | ||
var activeInput = this._activeInput; | ||
activeInput.onEventEnd(event); | ||
if (!this._enabled || activeInput.getTouches(event) !== 0) { | ||
var activeEvent = this._activeEvent; | ||
activeEvent.onEventEnd(event); | ||
if (!this._enabled || activeEvent.getTouches(event) !== 0) { | ||
return; | ||
} | ||
this._detachWindowEvent(activeInput); | ||
this._detachWindowEvent(activeEvent); | ||
clearTimeout(this._rightEdgeTimer); | ||
var prevEvent = activeInput.prevEvent; | ||
var prevEvent = activeEvent.prevEvent; | ||
var velocity = this._getOffset([ | ||
@@ -190,19 +193,19 @@ Math.abs(prevEvent.velocityX) * (prevEvent.offsetX < 0 ? -1 : 1), | ||
this._observer.release(this, prevEvent, velocity); | ||
activeInput.prevEvent = null; | ||
activeEvent.onRelease(); | ||
}; | ||
PanInput.prototype._attachWindowEvent = function (activeInput) { | ||
PanInput.prototype._attachWindowEvent = function (activeEvent) { | ||
var _this = this; | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.move.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { | ||
window.addEventListener(event, _this._onPanmove); | ||
}); | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.end.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { | ||
window.addEventListener(event, _this._onPanend); | ||
}); | ||
}; | ||
PanInput.prototype._detachWindowEvent = function (activeInput) { | ||
PanInput.prototype._detachWindowEvent = function (activeEvent) { | ||
var _this = this; | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.move.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { | ||
window.removeEventListener(event, _this._onPanmove); | ||
}); | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.end.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { | ||
window.removeEventListener(event, _this._onPanend); | ||
@@ -213,4 +216,4 @@ }); | ||
var _this = this; | ||
var activeInput = convertInputType(this.options.inputType); | ||
if (!activeInput) { | ||
var activeEvent = convertInputType(this.options.inputType); | ||
if (!activeEvent) { | ||
throw new Error("There is currently no inputType available for current device. There must be at least one available inputType."); | ||
@@ -220,4 +223,4 @@ } | ||
this._enabled = true; | ||
this._activeInput = activeInput; | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.start.forEach(function (event) { | ||
this._activeEvent = activeEvent; | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { | ||
var _a; | ||
@@ -229,4 +232,4 @@ (_a = _this.element) === null || _a === void 0 ? void 0 : _a.addEventListener(event, _this._onPanstart); | ||
var _this = this; | ||
var activeInput = this._activeInput; | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.start.forEach(function (event) { | ||
var activeEvent = this._activeEvent; | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { | ||
var _a; | ||
@@ -233,0 +236,0 @@ (_a = _this.element) === null || _a === void 0 ? void 0 : _a.removeEventListener(event, _this._onPanstart); |
@@ -21,3 +21,3 @@ var __assign = (this && this.__assign) || function () { | ||
this._enabled = false; | ||
this._activeInput = null; | ||
this._activeEvent = null; | ||
this.element = $(el); | ||
@@ -33,3 +33,3 @@ this.options = __assign({ scale: 1, threshold: 0, inputType: ["touch", "pointer"] }, options); | ||
PinchInput.prototype.connect = function (observer) { | ||
if (this._activeInput) { | ||
if (this._activeEvent) { | ||
this._detachEvent(); | ||
@@ -64,5 +64,5 @@ } | ||
PinchInput.prototype._onPinchStart = function (event) { | ||
var activeInput = this._activeInput; | ||
var pinchEvent = activeInput.onEventStart(event); | ||
if (!pinchEvent || !this._enabled || activeInput.getTouches(event) !== 2) { | ||
var activeEvent = this._activeEvent; | ||
var pinchEvent = activeEvent.onEventStart(event); | ||
if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) { | ||
return; | ||
@@ -73,34 +73,34 @@ } | ||
this._pinchFlag = true; | ||
activeInput.prevEvent = pinchEvent; | ||
activeEvent.prevEvent = pinchEvent; | ||
}; | ||
PinchInput.prototype._onPinchMove = function (event) { | ||
var activeInput = this._activeInput; | ||
var pinchEvent = activeInput.onEventMove(event); | ||
var activeEvent = this._activeEvent; | ||
var pinchEvent = activeEvent.onEventMove(event); | ||
if (!pinchEvent || | ||
!this._pinchFlag || | ||
!this._enabled || | ||
activeInput.getTouches(event) !== 2) { | ||
activeEvent.getTouches(event) !== 2) { | ||
return; | ||
} | ||
var offset = this._getOffset(pinchEvent.scale, activeInput.prevEvent.scale); | ||
var offset = this._getOffset(pinchEvent.scale, activeEvent.prevEvent.scale); | ||
this._observer.change(this, event, toAxis(this.axes, [offset])); | ||
activeInput.prevEvent = pinchEvent; | ||
activeEvent.prevEvent = pinchEvent; | ||
}; | ||
PinchInput.prototype._onPinchEnd = function (event) { | ||
var activeInput = this._activeInput; | ||
activeInput.onEventEnd(event); | ||
var activeEvent = this._activeEvent; | ||
activeEvent.onEventEnd(event); | ||
if (!this._pinchFlag || | ||
!this._enabled || | ||
activeInput.getTouches(event) >= 2) { | ||
activeEvent.getTouches(event) >= 2) { | ||
return; | ||
} | ||
this._observer.release(this, event, [0], 0); | ||
activeEvent.onRelease(); | ||
this._baseValue = null; | ||
this._pinchFlag = false; | ||
activeInput.prevEvent = null; | ||
}; | ||
PinchInput.prototype._attachEvent = function (observer) { | ||
var _this = this; | ||
var activeInput = convertInputType(this.options.inputType); | ||
if (!activeInput) { | ||
var activeEvent = convertInputType(this.options.inputType); | ||
if (!activeEvent) { | ||
throw new Error("There is currently no inputType available for current device. There must be at least one available inputType."); | ||
@@ -110,10 +110,10 @@ } | ||
this._enabled = true; | ||
this._activeInput = activeInput; | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.start.forEach(function (event) { | ||
this._activeEvent = activeEvent; | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { | ||
_this.element.addEventListener(event, _this._onPinchStart, false); | ||
}); | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.move.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { | ||
_this.element.addEventListener(event, _this._onPinchMove, false); | ||
}); | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.end.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { | ||
_this.element.addEventListener(event, _this._onPinchEnd, false); | ||
@@ -124,10 +124,10 @@ }); | ||
var _this = this; | ||
var activeInput = this._activeInput; | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.start.forEach(function (event) { | ||
var activeEvent = this._activeEvent; | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.start.forEach(function (event) { | ||
_this.element.removeEventListener(event, _this._onPinchStart, false); | ||
}); | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.move.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.move.forEach(function (event) { | ||
_this.element.removeEventListener(event, _this._onPinchMove, false); | ||
}); | ||
activeInput === null || activeInput === void 0 ? void 0 : activeInput.end.forEach(function (event) { | ||
activeEvent === null || activeEvent === void 0 ? void 0 : activeEvent.end.forEach(function (event) { | ||
_this.element.removeEventListener(event, _this._onPinchEnd, false); | ||
@@ -134,0 +134,0 @@ }); |
@@ -31,4 +31,4 @@ var __extends = (this && this.__extends) || (function () { | ||
RotatePanInput.prototype._onPanstart = function (event) { | ||
var activeInput = this._activeInput; | ||
var panEvent = activeInput.onEventStart(event, this.options.inputButton); | ||
var activeEvent = this._activeEvent; | ||
var panEvent = activeEvent.onEventStart(event, this.options.inputButton); | ||
if (!panEvent || !this.isEnabled()) { | ||
@@ -39,3 +39,3 @@ return; | ||
this._observer.hold(this, panEvent); | ||
this._attachWindowEvent(activeInput); | ||
this._attachWindowEvent(activeEvent); | ||
this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); | ||
@@ -48,7 +48,7 @@ this._rotateOrigin = [ | ||
this._triggerChange(panEvent); | ||
activeInput.prevEvent = panEvent; | ||
activeEvent.prevEvent = panEvent; | ||
}; | ||
RotatePanInput.prototype._onPanmove = function (event) { | ||
var activeInput = this._activeInput; | ||
var panEvent = activeInput.onEventMove(event, this.options.inputButton); | ||
var activeEvent = this._activeEvent; | ||
var panEvent = activeEvent.onEventMove(event, this.options.inputButton); | ||
if (!panEvent || !this.isEnabled()) { | ||
@@ -62,11 +62,11 @@ return; | ||
this._triggerChange(panEvent); | ||
activeInput.prevEvent = panEvent; | ||
activeEvent.prevEvent = panEvent; | ||
}; | ||
RotatePanInput.prototype._onPanend = function (event) { | ||
var activeInput = this._activeInput; | ||
activeInput.onEventEnd(event); | ||
var activeEvent = this._activeEvent; | ||
activeEvent.onEventEnd(event); | ||
if (!this.isEnabled()) { | ||
return; | ||
} | ||
var prevEvent = activeInput.prevEvent; | ||
var prevEvent = activeEvent.prevEvent; | ||
this._triggerChange(prevEvent); | ||
@@ -79,4 +79,4 @@ var vx = prevEvent.velocityX; | ||
]); | ||
activeInput.prevEvent = null; | ||
this._detachWindowEvent(activeInput); | ||
activeEvent.onRelease(); | ||
this._detachWindowEvent(activeEvent); | ||
}; | ||
@@ -83,0 +83,0 @@ RotatePanInput.prototype._triggerChange = function (event) { |
{ | ||
"name": "@egjs/axes", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "A module used to change the information of user action entered by various input devices such as touch screen or mouse into the logical virtual coordinates. You can easily create a UI that responds to user actions.", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
@@ -10,2 +10,6 @@ export const DIRECTION_NONE = 1; | ||
export const MOUSE_LEFT = "left"; | ||
export const MOUSE_RIGHT = "right"; | ||
export const MOUSE_MIDDLE = "middle"; | ||
import getAgent from "@egjs/agent"; | ||
@@ -12,0 +16,0 @@ |
import { ExtendedEvent, InputEventType } from "../types"; | ||
import { getAngle } from "../utils"; | ||
import { window } from "../browser"; | ||
import { MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT } from "../const"; | ||
@@ -13,8 +14,16 @@ export const SUPPORT_TOUCH = "ontouchstart" in window; | ||
public abstract onEventStart(event: InputEventType): ExtendedEvent; | ||
public abstract onEventStart( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent; | ||
public abstract onEventMove(event: InputEventType): ExtendedEvent; | ||
public abstract onEventMove( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent; | ||
public abstract onEventEnd(event: InputEventType): void; | ||
public abstract onRelease(event: InputEventType): void; | ||
public abstract getTouches(event: InputEventType): number; | ||
@@ -74,2 +83,31 @@ | ||
} | ||
protected _getButton(event: InputEventType): string { | ||
const buttonCodeMap = { 1: MOUSE_LEFT, 2: MOUSE_RIGHT, 4: MOUSE_MIDDLE }; | ||
const button = this._isTouchEvent(event) | ||
? MOUSE_LEFT | ||
: buttonCodeMap[event.buttons]; | ||
return button ? button : null; | ||
} | ||
protected _isTouchEvent(event: InputEventType): event is TouchEvent { | ||
return event.type.indexOf("touch") > -1; | ||
} | ||
protected _isValidButton(button: string, inputButton: string[]): boolean { | ||
return inputButton.indexOf(button) > -1; | ||
} | ||
protected _preventMouseButton(event: InputEventType, button: string): void { | ||
if (button === MOUSE_RIGHT) { | ||
window.addEventListener("contextmenu", this._stopContextMenu); | ||
} else if (button === MOUSE_MIDDLE) { | ||
event.preventDefault(); | ||
} | ||
} | ||
private _stopContextMenu = (event: InputEventType) => { | ||
event.preventDefault(); | ||
window.removeEventListener("contextmenu", this._stopContextMenu); | ||
}; | ||
} |
@@ -10,7 +10,24 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
public onEventStart(event: InputEventType): ExtendedEvent { | ||
public onEventStart( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent { | ||
const button = this._getButton(event); | ||
if (inputButton && !this._isValidButton(button, inputButton)) { | ||
return null; | ||
} | ||
this._preventMouseButton(event, button); | ||
return this.extendEvent(event); | ||
} | ||
public onEventMove(event: InputEventType): ExtendedEvent { | ||
public onEventMove( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent { | ||
if ( | ||
inputButton && | ||
!this._isValidButton(this._getButton(event), inputButton) | ||
) { | ||
return null; | ||
} | ||
return this.extendEvent(event); | ||
@@ -23,2 +40,7 @@ } | ||
public onRelease(): void { | ||
this.prevEvent = null; | ||
return; | ||
} | ||
public getTouches(): number { | ||
@@ -25,0 +47,0 @@ return 0; |
@@ -16,3 +16,11 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
public onEventStart(event: InputEventType): ExtendedEvent { | ||
public onEventStart( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent { | ||
const button = this._getButton(event); | ||
if (inputButton && !this._isValidButton(button, inputButton)) { | ||
return null; | ||
} | ||
this._preventMouseButton(event, button); | ||
this._updatePointerEvent(event as PointerEvent); | ||
@@ -22,3 +30,12 @@ return this.extendEvent(event); | ||
public onEventMove(event: InputEventType): ExtendedEvent { | ||
public onEventMove( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent { | ||
if ( | ||
inputButton && | ||
!this._isValidButton(this._getButton(event), inputButton) | ||
) { | ||
return null; | ||
} | ||
this._updatePointerEvent(event as PointerEvent); | ||
@@ -32,2 +49,9 @@ return this.extendEvent(event); | ||
public onRelease(): void { | ||
this.prevEvent = null; | ||
this._firstInputs = []; | ||
this._recentInputs = []; | ||
return; | ||
} | ||
public getTouches(): number { | ||
@@ -82,3 +106,3 @@ return this._recentInputs.length; | ||
private _removePointerEvent(event: PointerEvent) { | ||
private _removePointerEvent(event?: PointerEvent) { | ||
this._firstInputs = this._firstInputs.filter( | ||
@@ -85,0 +109,0 @@ (x) => x.pointerId !== event.pointerId |
@@ -26,2 +26,8 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
public onRelease(): void { | ||
this.prevEvent = null; | ||
this._baseTouches = null; | ||
return; | ||
} | ||
public getTouches(event: InputEventType): number { | ||
@@ -28,0 +34,0 @@ return (event as TouchEvent).touches.length; |
@@ -12,10 +12,27 @@ import { InputEventType, ExtendedEvent } from "../types"; | ||
public onEventStart(event: InputEventType): ExtendedEvent { | ||
public onEventStart( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent { | ||
const button = this._getButton(event); | ||
if (this._isTouchEvent(event)) { | ||
this._baseTouches = (event as TouchEvent).touches; | ||
this._baseTouches = event.touches; | ||
} | ||
if (inputButton && !this._isValidButton(button, inputButton)) { | ||
return null; | ||
} | ||
this._preventMouseButton(event, button); | ||
return this.extendEvent(event); | ||
} | ||
public onEventMove(event: InputEventType): ExtendedEvent { | ||
public onEventMove( | ||
event: InputEventType, | ||
inputButton?: string[] | ||
): ExtendedEvent { | ||
if ( | ||
inputButton && | ||
!this._isValidButton(this._getButton(event), inputButton) | ||
) { | ||
return null; | ||
} | ||
return this.extendEvent(event); | ||
@@ -26,3 +43,3 @@ } | ||
if (this._isTouchEvent(event)) { | ||
this._baseTouches = (event as TouchEvent).touches; | ||
this._baseTouches = event.touches; | ||
} | ||
@@ -32,4 +49,10 @@ return; | ||
public onRelease(): void { | ||
this.prevEvent = null; | ||
this._baseTouches = null; | ||
return; | ||
} | ||
public getTouches(event: InputEventType): number { | ||
return this._isTouchEvent(event) ? (event as TouchEvent).touches.length : 0; | ||
return this._isTouchEvent(event) ? event.touches.length : 0; | ||
} | ||
@@ -39,13 +62,8 @@ | ||
if (this._isTouchEvent(event)) { | ||
if ( | ||
(event as TouchEvent).touches.length !== 2 || | ||
this._baseTouches.length < 2 | ||
) { | ||
if (event.touches.length !== 2 || this._baseTouches.length < 2) { | ||
return 1; // TODO: consider calculating non-pinch gesture scale | ||
} | ||
return ( | ||
this._getDistance( | ||
(event as TouchEvent).touches[0], | ||
(event as TouchEvent).touches[1] | ||
) / this._getDistance(this._baseTouches[0], this._baseTouches[1]) | ||
this._getDistance(event.touches[0], event.touches[1]) / | ||
this._getDistance(this._baseTouches[0], this._baseTouches[1]) | ||
); | ||
@@ -62,9 +80,9 @@ } | ||
return { | ||
x: (event as TouchEvent).touches[0].clientX, | ||
y: (event as TouchEvent).touches[0].clientY, | ||
x: event.touches[0].clientX, | ||
y: event.touches[0].clientY, | ||
}; | ||
} | ||
return { | ||
x: (event as MouseEvent).clientX, | ||
y: (event as MouseEvent).clientY, | ||
x: event.clientX, | ||
y: event.clientY, | ||
}; | ||
@@ -96,6 +114,2 @@ } | ||
} | ||
private _isTouchEvent(event: InputEventType): boolean { | ||
return event.hasOwnProperty("touches"); | ||
} | ||
} |
import { Axis } from "../AxisManager"; | ||
import { AxesOption } from "../Axes"; | ||
import { ActiveInput } from "../types"; | ||
import { ActiveEvent } from "../types"; | ||
import { MouseEventInput } from "../eventInput/MouseEventInput"; | ||
@@ -47,3 +47,3 @@ import { TouchEventInput } from "../eventInput/TouchEventInput"; | ||
export const convertInputType = (inputType: string[] = []): ActiveInput => { | ||
export const convertInputType = (inputType: string[] = []): ActiveEvent => { | ||
let hasTouch = false; | ||
@@ -50,0 +50,0 @@ let hasMouse = false; |
@@ -10,4 +10,5 @@ import { $, setCssProps } from "../utils"; | ||
PREVENT_SCROLL_CSSPROPS, | ||
MOUSE_LEFT, | ||
} from "../const"; | ||
import { ActiveInput, InputEventType } from "../types"; | ||
import { ActiveEvent, InputEventType } from "../types"; | ||
@@ -23,2 +24,3 @@ import { | ||
inputType?: string[]; | ||
inputButton?: string[]; | ||
scale?: number[]; | ||
@@ -60,7 +62,14 @@ thresholdAngle?: number; | ||
* @ko eg.Axes.PanInput 모듈의 옵션 객체 | ||
* @param {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices. | ||
* @param {String[]} [inputType=["touch","mouse", "pointer"]] Types of input devices | ||
* - touch: Touch screen | ||
* - mouse: Mouse <ko>입력 장치 종류. | ||
* - mouse: Mouse <ko>입력 장치 종류 | ||
* - touch: 터치 입력 장치 | ||
* - mouse: 마우스</ko> | ||
* @param {String[]} [inputButton=["left"]] List of buttons to allow input | ||
* - left: Left mouse button and normal touch | ||
* - middle: Mouse wheel press | ||
* - right: Right mouse button <ko>입력을 허용할 버튼 목록 | ||
* - left: 마우스 왼쪽 버튼 | ||
* - middle: 마우스 휠 눌림 | ||
* - right: 마우스 오른쪽 버튼 </ko> | ||
* @param {Number[]} [scale] Coordinate scale that a user can move<ko>사용자의 동작으로 이동하는 좌표의 배율</ko> | ||
@@ -104,3 +113,3 @@ * @param {Number} [scale[0]=1] horizontal axis scale <ko>수평축 배율</ko> | ||
protected _enabled = false; | ||
protected _activeInput: ActiveInput = null; | ||
protected _activeEvent: ActiveEvent = null; | ||
private _originalCssProps: { [key: string]: string }; | ||
@@ -117,2 +126,3 @@ private _atRightEdge = false; | ||
inputType: ["touch", "mouse", "pointer"], | ||
inputButton: [MOUSE_LEFT], | ||
scale: [1, 1], | ||
@@ -146,5 +156,5 @@ thresholdAngle: 45, | ||
public connect(observer: InputTypeObserver): InputType { | ||
if (this._activeInput) { | ||
if (this._activeEvent) { | ||
this._detachElementEvent(); | ||
this._detachWindowEvent(this._activeInput); | ||
this._detachWindowEvent(this._activeEvent); | ||
} | ||
@@ -158,3 +168,3 @@ this._attachElementEvent(observer); | ||
this._detachElementEvent(); | ||
this._detachWindowEvent(this._activeInput); | ||
this._detachWindowEvent(this._activeEvent); | ||
if (this._originalCssProps !== PREVENT_SCROLL_CSSPROPS) { | ||
@@ -206,10 +216,8 @@ setCssProps(this.element, this._originalCssProps); | ||
protected _onPanstart(event: InputEventType) { | ||
const activeInput = this._activeInput; | ||
activeInput.onEventStart(event); | ||
if (!this._enabled || activeInput.getTouches(event) > 1) { | ||
const activeEvent = this._activeEvent; | ||
const panEvent = activeEvent.onEventStart(event, this.options.inputButton); | ||
if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { | ||
return; | ||
} | ||
const panEvent = activeInput.extendEvent(event); | ||
if (panEvent.srcEvent.cancelable !== false) { | ||
@@ -221,4 +229,4 @@ const edgeThreshold = this.options.iOSEdgeSwipeThreshold; | ||
IS_IOS_SAFARI && panEvent.center.x > window.innerWidth - edgeThreshold; | ||
this._attachWindowEvent(activeInput); | ||
activeInput.prevEvent = panEvent; | ||
this._attachWindowEvent(activeEvent); | ||
activeEvent.prevEvent = panEvent; | ||
} | ||
@@ -228,9 +236,8 @@ } | ||
protected _onPanmove(event: InputEventType) { | ||
const activeInput = this._activeInput; | ||
activeInput.onEventMove(event); | ||
if (!this._enabled || activeInput.getTouches(event) > 1) { | ||
const activeEvent = this._activeEvent; | ||
const panEvent = activeEvent.onEventMove(event, this.options.inputButton); | ||
if (!panEvent || !this._enabled || activeEvent.getTouches(event) > 1) { | ||
return; | ||
} | ||
const panEvent = activeInput.extendEvent(event); | ||
const { iOSEdgeSwipeThreshold, releaseOnScroll } = this.options; | ||
@@ -247,3 +254,3 @@ const userDirection = getDirectionByAngle( | ||
if (activeInput.prevEvent && IS_IOS_SAFARI) { | ||
if (activeEvent.prevEvent && IS_IOS_SAFARI) { | ||
const swipeLeftToRight = panEvent.center.x < 0; | ||
@@ -253,4 +260,3 @@ | ||
// iOS swipe left => right | ||
this._detachWindowEvent(activeInput); | ||
this._observer.release(this, activeInput.prevEvent, [0, 0]); | ||
this._forceRelease(); | ||
return; | ||
@@ -267,6 +273,6 @@ } else if (this._atRightEdge) { | ||
// iOS swipe right => left | ||
this._rightEdgeTimer = window.setTimeout(() => { | ||
this._detachWindowEvent(activeInput); | ||
this._observer.release(this, activeInput.prevEvent, [0, 0]); | ||
}, 100); | ||
this._rightEdgeTimer = window.setTimeout( | ||
() => this._forceRelease(), | ||
100 | ||
); | ||
} | ||
@@ -294,14 +300,14 @@ } | ||
} | ||
activeInput.prevEvent = panEvent; | ||
activeEvent.prevEvent = panEvent; | ||
} | ||
protected _onPanend(event: InputEventType) { | ||
const activeInput = this._activeInput; | ||
activeInput.onEventEnd(event); | ||
if (!this._enabled || activeInput.getTouches(event) !== 0) { | ||
const activeEvent = this._activeEvent; | ||
activeEvent.onEventEnd(event); | ||
if (!this._enabled || activeEvent.getTouches(event) !== 0) { | ||
return; | ||
} | ||
this._detachWindowEvent(activeInput); | ||
this._detachWindowEvent(activeEvent); | ||
clearTimeout(this._rightEdgeTimer); | ||
const prevEvent = activeInput.prevEvent; | ||
const prevEvent = activeEvent.prevEvent; | ||
const velocity = this._getOffset( | ||
@@ -318,19 +324,20 @@ [ | ||
this._observer.release(this, prevEvent, velocity); | ||
activeEvent.onRelease(); | ||
} | ||
protected _attachWindowEvent(activeInput: ActiveInput) { | ||
activeInput?.move.forEach((event) => { | ||
window.addEventListener(event, this._onPanmove, false); | ||
protected _attachWindowEvent(activeEvent: ActiveEvent) { | ||
activeEvent?.move.forEach((event) => { | ||
window.addEventListener(event, this._onPanmove); | ||
}); | ||
activeInput?.end.forEach((event) => { | ||
window.addEventListener(event, this._onPanend, false); | ||
activeEvent?.end.forEach((event) => { | ||
window.addEventListener(event, this._onPanend); | ||
}); | ||
} | ||
protected _detachWindowEvent(activeInput: ActiveInput) { | ||
activeInput?.move.forEach((event) => { | ||
window.removeEventListener(event, this._onPanmove, false); | ||
protected _detachWindowEvent(activeEvent: ActiveEvent) { | ||
activeEvent?.move.forEach((event) => { | ||
window.removeEventListener(event, this._onPanmove); | ||
}); | ||
activeInput?.end.forEach((event) => { | ||
window.removeEventListener(event, this._onPanend, false); | ||
activeEvent?.end.forEach((event) => { | ||
window.removeEventListener(event, this._onPanend); | ||
}); | ||
@@ -340,4 +347,4 @@ } | ||
private _attachElementEvent(observer: InputTypeObserver) { | ||
const activeInput = convertInputType(this.options.inputType); | ||
if (!activeInput) { | ||
const activeEvent = convertInputType(this.options.inputType); | ||
if (!activeEvent) { | ||
throw new Error( | ||
@@ -349,5 +356,5 @@ "There is currently no inputType available for current device. There must be at least one available inputType." | ||
this._enabled = true; | ||
this._activeInput = activeInput; | ||
activeInput?.start.forEach((event) => { | ||
this.element?.addEventListener(event, this._onPanstart, false); | ||
this._activeEvent = activeEvent; | ||
activeEvent?.start.forEach((event) => { | ||
this.element?.addEventListener(event, this._onPanstart); | ||
}); | ||
@@ -357,5 +364,5 @@ } | ||
private _detachElementEvent() { | ||
const activeInput = this._activeInput; | ||
activeInput?.start.forEach((event) => { | ||
this.element?.removeEventListener(event, this._onPanstart, false); | ||
const activeEvent = this._activeEvent; | ||
activeEvent?.start.forEach((event) => { | ||
this.element?.removeEventListener(event, this._onPanstart); | ||
}); | ||
@@ -378,2 +385,9 @@ this._enabled = false; | ||
} | ||
private _forceRelease = () => { | ||
const activeEvent = this._activeEvent; | ||
this._detachWindowEvent(activeEvent); | ||
this._observer.release(this, activeEvent.prevEvent, [0, 0]); | ||
activeEvent.onRelease(); | ||
}; | ||
} |
import { $, setCssProps } from "../utils"; | ||
import { ActiveInput, InputEventType } from "../types"; | ||
import { ActiveEvent, InputEventType } from "../types"; | ||
import { PREVENT_SCROLL_CSSPROPS } from "../const"; | ||
@@ -48,3 +48,3 @@ | ||
private _originalCssProps: { [key: string]: string }; | ||
private _activeInput: ActiveInput = null; | ||
private _activeEvent: ActiveEvent = null; | ||
private _baseValue: number; | ||
@@ -73,3 +73,3 @@ | ||
public connect(observer: InputTypeObserver): InputType { | ||
if (this._activeInput) { | ||
if (this._activeEvent) { | ||
this._detachEvent(); | ||
@@ -129,4 +129,5 @@ } | ||
private _onPinchStart(event: InputEventType) { | ||
this._activeInput.onEventStart(event); | ||
if (!this._enabled || this._activeInput.getTouches(event) !== 2) { | ||
const activeEvent = this._activeEvent; | ||
const pinchEvent = activeEvent.onEventStart(event); | ||
if (!pinchEvent || !this._enabled || activeEvent.getTouches(event) !== 2) { | ||
return; | ||
@@ -138,12 +139,13 @@ } | ||
this._pinchFlag = true; | ||
const pinchEvent = this._activeInput.extendEvent(event); | ||
this._activeInput.prevEvent = pinchEvent; | ||
activeEvent.prevEvent = pinchEvent; | ||
} | ||
private _onPinchMove(event: InputEventType) { | ||
this._activeInput.onEventMove(event); | ||
const activeEvent = this._activeEvent; | ||
const pinchEvent = activeEvent.onEventMove(event); | ||
if ( | ||
!pinchEvent || | ||
!this._pinchFlag || | ||
!this._enabled || | ||
this._activeInput.getTouches(event) !== 2 | ||
activeEvent.getTouches(event) !== 2 | ||
) { | ||
@@ -153,17 +155,17 @@ return; | ||
const pinchEvent = this._activeInput.extendEvent(event); | ||
const offset = this._getOffset( | ||
pinchEvent.scale, | ||
this._activeInput.prevEvent.scale | ||
activeEvent.prevEvent.scale | ||
); | ||
this._observer.change(this, event, toAxis(this.axes, [offset])); | ||
this._activeInput.prevEvent = pinchEvent; | ||
activeEvent.prevEvent = pinchEvent; | ||
} | ||
private _onPinchEnd(event: InputEventType) { | ||
this._activeInput.onEventEnd(event); | ||
const activeEvent = this._activeEvent; | ||
activeEvent.onEventEnd(event); | ||
if ( | ||
!this._pinchFlag || | ||
!this._enabled || | ||
this._activeInput.getTouches(event) >= 2 | ||
activeEvent.getTouches(event) >= 2 | ||
) { | ||
@@ -174,10 +176,10 @@ return; | ||
this._observer.release(this, event, [0], 0); | ||
activeEvent.onRelease(); | ||
this._baseValue = null; | ||
this._pinchFlag = false; | ||
this._activeInput.prevEvent = null; | ||
} | ||
private _attachEvent(observer: InputTypeObserver) { | ||
const activeInput = convertInputType(this.options.inputType); | ||
if (!activeInput) { | ||
const activeEvent = convertInputType(this.options.inputType); | ||
if (!activeEvent) { | ||
throw new Error( | ||
@@ -189,10 +191,10 @@ "There is currently no inputType available for current device. There must be at least one available inputType." | ||
this._enabled = true; | ||
this._activeInput = activeInput; | ||
activeInput?.start.forEach((event) => { | ||
this._activeEvent = activeEvent; | ||
activeEvent?.start.forEach((event) => { | ||
this.element.addEventListener(event, this._onPinchStart, false); | ||
}); | ||
activeInput?.move.forEach((event) => { | ||
activeEvent?.move.forEach((event) => { | ||
this.element.addEventListener(event, this._onPinchMove, false); | ||
}); | ||
activeInput?.end.forEach((event) => { | ||
activeEvent?.end.forEach((event) => { | ||
this.element.addEventListener(event, this._onPinchEnd, false); | ||
@@ -203,10 +205,10 @@ }); | ||
private _detachEvent() { | ||
const activeInput = this._activeInput; | ||
activeInput?.start.forEach((event) => { | ||
const activeEvent = this._activeEvent; | ||
activeEvent?.start.forEach((event) => { | ||
this.element.removeEventListener(event, this._onPinchStart, false); | ||
}); | ||
activeInput?.move.forEach((event) => { | ||
activeEvent?.move.forEach((event) => { | ||
this.element.removeEventListener(event, this._onPinchMove, false); | ||
}); | ||
activeInput?.end.forEach((event) => { | ||
activeEvent?.end.forEach((event) => { | ||
this.element.removeEventListener(event, this._onPinchEnd, false); | ||
@@ -213,0 +215,0 @@ }); |
@@ -51,5 +51,5 @@ import { ExtendedEvent } from "../types"; | ||
protected _onPanstart(event: MouseEvent) { | ||
const activeInput = this._activeInput; | ||
activeInput.onEventStart(event); | ||
if (!this.isEnabled) { | ||
const activeEvent = this._activeEvent; | ||
const panEvent = activeEvent.onEventStart(event, this.options.inputButton); | ||
if (!panEvent || !this.isEnabled()) { | ||
return; | ||
@@ -59,6 +59,5 @@ } | ||
const rect = this.element.getBoundingClientRect(); | ||
const panEvent = activeInput.extendEvent(event); | ||
this._observer.hold(this, panEvent); | ||
this._attachWindowEvent(activeInput); | ||
this._attachWindowEvent(activeEvent); | ||
// TODO: how to do if element is ellipse not circle. | ||
@@ -76,14 +75,12 @@ this._coefficientForDistanceToAngle = 360 / (rect.width * Math.PI); // from 2*pi*r * x / 360 | ||
this._triggerChange(panEvent); | ||
activeInput.prevEvent = panEvent; | ||
activeEvent.prevEvent = panEvent; | ||
} | ||
protected _onPanmove(event: MouseEvent) { | ||
const activeInput = this._activeInput; | ||
activeInput.onEventMove(event); | ||
if (!this.isEnabled) { | ||
const activeEvent = this._activeEvent; | ||
const panEvent = activeEvent.onEventMove(event, this.options.inputButton); | ||
if (!panEvent || !this.isEnabled()) { | ||
return; | ||
} | ||
const panEvent = activeInput.extendEvent(event); | ||
if (panEvent.srcEvent.cancelable !== false) { | ||
@@ -94,12 +91,12 @@ panEvent.srcEvent.preventDefault(); | ||
this._triggerChange(panEvent); | ||
activeInput.prevEvent = panEvent; | ||
activeEvent.prevEvent = panEvent; | ||
} | ||
protected _onPanend(event: MouseEvent) { | ||
const activeInput = this._activeInput; | ||
activeInput.onEventEnd(event); | ||
if (!this.isEnabled) { | ||
const activeEvent = this._activeEvent; | ||
activeEvent.onEventEnd(event); | ||
if (!this.isEnabled()) { | ||
return; | ||
} | ||
const prevEvent = activeInput.prevEvent; | ||
const prevEvent = activeEvent.prevEvent; | ||
this._triggerChange(prevEvent); | ||
@@ -113,3 +110,4 @@ const vx = prevEvent.velocityX; | ||
]); | ||
this._detachWindowEvent(activeInput); | ||
activeEvent.onRelease(); | ||
this._detachWindowEvent(activeEvent); | ||
} | ||
@@ -116,0 +114,0 @@ |
@@ -12,3 +12,3 @@ import { Axis } from "./AxisManager"; | ||
export type ActiveInput = | ||
export type ActiveEvent = | ||
| MouseEventInput | ||
@@ -15,0 +15,0 @@ | TouchEventInput |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1756889
17129