@egjs/flicking
Advanced tools
Comparing version 3.0.0-beta3 to 3.0.0-beta4
@@ -26,2 +26,3 @@ import Flicking from "./Flicking"; | ||
snap: number; | ||
freeScroll: boolean; | ||
} | ||
@@ -67,2 +68,3 @@ export interface FlickingStatus { | ||
readonly SELECT: "select"; | ||
readonly NONE: ""; | ||
} | ||
@@ -69,0 +71,0 @@ export interface FlickingEvent { |
@@ -7,5 +7,5 @@ /* | ||
https://github.com/naver/egjs-flicking | ||
@version 3.0.0-beta3 | ||
@version 3.0.0-beta4 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/component"),require("@egjs/axes")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/axes"],e):((t=t||self).eg=t.eg||{},t.eg.Flicking=e(t.eg.Component,t.eg.Axes))}(this,function(t,o){"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 p(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.forEach(function(n){Object.keys(n).forEach(function(t){var e=n[t];i[t]=e})}),i}var s=function(){var t={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"},e=document.documentElement.style,n="";for(var i in t)i in e&&(n=i);if(!n)throw new Error("Browser doesn't support CSS3 2D Transforms.");var o=document.createElement("div");document.documentElement.insertBefore(o,null),o.style[n]="translate3d(1px, 1px, 1px)";var r=window.getComputedStyle(o).getPropertyValue(t[n]);o.parentElement.removeChild(o);var a={name:n,has3d:0<r.length&&"none"!==r};return s=function(){return a},a};function a(e,n){Object.keys(n).forEach(function(t){e.style[t]=n[t]})}function f(t,e,n){return Math.max(Math.min(t,n),e)}function d(t,e,n){return e<=t&&t<=n}function g(t,e,n){var i=null!=n?n:e/2,o=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof t)return f(t,0,e);for(var r=0,a=0,s=o.exec(t);null!=s;){var l=s[1],c=s[2],h=s[3],u=parseFloat(c);if(r<=0&&(l=l||"+"),!l)return i;"%"===h&&(u=u/100*e),a+="+"===l?u:-u,++r,s=o.exec(t)}return 0===r?i:f(a,0,e)}function b(t,e){var n=e[0],i=e[1],o=e[2];return i<t&&o-i?(t-i)/(o-i):t<i&&i-n?(t-i)/(i-n):t!==i&&o-n?(t-n)/(o-n):0}var v={classPrefix:"eg-flick",deceleration:.0075,horizontal:!0,circular:!1,threshold:40,duration:100,panelEffect:function(t){return 1-Math.pow(1-t,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,bounce:10,autoResize:!1,adaptive:!1,zIndex:2e3,bound:!1,overflow:!1,hanger:"50%",anchor:"50%",gap:0,snap:1},l={position:"relative",zIndex:v.zIndex,width:"100%",height:"100%",willChange:"transform",overflow:"hidden"},c={width:"100%",height:"100%"},h={position:"absolute"},N={HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",CHANGE:"change",RESTORE:"restore",SELECT:"select"},P={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},u=0,m=1,x=2,M=3,R=4,E={PREV:"PREV",NEXT:"NEXT"},A=s(),S=function(){function i(t,e,n){var i,o;this.element=t,this.state={index:e,horizontal:n.horizontal,position:0,anchorExpression:n.anchorExpression,relativeAnchorPosition:0,size:0,clonedPanels:[],isClone:!1,cloneIndex:-1,originalStyle:{className:t.getAttribute("class")||null,style:t.getAttribute("style")||null},cachedBbox:null},n.classPrefix&&(i=t,o=n.classPrefix+"-panel",i.classList?i.classList.add(o):i.className.indexOf(o)<0&&(i.className=(i.className+" "+o).replace(/\s{2,}/g," "))),a(this.element,h),this.resize()}var t=i.prototype;return t.resize=function(){var t=this.state;t.cachedBbox=null;var e=this.getBbox();t.size=t.horizontal?e.width:e.height,t.isClone||t.clonedPanels.forEach(function(t){return t.resize()})},t.destroy=function(){var t=this.element,e=this.state.originalStyle;for(var n in e.className?t.setAttribute("class",e.className):t.removeAttribute("class"),e.style?t.setAttribute("style",e.style):t.removeAttribute("style"),this)this[n]=null},t.getElement=function(){return this.element},t.getAnchorPosition=function(){return this.state.position+this.state.relativeAnchorPosition},t.getRelativeAnchorPosition=function(){return this.state.relativeAnchorPosition},t.getIndex=function(){return this.state.index},t.getPosition=function(){return this.state.position},t.getSize=function(){return this.state.size},t.getPrevPanel=function(){return this.prevPanel},t.getNextPanel=function(){return this.nextPanel},t.getBbox=function(){var t=this.state;return t.cachedBbox||(t.cachedBbox=this.element.getBoundingClientRect()),t.cachedBbox},t.isClone=function(){return this.state.isClone},t.getCloneIndex=function(){return this.state.cloneIndex},t.getClonedPanels=function(){return this.state.clonedPanels},t.getIdenticalPanels=function(){var t=this.state;return t.isClone?this.original.getIdenticalPanels():[this].concat(t.clonedPanels)},t.setPosition=function(t){var e=this.state,n=this.element.style;e.position=t,e.horizontal?n.left=t+"px":n.top=t+"px",e.relativeAnchorPosition=g(e.anchorExpression,e.size)},t.setPrevPanel=function(t){this.prevPanel=t},t.setNextPanel=function(t){this.nextPanel=t},t.clone=function(t){var e=this.state,n=new i(this.element.cloneNode(!0),e.index,{anchorExpression:e.anchorExpression,horizontal:e.horizontal});return n.original=this,n.state.isClone=!0,n.state.cloneIndex=t,n.state.size=e.size,e.clonedPanels.push(n),n},t.removeClonedPanelsAfter=function(t){for(var e=0,n=this.state.clonedPanels.splice(t);e<n.length;e++){var i=n[e].getElement();i.parentNode.removeChild(i)}},i}(),T=function(){function t(t,e,n){this.clonedPanels=[],this.viewportElement=t,this.cameraElement=e,this.state={index:n.defaultIndex,size:0,position:0,hangerPosition:0,scrollArea:{prev:0,next:0},translate:A},this.options=n,this.build()}var e=t.prototype;return e.moveTo=function(t,e,n){void 0===n&&(n=this.options.duration);var i=this.state,o=t.anchorPosition-i.hangerPosition;o=this.canSetBoundMode()?f(o,i.scrollArea.prev,i.scrollArea.next):o,i.index=t.index,e&&e.setTo?e.setTo({flick:o},n):this.axes.setTo({flick:o},n)},e.moveCamera=function(t){var e=this.state,n=e.translate.name,i=(this.options.horizontal?[-t,0]:[0,-t]).map(function(t){return Math.round(t)+"px"}).join(", ");this.cameraElement.style[n]=e.translate.has3d?"translate3d("+i+", 0px)":"translate("+i+")",e.position=t},e.resize=function(){this.updateSize(),this.updateOriginalPanelPositions(),this.updateAdaptiveSize(),this.updateScrollArea(),this.options.circular&&(this.clonePanels(),this.relocatePanels()),this.chainPanels(),this.updateCameraPosition()},e.findNearestPanel=function(){var t=this.state,e=this.panels,n=this.clonedPanels,i=t.scrollArea,o=t.position+t.hangerPosition;if(this.isOutOfBound())return t.position<i.prev?e[0]:e[e.length-1];for(var r,a=1/0,s=0,l=e.concat(n);s<l.length;s++){var c=l[s],h=c.getPosition(),u=h+c.getSize(),f=d(o,h,u)?0:Math.min(Math.abs(h-o),Math.abs(u-o));if(a<f)break;a=f,r=c}return r},e.findPanelOf=function(t){for(var e=0,n=this.panels.concat(this.clonedPanels);e<n.length;e++){var i=n[e];if(i.getElement().contains(t))return i}},e.findNearestIdenticalPanel=function(t){var e=this.state,i=t,o=1/0,r=e.position+e.hangerPosition;return t.getIdenticalPanels().forEach(function(t){var e=t.getAnchorPosition(),n=Math.abs(e-r);n<o&&(i=t,o=n)}),i},e.findShortestPositionToPanel=function(t){var e=this.state,n=this.options,i=t.getAnchorPosition(),o=Math.abs(e.position+e.hangerPosition-i),r=e.scrollArea.next-e.scrollArea.prev;if(n.circular)return o<=r-o?i-e.hangerPosition:i>e.position+e.hangerPosition?i-e.hangerPosition-r:i-e.hangerPosition+r;var a=i-e.hangerPosition;return this.canSetBoundMode()?f(a,e.scrollArea.prev,e.scrollArea.next):a},e.enable=function(){this.panInput.enable()},e.disable=function(){this.panInput.disable()},e.updateAdaptiveSize=function(){var t,e=this.options,i=e.horizontal;if(e.adaptive){var n=this.getCurrentPanel().getBbox();t=i?n.height:n.width}else{t=this.panels.reduce(function(t,e){var n=e.getBbox();return Math.max(t,i?n.height:n.width)},0)}var o=this.viewportElement.style;i?(o.height=t+"px",o.minHeight="100%",o.width="100%"):(o.width=t+"px",o.minWidth="100%",o.height="100%")},e.destroy=function(){var t=this.viewportElement,e=t.parentElement;for(var n in e.removeChild(t),this.axes.destroy(),this.panInput.destroy(),this.panels.forEach(function(t){e.appendChild(t.getElement()),t.destroy()}),this)this[n]=null},e.restore=function(t){var e=t.panels,n=this.cameraElement;n.innerHTML=e.map(function(t){return t.html}).join(""),this.viewportElement.appendChild(n),this.state.index=t.index,this.moveCamera(t.position),this.panels=[],this.clonedPanels=[],this.createPanels(),this.resize()},e.getPanelCount=function(){return this.panels.length},e.getPanel=function(t){return d(t,0,this.panels.length-1)?this.panels[t]:null},e.getCurrentPanel=function(){return this.panels[this.state.index]},e.getIndex=function(){return this.state.index},e.getPrevIndex=function(){var t=this.state.index-1;return t<0&&(t=this.options.circular?this.panels.length-1:-1),t},e.getNextIndex=function(){var t=this.state.index+1;return t>=this.panels.length&&(t=this.options.circular?0:-1),t},e.getSize=function(){return this.state.size},e.getScrollArea=function(){return this.state.scrollArea},e.getScrollAreaSize=function(){var t=this.state.scrollArea;return t.next-t.prev},e.getHangerPosition=function(){return this.state.hangerPosition},e.getCameraPosition=function(){return this.state.position},e.getAllPanels=function(t){var e=this.panels;return t?e.concat(this.clonedPanels):e},e.connectAxesHandler=function(t){var e=this.axes;this.axesHandlers=t,e.on(t),this.resume()},e.pause=function(){this.axes.off()},e.resume=function(){this.axes.on(this.axesHandlers)},e.build=function(){this.applyCSSValue(),this.setAxesInstance(),this.createPanels(),this.resize(),this.moveToDefaultPanel()},e.applyCSSValue=function(){var t=this.options,e=this.viewportElement,n=this.cameraElement,i=t.classPrefix;e.className=i+"-viewport",n.className=i+"-camera",a(e,l),a(n,c),t.zIndex&&(e.style.zIndex=""+t.zIndex),t.overflow&&(e.style.overflow="visible")},e.setAxesInstance=function(){var t=this.state,e=this.options,n=t.scrollArea,i=e.horizontal;this.axes=new o({flick:{range:[n.prev,n.next],circular:e.circular,bounce:[0,0]}},{easing:e.panelEffect,deceleration:e.deceleration,interruptable:!0}),this.panInput=this.makeNewPanInput(),this.axes.connect(i?["flick",""]:["","flick"],this.panInput)},e.createPanels=function(){var t,e=this.state,n=this.options,i=this.cameraElement.children;if(!i||!i.length)throw new Error("There're no panel elements.");this.panels=(t=i,[].slice.call(t)).map(function(t,e){return new S(t,e,{horizontal:n.horizontal,classPrefix:n.classPrefix,anchorExpression:n.anchor})}),e.index=f(e.index,0,this.panels.length-1)},e.clonePanels=function(){var i=this,t=this.state,e=this.panels,o=this.clonedPanels,n=t.size,r=e[e.length-1],a=r.getPosition()+r.getSize()+this.options.gap,s=n+e[0].getRelativeAnchorPosition(),l=o[o.length-1],c=Math.ceil(s/a),h=l?l.getCloneIndex()+1:0;if(h<c)for(var u=function(n){e.forEach(function(t){var e=t.clone(n);i.appendPanelElement(e.getElement()),o.push(e)})},f=h;f<c;f++)u(f);else c<h&&(e.forEach(function(t){t.removeClonedPanelsAfter(c)}),this.clonedPanels.splice(c*e.length))},e.relocatePanels=function(){var t=this.state,e=this.options,n=this.panels,i=this.clonedPanels,o=t.scrollArea,r=o.next+t.size,a=(o.prev,n[0]),s=n[n.length-1];if(a){for(var l=s.getPosition()+s.getSize()+e.gap,c=0,h=i;c<h.length;c++){var u=(v=h[c]).getIdenticalPanels()[0],f=l*(v.getCloneIndex()+1)+u.getPosition();v.setPosition(f)}for(var p=a.getPosition(),d=0,g=i.concat().reverse();d<g.length;d++){var v,P=(v=g[d]).getPosition(),m=p-v.getSize()-e.gap;if(P<=r)break;v.setPosition(m),p=m}}},e.chainPanels=function(){var o=this.panels.concat(this.clonedPanels);if(o.forEach(function(t,e){var n=0<e?o[e-1]:null,i=e<o.length-1?o[e+1]:null;t.setPrevPanel(n),t.setNextPanel(i)}),this.options.circular){var t=o[0],e=o[o.length-1];t.setPrevPanel(e),e.setNextPanel(t)}},e.moveToDefaultPanel=function(){var t=this.state,e=f(this.options.defaultIndex,0,this.panels.length-1),n=this.panels[e].getAnchorPosition()-t.hangerPosition;n=this.canSetBoundMode()?f(n,t.scrollArea.prev,t.scrollArea.next):n,t.index=e,this.moveCamera(n),this.axes.setTo({flick:n},0)},e.isOutOfBound=function(){var t=this.state,e=t.scrollArea;return!this.options.circular&&(t.position<e.prev||t.position>e.next)},e.canSetBoundMode=function(){var t=this.state,e=this.options,n=this.panels,i=n[n.length-1],o=i.getPosition()+i.getSize();return e.bound&&!e.circular&&o>=t.size},e.updateSize=function(){var t=this.state,e=this.options,n=this.viewportElement;e.horizontal||(n.style.width="",n.style.minWidth="");var i=n.getBoundingClientRect();t.size=e.horizontal?i.width:i.height,t.hangerPosition=g(e.hanger,t.size)},e.updateOriginalPanelPositions=function(){var i=this.options.gap,t=this.panels,o=0;t.forEach(function(t){t.resize();var e=o,n=t.getSize();t.setPosition(e),o+=n+i})},e.updateScrollArea=function(){var t=this.state,e=this.panels,n=this.options,i=this.axes,o=e[0],r=e[e.length-1],a=t.hangerPosition;if(this.canSetBoundMode())t.scrollArea={prev:o.getPosition(),next:r.getPosition()+r.getSize()-t.size};else if(n.circular){var s=r.getPosition()+r.getSize()+n.gap;t.scrollArea={prev:o.getAnchorPosition()-a,next:s+o.getRelativeAnchorPosition()-a}}else t.scrollArea={prev:o.getAnchorPosition()-a,next:r.getAnchorPosition()-a};var l,c=t.size,h=n.bounce,u=h;if((l=h)&&l.constructor===Array)u=h.map(function(t){return g(t,c,v.bounce)});else{var f=g(h,c,v.bounce);u=[f,f]}i.axis.flick.range=[t.scrollArea.prev,t.scrollArea.next],i.axis.flick.bounce=u},e.updateCameraPosition=function(){var t=this.state,e=this.panels,n=this.axes,i=e[t.index].getAnchorPosition()-t.hangerPosition;this.canSetBoundMode()&&(i=f(i,t.scrollArea.prev,t.scrollArea.next)),this.moveCamera(i),this.pause(),n.setTo({flick:i},0),this.resume()},e.makeNewPanInput=function(){var t=this.options;return new o.PanInput(this.viewportElement,{inputType:t.inputType,thresholdAngle:t.thresholdAngle,scale:t.horizontal?[-1,0]:[0,-1]})},e.appendPanelElement=function(t){this.cameraElement.appendChild(t)},t}(),e=function(){function t(){this.delta=0,this.direction=null,this.targetPanel=null}var e=t.prototype;return e.onEnter=function(t){this.delta=t.delta,this.direction=t.direction,this.targetPanel=t.targetPanel},e.onExit=function(t){},e.onHold=function(t,e){},e.onChange=function(t,e){},e.onRelease=function(t,e){},e.onAnimationEnd=function(t,e){},e.onFinish=function(t,e){},t}(),y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=u,t.holding=!1,t.playing=!1,t}r(t,e);var n=t.prototype;return n.onEnter=function(){this.direction=null,this.targetPanel=null,this.delta=0},n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(N.HOLD_START,t,!0).onSuccess(function(){i(m)}).onStopped(function(){i(R)})},n.onChange=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(N.MOVE_START,t,!1).onSuccess(function(){i(M).onChange(t,e)}).onStopped(function(){i(R)})},t}(e),C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=m,t.holding=!0,t.playing=!0,t.releaseEvent=null,t}r(t,e);var n=t.prototype;return n.onChange=function(t,e){var n=e.flicking,i=e.triggerEvent,o=e.transitTo,r=n.options.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY;this.direction=r<0?E.NEXT:E.PREV,i(N.MOVE_START,t,!0).onSuccess(function(){o(x).onChange(t,e)}).onStopped(function(){o(R)})},n.onRelease=function(t,e){var n=e.viewport,i=e.triggerEvent,o=e.transitTo;if(i(N.HOLD_END,t,!0),0!==t.delta.flick)return t.setTo({flick:n.getCameraPosition()},0),void o(u);this.releaseEvent=t},n.onFinish=function(t,e){var n=e.viewport,i=e.triggerEvent,o=e.transitTo,r=e.castToReadonlyPanel;if(o(u),this.releaseEvent){var a=this.releaseEvent.inputEvent.srcEvent.target,s=n.findPanelOf(a),l=n.getCameraPosition();if(s){var c=s.getPosition();i(N.SELECT,null,!0,{direction:l<c?E.NEXT:c<l?E.PREV:null,selectedIndex:s.getIndex(),selectedPanel:r(s)})}}},t}(e),w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=x,t.holding=!0,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onEnter=function(t){e.prototype.onEnter.call(this,t),this.delta=0},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(R)})},n.onRelease=function(t,e){var n=e.flicking,i=e.viewport,o=e.triggerEvent,r=e.moveToPanel,a=e.castToReadonlyPanel,s=e.transitTo,l=e.stopCamera,c=this.delta,h=n.options,u=0<c,f=Math.abs(c),p=t.inputEvent.deltaX?Math.abs(180*Math.atan(t.inputEvent.deltaY/t.inputEvent.deltaX)/Math.PI):90,d=f>=h.threshold&&(h.horizontal?p<=h.thresholdAngle:p>h.thresholdAngle);if(o(N.HOLD_END,t,!0),!d&&this.targetPanel)return i.moveTo(this.targetPanel,t),void s(M);var g=i.getCurrentPanel(),v=i.getCameraPosition()+i.getHangerPosition(),P=h.gap/2,m=u?g.getSize()-g.getRelativeAnchorPosition()+P:g.getRelativeAnchorPosition()+P;m=Math.max(m,h.threshold);var x,E=Math.abs(t.delta.flick),A=h.snap,S=h.duration,T=a(g);if(d){var y=0;if(m<=E){for(var C=T.position;Math.abs(T.position-C)<E&&y<A;){var w=u?T.next():T.prev();if(!w)break;T=w,++y}1<y&&(x=Math.min(S*y,Math.max(t.duration,S)))}if(y<=1)if(f<=m){var z=u?g.getNextPanel():g.getPrevPanel();if(h.circular){var I=g.getIdenticalPanels()[1];(b=Math.abs(g.getAnchorPosition()-v)>Math.abs(I.getAnchorPosition()-v))&&(z=u?I.getNextPanel():I.getPrevPanel())}T=a(null!=z?z:g)}else T=a(i.findNearestPanel())}else if(h.circular){I=g.getIdenticalPanels()[1];var b=Math.abs(g.getAnchorPosition()-v)>Math.abs(I.getAnchorPosition()-v);!u&&b&&(T=a(I))}r(T,!d||!h.circular&&T.position===g.getPosition()?N.RESTORE:N.CHANGE,t,x).onSuccess(function(){s(M)}).onStopped(function(){s(R),l(t)})},t}(e),z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=M,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(N.HOLD_START,t,!0).onSuccess(function(){i(x)}).onStopped(function(){i(R)})},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(R)})},n.onFinish=function(t,e){var n=e.flicking,i=e.viewport,o=e.triggerEvent,r=e.transitTo,a=t&&t.isTrusted;o(N.MOVE_END,t,a),n.options.adaptive&&i.updateAdaptiveSize(),r(u)},t}(e),I=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=R,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onAnimationEnd=function(t,e){(0,e.transitTo)(u)},n.onRelease=function(t,e){var n=e.transitTo;0===t.delta.flick&&n(u)},t}(e),n=function(){function t(){var i=this;this.state=new y,this.transitTo=function(t){var e=i.state;if(e.type!==t){var n=void 0;switch(t){case u:n=new y;break;case m:n=new C;break;case x:n=new w;break;case M:n=new z;break;case R:n=new I}e.onExit(n),n.onEnter(e),i.state=n}return i.state}}var e=t.prototype;return e.fire=function(t,e,n){var i=this.state;switch(t){case P.HOLD:i.onHold(e,n);break;case P.CHANGE:i.onChange(e,n);break;case P.RELEASE:i.onRelease(e,n);break;case P.ANIMATION_END:i.onAnimationEnd(e,n);break;case P.FINISH:i.onFinish(e,n)}},e.getState=function(){return this.state},t}();return function(f){function t(t,e){void 0===e&&(e={});var n,I=f.call(this)||this;if(I.plugins=[],I.triggerEvent=function(t,e,n,i){void 0===i&&(i={});var o=I.viewport,r=I.stateMachine.getState(),a=o.getCurrentPanel(),s=o.getScrollArea(),l=s.prev,c=s.next,h=b(o.getCameraPosition(),[l,l,c]);I.options.circular&&(h%=1);var u=!f.prototype.trigger.call(I,t,p({type:t,index:a.getIndex(),panel:I.castToReadonlyPanel(a),direction:r.direction,holding:r.holding,progress:h,axesEvent:e,isTrusted:n},i));return{onSuccess:function(t){return u||t(),this},onStopped:function(t){return u&&t(),this}}},I.moveCamera=function(t){var e=I.viewport,n=I.stateMachine.getState(),i=I.options,o=t.pos.flick;if(t.isTrusted&&n.holding){var r=(i.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY)<0,a=e.getCameraPosition(),s=o-a,l=r===o<a;if(i.circular&&l){var c=e.getScrollAreaSize();s=-Math.sign(s)*(c-Math.abs(s))}var h=0===s?n.direction:0<s?E.NEXT:E.PREV;n.delta+=s,n.direction=h}var u=e.getCameraPosition();return e.moveCamera(o),I.triggerEvent(N.MOVE,t,t.isTrusted).onStopped(function(){e.moveCamera(u)})},I.stopCamera=function(t){var e=I.viewport;t&&t.setTo&&t.setTo({flick:e.getCameraPosition()},0),I.stateMachine.transitTo(u)},I.moveToPanel=function(e,t,n,i){void 0===i&&(i=I.options.duration);var o,r=I.viewport,a=I.stateMachine,s=r.getCurrentPanel(),l=e.anchorPosition-r.getHangerPosition(),c=r.getCameraPosition(),h=null!==n,u=c<l?E.NEXT:E.PREV;return(o=t===N.CHANGE?I.triggerEvent(N.CHANGE,n,h,{index:e.index,panel:e,direction:u,prevIndex:s.getIndex(),prevPanel:I.castToReadonlyPanel(s)}):I.triggerEvent(N.RESTORE,n,h)).onSuccess(function(){var t=a.getState();t.targetPanel=e,t.direction=u,r.moveTo(e,n,i)}),i<=0&&a.fire(P.FINISH,null,I.eventContext),o},I.castToReadonlyPanel=function(i,o){void 0===o&&(o=i.getPosition());var r=I,t=I.options.circular,a=I.viewport,e=i.getSize(),n=i.getRelativeAnchorPosition(),s=a.getCameraPosition(),l=a.getHangerPosition(),c=s+l,h=I.viewport.findNearestPanel(),u=h.getAnchorPosition()>c||!h.getNextPanel(),f=(u?h.getPrevPanel():h)||h,p=(u?h:h.getNextPanel())||h,d=a.getScrollAreaSize(),g=a.getSize(),v=f.getAnchorPosition(),P=p.getAnchorPosition();P<v&&(v<c?P+=d:v-=d);var m=[v,v,P],x=[-e,l-n,g],E=I.getPanelCount(),A=f.getCloneIndex(),S=(t?Math.floor(o/d)*E:0)+i.getIndex()-b(c,m)-(f.getIndex()+(A+1)*E),T=o-s,y=b(T,x),C=T+e,w=Math.min(g,C)-Math.max(T,0),z=0<=w?w/e:0;return{element:i.getElement(),index:i.getIndex(),position:o,progress:S,outsetProgress:y,visibleRatio:z,anchorPosition:o+i.getRelativeAnchorPosition(),size:i.getSize(),focus:function(t){a.getCameraPosition()+a.getHangerPosition()!==i.getAnchorPosition()&&r.moveToPanel(this,N.CHANGE,null,t)},update:function(e){i.getIdenticalPanels().forEach(function(t){return e(t.getElement())})},prev:function(){var t=i.getPrevPanel();if(null==t)return null;for(var e=a.getScrollAreaSize(),n=t.getPosition();o<n;)n-=e;return r.castToReadonlyPanel(t,n)},next:function(){var t=i.getNextPanel();if(null==t)return null;for(var e=a.getScrollAreaSize(),n=t.getPosition();n<o;)n+=e;return r.castToReadonlyPanel(t,n)}}},"string"==typeof t){if(!(n=document.querySelector(t)))throw new Error("Base element doesn't exist.")}else{if(!t.nodeName||1!==t.nodeType)throw new Error("Element should be provided in string or HTMLElement.");n=t}return I.wrapper=n,I.build(e),I}r(t,f);var e=t.prototype;return e.prev=function(t){return this.moveTo(this.viewport.getPrevIndex(),t)},e.next=function(t){return this.moveTo(this.viewport.getNextIndex(),t)},e.moveTo=function(t,e){var n=this.viewport,i=n.getPanel(t);if(i){var o=this.stateMachine.getState(),r=n.getIndex();if(!(o.type===u&&i.getIndex()!==r))return this;var a=this.castToReadonlyPanel(n.findNearestIdenticalPanel(i));this.moveToPanel(a,N.CHANGE,null,e)}return this},e.getIndex=function(){return this.viewport.getIndex()},e.getPrevIndex=function(){return this.viewport.getPrevIndex()},e.getNextIndex=function(){return this.viewport.getNextIndex()},e.getCurrentPanel=function(){return this.castToReadonlyPanel(this.viewport.getCurrentPanel())},e.getPanel=function(t){var e=this.viewport.getPanel(t);return e?this.castToReadonlyPanel(e):null},e.getAllPanels=function(t){var e=this;return this.viewport.getAllPanels(t).map(function(t){return e.castToReadonlyPanel(t)})},e.getVisiblePanels=function(){return this.getAllPanels(!0).filter(function(t){var e=t.outsetProgress;return-1<e&&e<1})},e.getPanelCount=function(){return this.viewport.getPanelCount()},e.isPlaying=function(){return this.stateMachine.getState().playing},e.enableInput=function(){return this.viewport.enable(),this},e.disableInput=function(){return this.viewport.disable(),this},e.getStatus=function(){var t=this.viewport.getAllPanels().map(function(t){return{html:t.getElement().outerHTML,index:t.getIndex()}});return{index:this.getIndex(),panels:t,position:this.viewport.getCameraPosition()}},e.setStatus=function(t){this.viewport.restore(t)},e.addPlugins=function(t){var e=this,n=[].concat(t);return n.forEach(function(t){t.init(e)}),this.plugins=this.plugins.concat(n),this},e.removePlugins=function(t){var n=this,i=this.plugins;return[].concat(t).forEach(function(t){var e=i.indexOf(t);-1<e&&i.splice(e,1),t.destroy(n)}),this},e.destroy=function(){var e=this;for(var t in this.off(),this.viewport.destroy(),this.plugins.forEach(function(t){t.destroy(e)}),this)this[t]=null},e.resize=function(){return this.viewport.resize(),this},e.build=function(t){this.setInitialState(t),this.initViewport(),this.listenInput(),this.listenResize()},e.setInitialState=function(t){this.options=p({},v,t),this.stateMachine=new n},e.initViewport=function(){var t=this.wrapper,e=this.options,n=t.children;if(!n||!n.length)throw new Error("Given base element doesn't have proper DOM structure to be initialized.");for(var i=document.createElement("div"),o=t.firstChild;o;)i.appendChild(o),o=t.firstChild;var r=document.createElement("div");r.appendChild(i),t.appendChild(r),this.viewport=new T(r,i,e)},e.listenInput=function(){var n=this,i=n.stateMachine;n.eventContext={flicking:n,viewport:n.viewport,transitTo:i.transitTo,triggerEvent:n.triggerEvent,moveCamera:n.moveCamera,stopCamera:n.stopCamera,moveToPanel:n.moveToPanel,castToReadonlyPanel:n.castToReadonlyPanel};var o={},t=function(t){var e=P[t];o[e]=function(t){return i.fire(e,t,n.eventContext)}};for(var e in P)t(e);n.viewport.connectAxesHandler(o)},e.listenResize=function(){var t=this;this.options.autoResize&&window.addEventListener("resize",function(){t.resize()})},t.VERSION="3.0.0-beta3",t.DIRECTION=E,t.EVENTS=N,t}(t)}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/component"),require("@egjs/axes")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/axes"],e):((t=t||self).eg=t.eg||{},t.eg.Flicking=e(t.eg.Component,t.eg.Axes))}(this,function(t,o){"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 p(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.forEach(function(n){Object.keys(n).forEach(function(t){var e=n[t];i[t]=e})}),i}var s=function(){var t={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"},e=document.documentElement.style,n="";for(var i in t)i in e&&(n=i);if(!n)throw new Error("Browser doesn't support CSS3 2D Transforms.");var o=document.createElement("div");document.documentElement.insertBefore(o,null),o.style[n]="translate3d(1px, 1px, 1px)";var r=window.getComputedStyle(o).getPropertyValue(t[n]);o.parentElement.removeChild(o);var a={name:n,has3d:0<r.length&&"none"!==r};return s=function(){return a},a};function a(e,n){Object.keys(n).forEach(function(t){e.style[t]=n[t]})}function f(t,e,n){return Math.max(Math.min(t,n),e)}function d(t,e,n){return e<=t&&t<=n}function g(t,e,n){var i=null!=n?n:e/2,o=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof t)return f(t,0,e);for(var r=0,a=0,s=o.exec(t);null!=s;){var l=s[1],c=s[2],h=s[3],u=parseFloat(c);if(r<=0&&(l=l||"+"),!l)return i;"%"===h&&(u=u/100*e),a+="+"===l?u:-u,++r,s=o.exec(t)}return 0===r?i:f(a,0,e)}function b(t,e){var n=e[0],i=e[1],o=e[2];return i<t&&o-i?(t-i)/(o-i):t<i&&i-n?(t-i)/(i-n):t!==i&&o-n?(t-n)/(o-n):0}var v={classPrefix:"eg-flick",deceleration:.0075,horizontal:!0,circular:!1,threshold:40,duration:100,panelEffect:function(t){return 1-Math.pow(1-t,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,bounce:10,autoResize:!1,adaptive:!1,zIndex:2e3,bound:!1,overflow:!1,hanger:"50%",anchor:"50%",gap:0,snap:1,freeScroll:!1},l={position:"relative",zIndex:v.zIndex,width:"100%",height:"100%",willChange:"transform",overflow:"hidden"},c={width:"100%",height:"100%"},h={position:"absolute"},M={HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",CHANGE:"change",RESTORE:"restore",SELECT:"select",NONE:""},P={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},u=0,m=1,x=2,R=3,O=4,E={PREV:"PREV",NEXT:"NEXT"},A=s(),S=function(){function i(t,e,n){var i,o;this.element=t,this.state={index:e,horizontal:n.horizontal,position:0,anchorExpression:n.anchorExpression,relativeAnchorPosition:0,size:0,clonedPanels:[],isClone:!1,cloneIndex:-1,originalStyle:{className:t.getAttribute("class")||null,style:t.getAttribute("style")||null},cachedBbox:null},n.classPrefix&&(i=t,o=n.classPrefix+"-panel",i.classList?i.classList.add(o):i.className.indexOf(o)<0&&(i.className=(i.className+" "+o).replace(/\s{2,}/g," "))),a(this.element,h),this.resize()}var t=i.prototype;return t.resize=function(){var t=this.state;t.cachedBbox=null;var e=this.getBbox();t.size=t.horizontal?e.width:e.height,t.isClone||t.clonedPanels.forEach(function(t){return t.resize()})},t.destroy=function(){var t=this.element,e=this.state.originalStyle;for(var n in e.className?t.setAttribute("class",e.className):t.removeAttribute("class"),e.style?t.setAttribute("style",e.style):t.removeAttribute("style"),this)this[n]=null},t.getElement=function(){return this.element},t.getAnchorPosition=function(){return this.state.position+this.state.relativeAnchorPosition},t.getRelativeAnchorPosition=function(){return this.state.relativeAnchorPosition},t.getIndex=function(){return this.state.index},t.getPosition=function(){return this.state.position},t.getSize=function(){return this.state.size},t.getPrevPanel=function(){return this.prevPanel},t.getNextPanel=function(){return this.nextPanel},t.getBbox=function(){var t=this.state;return t.cachedBbox||(t.cachedBbox=this.element.getBoundingClientRect()),t.cachedBbox},t.isClone=function(){return this.state.isClone},t.getCloneIndex=function(){return this.state.cloneIndex},t.getClonedPanels=function(){return this.state.clonedPanels},t.getIdenticalPanels=function(){var t=this.state;return t.isClone?this.original.getIdenticalPanels():[this].concat(t.clonedPanels)},t.setPosition=function(t){var e=this.state,n=this.element.style;e.position=t,e.horizontal?n.left=t+"px":n.top=t+"px",e.relativeAnchorPosition=g(e.anchorExpression,e.size)},t.setPrevPanel=function(t){this.prevPanel=t},t.setNextPanel=function(t){this.nextPanel=t},t.clone=function(t){var e=this.state,n=new i(this.element.cloneNode(!0),e.index,{anchorExpression:e.anchorExpression,horizontal:e.horizontal});return n.original=this,n.state.isClone=!0,n.state.cloneIndex=t,n.state.size=e.size,e.clonedPanels.push(n),n},t.removeClonedPanelsAfter=function(t){for(var e=0,n=this.state.clonedPanels.splice(t);e<n.length;e++){var i=n[e].getElement();i.parentNode.removeChild(i)}},i}(),T=function(){function t(t,e,n){this.clonedPanels=[],this.viewportElement=t,this.cameraElement=e,this.state={index:n.defaultIndex,size:0,position:0,hangerPosition:0,scrollArea:{prev:0,next:0},translate:A},this.options=n,this.build()}var e=t.prototype;return e.moveTo=function(t,e,n){void 0===n&&(n=this.options.duration);var i=this.state,o=this.options.freeScroll,r=t.anchorPosition-i.hangerPosition;r=this.canSetBoundMode()?f(r,i.scrollArea.prev,i.scrollArea.next):r,i.index=t.index,e&&e.setTo?e.setTo({flick:o?e.destPos.flick:r},n):this.axes.setTo({flick:r},n)},e.moveCamera=function(t){var e=this.state,n=e.translate.name,i=(this.options.horizontal?[-t,0]:[0,-t]).map(function(t){return Math.round(t)+"px"}).join(", ");this.cameraElement.style[n]=e.translate.has3d?"translate3d("+i+", 0px)":"translate("+i+")",e.position=t},e.resize=function(){this.updateSize(),this.updateOriginalPanelPositions(),this.updateAdaptiveSize(),this.updateScrollArea(),this.options.circular&&(this.clonePanels(),this.relocatePanels()),this.chainPanels(),this.updateCameraPosition()},e.findNearestPanel=function(){var t=this.state,e=this.panels,n=this.clonedPanels,i=t.scrollArea,o=t.position+t.hangerPosition;if(this.isOutOfBound())return t.position<i.prev?e[0]:e[e.length-1];for(var r,a=1/0,s=0,l=e.concat(n);s<l.length;s++){var c=l[s],h=c.getPosition(),u=h+c.getSize(),f=d(o,h,u)?0:Math.min(Math.abs(h-o),Math.abs(u-o));if(a<f)break;a=f,r=c}return r},e.findPanelOf=function(t){for(var e=0,n=this.panels.concat(this.clonedPanels);e<n.length;e++){var i=n[e];if(i.getElement().contains(t))return i}},e.findNearestIdenticalPanel=function(t){var e=this.state,i=t,o=1/0,r=e.position+e.hangerPosition;return t.getIdenticalPanels().forEach(function(t){var e=t.getAnchorPosition(),n=Math.abs(e-r);n<o&&(i=t,o=n)}),i},e.findShortestPositionToPanel=function(t){var e=this.state,n=this.options,i=t.getAnchorPosition(),o=Math.abs(e.position+e.hangerPosition-i),r=e.scrollArea.next-e.scrollArea.prev;if(n.circular)return o<=r-o?i-e.hangerPosition:i>e.position+e.hangerPosition?i-e.hangerPosition-r:i-e.hangerPosition+r;var a=i-e.hangerPosition;return this.canSetBoundMode()?f(a,e.scrollArea.prev,e.scrollArea.next):a},e.enable=function(){this.panInput.enable()},e.disable=function(){this.panInput.disable()},e.updateAdaptiveSize=function(){var t,e=this.options,i=e.horizontal;if(e.adaptive){var n=this.getCurrentPanel().getBbox();t=i?n.height:n.width}else{t=this.panels.reduce(function(t,e){var n=e.getBbox();return Math.max(t,i?n.height:n.width)},0)}var o=this.viewportElement.style;i?(o.height=t+"px",o.minHeight="100%",o.width="100%"):(o.width=t+"px",o.minWidth="100%",o.height="100%")},e.destroy=function(){var t=this.viewportElement,e=t.parentElement;for(var n in e.removeChild(t),this.axes.destroy(),this.panInput.destroy(),this.panels.forEach(function(t){e.appendChild(t.getElement()),t.destroy()}),this)this[n]=null},e.restore=function(t){var e=t.panels,n=this.cameraElement;n.innerHTML=e.map(function(t){return t.html}).join(""),this.viewportElement.appendChild(n),this.state.index=t.index,this.moveCamera(t.position),this.panels=[],this.clonedPanels=[],this.createPanels(),this.resize()},e.getPanelCount=function(){return this.panels.length},e.getPanel=function(t){return d(t,0,this.panels.length-1)?this.panels[t]:null},e.getCurrentPanel=function(){return this.panels[this.state.index]},e.getIndex=function(){return this.state.index},e.getPrevIndex=function(){var t=this.state.index-1;return t<0&&(t=this.options.circular?this.panels.length-1:-1),t},e.getNextIndex=function(){var t=this.state.index+1;return t>=this.panels.length&&(t=this.options.circular?0:-1),t},e.getSize=function(){return this.state.size},e.getScrollArea=function(){return this.state.scrollArea},e.getScrollAreaSize=function(){var t=this.state.scrollArea;return t.next-t.prev},e.getHangerPosition=function(){return this.state.hangerPosition},e.getCameraPosition=function(){return this.state.position},e.getAllPanels=function(t){var e=this.panels;return t?e.concat(this.clonedPanels):e},e.connectAxesHandler=function(t){var e=this.axes;this.axesHandlers=t,e.on(t),this.resume()},e.pause=function(){this.axes.off()},e.resume=function(){this.axes.on(this.axesHandlers)},e.build=function(){this.applyCSSValue(),this.setAxesInstance(),this.createPanels(),this.resize(),this.moveToDefaultPanel()},e.applyCSSValue=function(){var t=this.options,e=this.viewportElement,n=this.cameraElement,i=t.classPrefix;e.className=i+"-viewport",n.className=i+"-camera",a(e,l),a(n,c),t.zIndex&&(e.style.zIndex=""+t.zIndex),t.overflow&&(e.style.overflow="visible")},e.setAxesInstance=function(){var t=this.state,e=this.options,n=t.scrollArea,i=e.horizontal;this.axes=new o({flick:{range:[n.prev,n.next],circular:e.circular,bounce:[0,0]}},{easing:e.panelEffect,deceleration:e.deceleration,interruptable:!0}),this.panInput=this.makeNewPanInput(),this.axes.connect(i?["flick",""]:["","flick"],this.panInput)},e.createPanels=function(){var t,e=this.state,n=this.options,i=this.cameraElement.children;if(!i||!i.length)throw new Error("There're no panel elements.");this.panels=(t=i,[].slice.call(t)).map(function(t,e){return new S(t,e,{horizontal:n.horizontal,classPrefix:n.classPrefix,anchorExpression:n.anchor})}),e.index=f(e.index,0,this.panels.length-1)},e.clonePanels=function(){var i=this,t=this.state,e=this.panels,o=this.clonedPanels,n=t.size,r=e[e.length-1],a=r.getPosition()+r.getSize()+this.options.gap,s=n+e[0].getRelativeAnchorPosition(),l=o[o.length-1],c=Math.ceil(s/a),h=l?l.getCloneIndex()+1:0;if(h<c)for(var u=function(n){e.forEach(function(t){var e=t.clone(n);i.appendPanelElement(e.getElement()),o.push(e)})},f=h;f<c;f++)u(f);else c<h&&(e.forEach(function(t){t.removeClonedPanelsAfter(c)}),this.clonedPanels.splice(c*e.length))},e.relocatePanels=function(){var t=this.state,e=this.options,n=this.panels,i=this.clonedPanels,o=t.scrollArea,r=o.next+t.size,a=(o.prev,n[0]),s=n[n.length-1];if(a){for(var l=s.getPosition()+s.getSize()+e.gap,c=0,h=i;c<h.length;c++){var u=(v=h[c]).getIdenticalPanels()[0],f=l*(v.getCloneIndex()+1)+u.getPosition();v.setPosition(f)}for(var p=a.getPosition(),d=0,g=i.concat().reverse();d<g.length;d++){var v,P=(v=g[d]).getPosition(),m=p-v.getSize()-e.gap;if(P<=r)break;v.setPosition(m),p=m}}},e.chainPanels=function(){var o=this.panels.concat(this.clonedPanels);if(o.forEach(function(t,e){var n=0<e?o[e-1]:null,i=e<o.length-1?o[e+1]:null;t.setPrevPanel(n),t.setNextPanel(i)}),this.options.circular){var t=o[0],e=o[o.length-1];t.setPrevPanel(e),e.setNextPanel(t)}},e.moveToDefaultPanel=function(){var t=this.state,e=f(this.options.defaultIndex,0,this.panels.length-1),n=this.panels[e].getAnchorPosition()-t.hangerPosition;n=this.canSetBoundMode()?f(n,t.scrollArea.prev,t.scrollArea.next):n,t.index=e,this.moveCamera(n),this.axes.setTo({flick:n},0)},e.isOutOfBound=function(){var t=this.state,e=t.scrollArea;return!this.options.circular&&(t.position<e.prev||t.position>e.next)},e.canSetBoundMode=function(){var t=this.state,e=this.options,n=this.panels,i=n[n.length-1],o=i.getPosition()+i.getSize();return e.bound&&!e.circular&&o>=t.size},e.updateSize=function(){var t=this.state,e=this.options,n=this.viewportElement;e.horizontal||(n.style.width="",n.style.minWidth="");var i=n.getBoundingClientRect();t.size=e.horizontal?i.width:i.height,t.hangerPosition=g(e.hanger,t.size)},e.updateOriginalPanelPositions=function(){var i=this.options.gap,t=this.panels,o=0;t.forEach(function(t){t.resize();var e=o,n=t.getSize();t.setPosition(e),o+=n+i})},e.updateScrollArea=function(){var t=this.state,e=this.panels,n=this.options,i=this.axes,o=e[0],r=e[e.length-1],a=t.hangerPosition;if(this.canSetBoundMode())t.scrollArea={prev:o.getPosition(),next:r.getPosition()+r.getSize()-t.size};else if(n.circular){var s=r.getPosition()+r.getSize()+n.gap;t.scrollArea={prev:o.getAnchorPosition()-a,next:s+o.getRelativeAnchorPosition()-a}}else t.scrollArea={prev:o.getAnchorPosition()-a,next:r.getAnchorPosition()-a};var l,c=t.size,h=n.bounce,u=h;if((l=h)&&l.constructor===Array)u=h.map(function(t){return g(t,c,v.bounce)});else{var f=g(h,c,v.bounce);u=[f,f]}i.axis.flick.range=[t.scrollArea.prev,t.scrollArea.next],i.axis.flick.bounce=u},e.updateCameraPosition=function(){var t=this.state,e=this.panels,n=this.axes,i=e[t.index].getAnchorPosition()-t.hangerPosition;this.canSetBoundMode()&&(i=f(i,t.scrollArea.prev,t.scrollArea.next)),this.moveCamera(i),this.pause(),n.setTo({flick:i},0),this.resume()},e.makeNewPanInput=function(){var t=this.options;return new o.PanInput(this.viewportElement,{inputType:t.inputType,thresholdAngle:t.thresholdAngle,scale:t.horizontal?[-1,0]:[0,-1]})},e.appendPanelElement=function(t){this.cameraElement.appendChild(t)},t}(),e=function(){function t(){this.delta=0,this.direction=null,this.targetPanel=null}var e=t.prototype;return e.onEnter=function(t){this.delta=t.delta,this.direction=t.direction,this.targetPanel=t.targetPanel},e.onExit=function(t){},e.onHold=function(t,e){},e.onChange=function(t,e){},e.onRelease=function(t,e){},e.onAnimationEnd=function(t,e){},e.onFinish=function(t,e){},t}(),C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=u,t.holding=!1,t.playing=!1,t}r(t,e);var n=t.prototype;return n.onEnter=function(){this.direction=null,this.targetPanel=null,this.delta=0},n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(M.HOLD_START,t,!0).onSuccess(function(){i(m)}).onStopped(function(){i(O)})},n.onChange=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(M.MOVE_START,t,!1).onSuccess(function(){i(R).onChange(t,e)}).onStopped(function(){i(O)})},t}(e),y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=m,t.holding=!0,t.playing=!0,t.releaseEvent=null,t}r(t,e);var n=t.prototype;return n.onChange=function(t,e){var n=e.flicking,i=e.triggerEvent,o=e.transitTo,r=n.options.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY;this.direction=r<0?E.NEXT:E.PREV,i(M.MOVE_START,t,!0).onSuccess(function(){o(x).onChange(t,e)}).onStopped(function(){o(O)})},n.onRelease=function(t,e){var n=e.viewport,i=e.triggerEvent,o=e.transitTo;if(i(M.HOLD_END,t,!0),0!==t.delta.flick)return t.setTo({flick:n.getCameraPosition()},0),void o(u);this.releaseEvent=t},n.onFinish=function(t,e){var n=e.viewport,i=e.triggerEvent,o=e.transitTo,r=e.castToReadonlyPanel;if(o(u),this.releaseEvent){var a=this.releaseEvent.inputEvent.srcEvent.target,s=n.findPanelOf(a),l=n.getCameraPosition();if(s){var c=s.getPosition();i(M.SELECT,null,!0,{direction:l<c?E.NEXT:c<l?E.PREV:null,selectedIndex:s.getIndex(),selectedPanel:r(s)})}}},t}(e),w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=x,t.holding=!0,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onEnter=function(t){e.prototype.onEnter.call(this,t),this.delta=0},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(O)})},n.onRelease=function(t,e){var n=e.flicking,i=e.viewport,o=e.triggerEvent,r=e.moveToPanel,a=e.castToReadonlyPanel,s=e.transitTo,l=e.stopCamera,c=this.delta,h=n.options,u=0<c,f=Math.abs(c),p=t.inputEvent.deltaX?Math.abs(180*Math.atan(t.inputEvent.deltaY/t.inputEvent.deltaX)/Math.PI):90,d=f>=h.threshold&&(h.horizontal?p<=h.thresholdAngle:p>h.thresholdAngle);if(o(M.HOLD_END,t,!0),!d&&this.targetPanel)return i.moveTo(this.targetPanel,t),void s(R);var g=i.getCurrentPanel(),v=i.getCameraPosition()+i.getHangerPosition(),P=h.gap/2,m=u?g.getSize()-g.getRelativeAnchorPosition()+P:g.getRelativeAnchorPosition()+P;m=Math.max(m,h.threshold);var x,E=Math.abs(t.delta.flick),A=h.freeScroll,S=A?1/0:h.snap,T=h.duration,C=a(A?i.findNearestPanel():g);if(A||d){var y=0;if(A||m<=E){for(var w=C.position;Math.abs(C.position-w)<E&&y<S;){var z=u?C.next():C.prev();if(!z)break;C=z,++y}A?x=t.duration:1<y&&(x=Math.min(T*y,Math.max(t.duration,T)))}if(!A&&y<=1)if(f<=m){var I=u?g.getNextPanel():g.getPrevPanel();if(h.circular){var b=g.getIdenticalPanels()[1];(N=Math.abs(g.getAnchorPosition()-v)>Math.abs(b.getAnchorPosition()-v))&&(I=u?b.getNextPanel():b.getPrevPanel())}C=a(null!=I?I:g)}else C=a(i.findNearestPanel())}else if(h.circular){b=g.getIdenticalPanels()[1];var N=Math.abs(g.getAnchorPosition()-v)>Math.abs(b.getAnchorPosition()-v);!u&&N&&(C=a(b))}r(C,d&&C.position!==g.getPosition()?M.CHANGE:A?M.NONE:M.RESTORE,t,x).onSuccess(function(){s(R)}).onStopped(function(){s(O),l(t)})},t}(e),z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=R,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(M.HOLD_START,t,!0).onSuccess(function(){i(x)}).onStopped(function(){i(O)})},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(O)})},n.onFinish=function(t,e){var n=e.flicking,i=e.viewport,o=e.triggerEvent,r=e.transitTo,a=t&&t.isTrusted;o(M.MOVE_END,t,a),n.options.adaptive&&i.updateAdaptiveSize(),r(u)},t}(e),I=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=O,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onAnimationEnd=function(t,e){(0,e.transitTo)(u)},n.onRelease=function(t,e){var n=e.transitTo;0===t.delta.flick&&n(u)},t}(e),n=function(){function t(){var i=this;this.state=new C,this.transitTo=function(t){var e=i.state;if(e.type!==t){var n=void 0;switch(t){case u:n=new C;break;case m:n=new y;break;case x:n=new w;break;case R:n=new z;break;case O:n=new I}e.onExit(n),n.onEnter(e),i.state=n}return i.state}}var e=t.prototype;return e.fire=function(t,e,n){var i=this.state;switch(t){case P.HOLD:i.onHold(e,n);break;case P.CHANGE:i.onChange(e,n);break;case P.RELEASE:i.onRelease(e,n);break;case P.ANIMATION_END:i.onAnimationEnd(e,n);break;case P.FINISH:i.onFinish(e,n)}},e.getState=function(){return this.state},t}();return function(f){function t(t,e){void 0===e&&(e={});var n,I=f.call(this)||this;if(I.plugins=[],I.triggerEvent=function(t,e,n,i){void 0===i&&(i={});var o=I.viewport,r=I.stateMachine.getState(),a=o.getCurrentPanel(),s=o.getScrollArea(),l=s.prev,c=s.next,h=b(o.getCameraPosition(),[l,l,c]);I.options.circular&&(h%=1);var u=!f.prototype.trigger.call(I,t,p({type:t,index:a.getIndex(),panel:I.castToReadonlyPanel(a),direction:r.direction,holding:r.holding,progress:h,axesEvent:e,isTrusted:n},i));return{onSuccess:function(t){return u||t(),this},onStopped:function(t){return u&&t(),this}}},I.moveCamera=function(t){var e=I.viewport,n=I.stateMachine.getState(),i=I.options,o=t.pos.flick;if(t.isTrusted&&n.holding){var r=(i.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY)<0,a=e.getCameraPosition(),s=o-a,l=r===o<a;if(i.circular&&l){var c=e.getScrollAreaSize();s=-Math.sign(s)*(c-Math.abs(s))}var h=0===s?n.direction:0<s?E.NEXT:E.PREV;n.delta+=s,n.direction=h}var u=e.getCameraPosition();return e.moveCamera(o),I.triggerEvent(M.MOVE,t,t.isTrusted).onStopped(function(){e.moveCamera(u)})},I.stopCamera=function(t){var e=I.viewport;t&&t.setTo&&t.setTo({flick:e.getCameraPosition()},0),I.stateMachine.transitTo(u)},I.moveToPanel=function(e,t,n,i){void 0===i&&(i=I.options.duration);var o,r=I.viewport,a=I.stateMachine,s=r.getCurrentPanel(),l=e.anchorPosition-r.getHangerPosition(),c=r.getCameraPosition(),h=null!==n,u=c<l?E.NEXT:E.PREV;return(o=t===M.CHANGE?I.triggerEvent(M.CHANGE,n,h,{index:e.index,panel:e,direction:u,prevIndex:s.getIndex(),prevPanel:I.castToReadonlyPanel(s)}):t===M.RESTORE?I.triggerEvent(M.RESTORE,n,h):{onSuccess:function(t){return t(),this},onStopped:function(t){return this}}).onSuccess(function(){var t=a.getState();t.targetPanel=e,t.direction=u,r.moveTo(e,n,i)}),i<=0&&a.fire(P.FINISH,null,I.eventContext),o},I.castToReadonlyPanel=function(i,o){void 0===o&&(o=i.getPosition());var r=I,t=I.options.circular,a=I.viewport,e=i.getSize(),n=i.getRelativeAnchorPosition(),s=a.getCameraPosition(),l=a.getHangerPosition(),c=s+l,h=I.viewport.findNearestPanel(),u=h.getAnchorPosition()>c||!h.getNextPanel(),f=(u?h.getPrevPanel():h)||h,p=(u?h:h.getNextPanel())||h,d=a.getScrollAreaSize(),g=a.getSize(),v=f.getAnchorPosition(),P=p.getAnchorPosition();P<v&&(v<c?P+=d:v-=d);var m=[v,v,P],x=[-e,l-n,g],E=I.getPanelCount(),A=f.getCloneIndex(),S=(t?Math.floor(o/d)*E:0)+i.getIndex()-b(c,m)-(f.getIndex()+(A+1)*E),T=o-s,C=b(T,x),y=T+e,w=Math.min(g,y)-Math.max(T,0),z=0<=w?w/e:0;return{element:i.getElement(),index:i.getIndex(),position:o,progress:S,outsetProgress:C,visibleRatio:z,anchorPosition:o+i.getRelativeAnchorPosition(),size:i.getSize(),focus:function(t){if(a.getCameraPosition()+a.getHangerPosition()!==i.getAnchorPosition()){var e=a.getCurrentPanel().getPosition();r.moveToPanel(this,e===o?M.NONE:M.CHANGE,null,t)}},update:function(e){i.getIdenticalPanels().forEach(function(t){return e(t.getElement())})},prev:function(){var t=i.getPrevPanel();if(null==t)return null;for(var e=a.getScrollAreaSize(),n=t.getPosition();o<n;)n-=e;return r.castToReadonlyPanel(t,n)},next:function(){var t=i.getNextPanel();if(null==t)return null;for(var e=a.getScrollAreaSize(),n=t.getPosition();n<o;)n+=e;return r.castToReadonlyPanel(t,n)}}},"string"==typeof t){if(!(n=document.querySelector(t)))throw new Error("Base element doesn't exist.")}else{if(!t.nodeName||1!==t.nodeType)throw new Error("Element should be provided in string or HTMLElement.");n=t}return I.wrapper=n,I.build(e),I}r(t,f);var e=t.prototype;return e.prev=function(t){return this.moveTo(this.viewport.getPrevIndex(),t)},e.next=function(t){return this.moveTo(this.viewport.getNextIndex(),t)},e.moveTo=function(t,e){var n=this.viewport,i=n.getPanel(t),o=this.stateMachine.getState();if(!i||o.type!==u)return this;if(n.getCameraPosition()+n.getHangerPosition()===i.getAnchorPosition())return this;var r=i.getIndex(),a=n.getIndex(),s=this.castToReadonlyPanel(n.findNearestIdenticalPanel(i));return this.moveToPanel(s,r===a?M.NONE:M.CHANGE,null,e),this},e.getIndex=function(){return this.viewport.getIndex()},e.getPrevIndex=function(){return this.viewport.getPrevIndex()},e.getNextIndex=function(){return this.viewport.getNextIndex()},e.getCurrentPanel=function(){return this.castToReadonlyPanel(this.viewport.getCurrentPanel())},e.getPanel=function(t){var e=this.viewport.getPanel(t);return e?this.castToReadonlyPanel(e):null},e.getAllPanels=function(t){var e=this;return this.viewport.getAllPanels(t).map(function(t){return e.castToReadonlyPanel(t)})},e.getVisiblePanels=function(){return this.getAllPanels(!0).filter(function(t){var e=t.outsetProgress;return-1<e&&e<1})},e.getPanelCount=function(){return this.viewport.getPanelCount()},e.isPlaying=function(){return this.stateMachine.getState().playing},e.enableInput=function(){return this.viewport.enable(),this},e.disableInput=function(){return this.viewport.disable(),this},e.getStatus=function(){var t=this.viewport.getAllPanels().map(function(t){return{html:t.getElement().outerHTML,index:t.getIndex()}});return{index:this.getIndex(),panels:t,position:this.viewport.getCameraPosition()}},e.setStatus=function(t){this.viewport.restore(t)},e.addPlugins=function(t){var e=this,n=[].concat(t);return n.forEach(function(t){t.init(e)}),this.plugins=this.plugins.concat(n),this},e.removePlugins=function(t){var n=this,i=this.plugins;return[].concat(t).forEach(function(t){var e=i.indexOf(t);-1<e&&i.splice(e,1),t.destroy(n)}),this},e.destroy=function(){var e=this;for(var t in this.off(),this.viewport.destroy(),this.plugins.forEach(function(t){t.destroy(e)}),this)this[t]=null},e.resize=function(){return this.viewport.resize(),this},e.build=function(t){this.setInitialState(t),this.initViewport(),this.listenInput(),this.listenResize()},e.setInitialState=function(t){this.options=p({},v,t),this.stateMachine=new n},e.initViewport=function(){var t=this.wrapper,e=this.options,n=t.children;if(!n||!n.length)throw new Error("Given base element doesn't have proper DOM structure to be initialized.");for(var i=document.createElement("div"),o=t.firstChild;o;)i.appendChild(o),o=t.firstChild;var r=document.createElement("div");r.appendChild(i),t.appendChild(r),this.viewport=new T(r,i,e)},e.listenInput=function(){var n=this,i=n.stateMachine;n.eventContext={flicking:n,viewport:n.viewport,transitTo:i.transitTo,triggerEvent:n.triggerEvent,moveCamera:n.moveCamera,stopCamera:n.stopCamera,moveToPanel:n.moveToPanel,castToReadonlyPanel:n.castToReadonlyPanel};var o={},t=function(t){var e=P[t];o[e]=function(t){return i.fire(e,t,n.eventContext)}};for(var e in P)t(e);n.viewport.connectAxesHandler(o)},e.listenResize=function(){var t=this;this.options.autoResize&&window.addEventListener("resize",function(){t.resize()})},t.VERSION="3.0.0-beta4",t.DIRECTION=E,t.EVENTS=M,t}(t)}); | ||
//# sourceMappingURL=flicking.min.js.map |
@@ -7,3 +7,3 @@ /* | ||
https://github.com/naver/egjs-flicking | ||
@version 3.0.0-beta3 | ||
@version 3.0.0-beta4 | ||
All-in-one packaged file for ease use of '@egjs/flicking' with below dependencies. | ||
@@ -14,3 +14,3 @@ - @egjs/axes ^2.5.9, @egjs/component ^2.1.2 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=t||self).eg=t.eg||{},t.eg.Flicking=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 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 a(t){return void 0===t}var t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],o=0;e.stop=function(){i=!0},e.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),u=2;u<s;u++)a[u-2]=arguments[u];for(1<=a.length&&(r=r.concat(a)),o=0;n[o];o++)n[o].apply(this,r);return!i},e.once=function(r,o){if("object"==typeof r&&a(o)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];o.apply(s,n),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,i=t;for(n in i)this.off(n,i[n]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function f(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.forEach(function(n){Object.keys(n).forEach(function(t){var e=n[t];i[t]=e})}),i}var u=function(){var t={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"},e=document.documentElement.style,n="";for(var i in t)i in e&&(n=i);if(!n)throw new Error("Browser doesn't support CSS3 2D Transforms.");var r=document.createElement("div");document.documentElement.insertBefore(r,null),r.style[n]="translate3d(1px, 1px, 1px)";var o=window.getComputedStyle(r).getPropertyValue(t[n]);r.parentElement.removeChild(r);var s={name:n,has3d:0<o.length&&"none"!==o};return u=function(){return s},s};function o(e,n){Object.keys(n).forEach(function(t){e.style[t]=n[t]})}function p(t,e,n){return Math.max(Math.min(t,n),e)}function v(t,e,n){return e<=t&&t<=n}function d(t,e,n){var i=null!=n?n:e/2,r=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof t)return p(t,0,e);for(var o=0,s=0,a=r.exec(t);null!=a;){var u=a[1],h=a[2],c=a[3],l=parseFloat(h);if(o<=0&&(u=u||"+"),!u)return i;"%"===c&&(l=l/100*e),s+="+"===u?l:-l,++o,a=r.exec(t)}return 0===o?i:p(s,0,e)}function z(t,e){var n=e[0],i=e[1],r=e[2];return i<t&&r-i?(t-i)/(r-i):t<i&&i-n?(t-i)/(i-n):t!==i&&r-n?(t-n)/(r-n):0}var g={classPrefix:"eg-flick",deceleration:.0075,horizontal:!0,circular:!1,threshold:40,duration:100,panelEffect:function(t){return 1-Math.pow(1-t,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,bounce:10,autoResize:!1,adaptive:!1,zIndex:2e3,bound:!1,overflow:!1,hanger:"50%",anchor:"50%",gap:0,snap:1},s={position:"relative",zIndex:g.zIndex,width:"100%",height:"100%",willChange:"transform",overflow:"hidden"},h={width:"100%",height:"100%"},c={position:"absolute"},O={HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",CHANGE:"change",RESTORE:"restore",SELECT:"select"},m={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},l=0,P=1,x=2,M=3,_=4,y={PREV:"PREV",NEXT:"NEXT"},E=u(),T=function(){function i(t,e,n){var i,r;this.element=t,this.state={index:e,horizontal:n.horizontal,position:0,anchorExpression:n.anchorExpression,relativeAnchorPosition:0,size:0,clonedPanels:[],isClone:!1,cloneIndex:-1,originalStyle:{className:t.getAttribute("class")||null,style:t.getAttribute("style")||null},cachedBbox:null},n.classPrefix&&(i=t,r=n.classPrefix+"-panel",i.classList?i.classList.add(r):i.className.indexOf(r)<0&&(i.className=(i.className+" "+r).replace(/\s{2,}/g," "))),o(this.element,c),this.resize()}var t=i.prototype;return t.resize=function(){var t=this.state;t.cachedBbox=null;var e=this.getBbox();t.size=t.horizontal?e.width:e.height,t.isClone||t.clonedPanels.forEach(function(t){return t.resize()})},t.destroy=function(){var t=this.element,e=this.state.originalStyle;for(var n in e.className?t.setAttribute("class",e.className):t.removeAttribute("class"),e.style?t.setAttribute("style",e.style):t.removeAttribute("style"),this)this[n]=null},t.getElement=function(){return this.element},t.getAnchorPosition=function(){return this.state.position+this.state.relativeAnchorPosition},t.getRelativeAnchorPosition=function(){return this.state.relativeAnchorPosition},t.getIndex=function(){return this.state.index},t.getPosition=function(){return this.state.position},t.getSize=function(){return this.state.size},t.getPrevPanel=function(){return this.prevPanel},t.getNextPanel=function(){return this.nextPanel},t.getBbox=function(){var t=this.state;return t.cachedBbox||(t.cachedBbox=this.element.getBoundingClientRect()),t.cachedBbox},t.isClone=function(){return this.state.isClone},t.getCloneIndex=function(){return this.state.cloneIndex},t.getClonedPanels=function(){return this.state.clonedPanels},t.getIdenticalPanels=function(){var t=this.state;return t.isClone?this.original.getIdenticalPanels():[this].concat(t.clonedPanels)},t.setPosition=function(t){var e=this.state,n=this.element.style;e.position=t,e.horizontal?n.left=t+"px":n.top=t+"px",e.relativeAnchorPosition=d(e.anchorExpression,e.size)},t.setPrevPanel=function(t){this.prevPanel=t},t.setNextPanel=function(t){this.nextPanel=t},t.clone=function(t){var e=this.state,n=new i(this.element.cloneNode(!0),e.index,{anchorExpression:e.anchorExpression,horizontal:e.horizontal});return n.original=this,n.state.isClone=!0,n.state.cloneIndex=t,n.state.size=e.size,e.clonedPanels.push(n),n},t.removeClonedPanelsAfter=function(t){for(var e=0,n=this.state.clonedPanels.splice(t);e<n.length;e++){var i=n[e].getElement();i.parentNode.removeChild(i)}},i}();function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function A(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var C,I="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign,S=["","webkit","Moz","MS","ms","o"],e="undefined"==typeof document?{style:{}}:document.createElement("div"),n="function",R=Math.round,N=Math.abs,D=Date.now;function H(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<S.length;){if((i=(n=S[o])?n+r:e)in t)return i;o++}}C="undefined"==typeof window?{}:window;var k=H(e.style,"touchAction"),X=void 0!==k;var F="compute",Y="auto",j="manipulation",L="none",V="pan-x",B="pan-y",q=function(){if(!X)return!1;var e={},n=C.CSS&&C.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!n||C.CSS.supports("touch-action",t)}),e}(),W="ontouchstart"in C,G=void 0!==H(C,"PointerEvent"),U=W&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),Q="touch",Z="mouse",J=25,K=1,$=4,tt=8,et=1,nt=2,it=4,rt=8,ot=16,st=nt|it,at=rt|ot,ut=st|at,ht=["x","y"],ct=["clientX","clientY"];function lt(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function pt(t,e){return typeof t===n?t.apply(e&&e[0]||void 0,e):t}function ft(t,e){return-1<t.indexOf(e)}var vt=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===F&&(t=this.compute()),X&&this.manager.element.style&&q[t]&&(this.manager.element.style[k]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return lt(this.manager.recognizers,function(t){pt(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(ft(t,L))return L;var e=ft(t,V),n=ft(t,B);return e&&n?L:e||n?e?V:B:ft(t,j)?j:Y}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=ft(i,L)&&!q[L],o=ft(i,B)&&!q[B],s=ft(i,V)&&!q[V];if(r){var a=1===t.pointers.length,u=t.distance<2,h=t.deltaTime<250;if(a&&u&&h)return}if(!s||!o)return r||o&&n&st||s&&n&at?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function dt(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function gt(t){var e=t.length;if(1===e)return{x:R(t[0].clientX),y:R(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:R(n/e),y:R(i/e)}}function mt(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:R(t.pointers[n].clientX),clientY:R(t.pointers[n].clientY)},n++;return{timeStamp:D(),pointers:e,center:gt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function Pt(t,e,n){n||(n=ht);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function xt(t,e,n){n||(n=ht);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function yt(t,e){return t===e?et:N(t)>=N(e)?t<0?nt:it:e<0?rt:ot}function Et(t,e,n){return{x:e/t||0,y:n/t||0}}function Tt(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=mt(e)),1<r&&!n.firstMultiple?n.firstMultiple=mt(e):1===r&&(n.firstMultiple=!1);var o,s,a,u,h,c,l=n.firstInput,p=n.firstMultiple,f=p?p.center:l.center,v=e.center=gt(i);e.timeStamp=D(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=xt(f,v),e.distance=Pt(f,v),o=n,a=(s=e).center,u=o.offsetDelta||{},h=o.prevDelta||{},c=o.prevInput||{},s.eventType!==K&&c.eventType!==$||(h=o.prevDelta={x:c.deltaX||0,y:c.deltaY||0},u=o.offsetDelta={x:a.x,y:a.y}),s.deltaX=h.x+(a.x-u.x),s.deltaY=h.y+(a.y-u.y),e.offsetDirection=yt(e.deltaX,e.deltaY);var d,g,m,P,x=Et(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=x.x,e.overallVelocityY=x.y,e.overallVelocity=N(x.x)>N(x.y)?x.x:x.y,e.scale=p?(d=p.pointers,Pt((g=i)[0],g[1],ct)/Pt(d[0],d[1],ct)):1,e.rotation=p?(m=p.pointers,xt((P=i)[1],P[0],ct)+xt(m[1],m[0],ct)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==tt&&(J<a||void 0===s.velocity)){var u=e.deltaX-s.deltaX,h=e.deltaY-s.deltaY,c=Et(a,u,h);i=c.x,r=c.y,n=N(c.x)>N(c.y)?c.x:c.y,o=yt(u,h),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}(n,e);var y=t.element;dt(e.srcEvent.target,y)&&(y=e.srcEvent.target),e.target=y}function bt(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&K&&i-r==0,s=e&($|tt)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,Tt(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function At(t){return t.trim().split(/\s+/g)}function wt(e,t,n){lt(At(t),function(t){e.addEventListener(t,n,!1)})}function Ct(e,t,n){lt(At(t),function(t){e.removeEventListener(t,n,!1)})}function It(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var St=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){pt(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&wt(this.element,this.evEl,this.domHandler),this.evTarget&&wt(this.target,this.evTarget,this.domHandler),this.evWin&&wt(It(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&Ct(this.element,this.evEl,this.domHandler),this.evTarget&&Ct(this.target,this.evTarget,this.domHandler),this.evWin&&Ct(It(this.element),this.evWin,this.domHandler)},t}();function zt(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}var Ot={pointerdown:K,pointermove:2,pointerup:$,pointercancel:tt,pointerout:tt},Mt={2:Q,3:"pen",4:Z,5:"kinect"},_t="pointerdown",Rt="pointermove pointerup pointercancel";C.MSPointerEvent&&!C.PointerEvent&&(_t="MSPointerDown",Rt="MSPointerMove MSPointerUp MSPointerCancel");var Nt=function(n){function i(){var t,e=i.prototype;return e.evEl=_t,e.evWin=Rt,(t=n.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return A(i,n),i.prototype.handler=function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=Ot[i],o=Mt[t.pointerType]||t.pointerType,s=o===Q,a=zt(e,t.pointerId,"pointerId");r&K&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&($|tt)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))},i}(St);function Dt(t){return Array.prototype.slice.call(t,0)}function Ht(t,n,e){for(var i=[],r=[],o=0;o<t.length;){var s=n?t[o][n]:t[o];zt(r,s)<0&&i.push(t[o]),r[o]=s,o++}return e&&(i=n?i.sort(function(t,e){return t[n]>e[n]}):i.sort()),i}var kt={touchstart:K,touchmove:2,touchend:$,touchcancel:tt},Xt=function(t){function e(){return e.prototype.evTarget="touchstart touchmove touchend touchcancel",e.prototype.targetIds={},t.apply(this,arguments)||this}return A(e,t),e.prototype.handler=function(t){var e=kt[t.type],n=function(t,e){var n,i,r=Dt(t.touches),o=this.targetIds;if(e&(2|K)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=Dt(t.changedTouches),a=[],u=this.target;if(i=r.filter(function(t){return dt(t.target,u)}),e===K)for(n=0;n<i.length;)o[i[n].identifier]=!0,n++;n=0;for(;n<s.length;)o[s[n].identifier]&&a.push(s[n]),e&($|tt)&&delete o[s[n].identifier],n++;return a.length?[Ht(i.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:Q,srcEvent:t})},e}(St);var Ft={mousedown:K,mousemove:2,mouseup:$},Yt=function(n){function i(){var t,e=i.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=n.apply(this,arguments)||this).pressed=!1,t}return A(i,n),i.prototype.handler=function(t){var e=Ft[t.type];e&K&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=$),this.pressed&&(e&$&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:Z,srcEvent:t}))},i}(St),jt=2500,Lt=25;function Vt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY},i=this.lastTouches;this.lastTouches.push(n);setTimeout(function(){var t=i.indexOf(n);-1<t&&i.splice(t,1)},jt)}}var Bt=function(){return function(n){function t(t,e){var o;return(o=n.call(this,t,e)||this).handler=function(t,e,n){var i=n.pointerType===Q,r=n.pointerType===Z;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(t,e){t&K?(this.primaryTouch=e.changedPointers[0].identifier,Vt.call(this,e)):t&($|tt)&&Vt.call(this,e)}).call(w(w(o)),e,n);else if(r&&function(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=Lt&&s<=Lt)return!0}return!1}.call(w(w(o)),n))return;o.callback(t,e,n)}},o.touch=new Xt(o.manager,o.handler),o.mouse=new Yt(o.manager,o.handler),o.primaryTouch=null,o.lastTouches=[],o}return A(t,n),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(St)}();function qt(t,e,n){return!!Array.isArray(t)&&(lt(t,n[e],n),!0)}var Wt=1;function Gt(t,e){var n=e.manager;return n?n.get(t):t}function Ut(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var Qt=function(){function t(t){void 0===t&&(t={}),this.options=b({enable:!0},t),this.id=Wt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return I(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(qt(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Gt(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return qt(t,"dropRecognizeWith",this)||(t=Gt(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(qt(t,"requireFailure",this))return this;var e=this.requireFail;return-1===zt(e,t=Gt(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(qt(t,"dropRequireFailure",this))return this;t=Gt(t,this);var e=zt(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var n=this,t=this.state;function i(t){n.manager.emit(t,e)}t<8&&i(n.options.event+Ut(t)),i(n.options.event),e.additionalEvent&&i(e.additionalEvent),8<=t&&i(n.options.event+Ut(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=I({},t);if(!pt(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),Zt={domEvents:!1,touchAction:F,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Jt(n,i){var r,o=n.element;o.style&&(lt(n.options.cssProps,function(t,e){r=H(o.style,e),o.style[r]=i?(n.oldCssProps[r]=o.style[r],t):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var Kt=function(){function t(t,e){var n,i=this;this.options=I({},Zt,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(G?Nt:U?Xt:W?Bt:Yt))(n,bt),this.touchAction=new vt(this,this.options.touchAction),Jt(this,!0),lt(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return I(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!==r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),o++}},e.get=function(t){if(t instanceof Qt)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event===t)return e[n];return null},e.add=function(t){if(qt(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(qt(t,"remove",this))return this;var e=this.get(t);if(t){var n=this.recognizers,i=zt(n,e);-1!==i&&(n.splice(i,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var n=this.handlers;return lt(At(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var n=this.handlers;return lt(At(t),function(t){e?n[t]&&n[t].splice(zt(n[t],e),1):delete n[t]}),this},e.emit=function(t,e){var n,i,r;this.options.domEvents&&(n=t,i=e,(r=document.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var o=this.handlers[t]&&this.handlers[t].slice();if(o&&o.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var s=0;s<o.length;)o[s](e),s++}},e.destroy=function(){this.element&&Jt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}();var $t=function(e){function t(t){return void 0===t&&(t={}),e.call(this,b({pointers:1},t))||this}A(t,e);var n=t.prototype;return n.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},n.process=function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&tt||!r)?16|e:i||r?n&$?8|e:2&e?4|e:2:32},t}(Qt);function te(t){return t===ot?"down":t===rt?"up":t===nt?"left":t===it?"right":""}var ee=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,b({event:"pan",threshold:10,pointers:1,direction:ut},t))||this).pX=null,e.pY=null,e}A(t,n);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&st&&e.push(B),t&at&&e.push(V),e},e.directionTest=function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(i=e.direction&st?(r=0===o?et:o<0?nt:it,n=o!==this.pX,Math.abs(t.deltaX)):(r=0===s?et:s<0?rt:ot,n=s!==this.pY,Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},e.attrTest=function(t){return $t.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=te(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}($t),ne=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])};var ie=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};function re(t,e,n,i){var r=t,o=[n[0]?e[0]:i?e[0]-i[0]:e[0],n[1]?e[1]:i?e[1]+i[1]:e[1]];return r=Math.max(o[0],r),+(r=Math.min(o[1],r)).toFixed(5)}function oe(t,e){return t<e[0]||t>e[1]}function se(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function ae(t,e,n){var i=t,r=e[0],o=e[1],s=o-r;return n[1]&&o<t&&(i=(i-o)%s+r),n[0]&&t<r&&(i=(i-r)%s+o),+i.toFixed(5)}function ue(t,e){for(var n in t)if(t[n]!==e[n])return!1;return!0}var he,ce=function(){function t(t,e){var n=this;this.axis=t,this.options=e,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._complementOptions=function(){var r=this;Object.keys(this.axis).forEach(function(i){r.axis[i]=ie({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])})})},e.getDelta=function(t,e){var n=this.get(t);return this.map(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},{}):ie({},this._pos,t||{})},e.moveTo=function(n){var i=this,t=this.map(this._pos,function(t,e){return e in n?n[e]-i._pos[e]:0});return this.set(n),{pos:ie({},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,e){var n=this.axis;for(var i in t)if(i&&!e(t[i],i,n[i]))return!1;return!0},e.filter=function(t,e){var n={},i=this.axis;for(var r in t)r&&e(t[r],r,i[r])&&(n[r]=t[r]);return n},e.map=function(t,e){var n={},i=this.axis;for(var r in t)r&&(n[r]=e(t[r],r,i[r]));return n},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,n){return!oe(t,n.range)})},t}();function le(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var pe=(he="undefined"==typeof window?{}:window).requestAnimationFrame||he.webkitRequestAnimationFrame,fe=he.cancelAnimationFrame||he.webkitCancelAnimationFrame;if(pe&&!fe){var ve={},de=pe;pe=function(e){var n=de(function(t){ve[n]&&e(t)});return ve[n]=!0,n},fe=function(t){delete ve[t]}}else pe&&fe||(pe=function(t){return he.setTimeout(function(){t(he.performance&&he.performance.now&&he.performance.now()||(new Date).getTime())},16)},fe=he.clearTimeout);function ge(t,e,n){return Math.max(Math.min(t,n),e)}var me=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm;this.options=e,this.itm=n,this.em=i,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(o,t,e){var n,s=this;if(void 0!==e)n=e;else{var i=this.axm.map(t,function(t,e){return n=Math.abs(Math.abs(t)-Math.abs(o[e])),i=s.options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r});n=Object.keys(i).reduce(function(t,e){return Math.max(t,i[e])},-1/0)}return ge(n,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,n){var i=this.axm.get(),r=t,o=n&&n.event||null;return{depaPos:i,destPos:r,duration:ge(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,r),inputEvent:o,input:n&&n.input||null,isTrusted:!!o,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e,n){return ae(t,n.range,n.circular)});this.axm.every(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,fe(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},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.axm.get(),n=this.axm.map(e,function(t,e,n){return Math.min(n.range[1],Math.max(n.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e,n){return se(t,n.range,n.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e,n){return ae(t,n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.em.triggerFinish(!!t)},e.animateLoop=function(e,n){if(this._animateParam=ie({},e),this._animateParam.startTime=(new Date).getTime(),e.duration){var i=this._animateParam,r=this;!function t(){if(r._raf=null,1<=r.frame(i))return ue(e.destPos,r.axm.get(Object.keys(e.destPos)))||r.em.triggerChange(e.destPos),void n();r._raf=pe(t)}()}else this.em.triggerChange(e.destPos),n()},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=ge(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,r=this.createAnimationParam(t,e,n),o=ie({},r.depaPos),s=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!s&&this.axm.every(a.destPos,function(t,e,n){return se(t,n.range,n.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!ue(a.destPos,o)){var u=n&&n.event||null;this.animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(o,a.destPos),isTrusted:!!u,inputEvent:u,input:n&&n.input||null},function(){return i.animationEnd()})}},e.frame=function(i){var t=(new Date).getTime()-i.startTime,r=this.easing(t/i.duration),e=i.depaPos;return e=this.axm.map(e,function(t,e,n){return ae(t+=i.delta[e]*r,n.range,n.circular)}),this.em.triggerChange(e),r},e.easing=function(t){return 1<t?1:this.options.easing(t)},e.setTo=function(t,i){void 0===i&&(i=0);var e=Object.keys(t);this.grab(e);var n=this.axm.get(e);if(ue(t,n))return this;this.itm.setInterrupt(!0);var r=this.axm.filter(t,function(t,e){return n[e]!==t});return Object.keys(r).length&&(ue(r=this.axm.map(r,function(t,e,n){return n.circular&&(n.circular[0]||n.circular[1])?0<i?t:ae(t,n.range,n.circular):re(t,n.range,n.circular)}),n)||(0<i?this.animateTo(r,i):(this.em.triggerChange(r),this.itm.setInterrupt(!1)))),this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(this.axm.map(this.axm.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},t}(),Pe=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){this.axes.trigger("hold",{pos:t,input:e.input||null,inputEvent:e.event||null,isTrusted:!0})},e.triggerRelease=function(t){t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},e.triggerChange=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=this.am.getEventInfo(),r=this.am.axm.moveTo(t),o=e&&e.event||i&&i.event||null,s={pos:r.pos,delta:r.delta,holding:n,inputEvent:o,isTrusted:!!o,input:e&&e.input||i&&i.input||null,set:o?this.createUserControll(r.pos):function(){}};this.axes.trigger("change",s),o&&this.am.axm.set(s.set().destPos)},e.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:ie({},t),duration:e};return function(t,e){return t&&(n.destPos=ie({},t)),void 0!==e&&(n.duration=e),n}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},t}(),xe=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}(),ye=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm,o=t.am;this.isOutside=!1,this.moveDistance=null,this.options=e,this.itm=n,this.em=i,this.axm=r,this.am=o}var e=t.prototype;return e.atOutside=function(t){var s=this;if(this.isOutside)return this.axm.map(t,function(t,e,n){var i=n.range[0]-n.bounce[0],r=n.range[1]+n.bounce[1];return r<t?r:t<i?i:t});var a=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,e,n){var i=n.range[0],r=n.range[1],o=n.bounce;return t<i?i-s.am.easing((i-t)/(o[0]*a))*o[0]:r<t?r+s.am.easing((t-r)/(o[1]*a))*o[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var n={input:t,event:e};this.itm.setInterrupt(!0),this.am.grab(t.axes,n),!this.moveDistance&&this.em.triggerHold(this.axm.get(),n),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,n){if(this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,r=this.axm.get(t.axes);i=this.axm.map(this.moveDistance||r,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),i=this.axm.map(i,function(t,e,n){return ae(t,n.range,n.circular)}),this.isOutside&&this.axm.every(r,function(t,e,n){return!oe(t,n.range)})&&(this.isOutside=!1),i=this.atOutside(i),this.em.triggerChange(i,{input:t,event:e},!0)}},e.release=function(t,e,n,i){if(this.itm.isInterrupting()&&this.moveDistance){var r=this.axm.get(t.axes),o=this.axm.get(),s=this.axm.get(this.axm.map(n,function(t,e,n){return n.circular&&(n.circular[0]||n.circular[1])?r[e]+t:re(r[e]+t,n.range,n.circular,n.bounce)})),a=this.am.getDuration(s,r,i);0===a&&(s=ie({},o));var u={depaPos:o,destPos:s,duration:a,delta:this.axm.getDelta(o,s),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(u),this.moveDistance=null;var h=this.am.getUserControll(u),c=ue(h.destPos,o),l={input:t,event:e};c||0===h.duration?(!c&&this.em.triggerChange(h.destPos,l,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(l):this.em.triggerFinish(!0)):this.am.animateTo(h.destPos,h.duration,l)}},t}(),Ee=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""}(),Te=function(r){function t(t,e,n){void 0===t&&(t={});var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=ie({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4},e),i.itm=new xe(i.options),i.axm=new ce(i.axis,i.options),i.em=new Pe(i),i.am=new me(i),i.io=new ye(i),i.em.setAnimationManager(i.am),n&&i.em.triggerChange(n),i}!function(t,e){function n(){this.constructor=t}ne(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,r);var e=t.prototype;return e.connect=function(t,e){var n;if(n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});i.length&&(e.hammer=i[0].hammer)}return e.mapAxes(n),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.5.9",t.TRANSFORM=Ee,t.DIRECTION_NONE=et,t.DIRECTION_LEFT=nt,t.DIRECTION_RIGHT=it,t.DIRECTION_UP=rt,t.DIRECTION_DOWN=ot,t.DIRECTION_HORIZONTAL=st,t.DIRECTION_VERTICAL=at,t.DIRECTION_ALL=ut,t}(t),be="PointerEvent"in he||"MSPointerEvent"in he,Ae="ontouchstart"in he,we="_EGJS_AXES_INPUTTYPE_";function Ce(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function Ie(t,e,n){return n?!!(e===ut||e&t&&n&t):!!(e&t)}var Se=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,void 0===Kt)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=function e(t,n){var i;if(void 0===n&&(n=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var r=document.createElement("div");r.innerHTML=t,i=le(r.childNodes)}else i=le(document.querySelectorAll(t));n||(i=1<=i.length?i[0]:void 0)}else t===he?i=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in he&&t instanceof jQuery||t.constructor.prototype.jquery?i=n?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return e(t)}),n||(i=1<=i.length?i[0]:void 0)):i=t;return i}(t),this.options=ie({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.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?ut:e?st:n?at:et,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[we];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=function(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=Ae;break;case"pointer":i=be}}),i?Nt:e&&n?Bt:e?Xt:n?Yt:null}(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=function(t,e){try{return new Kt(t,ie({},e))}catch(t){return null}}(this.element,ie({inputClass:i},this.options.hammerManagerOptions)),this.element[we]=n}return this.panRecognizer=new ee(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=et,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[we],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=function(t,e){if(e<0||90<e)return et;var n=Math.abs(t);return e<n&&n<180-e?at:st}(t.angle,this.options.thresholdAngle),n=this.hammer.session.prevInput;t.offsetY=n?(t.offsetX=t.deltaX-n.deltaX,t.deltaY-n.deltaY):t.offsetX=0;var i=this.getOffset([t.offsetX,t.offsetY],[Ie(st,this._direction,e),Ie(at,this._direction,e)]),r=i.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),(t.preventSystemEvent=r)&&this.observer.change(this,t,Ce(this.axes,i))},e.onPanend=function(t){var e,n,i,r,o=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[Ie(st,this._direction),Ie(at,this._direction)]);e=o,n=this.observer.options.deceleration,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=Math.abs(i/-n),o=[e[0]/2*r,e[1]/2*r],this.observer.release(this,t,Ce(this.axes,o))},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),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}(),ze=function(){function t(t,e,n){this.clonedPanels=[],this.viewportElement=t,this.cameraElement=e,this.state={index:n.defaultIndex,size:0,position:0,hangerPosition:0,scrollArea:{prev:0,next:0},translate:E},this.options=n,this.build()}var e=t.prototype;return e.moveTo=function(t,e,n){void 0===n&&(n=this.options.duration);var i=this.state,r=t.anchorPosition-i.hangerPosition;r=this.canSetBoundMode()?p(r,i.scrollArea.prev,i.scrollArea.next):r,i.index=t.index,e&&e.setTo?e.setTo({flick:r},n):this.axes.setTo({flick:r},n)},e.moveCamera=function(t){var e=this.state,n=e.translate.name,i=(this.options.horizontal?[-t,0]:[0,-t]).map(function(t){return Math.round(t)+"px"}).join(", ");this.cameraElement.style[n]=e.translate.has3d?"translate3d("+i+", 0px)":"translate("+i+")",e.position=t},e.resize=function(){this.updateSize(),this.updateOriginalPanelPositions(),this.updateAdaptiveSize(),this.updateScrollArea(),this.options.circular&&(this.clonePanels(),this.relocatePanels()),this.chainPanels(),this.updateCameraPosition()},e.findNearestPanel=function(){var t=this.state,e=this.panels,n=this.clonedPanels,i=t.scrollArea,r=t.position+t.hangerPosition;if(this.isOutOfBound())return t.position<i.prev?e[0]:e[e.length-1];for(var o,s=1/0,a=0,u=e.concat(n);a<u.length;a++){var h=u[a],c=h.getPosition(),l=c+h.getSize(),p=v(r,c,l)?0:Math.min(Math.abs(c-r),Math.abs(l-r));if(s<p)break;s=p,o=h}return o},e.findPanelOf=function(t){for(var e=0,n=this.panels.concat(this.clonedPanels);e<n.length;e++){var i=n[e];if(i.getElement().contains(t))return i}},e.findNearestIdenticalPanel=function(t){var e=this.state,i=t,r=1/0,o=e.position+e.hangerPosition;return t.getIdenticalPanels().forEach(function(t){var e=t.getAnchorPosition(),n=Math.abs(e-o);n<r&&(i=t,r=n)}),i},e.findShortestPositionToPanel=function(t){var e=this.state,n=this.options,i=t.getAnchorPosition(),r=Math.abs(e.position+e.hangerPosition-i),o=e.scrollArea.next-e.scrollArea.prev;if(n.circular)return r<=o-r?i-e.hangerPosition:i>e.position+e.hangerPosition?i-e.hangerPosition-o:i-e.hangerPosition+o;var s=i-e.hangerPosition;return this.canSetBoundMode()?p(s,e.scrollArea.prev,e.scrollArea.next):s},e.enable=function(){this.panInput.enable()},e.disable=function(){this.panInput.disable()},e.updateAdaptiveSize=function(){var t,e=this.options,i=e.horizontal;if(e.adaptive){var n=this.getCurrentPanel().getBbox();t=i?n.height:n.width}else{t=this.panels.reduce(function(t,e){var n=e.getBbox();return Math.max(t,i?n.height:n.width)},0)}var r=this.viewportElement.style;i?(r.height=t+"px",r.minHeight="100%",r.width="100%"):(r.width=t+"px",r.minWidth="100%",r.height="100%")},e.destroy=function(){var t=this.viewportElement,e=t.parentElement;for(var n in e.removeChild(t),this.axes.destroy(),this.panInput.destroy(),this.panels.forEach(function(t){e.appendChild(t.getElement()),t.destroy()}),this)this[n]=null},e.restore=function(t){var e=t.panels,n=this.cameraElement;n.innerHTML=e.map(function(t){return t.html}).join(""),this.viewportElement.appendChild(n),this.state.index=t.index,this.moveCamera(t.position),this.panels=[],this.clonedPanels=[],this.createPanels(),this.resize()},e.getPanelCount=function(){return this.panels.length},e.getPanel=function(t){return v(t,0,this.panels.length-1)?this.panels[t]:null},e.getCurrentPanel=function(){return this.panels[this.state.index]},e.getIndex=function(){return this.state.index},e.getPrevIndex=function(){var t=this.state.index-1;return t<0&&(t=this.options.circular?this.panels.length-1:-1),t},e.getNextIndex=function(){var t=this.state.index+1;return t>=this.panels.length&&(t=this.options.circular?0:-1),t},e.getSize=function(){return this.state.size},e.getScrollArea=function(){return this.state.scrollArea},e.getScrollAreaSize=function(){var t=this.state.scrollArea;return t.next-t.prev},e.getHangerPosition=function(){return this.state.hangerPosition},e.getCameraPosition=function(){return this.state.position},e.getAllPanels=function(t){var e=this.panels;return t?e.concat(this.clonedPanels):e},e.connectAxesHandler=function(t){var e=this.axes;this.axesHandlers=t,e.on(t),this.resume()},e.pause=function(){this.axes.off()},e.resume=function(){this.axes.on(this.axesHandlers)},e.build=function(){this.applyCSSValue(),this.setAxesInstance(),this.createPanels(),this.resize(),this.moveToDefaultPanel()},e.applyCSSValue=function(){var t=this.options,e=this.viewportElement,n=this.cameraElement,i=t.classPrefix;e.className=i+"-viewport",n.className=i+"-camera",o(e,s),o(n,h),t.zIndex&&(e.style.zIndex=""+t.zIndex),t.overflow&&(e.style.overflow="visible")},e.setAxesInstance=function(){var t=this.state,e=this.options,n=t.scrollArea,i=e.horizontal;this.axes=new Te({flick:{range:[n.prev,n.next],circular:e.circular,bounce:[0,0]}},{easing:e.panelEffect,deceleration:e.deceleration,interruptable:!0}),this.panInput=this.makeNewPanInput(),this.axes.connect(i?["flick",""]:["","flick"],this.panInput)},e.createPanels=function(){var t,e=this.state,n=this.options,i=this.cameraElement.children;if(!i||!i.length)throw new Error("There're no panel elements.");this.panels=(t=i,[].slice.call(t)).map(function(t,e){return new T(t,e,{horizontal:n.horizontal,classPrefix:n.classPrefix,anchorExpression:n.anchor})}),e.index=p(e.index,0,this.panels.length-1)},e.clonePanels=function(){var i=this,t=this.state,e=this.panels,r=this.clonedPanels,n=t.size,o=e[e.length-1],s=o.getPosition()+o.getSize()+this.options.gap,a=n+e[0].getRelativeAnchorPosition(),u=r[r.length-1],h=Math.ceil(a/s),c=u?u.getCloneIndex()+1:0;if(c<h)for(var l=function(n){e.forEach(function(t){var e=t.clone(n);i.appendPanelElement(e.getElement()),r.push(e)})},p=c;p<h;p++)l(p);else h<c&&(e.forEach(function(t){t.removeClonedPanelsAfter(h)}),this.clonedPanels.splice(h*e.length))},e.relocatePanels=function(){var t=this.state,e=this.options,n=this.panels,i=this.clonedPanels,r=t.scrollArea,o=r.next+t.size,s=(r.prev,n[0]),a=n[n.length-1];if(s){for(var u=a.getPosition()+a.getSize()+e.gap,h=0,c=i;h<c.length;h++){var l=(g=c[h]).getIdenticalPanels()[0],p=u*(g.getCloneIndex()+1)+l.getPosition();g.setPosition(p)}for(var f=s.getPosition(),v=0,d=i.concat().reverse();v<d.length;v++){var g,m=(g=d[v]).getPosition(),P=f-g.getSize()-e.gap;if(m<=o)break;g.setPosition(P),f=P}}},e.chainPanels=function(){var r=this.panels.concat(this.clonedPanels);if(r.forEach(function(t,e){var n=0<e?r[e-1]:null,i=e<r.length-1?r[e+1]:null;t.setPrevPanel(n),t.setNextPanel(i)}),this.options.circular){var t=r[0],e=r[r.length-1];t.setPrevPanel(e),e.setNextPanel(t)}},e.moveToDefaultPanel=function(){var t=this.state,e=p(this.options.defaultIndex,0,this.panels.length-1),n=this.panels[e].getAnchorPosition()-t.hangerPosition;n=this.canSetBoundMode()?p(n,t.scrollArea.prev,t.scrollArea.next):n,t.index=e,this.moveCamera(n),this.axes.setTo({flick:n},0)},e.isOutOfBound=function(){var t=this.state,e=t.scrollArea;return!this.options.circular&&(t.position<e.prev||t.position>e.next)},e.canSetBoundMode=function(){var t=this.state,e=this.options,n=this.panels,i=n[n.length-1],r=i.getPosition()+i.getSize();return e.bound&&!e.circular&&r>=t.size},e.updateSize=function(){var t=this.state,e=this.options,n=this.viewportElement;e.horizontal||(n.style.width="",n.style.minWidth="");var i=n.getBoundingClientRect();t.size=e.horizontal?i.width:i.height,t.hangerPosition=d(e.hanger,t.size)},e.updateOriginalPanelPositions=function(){var i=this.options.gap,t=this.panels,r=0;t.forEach(function(t){t.resize();var e=r,n=t.getSize();t.setPosition(e),r+=n+i})},e.updateScrollArea=function(){var t=this.state,e=this.panels,n=this.options,i=this.axes,r=e[0],o=e[e.length-1],s=t.hangerPosition;if(this.canSetBoundMode())t.scrollArea={prev:r.getPosition(),next:o.getPosition()+o.getSize()-t.size};else if(n.circular){var a=o.getPosition()+o.getSize()+n.gap;t.scrollArea={prev:r.getAnchorPosition()-s,next:a+r.getRelativeAnchorPosition()-s}}else t.scrollArea={prev:r.getAnchorPosition()-s,next:o.getAnchorPosition()-s};var u,h=t.size,c=n.bounce,l=c;if((u=c)&&u.constructor===Array)l=c.map(function(t){return d(t,h,g.bounce)});else{var p=d(c,h,g.bounce);l=[p,p]}i.axis.flick.range=[t.scrollArea.prev,t.scrollArea.next],i.axis.flick.bounce=l},e.updateCameraPosition=function(){var t=this.state,e=this.panels,n=this.axes,i=e[t.index].getAnchorPosition()-t.hangerPosition;this.canSetBoundMode()&&(i=p(i,t.scrollArea.prev,t.scrollArea.next)),this.moveCamera(i),this.pause(),n.setTo({flick:i},0),this.resume()},e.makeNewPanInput=function(){var t=this.options;return new Se(this.viewportElement,{inputType:t.inputType,thresholdAngle:t.thresholdAngle,scale:t.horizontal?[-1,0]:[0,-1]})},e.appendPanelElement=function(t){this.cameraElement.appendChild(t)},t}(),Oe=function(){function t(){this.delta=0,this.direction=null,this.targetPanel=null}var e=t.prototype;return e.onEnter=function(t){this.delta=t.delta,this.direction=t.direction,this.targetPanel=t.targetPanel},e.onExit=function(t){},e.onHold=function(t,e){},e.onChange=function(t,e){},e.onRelease=function(t,e){},e.onAnimationEnd=function(t,e){},e.onFinish=function(t,e){},t}(),Me=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=l,t.holding=!1,t.playing=!1,t}r(t,e);var n=t.prototype;return n.onEnter=function(){this.direction=null,this.targetPanel=null,this.delta=0},n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(O.HOLD_START,t,!0).onSuccess(function(){i(P)}).onStopped(function(){i(_)})},n.onChange=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(O.MOVE_START,t,!1).onSuccess(function(){i(M).onChange(t,e)}).onStopped(function(){i(_)})},t}(Oe),_e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=P,t.holding=!0,t.playing=!0,t.releaseEvent=null,t}r(t,e);var n=t.prototype;return n.onChange=function(t,e){var n=e.flicking,i=e.triggerEvent,r=e.transitTo,o=n.options.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY;this.direction=o<0?y.NEXT:y.PREV,i(O.MOVE_START,t,!0).onSuccess(function(){r(x).onChange(t,e)}).onStopped(function(){r(_)})},n.onRelease=function(t,e){var n=e.viewport,i=e.triggerEvent,r=e.transitTo;if(i(O.HOLD_END,t,!0),0!==t.delta.flick)return t.setTo({flick:n.getCameraPosition()},0),void r(l);this.releaseEvent=t},n.onFinish=function(t,e){var n=e.viewport,i=e.triggerEvent,r=e.transitTo,o=e.castToReadonlyPanel;if(r(l),this.releaseEvent){var s=this.releaseEvent.inputEvent.srcEvent.target,a=n.findPanelOf(s),u=n.getCameraPosition();if(a){var h=a.getPosition();i(O.SELECT,null,!0,{direction:u<h?y.NEXT:h<u?y.PREV:null,selectedIndex:a.getIndex(),selectedPanel:o(a)})}}},t}(Oe),Re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=x,t.holding=!0,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onEnter=function(t){e.prototype.onEnter.call(this,t),this.delta=0},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(_)})},n.onRelease=function(t,e){var n=e.flicking,i=e.viewport,r=e.triggerEvent,o=e.moveToPanel,s=e.castToReadonlyPanel,a=e.transitTo,u=e.stopCamera,h=this.delta,c=n.options,l=0<h,p=Math.abs(h),f=t.inputEvent.deltaX?Math.abs(180*Math.atan(t.inputEvent.deltaY/t.inputEvent.deltaX)/Math.PI):90,v=p>=c.threshold&&(c.horizontal?f<=c.thresholdAngle:f>c.thresholdAngle);if(r(O.HOLD_END,t,!0),!v&&this.targetPanel)return i.moveTo(this.targetPanel,t),void a(M);var d=i.getCurrentPanel(),g=i.getCameraPosition()+i.getHangerPosition(),m=c.gap/2,P=l?d.getSize()-d.getRelativeAnchorPosition()+m:d.getRelativeAnchorPosition()+m;P=Math.max(P,c.threshold);var x,y=Math.abs(t.delta.flick),E=c.snap,T=c.duration,b=s(d);if(v){var A=0;if(P<=y){for(var w=b.position;Math.abs(b.position-w)<y&&A<E;){var C=l?b.next():b.prev();if(!C)break;b=C,++A}1<A&&(x=Math.min(T*A,Math.max(t.duration,T)))}if(A<=1)if(p<=P){var I=l?d.getNextPanel():d.getPrevPanel();if(c.circular){var S=d.getIdenticalPanels()[1];(z=Math.abs(d.getAnchorPosition()-g)>Math.abs(S.getAnchorPosition()-g))&&(I=l?S.getNextPanel():S.getPrevPanel())}b=s(null!=I?I:d)}else b=s(i.findNearestPanel())}else if(c.circular){S=d.getIdenticalPanels()[1];var z=Math.abs(d.getAnchorPosition()-g)>Math.abs(S.getAnchorPosition()-g);!l&&z&&(b=s(S))}o(b,!v||!c.circular&&b.position===d.getPosition()?O.RESTORE:O.CHANGE,t,x).onSuccess(function(){a(M)}).onStopped(function(){a(_),u(t)})},t}(Oe),Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=M,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(O.HOLD_START,t,!0).onSuccess(function(){i(x)}).onStopped(function(){i(_)})},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(_)})},n.onFinish=function(t,e){var n=e.flicking,i=e.viewport,r=e.triggerEvent,o=e.transitTo,s=t&&t.isTrusted;r(O.MOVE_END,t,s),n.options.adaptive&&i.updateAdaptiveSize(),o(l)},t}(Oe),De=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=_,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onAnimationEnd=function(t,e){(0,e.transitTo)(l)},n.onRelease=function(t,e){var n=e.transitTo;0===t.delta.flick&&n(l)},t}(Oe),He=function(){function t(){var i=this;this.state=new Me,this.transitTo=function(t){var e=i.state;if(e.type!==t){var n=void 0;switch(t){case l:n=new Me;break;case P:n=new _e;break;case x:n=new Re;break;case M:n=new Ne;break;case _:n=new De}e.onExit(n),n.onEnter(e),i.state=n}return i.state}}var e=t.prototype;return e.fire=function(t,e,n){var i=this.state;switch(t){case m.HOLD:i.onHold(e,n);break;case m.CHANGE:i.onChange(e,n);break;case m.RELEASE:i.onRelease(e,n);break;case m.ANIMATION_END:i.onAnimationEnd(e,n);break;case m.FINISH:i.onFinish(e,n)}},e.getState=function(){return this.state},t}();return function(p){function t(t,e){void 0===e&&(e={});var n,S=p.call(this)||this;if(S.plugins=[],S.triggerEvent=function(t,e,n,i){void 0===i&&(i={});var r=S.viewport,o=S.stateMachine.getState(),s=r.getCurrentPanel(),a=r.getScrollArea(),u=a.prev,h=a.next,c=z(r.getCameraPosition(),[u,u,h]);S.options.circular&&(c%=1);var l=!p.prototype.trigger.call(S,t,f({type:t,index:s.getIndex(),panel:S.castToReadonlyPanel(s),direction:o.direction,holding:o.holding,progress:c,axesEvent:e,isTrusted:n},i));return{onSuccess:function(t){return l||t(),this},onStopped:function(t){return l&&t(),this}}},S.moveCamera=function(t){var e=S.viewport,n=S.stateMachine.getState(),i=S.options,r=t.pos.flick;if(t.isTrusted&&n.holding){var o=(i.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY)<0,s=e.getCameraPosition(),a=r-s,u=o===r<s;if(i.circular&&u){var h=e.getScrollAreaSize();a=-Math.sign(a)*(h-Math.abs(a))}var c=0===a?n.direction:0<a?y.NEXT:y.PREV;n.delta+=a,n.direction=c}var l=e.getCameraPosition();return e.moveCamera(r),S.triggerEvent(O.MOVE,t,t.isTrusted).onStopped(function(){e.moveCamera(l)})},S.stopCamera=function(t){var e=S.viewport;t&&t.setTo&&t.setTo({flick:e.getCameraPosition()},0),S.stateMachine.transitTo(l)},S.moveToPanel=function(e,t,n,i){void 0===i&&(i=S.options.duration);var r,o=S.viewport,s=S.stateMachine,a=o.getCurrentPanel(),u=e.anchorPosition-o.getHangerPosition(),h=o.getCameraPosition(),c=null!==n,l=h<u?y.NEXT:y.PREV;return(r=t===O.CHANGE?S.triggerEvent(O.CHANGE,n,c,{index:e.index,panel:e,direction:l,prevIndex:a.getIndex(),prevPanel:S.castToReadonlyPanel(a)}):S.triggerEvent(O.RESTORE,n,c)).onSuccess(function(){var t=s.getState();t.targetPanel=e,t.direction=l,o.moveTo(e,n,i)}),i<=0&&s.fire(m.FINISH,null,S.eventContext),r},S.castToReadonlyPanel=function(i,r){void 0===r&&(r=i.getPosition());var o=S,t=S.options.circular,s=S.viewport,e=i.getSize(),n=i.getRelativeAnchorPosition(),a=s.getCameraPosition(),u=s.getHangerPosition(),h=a+u,c=S.viewport.findNearestPanel(),l=c.getAnchorPosition()>h||!c.getNextPanel(),p=(l?c.getPrevPanel():c)||c,f=(l?c:c.getNextPanel())||c,v=s.getScrollAreaSize(),d=s.getSize(),g=p.getAnchorPosition(),m=f.getAnchorPosition();m<g&&(g<h?m+=v:g-=v);var P=[g,g,m],x=[-e,u-n,d],y=S.getPanelCount(),E=p.getCloneIndex(),T=(t?Math.floor(r/v)*y:0)+i.getIndex()-z(h,P)-(p.getIndex()+(E+1)*y),b=r-a,A=z(b,x),w=b+e,C=Math.min(d,w)-Math.max(b,0),I=0<=C?C/e:0;return{element:i.getElement(),index:i.getIndex(),position:r,progress:T,outsetProgress:A,visibleRatio:I,anchorPosition:r+i.getRelativeAnchorPosition(),size:i.getSize(),focus:function(t){s.getCameraPosition()+s.getHangerPosition()!==i.getAnchorPosition()&&o.moveToPanel(this,O.CHANGE,null,t)},update:function(e){i.getIdenticalPanels().forEach(function(t){return e(t.getElement())})},prev:function(){var t=i.getPrevPanel();if(null==t)return null;for(var e=s.getScrollAreaSize(),n=t.getPosition();r<n;)n-=e;return o.castToReadonlyPanel(t,n)},next:function(){var t=i.getNextPanel();if(null==t)return null;for(var e=s.getScrollAreaSize(),n=t.getPosition();n<r;)n+=e;return o.castToReadonlyPanel(t,n)}}},"string"==typeof t){if(!(n=document.querySelector(t)))throw new Error("Base element doesn't exist.")}else{if(!t.nodeName||1!==t.nodeType)throw new Error("Element should be provided in string or HTMLElement.");n=t}return S.wrapper=n,S.build(e),S}r(t,p);var e=t.prototype;return e.prev=function(t){return this.moveTo(this.viewport.getPrevIndex(),t)},e.next=function(t){return this.moveTo(this.viewport.getNextIndex(),t)},e.moveTo=function(t,e){var n=this.viewport,i=n.getPanel(t);if(i){var r=this.stateMachine.getState(),o=n.getIndex();if(!(r.type===l&&i.getIndex()!==o))return this;var s=this.castToReadonlyPanel(n.findNearestIdenticalPanel(i));this.moveToPanel(s,O.CHANGE,null,e)}return this},e.getIndex=function(){return this.viewport.getIndex()},e.getPrevIndex=function(){return this.viewport.getPrevIndex()},e.getNextIndex=function(){return this.viewport.getNextIndex()},e.getCurrentPanel=function(){return this.castToReadonlyPanel(this.viewport.getCurrentPanel())},e.getPanel=function(t){var e=this.viewport.getPanel(t);return e?this.castToReadonlyPanel(e):null},e.getAllPanels=function(t){var e=this;return this.viewport.getAllPanels(t).map(function(t){return e.castToReadonlyPanel(t)})},e.getVisiblePanels=function(){return this.getAllPanels(!0).filter(function(t){var e=t.outsetProgress;return-1<e&&e<1})},e.getPanelCount=function(){return this.viewport.getPanelCount()},e.isPlaying=function(){return this.stateMachine.getState().playing},e.enableInput=function(){return this.viewport.enable(),this},e.disableInput=function(){return this.viewport.disable(),this},e.getStatus=function(){var t=this.viewport.getAllPanels().map(function(t){return{html:t.getElement().outerHTML,index:t.getIndex()}});return{index:this.getIndex(),panels:t,position:this.viewport.getCameraPosition()}},e.setStatus=function(t){this.viewport.restore(t)},e.addPlugins=function(t){var e=this,n=[].concat(t);return n.forEach(function(t){t.init(e)}),this.plugins=this.plugins.concat(n),this},e.removePlugins=function(t){var n=this,i=this.plugins;return[].concat(t).forEach(function(t){var e=i.indexOf(t);-1<e&&i.splice(e,1),t.destroy(n)}),this},e.destroy=function(){var e=this;for(var t in this.off(),this.viewport.destroy(),this.plugins.forEach(function(t){t.destroy(e)}),this)this[t]=null},e.resize=function(){return this.viewport.resize(),this},e.build=function(t){this.setInitialState(t),this.initViewport(),this.listenInput(),this.listenResize()},e.setInitialState=function(t){this.options=f({},g,t),this.stateMachine=new He},e.initViewport=function(){var t=this.wrapper,e=this.options,n=t.children;if(!n||!n.length)throw new Error("Given base element doesn't have proper DOM structure to be initialized.");for(var i=document.createElement("div"),r=t.firstChild;r;)i.appendChild(r),r=t.firstChild;var o=document.createElement("div");o.appendChild(i),t.appendChild(o),this.viewport=new ze(o,i,e)},e.listenInput=function(){var n=this,i=n.stateMachine;n.eventContext={flicking:n,viewport:n.viewport,transitTo:i.transitTo,triggerEvent:n.triggerEvent,moveCamera:n.moveCamera,stopCamera:n.stopCamera,moveToPanel:n.moveToPanel,castToReadonlyPanel:n.castToReadonlyPanel};var r={},t=function(t){var e=m[t];r[e]=function(t){return i.fire(e,t,n.eventContext)}};for(var e in m)t(e);n.viewport.connectAxesHandler(r)},e.listenResize=function(){var t=this;this.options.autoResize&&window.addEventListener("resize",function(){t.resize()})},t.VERSION="3.0.0-beta3",t.DIRECTION=y,t.EVENTS=O,t}(t)}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=t||self).eg=t.eg||{},t.eg.Flicking=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 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 a(t){return void 0===t}var t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var e=t.prototype;return e.trigger=function(t,e){void 0===e&&(e={});var n=this._eventHandler[t]||[];if(!(0<n.length))return!0;n=n.concat(),e.eventType=t;var i=!1,r=[e],o=0;e.stop=function(){i=!0},e.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),u=2;u<s;u++)a[u-2]=arguments[u];for(1<=a.length&&(r=r.concat(a)),o=0;n[o];o++)n[o].apply(this,r);return!i},e.once=function(r,o){if("object"==typeof r&&a(o)){var t,e=r;for(t in e)this.once(t,e[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];o.apply(s,n),s.off(r,t)})}return this},e.hasOn=function(t){return!!this._eventHandler[t]},e.on=function(t,e){if("object"==typeof t&&a(e)){var n,i=t;for(n in i)this.on(n,i[n]);return this}if("string"==typeof t&&"function"==typeof e){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(e)}return this},e.off=function(t,e){if(a(t))return this._eventHandler={},this;if(a(e)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var n,i=t;for(n in i)this.off(n,i[n]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===e){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function p(i){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return t.forEach(function(n){Object.keys(n).forEach(function(t){var e=n[t];i[t]=e})}),i}var u=function(){var t={webkitTransform:"-webkit-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",OTransform:"-o-transform",transform:"transform"},e=document.documentElement.style,n="";for(var i in t)i in e&&(n=i);if(!n)throw new Error("Browser doesn't support CSS3 2D Transforms.");var r=document.createElement("div");document.documentElement.insertBefore(r,null),r.style[n]="translate3d(1px, 1px, 1px)";var o=window.getComputedStyle(r).getPropertyValue(t[n]);r.parentElement.removeChild(r);var s={name:n,has3d:0<o.length&&"none"!==o};return u=function(){return s},s};function o(e,n){Object.keys(n).forEach(function(t){e.style[t]=n[t]})}function f(t,e,n){return Math.max(Math.min(t,n),e)}function v(t,e,n){return e<=t&&t<=n}function d(t,e,n){var i=null!=n?n:e/2,r=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof t)return f(t,0,e);for(var o=0,s=0,a=r.exec(t);null!=a;){var u=a[1],h=a[2],c=a[3],l=parseFloat(h);if(o<=0&&(u=u||"+"),!u)return i;"%"===c&&(l=l/100*e),s+="+"===u?l:-l,++o,a=r.exec(t)}return 0===o?i:f(s,0,e)}function z(t,e){var n=e[0],i=e[1],r=e[2];return i<t&&r-i?(t-i)/(r-i):t<i&&i-n?(t-i)/(i-n):t!==i&&r-n?(t-n)/(r-n):0}var g={classPrefix:"eg-flick",deceleration:.0075,horizontal:!0,circular:!1,threshold:40,duration:100,panelEffect:function(t){return 1-Math.pow(1-t,3)},defaultIndex:0,inputType:["touch","mouse"],thresholdAngle:45,bounce:10,autoResize:!1,adaptive:!1,zIndex:2e3,bound:!1,overflow:!1,hanger:"50%",anchor:"50%",gap:0,snap:1,freeScroll:!1},s={position:"relative",zIndex:g.zIndex,width:"100%",height:"100%",willChange:"transform",overflow:"hidden"},h={width:"100%",height:"100%"},c={position:"absolute"},M={HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",CHANGE:"change",RESTORE:"restore",SELECT:"select",NONE:""},m={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},l=0,P=1,x=2,_=3,R=4,y={PREV:"PREV",NEXT:"NEXT"},E=u(),T=function(){function i(t,e,n){var i,r;this.element=t,this.state={index:e,horizontal:n.horizontal,position:0,anchorExpression:n.anchorExpression,relativeAnchorPosition:0,size:0,clonedPanels:[],isClone:!1,cloneIndex:-1,originalStyle:{className:t.getAttribute("class")||null,style:t.getAttribute("style")||null},cachedBbox:null},n.classPrefix&&(i=t,r=n.classPrefix+"-panel",i.classList?i.classList.add(r):i.className.indexOf(r)<0&&(i.className=(i.className+" "+r).replace(/\s{2,}/g," "))),o(this.element,c),this.resize()}var t=i.prototype;return t.resize=function(){var t=this.state;t.cachedBbox=null;var e=this.getBbox();t.size=t.horizontal?e.width:e.height,t.isClone||t.clonedPanels.forEach(function(t){return t.resize()})},t.destroy=function(){var t=this.element,e=this.state.originalStyle;for(var n in e.className?t.setAttribute("class",e.className):t.removeAttribute("class"),e.style?t.setAttribute("style",e.style):t.removeAttribute("style"),this)this[n]=null},t.getElement=function(){return this.element},t.getAnchorPosition=function(){return this.state.position+this.state.relativeAnchorPosition},t.getRelativeAnchorPosition=function(){return this.state.relativeAnchorPosition},t.getIndex=function(){return this.state.index},t.getPosition=function(){return this.state.position},t.getSize=function(){return this.state.size},t.getPrevPanel=function(){return this.prevPanel},t.getNextPanel=function(){return this.nextPanel},t.getBbox=function(){var t=this.state;return t.cachedBbox||(t.cachedBbox=this.element.getBoundingClientRect()),t.cachedBbox},t.isClone=function(){return this.state.isClone},t.getCloneIndex=function(){return this.state.cloneIndex},t.getClonedPanels=function(){return this.state.clonedPanels},t.getIdenticalPanels=function(){var t=this.state;return t.isClone?this.original.getIdenticalPanels():[this].concat(t.clonedPanels)},t.setPosition=function(t){var e=this.state,n=this.element.style;e.position=t,e.horizontal?n.left=t+"px":n.top=t+"px",e.relativeAnchorPosition=d(e.anchorExpression,e.size)},t.setPrevPanel=function(t){this.prevPanel=t},t.setNextPanel=function(t){this.nextPanel=t},t.clone=function(t){var e=this.state,n=new i(this.element.cloneNode(!0),e.index,{anchorExpression:e.anchorExpression,horizontal:e.horizontal});return n.original=this,n.state.isClone=!0,n.state.cloneIndex=t,n.state.size=e.size,e.clonedPanels.push(n),n},t.removeClonedPanelsAfter=function(t){for(var e=0,n=this.state.clonedPanels.splice(t);e<n.length;e++){var i=n[e].getElement();i.parentNode.removeChild(i)}},i}();function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function A(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function w(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var C,S="function"!=typeof Object.assign?function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(e[r]=i[r])}return e}:Object.assign,I=["","webkit","Moz","MS","ms","o"],e="undefined"==typeof document?{style:{}}:document.createElement("div"),n="function",O=Math.round,N=Math.abs,D=Date.now;function H(t,e){for(var n,i,r=e[0].toUpperCase()+e.slice(1),o=0;o<I.length;){if((i=(n=I[o])?n+r:e)in t)return i;o++}}C="undefined"==typeof window?{}:window;var k=H(e.style,"touchAction"),X=void 0!==k;var F="compute",Y="auto",j="manipulation",L="none",V="pan-x",B="pan-y",q=function(){if(!X)return!1;var e={},n=C.CSS&&C.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(t){return e[t]=!n||C.CSS.supports("touch-action",t)}),e}(),W="ontouchstart"in C,G=void 0!==H(C,"PointerEvent"),U=W&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),Q="touch",Z="mouse",J=25,K=1,$=4,tt=8,et=1,nt=2,it=4,rt=8,ot=16,st=nt|it,at=rt|ot,ut=st|at,ht=["x","y"],ct=["clientX","clientY"];function lt(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(void 0!==t.length)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function ft(t,e){return typeof t===n?t.apply(e&&e[0]||void 0,e):t}function pt(t,e){return-1<t.indexOf(e)}var vt=function(){function t(t,e){this.manager=t,this.set(e)}var e=t.prototype;return e.set=function(t){t===F&&(t=this.compute()),X&&this.manager.element.style&&q[t]&&(this.manager.element.style[k]=t),this.actions=t.toLowerCase().trim()},e.update=function(){this.set(this.manager.options.touchAction)},e.compute=function(){var e=[];return lt(this.manager.recognizers,function(t){ft(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(t){if(pt(t,L))return L;var e=pt(t,V),n=pt(t,B);return e&&n?L:e||n?e?V:B:pt(t,j)?j:Y}(e.join(" "))},e.preventDefaults=function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=pt(i,L)&&!q[L],o=pt(i,B)&&!q[B],s=pt(i,V)&&!q[V];if(r){var a=1===t.pointers.length,u=t.distance<2,h=t.deltaTime<250;if(a&&u&&h)return}if(!s||!o)return r||o&&n&st||s&&n&at?this.preventSrc(e):void 0}},e.preventSrc=function(t){this.manager.session.prevented=!0,t.preventDefault()},t}();function dt(t,e){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function gt(t){var e=t.length;if(1===e)return{x:O(t[0].clientX),y:O(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:O(n/e),y:O(i/e)}}function mt(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:O(t.pointers[n].clientX),clientY:O(t.pointers[n].clientY)},n++;return{timeStamp:D(),pointers:e,center:gt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function Pt(t,e,n){n||(n=ht);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function xt(t,e,n){n||(n=ht);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}function yt(t,e){return t===e?et:N(t)>=N(e)?t<0?nt:it:e<0?rt:ot}function Et(t,e,n){return{x:e/t||0,y:n/t||0}}function Tt(t,e){var n=t.session,i=e.pointers,r=i.length;n.firstInput||(n.firstInput=mt(e)),1<r&&!n.firstMultiple?n.firstMultiple=mt(e):1===r&&(n.firstMultiple=!1);var o,s,a,u,h,c,l=n.firstInput,f=n.firstMultiple,p=f?f.center:l.center,v=e.center=gt(i);e.timeStamp=D(),e.deltaTime=e.timeStamp-l.timeStamp,e.angle=xt(p,v),e.distance=Pt(p,v),o=n,a=(s=e).center,u=o.offsetDelta||{},h=o.prevDelta||{},c=o.prevInput||{},s.eventType!==K&&c.eventType!==$||(h=o.prevDelta={x:c.deltaX||0,y:c.deltaY||0},u=o.offsetDelta={x:a.x,y:a.y}),s.deltaX=h.x+(a.x-u.x),s.deltaY=h.y+(a.y-u.y),e.offsetDirection=yt(e.deltaX,e.deltaY);var d,g,m,P,x=Et(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=x.x,e.overallVelocityY=x.y,e.overallVelocity=N(x.x)>N(x.y)?x.x:x.y,e.scale=f?(d=f.pointers,Pt((g=i)[0],g[1],ct)/Pt(d[0],d[1],ct)):1,e.rotation=f?(m=f.pointers,xt((P=i)[1],P[0],ct)+xt(m[1],m[0],ct)):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,r,o,s=t.lastInterval||e,a=e.timeStamp-s.timeStamp;if(e.eventType!==tt&&(J<a||void 0===s.velocity)){var u=e.deltaX-s.deltaX,h=e.deltaY-s.deltaY,c=Et(a,u,h);i=c.x,r=c.y,n=N(c.x)>N(c.y)?c.x:c.y,o=yt(u,h),t.lastInterval=e}else n=s.velocity,i=s.velocityX,r=s.velocityY,o=s.direction;e.velocity=n,e.velocityX=i,e.velocityY=r,e.direction=o}(n,e);var y=t.element;dt(e.srcEvent.target,y)&&(y=e.srcEvent.target),e.target=y}function bt(t,e,n){var i=n.pointers.length,r=n.changedPointers.length,o=e&K&&i-r==0,s=e&($|tt)&&i-r==0;n.isFirst=!!o,n.isFinal=!!s,o&&(t.session={}),n.eventType=e,Tt(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function At(t){return t.trim().split(/\s+/g)}function wt(e,t,n){lt(At(t),function(t){e.addEventListener(t,n,!1)})}function Ct(e,t,n){lt(At(t),function(t){e.removeEventListener(t,n,!1)})}function St(t){var e=t.ownerDocument||t;return e.defaultView||e.parentWindow||window}var It=function(){function t(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){ft(e.options.enable,[e])&&n.handler(t)},this.init()}var e=t.prototype;return e.handler=function(){},e.init=function(){this.evEl&&wt(this.element,this.evEl,this.domHandler),this.evTarget&&wt(this.target,this.evTarget,this.domHandler),this.evWin&&wt(St(this.element),this.evWin,this.domHandler)},e.destroy=function(){this.evEl&&Ct(this.element,this.evEl,this.domHandler),this.evTarget&&Ct(this.target,this.evTarget,this.domHandler),this.evWin&&Ct(St(this.element),this.evWin,this.domHandler)},t}();function zt(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}var Ot={pointerdown:K,pointermove:2,pointerup:$,pointercancel:tt,pointerout:tt},Mt={2:Q,3:"pen",4:Z,5:"kinect"},_t="pointerdown",Rt="pointermove pointerup pointercancel";C.MSPointerEvent&&!C.PointerEvent&&(_t="MSPointerDown",Rt="MSPointerMove MSPointerUp MSPointerCancel");var Nt=function(n){function i(){var t,e=i.prototype;return e.evEl=_t,e.evWin=Rt,(t=n.apply(this,arguments)||this).store=t.manager.session.pointerEvents=[],t}return A(i,n),i.prototype.handler=function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=Ot[i],o=Mt[t.pointerType]||t.pointerType,s=o===Q,a=zt(e,t.pointerId,"pointerId");r&K&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&($|tt)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))},i}(It);function Dt(t){return Array.prototype.slice.call(t,0)}function Ht(t,n,e){for(var i=[],r=[],o=0;o<t.length;){var s=n?t[o][n]:t[o];zt(r,s)<0&&i.push(t[o]),r[o]=s,o++}return e&&(i=n?i.sort(function(t,e){return t[n]>e[n]}):i.sort()),i}var kt={touchstart:K,touchmove:2,touchend:$,touchcancel:tt},Xt=function(t){function e(){return e.prototype.evTarget="touchstart touchmove touchend touchcancel",e.prototype.targetIds={},t.apply(this,arguments)||this}return A(e,t),e.prototype.handler=function(t){var e=kt[t.type],n=function(t,e){var n,i,r=Dt(t.touches),o=this.targetIds;if(e&(2|K)&&1===r.length)return o[r[0].identifier]=!0,[r,r];var s=Dt(t.changedTouches),a=[],u=this.target;if(i=r.filter(function(t){return dt(t.target,u)}),e===K)for(n=0;n<i.length;)o[i[n].identifier]=!0,n++;n=0;for(;n<s.length;)o[s[n].identifier]&&a.push(s[n]),e&($|tt)&&delete o[s[n].identifier],n++;return a.length?[Ht(i.concat(a),"identifier",!0),a]:void 0}.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:Q,srcEvent:t})},e}(It);var Ft={mousedown:K,mousemove:2,mouseup:$},Yt=function(n){function i(){var t,e=i.prototype;return e.evEl="mousedown",e.evWin="mousemove mouseup",(t=n.apply(this,arguments)||this).pressed=!1,t}return A(i,n),i.prototype.handler=function(t){var e=Ft[t.type];e&K&&0===t.button&&(this.pressed=!0),2&e&&1!==t.which&&(e=$),this.pressed&&(e&$&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:Z,srcEvent:t}))},i}(It),jt=2500,Lt=25;function Vt(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY},i=this.lastTouches;this.lastTouches.push(n);setTimeout(function(){var t=i.indexOf(n);-1<t&&i.splice(t,1)},jt)}}var Bt=function(){return function(n){function t(t,e){var o;return(o=n.call(this,t,e)||this).handler=function(t,e,n){var i=n.pointerType===Q,r=n.pointerType===Z;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(t,e){t&K?(this.primaryTouch=e.changedPointers[0].identifier,Vt.call(this,e)):t&($|tt)&&Vt.call(this,e)}).call(w(w(o)),e,n);else if(r&&function(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=Lt&&s<=Lt)return!0}return!1}.call(w(w(o)),n))return;o.callback(t,e,n)}},o.touch=new Xt(o.manager,o.handler),o.mouse=new Yt(o.manager,o.handler),o.primaryTouch=null,o.lastTouches=[],o}return A(t,n),t.prototype.destroy=function(){this.touch.destroy(),this.mouse.destroy()},t}(It)}();function qt(t,e,n){return!!Array.isArray(t)&&(lt(t,n[e],n),!0)}var Wt=1;function Gt(t,e){var n=e.manager;return n?n.get(t):t}function Ut(t){return 16&t?"cancel":8&t?"end":4&t?"move":2&t?"start":""}var Qt=function(){function t(t){void 0===t&&(t={}),this.options=b({enable:!0},t),this.id=Wt++,this.manager=null,this.state=1,this.simultaneous={},this.requireFail=[]}var e=t.prototype;return e.set=function(t){return S(this.options,t),this.manager&&this.manager.touchAction.update(),this},e.recognizeWith=function(t){if(qt(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Gt(t,this)).id]||(e[t.id]=t).recognizeWith(this),this},e.dropRecognizeWith=function(t){return qt(t,"dropRecognizeWith",this)||(t=Gt(t,this),delete this.simultaneous[t.id]),this},e.requireFailure=function(t){if(qt(t,"requireFailure",this))return this;var e=this.requireFail;return-1===zt(e,t=Gt(t,this))&&(e.push(t),t.requireFailure(this)),this},e.dropRequireFailure=function(t){if(qt(t,"dropRequireFailure",this))return this;t=Gt(t,this);var e=zt(this.requireFail,t);return-1<e&&this.requireFail.splice(e,1),this},e.hasRequireFailures=function(){return 0<this.requireFail.length},e.canRecognizeWith=function(t){return!!this.simultaneous[t.id]},e.emit=function(e){var n=this,t=this.state;function i(t){n.manager.emit(t,e)}t<8&&i(n.options.event+Ut(t)),i(n.options.event),e.additionalEvent&&i(e.additionalEvent),8<=t&&i(n.options.event+Ut(t))},e.tryEmit=function(t){if(this.canEmit())return this.emit(t);this.state=32},e.canEmit=function(){for(var t=0;t<this.requireFail.length;){if(!(33&this.requireFail[t].state))return!1;t++}return!0},e.recognize=function(t){var e=S({},t);if(!ft(this.options.enable,[this,e]))return this.reset(),void(this.state=32);56&this.state&&(this.state=1),this.state=this.process(e),30&this.state&&this.tryEmit(e)},e.process=function(t){},e.getTouchAction=function(){},e.reset=function(){},t}(),Zt={domEvents:!1,touchAction:F,enable:!0,inputTarget:null,inputClass:null,preset:[],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Jt(n,i){var r,o=n.element;o.style&&(lt(n.options.cssProps,function(t,e){r=H(o.style,e),o.style[r]=i?(n.oldCssProps[r]=o.style[r],t):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}var Kt=function(){function t(t,e){var n,i=this;this.options=S({},Zt,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(G?Nt:U?Xt:W?Bt:Yt))(n,bt),this.touchAction=new vt(this,this.options.touchAction),Jt(this,!0),lt(this.options.recognizers,function(t){var e=i.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}var e=t.prototype;return e.set=function(t){return S(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},e.stop=function(t){this.session.stopped=t?2:1},e.recognize=function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&8&r.state)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!==r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&14&n.state&&(r=e.curRecognizer=n),o++}},e.get=function(t){if(t instanceof Qt)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event===t)return e[n];return null},e.add=function(t){if(qt(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),(t.manager=this).touchAction.update(),t},e.remove=function(t){if(qt(t,"remove",this))return this;var e=this.get(t);if(t){var n=this.recognizers,i=zt(n,e);-1!==i&&(n.splice(i,1),this.touchAction.update())}return this},e.on=function(t,e){if(void 0===t||void 0===e)return this;var n=this.handlers;return lt(At(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},e.off=function(t,e){if(void 0===t)return this;var n=this.handlers;return lt(At(t),function(t){e?n[t]&&n[t].splice(zt(n[t],e),1):delete n[t]}),this},e.emit=function(t,e){var n,i,r;this.options.domEvents&&(n=t,i=e,(r=document.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var o=this.handlers[t]&&this.handlers[t].slice();if(o&&o.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var s=0;s<o.length;)o[s](e),s++}},e.destroy=function(){this.element&&Jt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null},t}();var $t=function(e){function t(t){return void 0===t&&(t={}),e.call(this,b({pointers:1},t))||this}A(t,e);var n=t.prototype;return n.attrTest=function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},n.process=function(t){var e=this.state,n=t.eventType,i=6&e,r=this.attrTest(t);return i&&(n&tt||!r)?16|e:i||r?n&$?8|e:2&e?4|e:2:32},t}(Qt);function te(t){return t===ot?"down":t===rt?"up":t===nt?"left":t===it?"right":""}var ee=function(n){function t(t){var e;return void 0===t&&(t={}),(e=n.call(this,b({event:"pan",threshold:10,pointers:1,direction:ut},t))||this).pX=null,e.pY=null,e}A(t,n);var e=t.prototype;return e.getTouchAction=function(){var t=this.options.direction,e=[];return t&st&&e.push(B),t&at&&e.push(V),e},e.directionTest=function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(i=e.direction&st?(r=0===o?et:o<0?nt:it,n=o!==this.pX,Math.abs(t.deltaX)):(r=0===s?et:s<0?rt:ot,n=s!==this.pY,Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},e.attrTest=function(t){return $t.prototype.attrTest.call(this,t)&&(2&this.state||!(2&this.state)&&this.directionTest(t))},e.emit=function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=te(t.direction);e&&(t.additionalEvent=this.options.event+e),n.prototype.emit.call(this,t)},t}($t),ne=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])};var ie=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};function re(t,e,n,i){var r=t,o=[n[0]?e[0]:i?e[0]-i[0]:e[0],n[1]?e[1]:i?e[1]+i[1]:e[1]];return r=Math.max(o[0],r),+(r=Math.min(o[1],r)).toFixed(5)}function oe(t,e){return t<e[0]||t>e[1]}function se(t,e,n){return n[1]&&t>e[1]||n[0]&&t<e[0]}function ae(t,e,n){var i=t,r=e[0],o=e[1],s=o-r;return n[1]&&o<t&&(i=(i-o)%s+r),n[0]&&t<r&&(i=(i-r)%s+o),+i.toFixed(5)}function ue(t,e){for(var n in t)if(t[n]!==e[n])return!1;return!0}var he,ce=function(){function t(t,e){var n=this;this.axis=t,this.options=e,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._complementOptions=function(){var r=this;Object.keys(this.axis).forEach(function(i){r.axis[i]=ie({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])})})},e.getDelta=function(t,e){var n=this.get(t);return this.map(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},{}):ie({},this._pos,t||{})},e.moveTo=function(n){var i=this,t=this.map(this._pos,function(t,e){return e in n?n[e]-i._pos[e]:0});return this.set(n),{pos:ie({},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,e){var n=this.axis;for(var i in t)if(i&&!e(t[i],i,n[i]))return!1;return!0},e.filter=function(t,e){var n={},i=this.axis;for(var r in t)r&&e(t[r],r,i[r])&&(n[r]=t[r]);return n},e.map=function(t,e){var n={},i=this.axis;for(var r in t)r&&(n[r]=e(t[r],r,i[r]));return n},e.isOutside=function(t){return!this.every(t?this.get(t):this._pos,function(t,e,n){return!oe(t,n.range)})},t}();function le(t){for(var e=[],n=0,i=t.length;n<i;n++)e.push(t[n]);return e}var fe=(he="undefined"==typeof window?{}:window).requestAnimationFrame||he.webkitRequestAnimationFrame,pe=he.cancelAnimationFrame||he.webkitCancelAnimationFrame;if(fe&&!pe){var ve={},de=fe;fe=function(e){var n=de(function(t){ve[n]&&e(t)});return ve[n]=!0,n},pe=function(t){delete ve[t]}}else fe&&pe||(fe=function(t){return he.setTimeout(function(){t(he.performance&&he.performance.now&&he.performance.now()||(new Date).getTime())},16)},pe=he.clearTimeout);function ge(t,e,n){return Math.max(Math.min(t,n),e)}var me=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm;this.options=e,this.itm=n,this.em=i,this.axm=r,this.animationEnd=this.animationEnd.bind(this)}var e=t.prototype;return e.getDuration=function(o,t,e){var n,s=this;if(void 0!==e)n=e;else{var i=this.axm.map(t,function(t,e){return n=Math.abs(Math.abs(t)-Math.abs(o[e])),i=s.options.deceleration,(r=Math.sqrt(n/i*2))<100?0:r;var n,i,r});n=Object.keys(i).reduce(function(t,e){return Math.max(t,i[e])},-1/0)}return ge(n,this.options.minimumDuration,this.options.maximumDuration)},e.createAnimationParam=function(t,e,n){var i=this.axm.get(),r=t,o=n&&n.event||null;return{depaPos:i,destPos:r,duration:ge(e,this.options.minimumDuration,this.options.maximumDuration),delta:this.axm.getDelta(i,r),inputEvent:o,input:n&&n.input||null,isTrusted:!!o,done:this.animationEnd}},e.grab=function(t,e){if(this._animateParam&&t.length){var n=this.axm.get(t),i=this.axm.map(n,function(t,e,n){return ae(t,n.range,n.circular)});this.axm.every(i,function(t,e){return n[e]===t})||this.em.triggerChange(i,e,!!e),this._animateParam=null,this._raf&&(r=this._raf,pe(r)),this._raf=null,this.em.triggerAnimationEnd(!(!e||!e.event))}var r},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.axm.get(),n=this.axm.map(e,function(t,e,n){return Math.min(n.range[1],Math.max(n.range[0],t))});this.animateTo(n,this.getDuration(e,n),t)},e.animationEnd=function(){var t=this.getEventInfo();this._animateParam=null;var e=this.axm.filter(this.axm.get(),function(t,e,n){return se(t,n.range,n.circular)});0<Object.keys(e).length&&this.setTo(this.axm.map(e,function(t,e,n){return ae(t,n.range,n.circular)})),this.itm.setInterrupt(!1),this.em.triggerAnimationEnd(!!t),this.axm.isOutside()?this.restore(t):this.em.triggerFinish(!!t)},e.animateLoop=function(e,n){if(this._animateParam=ie({},e),this._animateParam.startTime=(new Date).getTime(),e.duration){var i=this._animateParam,r=this;!function t(){if(r._raf=null,1<=r.frame(i))return ue(e.destPos,r.axm.get(Object.keys(e.destPos)))||r.em.triggerChange(e.destPos),void n();r._raf=fe(t)}()}else this.em.triggerChange(e.destPos),n()},e.getUserControll=function(t){var e=t.setTo();return e.destPos=this.axm.get(e.destPos),e.duration=ge(e.duration,this.options.minimumDuration,this.options.maximumDuration),e},e.animateTo=function(t,e,n){var i=this,r=this.createAnimationParam(t,e,n),o=ie({},r.depaPos),s=this.em.triggerAnimationStart(r),a=this.getUserControll(r);if(!s&&this.axm.every(a.destPos,function(t,e,n){return se(t,n.range,n.circular)})&&console.warn("You can't stop the 'animation' event when 'circular' is true."),s&&!ue(a.destPos,o)){var u=n&&n.event||null;this.animateLoop({depaPos:o,destPos:a.destPos,duration:a.duration,delta:this.axm.getDelta(o,a.destPos),isTrusted:!!u,inputEvent:u,input:n&&n.input||null},function(){return i.animationEnd()})}},e.frame=function(i){var t=(new Date).getTime()-i.startTime,r=this.easing(t/i.duration),e=i.depaPos;return e=this.axm.map(e,function(t,e,n){return ae(t+=i.delta[e]*r,n.range,n.circular)}),this.em.triggerChange(e),r},e.easing=function(t){return 1<t?1:this.options.easing(t)},e.setTo=function(t,i){void 0===i&&(i=0);var e=Object.keys(t);this.grab(e);var n=this.axm.get(e);if(ue(t,n))return this;this.itm.setInterrupt(!0);var r=this.axm.filter(t,function(t,e){return n[e]!==t});return Object.keys(r).length&&(ue(r=this.axm.map(r,function(t,e,n){return n.circular&&(n.circular[0]||n.circular[1])?0<i?t:ae(t,n.range,n.circular):re(t,n.range,n.circular)}),n)||(0<i?this.animateTo(r,i):(this.em.triggerChange(r),this.itm.setInterrupt(!1)))),this},e.setBy=function(n,t){return void 0===t&&(t=0),this.setTo(this.axm.map(this.axm.get(Object.keys(n)),function(t,e){return t+n[e]}),t)},t}(),Pe=function(){function t(t){this.axes=t}var e=t.prototype;return e.triggerHold=function(t,e){this.axes.trigger("hold",{pos:t,input:e.input||null,inputEvent:e.event||null,isTrusted:!0})},e.triggerRelease=function(t){t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("release",t)},e.triggerChange=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var i=this.am.getEventInfo(),r=this.am.axm.moveTo(t),o=e&&e.event||i&&i.event||null,s={pos:r.pos,delta:r.delta,holding:n,inputEvent:o,isTrusted:!!o,input:e&&e.input||i&&i.input||null,set:o?this.createUserControll(r.pos):function(){}};this.axes.trigger("change",s),o&&this.am.axm.set(s.set().destPos)},e.triggerAnimationStart=function(t){return t.setTo=this.createUserControll(t.destPos,t.duration),this.axes.trigger("animationStart",t)},e.triggerAnimationEnd=function(t){void 0===t&&(t=!1),this.axes.trigger("animationEnd",{isTrusted:t})},e.triggerFinish=function(t){void 0===t&&(t=!1),this.axes.trigger("finish",{isTrusted:t})},e.createUserControll=function(t,e){void 0===e&&(e=0);var n={destPos:ie({},t),duration:e};return function(t,e){return t&&(n.destPos=ie({},t)),void 0!==e&&(n.duration=e),n}},e.setAnimationManager=function(t){this.am=t},e.destroy=function(){this.axes.off()},t}(),xe=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}(),ye=function(){function t(t){var e=t.options,n=t.itm,i=t.em,r=t.axm,o=t.am;this.isOutside=!1,this.moveDistance=null,this.options=e,this.itm=n,this.em=i,this.axm=r,this.am=o}var e=t.prototype;return e.atOutside=function(t){var s=this;if(this.isOutside)return this.axm.map(t,function(t,e,n){var i=n.range[0]-n.bounce[0],r=n.range[1]+n.bounce[1];return r<t?r:t<i?i:t});var a=this.am.easing(1e-5)/1e-5;return this.axm.map(t,function(t,e,n){var i=n.range[0],r=n.range[1],o=n.bounce;return t<i?i-s.am.easing((i-t)/(o[0]*a))*o[0]:r<t?r+s.am.easing((t-r)/(o[1]*a))*o[1]:t})},e.get=function(t){return this.axm.get(t.axes)},e.hold=function(t,e){if(!this.itm.isInterrupted()&&t.axes.length){var n={input:t,event:e};this.itm.setInterrupt(!0),this.am.grab(t.axes,n),!this.moveDistance&&this.em.triggerHold(this.axm.get(),n),this.isOutside=this.axm.isOutside(t.axes),this.moveDistance=this.axm.get(t.axes)}},e.change=function(t,e,n){if(this.itm.isInterrupting()&&!this.axm.every(n,function(t){return 0===t})){var i,r=this.axm.get(t.axes);i=this.axm.map(this.moveDistance||r,function(t,e){return t+(n[e]||0)}),this.moveDistance&&(this.moveDistance=i),i=this.axm.map(i,function(t,e,n){return ae(t,n.range,n.circular)}),this.isOutside&&this.axm.every(r,function(t,e,n){return!oe(t,n.range)})&&(this.isOutside=!1),i=this.atOutside(i),this.em.triggerChange(i,{input:t,event:e},!0)}},e.release=function(t,e,n,i){if(this.itm.isInterrupting()&&this.moveDistance){var r=this.axm.get(t.axes),o=this.axm.get(),s=this.axm.get(this.axm.map(n,function(t,e,n){return n.circular&&(n.circular[0]||n.circular[1])?r[e]+t:re(r[e]+t,n.range,n.circular,n.bounce)})),a=this.am.getDuration(s,r,i);0===a&&(s=ie({},o));var u={depaPos:o,destPos:s,duration:a,delta:this.axm.getDelta(o,s),inputEvent:e,input:t,isTrusted:!0};this.em.triggerRelease(u),this.moveDistance=null;var h=this.am.getUserControll(u),c=ue(h.destPos,o),l={input:t,event:e};c||0===h.duration?(!c&&this.em.triggerChange(h.destPos,l,!0),this.itm.setInterrupt(!1),this.axm.isOutside()?this.am.restore(l):this.em.triggerFinish(!0)):this.am.animateTo(h.destPos,h.duration,l)}},t}(),Ee=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""}(),Te=function(r){function t(t,e,n){void 0===t&&(t={});var i=r.call(this)||this;return i.axis=t,i._inputs=[],i.options=ie({easing:function(t){return 1-Math.pow(1-t,3)},interruptable:!0,maximumDuration:1/0,minimumDuration:0,deceleration:6e-4},e),i.itm=new xe(i.options),i.axm=new ce(i.axis,i.options),i.em=new Pe(i),i.am=new me(i),i.io=new ye(i),i.em.setAnimationManager(i.am),n&&i.em.triggerChange(n),i}!function(t,e){function n(){this.constructor=t}ne(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,r);var e=t.prototype;return e.connect=function(t,e){var n;if(n="string"==typeof t?t.split(" "):t.concat(),~this._inputs.indexOf(e)&&this.disconnect(e),"hammer"in e){var i=this._inputs.filter(function(t){return t.hammer&&t.element===e.element});i.length&&(e.hammer=i[0].hammer)}return e.mapAxes(n),e.connect(this.io),this._inputs.push(e),this},e.disconnect=function(t){if(t){var e=this._inputs.indexOf(t);0<=e&&(this._inputs[e].disconnect(),this._inputs.splice(e,1))}else this._inputs.forEach(function(t){return t.disconnect()}),this._inputs=[];return this},e.get=function(t){return this.axm.get(t)},e.setTo=function(t,e){return void 0===e&&(e=0),this.am.setTo(t,e),this},e.setBy=function(t,e){return void 0===e&&(e=0),this.am.setBy(t,e),this},e.isBounceArea=function(t){return this.axm.isOutside(t)},e.destroy=function(){this.disconnect(),this.em.destroy()},t.VERSION="2.5.9",t.TRANSFORM=Ee,t.DIRECTION_NONE=et,t.DIRECTION_LEFT=nt,t.DIRECTION_RIGHT=it,t.DIRECTION_UP=rt,t.DIRECTION_DOWN=ot,t.DIRECTION_HORIZONTAL=st,t.DIRECTION_VERTICAL=at,t.DIRECTION_ALL=ut,t}(t),be="PointerEvent"in he||"MSPointerEvent"in he,Ae="ontouchstart"in he,we="_EGJS_AXES_INPUTTYPE_";function Ce(i,t){return t.reduce(function(t,e,n){return i[n]&&(t[i[n]]=e),t},{})}function Se(t,e,n){return n?!!(e===ut||e&t&&n&t):!!(e&t)}var Ie=function(){function t(t,e){if(this.axes=[],this.hammer=null,this.element=null,this.panRecognizer=null,void 0===Kt)throw new Error("The Hammerjs must be loaded before eg.Axes.PanInput.\nhttp://hammerjs.github.io/");this.element=function e(t,n){var i;if(void 0===n&&(n=!1),"string"==typeof t){if(t.match(/^<([a-z]+)\s*([^>]*)>/)){var r=document.createElement("div");r.innerHTML=t,i=le(r.childNodes)}else i=le(document.querySelectorAll(t));n||(i=1<=i.length?i[0]:void 0)}else t===he?i=t:!t.nodeName||1!==t.nodeType&&9!==t.nodeType?"jQuery"in he&&t instanceof jQuery||t.constructor.prototype.jquery?i=n?t.toArray():t.get(0):Array.isArray(t)&&(i=t.map(function(t){return e(t)}),n||(i=1<=i.length?i[0]:void 0)):i=t;return i}(t),this.options=ie({inputType:["touch","mouse","pointer"],scale:[1,1],thresholdAngle:45,threshold:0,hammerManagerOptions:{cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",userDrag:"none"}}},e),this.onHammerInput=this.onHammerInput.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?ut:e?st:n?at:et,this.axes=t},e.connect=function(t){var e={direction:this._direction,threshold:this.options.threshold};if(this.hammer)this.removeRecognizer(),this.dettachEvent();else{var n=this.element[we];n||(n=String(Math.round(Math.random()*(new Date).getTime())));var i=function(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=Ae;break;case"pointer":i=be}}),i?Nt:e&&n?Bt:e?Xt:n?Yt:null}(this.options.inputType);if(!i)throw new Error("Wrong inputType parameter!");this.hammer=function(t,e){try{return new Kt(t,ie({},e))}catch(t){return null}}(this.element,ie({inputClass:i},this.options.hammerManagerOptions)),this.element[we]=n}return this.panRecognizer=new ee(e),this.hammer.add(this.panRecognizer),this.attachEvent(t),this},e.disconnect=function(){return this.removeRecognizer(),this.hammer&&this.dettachEvent(),this._direction=et,this},e.destroy=function(){this.disconnect(),this.hammer&&0===this.hammer.recognizers.length&&this.hammer.destroy(),delete this.element[we],this.element=null,this.hammer=null},e.enable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!0),this},e.disable=function(){return this.hammer&&(this.hammer.get("pan").options.enable=!1),this},e.isEnable=function(){return!(!this.hammer||!this.hammer.get("pan").options.enable)},e.removeRecognizer=function(){this.hammer&&this.panRecognizer&&(this.hammer.remove(this.panRecognizer),this.panRecognizer=null)},e.onHammerInput=function(t){this.isEnable()&&(t.isFirst?this.observer.hold(this,t):t.isFinal&&this.onPanend(t))},e.onPanmove=function(t){var e=function(t,e){if(e<0||90<e)return et;var n=Math.abs(t);return e<n&&n<180-e?at:st}(t.angle,this.options.thresholdAngle),n=this.hammer.session.prevInput;t.offsetY=n?(t.offsetX=t.deltaX-n.deltaX,t.deltaY-n.deltaY):t.offsetX=0;var i=this.getOffset([t.offsetX,t.offsetY],[Se(st,this._direction,e),Se(at,this._direction,e)]),r=i.some(function(t){return 0!==t});r&&(t.srcEvent.preventDefault(),t.srcEvent.stopPropagation()),(t.preventSystemEvent=r)&&this.observer.change(this,t,Ce(this.axes,i))},e.onPanend=function(t){var e,n,i,r,o=this.getOffset([Math.abs(t.velocityX)*(t.deltaX<0?-1:1),Math.abs(t.velocityY)*(t.deltaY<0?-1:1)],[Se(st,this._direction),Se(at,this._direction)]);e=o,n=this.observer.options.deceleration,i=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=Math.abs(i/-n),o=[e[0]/2*r,e[1]/2*r],this.observer.release(this,t,Ce(this.axes,o))},e.attachEvent=function(t){this.observer=t,this.hammer.on("hammer.input",this.onHammerInput).on("panstart panmove",this.onPanmove)},e.dettachEvent=function(){this.hammer.off("hammer.input",this.onHammerInput).off("panstart panmove",this.onPanmove),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}(),ze=function(){function t(t,e,n){this.clonedPanels=[],this.viewportElement=t,this.cameraElement=e,this.state={index:n.defaultIndex,size:0,position:0,hangerPosition:0,scrollArea:{prev:0,next:0},translate:E},this.options=n,this.build()}var e=t.prototype;return e.moveTo=function(t,e,n){void 0===n&&(n=this.options.duration);var i=this.state,r=this.options.freeScroll,o=t.anchorPosition-i.hangerPosition;o=this.canSetBoundMode()?f(o,i.scrollArea.prev,i.scrollArea.next):o,i.index=t.index,e&&e.setTo?e.setTo({flick:r?e.destPos.flick:o},n):this.axes.setTo({flick:o},n)},e.moveCamera=function(t){var e=this.state,n=e.translate.name,i=(this.options.horizontal?[-t,0]:[0,-t]).map(function(t){return Math.round(t)+"px"}).join(", ");this.cameraElement.style[n]=e.translate.has3d?"translate3d("+i+", 0px)":"translate("+i+")",e.position=t},e.resize=function(){this.updateSize(),this.updateOriginalPanelPositions(),this.updateAdaptiveSize(),this.updateScrollArea(),this.options.circular&&(this.clonePanels(),this.relocatePanels()),this.chainPanels(),this.updateCameraPosition()},e.findNearestPanel=function(){var t=this.state,e=this.panels,n=this.clonedPanels,i=t.scrollArea,r=t.position+t.hangerPosition;if(this.isOutOfBound())return t.position<i.prev?e[0]:e[e.length-1];for(var o,s=1/0,a=0,u=e.concat(n);a<u.length;a++){var h=u[a],c=h.getPosition(),l=c+h.getSize(),f=v(r,c,l)?0:Math.min(Math.abs(c-r),Math.abs(l-r));if(s<f)break;s=f,o=h}return o},e.findPanelOf=function(t){for(var e=0,n=this.panels.concat(this.clonedPanels);e<n.length;e++){var i=n[e];if(i.getElement().contains(t))return i}},e.findNearestIdenticalPanel=function(t){var e=this.state,i=t,r=1/0,o=e.position+e.hangerPosition;return t.getIdenticalPanels().forEach(function(t){var e=t.getAnchorPosition(),n=Math.abs(e-o);n<r&&(i=t,r=n)}),i},e.findShortestPositionToPanel=function(t){var e=this.state,n=this.options,i=t.getAnchorPosition(),r=Math.abs(e.position+e.hangerPosition-i),o=e.scrollArea.next-e.scrollArea.prev;if(n.circular)return r<=o-r?i-e.hangerPosition:i>e.position+e.hangerPosition?i-e.hangerPosition-o:i-e.hangerPosition+o;var s=i-e.hangerPosition;return this.canSetBoundMode()?f(s,e.scrollArea.prev,e.scrollArea.next):s},e.enable=function(){this.panInput.enable()},e.disable=function(){this.panInput.disable()},e.updateAdaptiveSize=function(){var t,e=this.options,i=e.horizontal;if(e.adaptive){var n=this.getCurrentPanel().getBbox();t=i?n.height:n.width}else{t=this.panels.reduce(function(t,e){var n=e.getBbox();return Math.max(t,i?n.height:n.width)},0)}var r=this.viewportElement.style;i?(r.height=t+"px",r.minHeight="100%",r.width="100%"):(r.width=t+"px",r.minWidth="100%",r.height="100%")},e.destroy=function(){var t=this.viewportElement,e=t.parentElement;for(var n in e.removeChild(t),this.axes.destroy(),this.panInput.destroy(),this.panels.forEach(function(t){e.appendChild(t.getElement()),t.destroy()}),this)this[n]=null},e.restore=function(t){var e=t.panels,n=this.cameraElement;n.innerHTML=e.map(function(t){return t.html}).join(""),this.viewportElement.appendChild(n),this.state.index=t.index,this.moveCamera(t.position),this.panels=[],this.clonedPanels=[],this.createPanels(),this.resize()},e.getPanelCount=function(){return this.panels.length},e.getPanel=function(t){return v(t,0,this.panels.length-1)?this.panels[t]:null},e.getCurrentPanel=function(){return this.panels[this.state.index]},e.getIndex=function(){return this.state.index},e.getPrevIndex=function(){var t=this.state.index-1;return t<0&&(t=this.options.circular?this.panels.length-1:-1),t},e.getNextIndex=function(){var t=this.state.index+1;return t>=this.panels.length&&(t=this.options.circular?0:-1),t},e.getSize=function(){return this.state.size},e.getScrollArea=function(){return this.state.scrollArea},e.getScrollAreaSize=function(){var t=this.state.scrollArea;return t.next-t.prev},e.getHangerPosition=function(){return this.state.hangerPosition},e.getCameraPosition=function(){return this.state.position},e.getAllPanels=function(t){var e=this.panels;return t?e.concat(this.clonedPanels):e},e.connectAxesHandler=function(t){var e=this.axes;this.axesHandlers=t,e.on(t),this.resume()},e.pause=function(){this.axes.off()},e.resume=function(){this.axes.on(this.axesHandlers)},e.build=function(){this.applyCSSValue(),this.setAxesInstance(),this.createPanels(),this.resize(),this.moveToDefaultPanel()},e.applyCSSValue=function(){var t=this.options,e=this.viewportElement,n=this.cameraElement,i=t.classPrefix;e.className=i+"-viewport",n.className=i+"-camera",o(e,s),o(n,h),t.zIndex&&(e.style.zIndex=""+t.zIndex),t.overflow&&(e.style.overflow="visible")},e.setAxesInstance=function(){var t=this.state,e=this.options,n=t.scrollArea,i=e.horizontal;this.axes=new Te({flick:{range:[n.prev,n.next],circular:e.circular,bounce:[0,0]}},{easing:e.panelEffect,deceleration:e.deceleration,interruptable:!0}),this.panInput=this.makeNewPanInput(),this.axes.connect(i?["flick",""]:["","flick"],this.panInput)},e.createPanels=function(){var t,e=this.state,n=this.options,i=this.cameraElement.children;if(!i||!i.length)throw new Error("There're no panel elements.");this.panels=(t=i,[].slice.call(t)).map(function(t,e){return new T(t,e,{horizontal:n.horizontal,classPrefix:n.classPrefix,anchorExpression:n.anchor})}),e.index=f(e.index,0,this.panels.length-1)},e.clonePanels=function(){var i=this,t=this.state,e=this.panels,r=this.clonedPanels,n=t.size,o=e[e.length-1],s=o.getPosition()+o.getSize()+this.options.gap,a=n+e[0].getRelativeAnchorPosition(),u=r[r.length-1],h=Math.ceil(a/s),c=u?u.getCloneIndex()+1:0;if(c<h)for(var l=function(n){e.forEach(function(t){var e=t.clone(n);i.appendPanelElement(e.getElement()),r.push(e)})},f=c;f<h;f++)l(f);else h<c&&(e.forEach(function(t){t.removeClonedPanelsAfter(h)}),this.clonedPanels.splice(h*e.length))},e.relocatePanels=function(){var t=this.state,e=this.options,n=this.panels,i=this.clonedPanels,r=t.scrollArea,o=r.next+t.size,s=(r.prev,n[0]),a=n[n.length-1];if(s){for(var u=a.getPosition()+a.getSize()+e.gap,h=0,c=i;h<c.length;h++){var l=(g=c[h]).getIdenticalPanels()[0],f=u*(g.getCloneIndex()+1)+l.getPosition();g.setPosition(f)}for(var p=s.getPosition(),v=0,d=i.concat().reverse();v<d.length;v++){var g,m=(g=d[v]).getPosition(),P=p-g.getSize()-e.gap;if(m<=o)break;g.setPosition(P),p=P}}},e.chainPanels=function(){var r=this.panels.concat(this.clonedPanels);if(r.forEach(function(t,e){var n=0<e?r[e-1]:null,i=e<r.length-1?r[e+1]:null;t.setPrevPanel(n),t.setNextPanel(i)}),this.options.circular){var t=r[0],e=r[r.length-1];t.setPrevPanel(e),e.setNextPanel(t)}},e.moveToDefaultPanel=function(){var t=this.state,e=f(this.options.defaultIndex,0,this.panels.length-1),n=this.panels[e].getAnchorPosition()-t.hangerPosition;n=this.canSetBoundMode()?f(n,t.scrollArea.prev,t.scrollArea.next):n,t.index=e,this.moveCamera(n),this.axes.setTo({flick:n},0)},e.isOutOfBound=function(){var t=this.state,e=t.scrollArea;return!this.options.circular&&(t.position<e.prev||t.position>e.next)},e.canSetBoundMode=function(){var t=this.state,e=this.options,n=this.panels,i=n[n.length-1],r=i.getPosition()+i.getSize();return e.bound&&!e.circular&&r>=t.size},e.updateSize=function(){var t=this.state,e=this.options,n=this.viewportElement;e.horizontal||(n.style.width="",n.style.minWidth="");var i=n.getBoundingClientRect();t.size=e.horizontal?i.width:i.height,t.hangerPosition=d(e.hanger,t.size)},e.updateOriginalPanelPositions=function(){var i=this.options.gap,t=this.panels,r=0;t.forEach(function(t){t.resize();var e=r,n=t.getSize();t.setPosition(e),r+=n+i})},e.updateScrollArea=function(){var t=this.state,e=this.panels,n=this.options,i=this.axes,r=e[0],o=e[e.length-1],s=t.hangerPosition;if(this.canSetBoundMode())t.scrollArea={prev:r.getPosition(),next:o.getPosition()+o.getSize()-t.size};else if(n.circular){var a=o.getPosition()+o.getSize()+n.gap;t.scrollArea={prev:r.getAnchorPosition()-s,next:a+r.getRelativeAnchorPosition()-s}}else t.scrollArea={prev:r.getAnchorPosition()-s,next:o.getAnchorPosition()-s};var u,h=t.size,c=n.bounce,l=c;if((u=c)&&u.constructor===Array)l=c.map(function(t){return d(t,h,g.bounce)});else{var f=d(c,h,g.bounce);l=[f,f]}i.axis.flick.range=[t.scrollArea.prev,t.scrollArea.next],i.axis.flick.bounce=l},e.updateCameraPosition=function(){var t=this.state,e=this.panels,n=this.axes,i=e[t.index].getAnchorPosition()-t.hangerPosition;this.canSetBoundMode()&&(i=f(i,t.scrollArea.prev,t.scrollArea.next)),this.moveCamera(i),this.pause(),n.setTo({flick:i},0),this.resume()},e.makeNewPanInput=function(){var t=this.options;return new Ie(this.viewportElement,{inputType:t.inputType,thresholdAngle:t.thresholdAngle,scale:t.horizontal?[-1,0]:[0,-1]})},e.appendPanelElement=function(t){this.cameraElement.appendChild(t)},t}(),Oe=function(){function t(){this.delta=0,this.direction=null,this.targetPanel=null}var e=t.prototype;return e.onEnter=function(t){this.delta=t.delta,this.direction=t.direction,this.targetPanel=t.targetPanel},e.onExit=function(t){},e.onHold=function(t,e){},e.onChange=function(t,e){},e.onRelease=function(t,e){},e.onAnimationEnd=function(t,e){},e.onFinish=function(t,e){},t}(),Me=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=l,t.holding=!1,t.playing=!1,t}r(t,e);var n=t.prototype;return n.onEnter=function(){this.direction=null,this.targetPanel=null,this.delta=0},n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(M.HOLD_START,t,!0).onSuccess(function(){i(P)}).onStopped(function(){i(R)})},n.onChange=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(M.MOVE_START,t,!1).onSuccess(function(){i(_).onChange(t,e)}).onStopped(function(){i(R)})},t}(Oe),_e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=P,t.holding=!0,t.playing=!0,t.releaseEvent=null,t}r(t,e);var n=t.prototype;return n.onChange=function(t,e){var n=e.flicking,i=e.triggerEvent,r=e.transitTo,o=n.options.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY;this.direction=o<0?y.NEXT:y.PREV,i(M.MOVE_START,t,!0).onSuccess(function(){r(x).onChange(t,e)}).onStopped(function(){r(R)})},n.onRelease=function(t,e){var n=e.viewport,i=e.triggerEvent,r=e.transitTo;if(i(M.HOLD_END,t,!0),0!==t.delta.flick)return t.setTo({flick:n.getCameraPosition()},0),void r(l);this.releaseEvent=t},n.onFinish=function(t,e){var n=e.viewport,i=e.triggerEvent,r=e.transitTo,o=e.castToReadonlyPanel;if(r(l),this.releaseEvent){var s=this.releaseEvent.inputEvent.srcEvent.target,a=n.findPanelOf(s),u=n.getCameraPosition();if(a){var h=a.getPosition();i(M.SELECT,null,!0,{direction:u<h?y.NEXT:h<u?y.PREV:null,selectedIndex:a.getIndex(),selectedPanel:o(a)})}}},t}(Oe),Re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=x,t.holding=!0,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onEnter=function(t){e.prototype.onEnter.call(this,t),this.delta=0},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(R)})},n.onRelease=function(t,e){var n=e.flicking,i=e.viewport,r=e.triggerEvent,o=e.moveToPanel,s=e.castToReadonlyPanel,a=e.transitTo,u=e.stopCamera,h=this.delta,c=n.options,l=0<h,f=Math.abs(h),p=t.inputEvent.deltaX?Math.abs(180*Math.atan(t.inputEvent.deltaY/t.inputEvent.deltaX)/Math.PI):90,v=f>=c.threshold&&(c.horizontal?p<=c.thresholdAngle:p>c.thresholdAngle);if(r(M.HOLD_END,t,!0),!v&&this.targetPanel)return i.moveTo(this.targetPanel,t),void a(_);var d=i.getCurrentPanel(),g=i.getCameraPosition()+i.getHangerPosition(),m=c.gap/2,P=l?d.getSize()-d.getRelativeAnchorPosition()+m:d.getRelativeAnchorPosition()+m;P=Math.max(P,c.threshold);var x,y=Math.abs(t.delta.flick),E=c.freeScroll,T=E?1/0:c.snap,b=c.duration,A=s(E?i.findNearestPanel():d);if(E||v){var w=0;if(E||P<=y){for(var C=A.position;Math.abs(A.position-C)<y&&w<T;){var S=l?A.next():A.prev();if(!S)break;A=S,++w}E?x=t.duration:1<w&&(x=Math.min(b*w,Math.max(t.duration,b)))}if(!E&&w<=1)if(f<=P){var I=l?d.getNextPanel():d.getPrevPanel();if(c.circular){var z=d.getIdenticalPanels()[1];(O=Math.abs(d.getAnchorPosition()-g)>Math.abs(z.getAnchorPosition()-g))&&(I=l?z.getNextPanel():z.getPrevPanel())}A=s(null!=I?I:d)}else A=s(i.findNearestPanel())}else if(c.circular){z=d.getIdenticalPanels()[1];var O=Math.abs(d.getAnchorPosition()-g)>Math.abs(z.getAnchorPosition()-g);!l&&O&&(A=s(z))}o(A,v&&A.position!==d.getPosition()?M.CHANGE:E?M.NONE:M.RESTORE,t,x).onSuccess(function(){a(_)}).onStopped(function(){a(R),u(t)})},t}(Oe),Ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=_,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onHold=function(t,e){var n=e.triggerEvent,i=e.transitTo;n(M.HOLD_START,t,!0).onSuccess(function(){i(x)}).onStopped(function(){i(R)})},n.onChange=function(t,e){var n=e.moveCamera,i=e.transitTo;t.delta.flick&&n(t).onStopped(function(){i(R)})},n.onFinish=function(t,e){var n=e.flicking,i=e.viewport,r=e.triggerEvent,o=e.transitTo,s=t&&t.isTrusted;r(M.MOVE_END,t,s),n.options.adaptive&&i.updateAdaptiveSize(),o(l)},t}(Oe),De=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=R,t.holding=!1,t.playing=!0,t}r(t,e);var n=t.prototype;return n.onAnimationEnd=function(t,e){(0,e.transitTo)(l)},n.onRelease=function(t,e){var n=e.transitTo;0===t.delta.flick&&n(l)},t}(Oe),He=function(){function t(){var i=this;this.state=new Me,this.transitTo=function(t){var e=i.state;if(e.type!==t){var n=void 0;switch(t){case l:n=new Me;break;case P:n=new _e;break;case x:n=new Re;break;case _:n=new Ne;break;case R:n=new De}e.onExit(n),n.onEnter(e),i.state=n}return i.state}}var e=t.prototype;return e.fire=function(t,e,n){var i=this.state;switch(t){case m.HOLD:i.onHold(e,n);break;case m.CHANGE:i.onChange(e,n);break;case m.RELEASE:i.onRelease(e,n);break;case m.ANIMATION_END:i.onAnimationEnd(e,n);break;case m.FINISH:i.onFinish(e,n)}},e.getState=function(){return this.state},t}();return function(f){function t(t,e){void 0===e&&(e={});var n,I=f.call(this)||this;if(I.plugins=[],I.triggerEvent=function(t,e,n,i){void 0===i&&(i={});var r=I.viewport,o=I.stateMachine.getState(),s=r.getCurrentPanel(),a=r.getScrollArea(),u=a.prev,h=a.next,c=z(r.getCameraPosition(),[u,u,h]);I.options.circular&&(c%=1);var l=!f.prototype.trigger.call(I,t,p({type:t,index:s.getIndex(),panel:I.castToReadonlyPanel(s),direction:o.direction,holding:o.holding,progress:c,axesEvent:e,isTrusted:n},i));return{onSuccess:function(t){return l||t(),this},onStopped:function(t){return l&&t(),this}}},I.moveCamera=function(t){var e=I.viewport,n=I.stateMachine.getState(),i=I.options,r=t.pos.flick;if(t.isTrusted&&n.holding){var o=(i.horizontal?t.inputEvent.offsetX:t.inputEvent.offsetY)<0,s=e.getCameraPosition(),a=r-s,u=o===r<s;if(i.circular&&u){var h=e.getScrollAreaSize();a=-Math.sign(a)*(h-Math.abs(a))}var c=0===a?n.direction:0<a?y.NEXT:y.PREV;n.delta+=a,n.direction=c}var l=e.getCameraPosition();return e.moveCamera(r),I.triggerEvent(M.MOVE,t,t.isTrusted).onStopped(function(){e.moveCamera(l)})},I.stopCamera=function(t){var e=I.viewport;t&&t.setTo&&t.setTo({flick:e.getCameraPosition()},0),I.stateMachine.transitTo(l)},I.moveToPanel=function(e,t,n,i){void 0===i&&(i=I.options.duration);var r,o=I.viewport,s=I.stateMachine,a=o.getCurrentPanel(),u=e.anchorPosition-o.getHangerPosition(),h=o.getCameraPosition(),c=null!==n,l=h<u?y.NEXT:y.PREV;return(r=t===M.CHANGE?I.triggerEvent(M.CHANGE,n,c,{index:e.index,panel:e,direction:l,prevIndex:a.getIndex(),prevPanel:I.castToReadonlyPanel(a)}):t===M.RESTORE?I.triggerEvent(M.RESTORE,n,c):{onSuccess:function(t){return t(),this},onStopped:function(t){return this}}).onSuccess(function(){var t=s.getState();t.targetPanel=e,t.direction=l,o.moveTo(e,n,i)}),i<=0&&s.fire(m.FINISH,null,I.eventContext),r},I.castToReadonlyPanel=function(i,r){void 0===r&&(r=i.getPosition());var o=I,t=I.options.circular,s=I.viewport,e=i.getSize(),n=i.getRelativeAnchorPosition(),a=s.getCameraPosition(),u=s.getHangerPosition(),h=a+u,c=I.viewport.findNearestPanel(),l=c.getAnchorPosition()>h||!c.getNextPanel(),f=(l?c.getPrevPanel():c)||c,p=(l?c:c.getNextPanel())||c,v=s.getScrollAreaSize(),d=s.getSize(),g=f.getAnchorPosition(),m=p.getAnchorPosition();m<g&&(g<h?m+=v:g-=v);var P=[g,g,m],x=[-e,u-n,d],y=I.getPanelCount(),E=f.getCloneIndex(),T=(t?Math.floor(r/v)*y:0)+i.getIndex()-z(h,P)-(f.getIndex()+(E+1)*y),b=r-a,A=z(b,x),w=b+e,C=Math.min(d,w)-Math.max(b,0),S=0<=C?C/e:0;return{element:i.getElement(),index:i.getIndex(),position:r,progress:T,outsetProgress:A,visibleRatio:S,anchorPosition:r+i.getRelativeAnchorPosition(),size:i.getSize(),focus:function(t){if(s.getCameraPosition()+s.getHangerPosition()!==i.getAnchorPosition()){var e=s.getCurrentPanel().getPosition();o.moveToPanel(this,e===r?M.NONE:M.CHANGE,null,t)}},update:function(e){i.getIdenticalPanels().forEach(function(t){return e(t.getElement())})},prev:function(){var t=i.getPrevPanel();if(null==t)return null;for(var e=s.getScrollAreaSize(),n=t.getPosition();r<n;)n-=e;return o.castToReadonlyPanel(t,n)},next:function(){var t=i.getNextPanel();if(null==t)return null;for(var e=s.getScrollAreaSize(),n=t.getPosition();n<r;)n+=e;return o.castToReadonlyPanel(t,n)}}},"string"==typeof t){if(!(n=document.querySelector(t)))throw new Error("Base element doesn't exist.")}else{if(!t.nodeName||1!==t.nodeType)throw new Error("Element should be provided in string or HTMLElement.");n=t}return I.wrapper=n,I.build(e),I}r(t,f);var e=t.prototype;return e.prev=function(t){return this.moveTo(this.viewport.getPrevIndex(),t)},e.next=function(t){return this.moveTo(this.viewport.getNextIndex(),t)},e.moveTo=function(t,e){var n=this.viewport,i=n.getPanel(t),r=this.stateMachine.getState();if(!i||r.type!==l)return this;if(n.getCameraPosition()+n.getHangerPosition()===i.getAnchorPosition())return this;var o=i.getIndex(),s=n.getIndex(),a=this.castToReadonlyPanel(n.findNearestIdenticalPanel(i));return this.moveToPanel(a,o===s?M.NONE:M.CHANGE,null,e),this},e.getIndex=function(){return this.viewport.getIndex()},e.getPrevIndex=function(){return this.viewport.getPrevIndex()},e.getNextIndex=function(){return this.viewport.getNextIndex()},e.getCurrentPanel=function(){return this.castToReadonlyPanel(this.viewport.getCurrentPanel())},e.getPanel=function(t){var e=this.viewport.getPanel(t);return e?this.castToReadonlyPanel(e):null},e.getAllPanels=function(t){var e=this;return this.viewport.getAllPanels(t).map(function(t){return e.castToReadonlyPanel(t)})},e.getVisiblePanels=function(){return this.getAllPanels(!0).filter(function(t){var e=t.outsetProgress;return-1<e&&e<1})},e.getPanelCount=function(){return this.viewport.getPanelCount()},e.isPlaying=function(){return this.stateMachine.getState().playing},e.enableInput=function(){return this.viewport.enable(),this},e.disableInput=function(){return this.viewport.disable(),this},e.getStatus=function(){var t=this.viewport.getAllPanels().map(function(t){return{html:t.getElement().outerHTML,index:t.getIndex()}});return{index:this.getIndex(),panels:t,position:this.viewport.getCameraPosition()}},e.setStatus=function(t){this.viewport.restore(t)},e.addPlugins=function(t){var e=this,n=[].concat(t);return n.forEach(function(t){t.init(e)}),this.plugins=this.plugins.concat(n),this},e.removePlugins=function(t){var n=this,i=this.plugins;return[].concat(t).forEach(function(t){var e=i.indexOf(t);-1<e&&i.splice(e,1),t.destroy(n)}),this},e.destroy=function(){var e=this;for(var t in this.off(),this.viewport.destroy(),this.plugins.forEach(function(t){t.destroy(e)}),this)this[t]=null},e.resize=function(){return this.viewport.resize(),this},e.build=function(t){this.setInitialState(t),this.initViewport(),this.listenInput(),this.listenResize()},e.setInitialState=function(t){this.options=p({},g,t),this.stateMachine=new He},e.initViewport=function(){var t=this.wrapper,e=this.options,n=t.children;if(!n||!n.length)throw new Error("Given base element doesn't have proper DOM structure to be initialized.");for(var i=document.createElement("div"),r=t.firstChild;r;)i.appendChild(r),r=t.firstChild;var o=document.createElement("div");o.appendChild(i),t.appendChild(o),this.viewport=new ze(o,i,e)},e.listenInput=function(){var n=this,i=n.stateMachine;n.eventContext={flicking:n,viewport:n.viewport,transitTo:i.transitTo,triggerEvent:n.triggerEvent,moveCamera:n.moveCamera,stopCamera:n.stopCamera,moveToPanel:n.moveToPanel,castToReadonlyPanel:n.castToReadonlyPanel};var r={},t=function(t){var e=m[t];r[e]=function(t){return i.fire(e,t,n.eventContext)}};for(var e in m)t(e);n.viewport.connectAxesHandler(r)},e.listenResize=function(){var t=this;this.options.autoResize&&window.addEventListener("resize",function(){t.resize()})},t.VERSION="3.0.0-beta4",t.DIRECTION=y,t.EVENTS=M,t}(t)}); | ||
//# sourceMappingURL=flicking.pkgd.min.js.map |
{ | ||
"name": "@egjs/flicking", | ||
"version": "3.0.0-beta3", | ||
"version": "3.0.0-beta4", | ||
"description": "A module used to implement flicking interactions. With this module, you can make flicking gestures, which are ways to navigate left and right to move between panels arranged side by side.", | ||
@@ -46,3 +46,3 @@ "main": "dist/flicking.js", | ||
"devDependencies": { | ||
"@daybrush/jsdoc": "^0.3.7-rc3", | ||
"@daybrush/jsdoc": "^0.3.7", | ||
"@egjs/release-helper": "0.0.3", | ||
@@ -49,0 +49,0 @@ "@types/karma-chai": "^0.1.1", |
# egjs-flicking | ||
[![version][badge-version]][link-version] [![Build Status][badge-build-status]][link-build-status] [![Coverage Status][badge-coverage]][link-coverage] [![Greenkeeper][badge-gk]][link-gk] | ||
[![version][badge-version]][link-version] [![Build Status][badge-build-status]][link-build-status] [![Coverage Status][badge-coverage]][link-coverage] [![Greenkeeper][badge-gk]][link-gk] | ||
A module used to implement flicking interactions. | ||
With this module, you can make flicking gestures, which are ways to navigate left and right to move between panels arranged side by side. | ||
With this module, you can make flicking gestures, which are ways to navigate left and right to move between panels arranged side by side. | ||
@@ -14,3 +14,3 @@ ## Documents | ||
Download dist files from repo directly or install it via npm. | ||
Download dist files from repo directly or install it via npm. | ||
@@ -71,11 +71,11 @@ ### For development (Uncompressed) | ||
- **Latest** | ||
- https://naver.github.io/egjs-flicking/release/plugins/latest/dist/all.js (all) | ||
- https://naver.github.io/egjs-flicking/release/plugins/latest/dist/all.min.js (all) | ||
- https://naver.github.io/egjs-flicking/release/plugins/latest/dist/[PLUGIN-NAME].js | ||
- https://naver.github.io/egjs-flicking/release/plugins/latest/dist/[PLUGIN-NAME].min.js | ||
- https://naver.github.io/egjs-flicking-plugins/release/latest/dist/plugins.js (all) | ||
- https://naver.github.io/egjs-flicking-plugins/release/latest/dist/plugins.min.js (all) | ||
- https://naver.github.io/egjs-flicking-plugins/release/latest/dist/[PLUGIN-NAME].js | ||
- https://naver.github.io/egjs-flicking-plugins/release/latest/dist/[PLUGIN-NAME].min.js | ||
- **Specific version** | ||
- https://naver.github.io/egjs-flicking/release/plugins/[PLUGIN-VERSION]/dist/all.js (all) | ||
- https://naver.github.io/egjs-flicking/release/plugins/[PLUGIN-VERSION]/dist/all.min.js (all) | ||
- https://naver.github.io/egjs-flicking/release/plugins/[PLUGIN-VERSION]/dist/[PLUGIN-NAME].js | ||
- https://naver.github.io/egjs-flicking/release/plugins/[PLUGIN-VERSION]/dist/[PLUGIN-NAME].min.js | ||
- https://naver.github.io/egjs-flicking-plugins/release/[PLUGIN-VERSION]/dist/plugins.js (all) | ||
- https://naver.github.io/egjs-flicking-plugins/release/[PLUGIN-VERSION]/dist/plugins.min.js (all) | ||
- https://naver.github.io/egjs-flicking-plugins/release/[PLUGIN-VERSION]/dist/[PLUGIN-NAME].js | ||
- https://naver.github.io/egjs-flicking-plugins/release/[PLUGIN-VERSION]/dist/[PLUGIN-NAME].min.js | ||
@@ -82,0 +82,0 @@ ### Installation with npm |
@@ -61,2 +61,3 @@ import Panel from "./Panel"; | ||
const state = this.state; | ||
const freeScroll = this.options.freeScroll; | ||
let targetPos = panel.anchorPosition - state.hangerPosition; | ||
@@ -69,4 +70,5 @@ | ||
state.index = panel.index; | ||
// freeScroll only occurs in release events | ||
(axesEvent && axesEvent.setTo) | ||
? axesEvent.setTo({ flick: targetPos }, duration) | ||
? axesEvent.setTo({ flick: freeScroll ? axesEvent.destPos.flick : targetPos }, duration) | ||
: this.axes.setTo({ flick: targetPos }, duration); | ||
@@ -73,0 +75,0 @@ } |
@@ -25,2 +25,3 @@ import { FlickingOptions, EventType, Direction, AxesEventType, StateType } from "./types"; | ||
snap: 1, | ||
freeScroll: false, | ||
}; | ||
@@ -55,2 +56,3 @@ | ||
SELECT: "select", | ||
NONE: "", | ||
}; | ||
@@ -57,0 +59,0 @@ |
@@ -71,4 +71,5 @@ import Component from "@egjs/component"; | ||
* @param {string} [options.anchor="50%"] Position of anchor in panels, which can be hanged by viewport hanger.<br>Should be provided in px or % value of panel size.<br>You can combinate those values with plus/minus sign<br>ex) "50", "100px", "0%", "25% + 100px"<ko>패널 내부의 앵커의 위치. 뷰포트의 행어와 연계하여 패널이 화면 내에서 멈추는 지점을 설정할 수 있다.<br>px값이나, 패널의 크기 대비 %값을 사용할 수 있고, 이를 + 혹은 - 기호로 연계하여 사용할 수도 있다.<br>예) "50", "100px", "0%", "25% + 100px"</ko> | ||
* @param {number} [options.gap=0] - Space between each panels.<br>Should be given in number(px).<ko>패널간에 부여할 간격의 크기를 나타내는 숫자(px)</ko> | ||
* @param {number} [options.snap=1] - The number of panels you're going to roll over to when you snap<ko>한 번 스냅 할 때 최대 몇 개의 패널까지 넘길 건지 나타내는 숫자</ko> | ||
* @param {number} [options.gap=0] Space between each panels.<br>Should be given in number(px).<ko>패널간에 부여할 간격의 크기를 나타내는 숫자(px)</ko> | ||
* @param {number} [options.snap=1] The number of panels you're going to roll over to when you snap<ko>한 번 스냅 할 때 최대 몇 개의 패널까지 넘길 건지 나타내는 숫자</ko> | ||
* @param {boolean} [options.freeScroll=false] If true, panels can scroll freely when flicked.<ko>활성화 했을 때 플릭한 경우에 패널들을 자유롭게 스크롤할 수 있다.</ko> | ||
*/ | ||
@@ -128,19 +129,18 @@ constructor( | ||
const panel = viewport.getPanel(index); | ||
const state = this.stateMachine.getState(); | ||
if (panel) { | ||
const state = this.stateMachine.getState(); | ||
if (!panel || state.type !== STATE_TYPE.IDLE) { | ||
return this; | ||
} | ||
const hangerPosition = viewport.getCameraPosition() + viewport.getHangerPosition(); | ||
const anchorPosition = panel.getAnchorPosition(); | ||
const currentIndex = viewport.getIndex(); | ||
const canMove = (state.type === STATE_TYPE.IDLE) | ||
&& (panel.getIndex() !== currentIndex); | ||
if (!canMove) { | ||
return this; | ||
} | ||
const nearestPanel = this.castToReadonlyPanel(viewport.findNearestIdenticalPanel(panel)); | ||
this.moveToPanel(nearestPanel, EVENTS.CHANGE, null, duration); | ||
if (hangerPosition === anchorPosition) { | ||
return this; | ||
} | ||
const panelIndex = panel.getIndex(); | ||
const currentIndex = viewport.getIndex(); | ||
const nearestPanel = this.castToReadonlyPanel(viewport.findNearestIdenticalPanel(panel)); | ||
this.moveToPanel(nearestPanel, panelIndex === currentIndex ? EVENTS.NONE : EVENTS.CHANGE, null, duration); | ||
return this; | ||
@@ -528,3 +528,3 @@ } | ||
private moveToPanel = (panel: FlickingPanel, eventType: EventType["CHANGE"] | EventType["RESTORE"], axesEvent: any, duration: number = this.options.duration): TriggerCallback => { | ||
private moveToPanel = (panel: FlickingPanel, eventType: EventType["CHANGE"] | EventType["RESTORE"] | EventType["NONE"], axesEvent: any, duration: number = this.options.duration): TriggerCallback => { | ||
const viewport = this.viewport; | ||
@@ -551,4 +551,14 @@ const stateMachine = this.stateMachine; | ||
} as ChangeEvent); | ||
} else if (eventType === EVENTS.RESTORE) { | ||
eventResult = this.triggerEvent(EVENTS.RESTORE, axesEvent, isTrusted); | ||
} else { | ||
eventResult = this.triggerEvent(EVENTS.RESTORE, axesEvent, isTrusted); | ||
eventResult = { | ||
onSuccess(callback: () => void): TriggerCallback { | ||
callback(); | ||
return this; | ||
}, | ||
onStopped(callback: () => void): TriggerCallback { | ||
return this; | ||
}, | ||
}; | ||
} | ||
@@ -643,3 +653,4 @@ | ||
flicking.moveToPanel(this, EVENTS.CHANGE, null, duration); | ||
const currentPosition = viewport.getCurrentPanel().getPosition(); | ||
flicking.moveToPanel(this, currentPosition === position ? EVENTS.NONE : EVENTS.CHANGE, null, duration); | ||
}, | ||
@@ -646,0 +657,0 @@ update(this: FlickingPanel, updateFunction: (element: HTMLElement) => any): void { |
@@ -65,11 +65,12 @@ import State from "./State"; | ||
const flick = Math.abs(e.delta.flick); | ||
const snap = options.snap; | ||
const freeScroll = options.freeScroll; | ||
const snap = freeScroll ? Infinity : options.snap; | ||
const durationOption = options.duration; | ||
let duration: number | undefined; | ||
let panelToMove = castToReadonlyPanel(currentPanel); | ||
let panelToMove = castToReadonlyPanel(freeScroll ? viewport.findNearestPanel() : currentPanel); | ||
if (overThreshold) { | ||
if (freeScroll || overThreshold) { | ||
let count = 0; | ||
if (minimumDistanceToChange <= flick) { | ||
if (freeScroll || minimumDistanceToChange <= flick) { | ||
const position = panelToMove.position; | ||
@@ -86,5 +87,9 @@ | ||
} | ||
count > 1 && (duration = Math.min(durationOption * count, Math.max(e.duration, durationOption))); | ||
if (freeScroll) { | ||
duration = e.duration; | ||
} else if (count > 1) { | ||
duration = Math.min(durationOption * count, Math.max(e.duration, durationOption)); | ||
} | ||
} | ||
if (count <= 1) { | ||
if (!freeScroll && count <= 1) { | ||
if (swipeDistance <= minimumDistanceToChange) { | ||
@@ -122,4 +127,4 @@ let adjacentPanel = isNext | ||
const eventType = (!overThreshold || (!options.circular && panelToMove.position === currentPanel.getPosition())) | ||
? EVENTS.RESTORE | ||
const eventType = (!overThreshold || panelToMove.position === currentPanel.getPosition()) | ||
? (freeScroll ? EVENTS.NONE : EVENTS.RESTORE) | ||
: EVENTS.CHANGE; | ||
@@ -126,0 +131,0 @@ |
@@ -32,2 +32,3 @@ import Flicking from "./Flicking"; | ||
* @property - The number of panels you're going to roll over to when you snap<ko>한 번 스냅 할 때 최대 몇 개의 패널까지 넘길 건지 나타내는 숫자</ko> | ||
* @property - If true, panels can scroll freely when flicked.<ko>활성화 했을 때 플릭한 경우에 패널들이 자유롭게 스크롤할 수 있다.</ko> | ||
*/ | ||
@@ -55,2 +56,3 @@ export interface FlickingOptions { | ||
snap: number; | ||
freeScroll: boolean; | ||
} | ||
@@ -200,2 +202,3 @@ | ||
* @property - select 이벤트 | ||
* @property - 없음 | ||
*/ | ||
@@ -211,2 +214,3 @@ export interface EventType { | ||
readonly SELECT: "select"; | ||
readonly NONE: ""; | ||
} | ||
@@ -213,0 +217,0 @@ |
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
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
2615920
14113