@egjs/flicking
Version:
Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
9 lines • 151 kB
JavaScript
/*
Copyright (c) 2015-present NAVER Corp.
name: @egjs/flicking
license: MIT
author: NAVER Corp.
repository: https://github.com/naver/egjs-flicking
version: 4.13.1
*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).Flicking=n()}(this,(function(){"use strict";var e=function(n,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},e(n,t)};function n(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var t=function(){return t=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},t.apply(this,arguments)};function i(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}u((i=i.apply(e,n||[])).next())}))}function r(e,n){var t,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],i=0}finally{t=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function o(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var i,r,o=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}return a}function s(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(a(arguments[n]));return e}function u(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],i=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var i,r,o=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}return a}function c(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(l(arguments[n]));return e}"function"==typeof SuppressedError&&SuppressedError;var h=function(e){return void 0===e},f=function(){function e(e,n){var t,i;if(this._canceled=!1,n)try{for(var r=u(Object.keys(n)),o=r.next();!o.done;o=r.next()){var a=o.value;this[a]=n[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}this.eventType=e}var n=e.prototype;return n.stop=function(){this._canceled=!0},n.isCanceled=function(){return this._canceled},e}(),d=function(){function e(){this._eventHandler={}}var n=e.prototype;return n.trigger=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var i=e instanceof f?e.eventType:e,r=c(this._eventHandler[i]||[]);return r.length<=0||(e instanceof f?(e.currentTarget=this,r.forEach((function(n){n(e)}))):r.forEach((function(e){e.apply(void 0,c(n))}))),this},n.once=function(e,n){var t=this;if("object"==typeof e&&h(n)){var i=e;for(var r in i)this.once(r,i[r]);return this}if("string"==typeof e&&"function"==typeof n){var o=function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];n.apply(void 0,c(i)),t.off(e,o)};this.on(e,o)}return this},n.hasOn=function(e){return!!this._eventHandler[e]},n.on=function(e,n){if("object"==typeof e&&h(n)){var t=e;for(var i in t)this.on(i,t[i]);return this}if("string"==typeof e&&"function"==typeof n){var r=this._eventHandler[e];h(r)&&(this._eventHandler[e]=[],r=this._eventHandler[e]),r.push(n)}return this},n.off=function(e,n){var t,i;if(h(e))return this._eventHandler={},this;if(h(n)){if("string"==typeof e)return delete this._eventHandler[e],this;var r=e;for(var o in r)this.off(o,r[o]);return this}var a=this._eventHandler[e];if(a){var s=0;try{for(var l=u(a),c=l.next();!c.done;c=l.next()){if(c.value===n){a.splice(s,1),a.length<=0&&delete this._eventHandler[e];break}s++}}catch(e){t={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(t)throw t.error}}}return this},e.VERSION="3.0.4",e}(),g=f,p={WRONG_TYPE:0,ELEMENT_NOT_FOUND:1,VAL_MUST_NOT_NULL:2,NOT_ATTACHED_TO_FLICKING:3,WRONG_OPTION:4,INDEX_OUT_OF_RANGE:5,POSITION_NOT_REACHABLE:6,TRANSFORM_NOT_SUPPORTED:7,STOP_CALLED_BY_USER:8,ANIMATION_INTERRUPTED:9,ANIMATION_ALREADY_PLAYING:10,NOT_ALLOWED_IN_FRAMEWORK:11,NOT_INITIALIZED:12,NO_ACTIVE:13,NOT_ALLOWED_IN_VIRTUAL:14},v=function(e,n){return e+"("+typeof e+") is not a "+n.map((function(e){return'"'+e+'"'})).join(" or ")+"."},_=function(e){return'Element with selector "'+e+'" not found.'},m=function(e,n){return n+" should be provided. Given: "+e},b='This module is not attached to the Flicking instance. "init()" should be called first.',E=function(e,n){return'Option "'+e+'" is not in correct format, given: '+n},y=function(e,n,t){return'Index "'+e+'" is out of range: should be between '+n+" and "+t+"."},P=function(e){return'Position "'+e+'" is not reachable.'},x="Browser does not support CSS transform.",O="Event stop() is called by user.",T="Animation is interrupted by user input.",R="Animation is already playing.",w="This behavior is not allowed in the frameworks like React, Vue, or Angular.",I="Flicking is not initialized yet, call init() first.",A={READY:"ready",BEFORE_RESIZE:"beforeResize",AFTER_RESIZE:"afterResize",HOLD_START:"holdStart",HOLD_END:"holdEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",WILL_CHANGE:"willChange",CHANGED:"changed",WILL_RESTORE:"willRestore",RESTORED:"restored",SELECT:"select",NEED_PANEL:"needPanel",VISIBLE_CHANGE:"visibleChange",REACH_EDGE:"reachEdge",PANEL_CHANGE:"panelChange"},C={PREV:"prev",CENTER:"center",NEXT:"next"},S={PREV:"PREV",NEXT:"NEXT",NONE:null},k={SNAP:"snap",FREE_SCROLL:"freeScroll",STRICT:"strict"},D={VIEWPORT:"flicking-viewport",CAMERA:"flicking-camera",VERTICAL:"vertical",HIDDEN:"flicking-hidden",DEFAULT_VIRTUAL:"flicking-panel"},M={LINEAR:"linear",BOUND:"bound"},N={LTR:"ltr",RTL:"rtl"},z={HORIZONTAL:"horizontal",VERTICAL:"vertical"},j={__proto__:null,EVENTS:A,ALIGN:C,DIRECTION:S,MOVE_TYPE:k,CLASS:D,CIRCULAR_FALLBACK:M,ORDER:N,MOVE_DIRECTION:z,ERROR_CODE:p},L=function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];return n.forEach((function(n){Object.keys(n).forEach((function(t){e[t]=n[t]}))})),e},F=function(e,n){var t=null;if($(e)){var i=(n||document).querySelector(e);if(!i)throw new ge(_(e),p.ELEMENT_NOT_FOUND);t=i}else e&&e.nodeType===Node.ELEMENT_NODE&&(t=e);if(!t)throw new ge(v(e,["HTMLElement","string"]),p.WRONG_TYPE);return t},H=function(e,n){if(null==e)throw new ge(m(e,n),p.VAL_MUST_NOT_NULL)},V=function(e,n,t){return Math.max(Math.min(e,t),n)},B=function(e){if(!e)throw new ge(b,p.NOT_ATTACHED_TO_FLICKING);return e},G=function(e){return[].slice.call(e)},X=function(e,n){var t;if($(e))switch(e){case C.PREV:t=0;break;case C.CENTER:t=.5*n;break;case C.NEXT:t=n;break;default:if(null==(t=U(e,n)))throw new ge(E("align",e),p.WRONG_OPTION)}else t=e;return t},W=function(e,n){var t;if(Array.isArray(e))t=e.map((function(e){return U(e,n)}));else{var i=U(e,n);t=[i,i]}return t.map((function(n){if(null==n)throw new ge(E("bounce",e),p.WRONG_OPTION);return n}))},U=function(e,n){var t=Y(e);return null==t?null:t.percentage*n+t.absolute},Y=function(e){var n=/(?:(\+|\-)\s*)?(\d+(?:\.\d+)?(%|px)?)/g;if("number"==typeof e)return{percentage:0,absolute:e};for(var t={percentage:0,absolute:0},i=0,r=n.exec(e);null!=r;){var o=r[1],a=r[2],s=r[3],u=parseFloat(a);if(i<=0&&(o=o||"+"),!o)return null;var l="+"===o?1:-1;"%"===s?t.percentage+=l*(u/100):t.absolute+=l*u,++i,r=n.exec(e)}return 0===i?null:t},q=function(e){return"object"==typeof e?e.panel:e},K=function(e,n){return e===n?S.NONE:e<n?S.NEXT:S.PREV},Z=function(e){Array.isArray(e)||(e=[e]);var n=[];return e.forEach((function(e){if($(e)){var t=document.createElement("div");for(t.innerHTML=e,n.push.apply(n,s(G(t.children)));t.firstChild;)t.removeChild(t.firstChild)}else{if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new ge(v(e,["HTMLElement","string"]),p.WRONG_TYPE);n.push(e)}})),n},Q=function(e,n){return V(e<0?e+n:e,0,n)},J=function(e,n){var t,i;try{for(var r=o(e),a=r.next();!a.done;a=r.next()){if(a.value===n)return!0}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return!1},$=function(e){return"string"==typeof e},ee=function(e,n,t){var i=t-n;if(e<n)e=t-(n-e)%i;else if(e>t){e=n+(e-t)%i}return e},ne=function(e,n){var t,i;try{for(var r=o(e),a=r.next();!a.done;a=r.next()){var s=a.value;if(n(s))return s}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return null},te=function(e,n){for(var t=0;t<e.length;t++)if(n(e[t]))return t;return-1},ie=function(e,n,t){return(e-n)/(t-n)},re=function(e){return e?window.getComputedStyle(e)||e.currentStyle:{}},oe=function(e,n){var t=n.width,i=n.height;e&&(null!=t&&($(t)?e.style.width=t:e.style.width=t+"px"),null!=i&&($(i)?e.style.height=i:e.style.height=i+"px"))},ae=function(e,n,t){return e>=n&&e<=t},se=function(e,n){return e>=n?e%n:e<0?Q((e+1)%n-1,n):e},ue=function(e){for(var n=new Array(e),t=0;t<e;t++)n[t]=t;return n},le=function(e){var n=e.el,t=e.horizontal,i=e.useFractionalSize,r=e.useOffset,o=e.style,a=0;if(i){var s=parseFloat(t?o.width:o.height)||0,u="border-box"===o.boxSizing,l=t?parseFloat(o.borderLeftWidth||"0")+parseFloat(o.borderRightWidth||"0"):parseFloat(o.borderTopWidth||"0")+parseFloat(o.borderBottomWidth||"0");if(u)a=r?s:s-l;else{var c=t?parseFloat(o.paddingLeft||"0")+parseFloat(o.paddingRight||"0"):parseFloat(o.paddingTop||"0")+parseFloat(o.paddingBottom||"0");a=r?s+c+l:s+c}}else{var h=t?"Width":"Height";a=r?n["offset"+h]:n["client"+h]}return Math.max(a,0)},ce=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},he=function(e){return e.replace(/[\s-_]([a-z])/g,(function(e,n){return n.toUpperCase()}))},fe=function(e,n){for(var t={},i=e.attributes,r=i.length,o=0;o<r;++o){var a=i[o],s=a.name,u=a.value;-1!==s.indexOf(n)&&(t[he(s.replace(n,""))]=u)}return t},de={__proto__:null,merge:L,getElement:F,checkExistence:H,clamp:V,getFlickingAttached:B,toArray:G,parseAlign:X,parseBounce:W,parseArithmeticSize:U,parseArithmeticExpression:Y,parseCSSSizeValue:function(e){return $(e)?e:e+"px"},parsePanelAlign:q,getDirection:K,parseElement:Z,getMinusCompensatedIndex:Q,includes:J,isString:$,circulatePosition:ee,find:ne,findRight:function(e,n){for(var t=e.length-1;t>=0;t--){var i=e[t];if(n(i))return i}return null},findIndex:te,getProgress:ie,getStyle:re,setSize:oe,isBetween:ae,circulateIndex:se,range:ue,getElementSize:le,setPrototypeOf:ce,camelize:he,getDataAttributes:fe},ge=function(e){function t(n,i){var r=e.call(this,n)||this;return ce(r,t.prototype),r.name="FlickingError",r.code=i,r}return n(t,e),t}(Error),pe=function(){function e(e,n){this._flicking=e,this._el=n,this._width=0,this._height=0,this._padding={left:0,right:0,top:0,bottom:0},this._isBorderBoxSizing=!1}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"width",{get:function(){return this._width-this._padding.left-this._padding.right},enumerable:!1,configurable:!0}),Object.defineProperty(n,"height",{get:function(){return this._height-this._padding.top-this._padding.bottom},enumerable:!1,configurable:!0}),Object.defineProperty(n,"padding",{get:function(){return this._padding},enumerable:!1,configurable:!0}),n.setSize=function(e){var n=e.width,t=e.height,i=this._el,r=this._padding,o=this._isBorderBoxSizing;if(null!=n)if($(n))i.style.width=n;else{var a=o?n+r.left+r.right:n;i.style.width=a+"px"}if(null!=t)if($(t))i.style.height=t;else{var s=o?t+r.top+r.bottom:t;i.style.height=s+"px"}this.resize()},n.resize=function(){var e=this._el,n=re(e),t=this._flicking.useFractionalSize;this._width=le({el:e,horizontal:!0,useFractionalSize:t,useOffset:!1,style:n}),this._height=le({el:e,horizontal:!1,useFractionalSize:t,useOffset:!1,style:n}),this._padding={left:n.paddingLeft?parseFloat(n.paddingLeft):0,right:n.paddingRight?parseFloat(n.paddingRight):0,top:n.paddingTop?parseFloat(n.paddingTop):0,bottom:n.paddingBottom?parseFloat(n.paddingBottom):0},this._isBorderBoxSizing="border-box"===n.boxSizing},e}(),ve=function(){function e(e){var n,t=this;this._onResizeWrapper=function(){t._onResize([])},this._onResize=function(e){var n=t._flicking,i=n.resizeDebounce,r=n.maxResizeDebounce,o=n.element;if(e.find((function(e){return e.target===n.element}))&&1===e.length){var a={width:n.viewport.width,height:n.viewport.height},s={width:le({el:o,horizontal:!0,useFractionalSize:t._flicking.useFractionalSize,useOffset:!1,style:re(o)}),height:le({el:o,horizontal:!1,useFractionalSize:t._flicking.useFractionalSize,useOffset:!1,style:re(o)})};if(a.height===s.height&&a.width===s.width)return}i<=0?n.resize():(t._maxResizeDebounceTimer<=0&&r>0&&r>=i&&(t._maxResizeDebounceTimer=window.setTimeout(t._doScheduledResize,r)),t._resizeTimer>0&&(clearTimeout(t._resizeTimer),t._resizeTimer=0),t._resizeTimer=window.setTimeout(t._doScheduledResize,i))},this._doScheduledResize=function(){clearTimeout(t._resizeTimer),clearTimeout(t._maxResizeDebounceTimer),t._maxResizeDebounceTimer=-1,t._resizeTimer=-1,t._flicking.resize()},this._skipFirstResize=(n=!0,function(e){n?n=!1:t._onResize(e)}),this._flicking=e,this._enabled=!1,this._resizeObserver=null,this._resizeTimer=-1,this._maxResizeDebounceTimer=-1}var n=e.prototype;return Object.defineProperty(n,"enabled",{get:function(){return this._enabled},enumerable:!1,configurable:!0}),n.enable=function(){var e=this._flicking,n=e.viewport;if(this._enabled&&this.disable(),e.useResizeObserver&&window.ResizeObserver){var t=0!==n.width||0!==n.height?new ResizeObserver(this._skipFirstResize):new ResizeObserver(this._onResize);this._resizeObserver=t,this.observe(e.viewport.element),e.observePanelResize&&this.observePanels()}else window.addEventListener("resize",this._onResizeWrapper);return this._enabled=!0,this},n.observePanels=function(){var e=this;return this._flicking.panels.forEach((function(n){e.observe(n.element)})),this},n.unobservePanels=function(){var e=this;return this._flicking.panels.forEach((function(n){e.unobserve(n.element)})),this},n.observe=function(e){var n=this._resizeObserver;return n?(n.observe(e),this):this},n.unobserve=function(e){var n=this._resizeObserver;return n?(n.unobserve(e),this._flicking.observePanelResize&&this.unobservePanels(),this):this},n.disable=function(){if(!this._enabled)return this;var e=this._resizeObserver;return e?(e.disconnect(),this._resizeObserver=null):window.removeEventListener("resize",this._onResizeWrapper),this._enabled=!1,this},e}(),_e=function(){function e(e){this._element=e,this._rendered=!0}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._element},enumerable:!1,configurable:!0}),Object.defineProperty(n,"rendered",{get:function(){return this._rendered},enumerable:!1,configurable:!0}),n.show=function(e){var n=this.element,t=e.camera.element;n.parentElement!==t&&(t.appendChild(n),this._rendered=!0)},n.hide=function(e){var n=this.element,t=e.camera.element;n.parentElement===t&&(t.removeChild(n),this._rendered=!1)},e}(),me=function(){function e(e){this._flicking=e}var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._virtualElement.nativeElement},enumerable:!1,configurable:!0}),Object.defineProperty(n,"rendered",{get:function(){return this._virtualElement.visible},enumerable:!1,configurable:!0}),Object.defineProperty(n,"_virtualElement",{get:function(){var e=this._flicking,n=this._panel.elementIndex;return e.virtual.elements[n]},enumerable:!1,configurable:!0}),n.init=function(e){this._panel=e},n.show=function(){},n.hide=function(){},e}(),be=function(){function e(e,n){var t,i,r,o;this._flicking=e,this._renderPanel=null!==(t=null==n?void 0:n.renderPanel)&&void 0!==t?t:function(){return""},this._initialPanelCount=null!==(i=null==n?void 0:n.initialPanelCount)&&void 0!==i?i:-1,this._cache=null!==(r=null==n?void 0:n.cache)&&void 0!==r&&r,this._panelClass=null!==(o=null==n?void 0:n.panelClass)&&void 0!==o?o:D.DEFAULT_VIRTUAL,this._elements=[]}var n=e.prototype;return Object.defineProperty(n,"elements",{get:function(){return this._elements},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderPanel",{get:function(){return this._renderPanel},set:function(e){this._renderPanel=e,this._flicking.renderer.panels.forEach((function(e){return e.uncacheRenderResult()}))},enumerable:!1,configurable:!0}),Object.defineProperty(n,"initialPanelCount",{get:function(){return this._initialPanelCount},enumerable:!1,configurable:!0}),Object.defineProperty(n,"cache",{get:function(){return this._cache},set:function(e){this._cache=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelClass",{get:function(){return this._panelClass},set:function(e){this._panelClass=e},enumerable:!1,configurable:!0}),n.init=function(){var e=this._flicking;if(e.virtualEnabled){e.externalRenderer||e.renderExternal||this._initVirtualElements();var n=e.camera.children;this._elements=n.map((function(e){return{nativeElement:e,visible:!0}}))}},n.show=function(e){var n=this._elements[e],t=n.nativeElement;n.visible=!0,t.style.display&&(t.style.display="")},n.hide=function(e){var n=this._elements[e],t=n.nativeElement;n.visible=!1,t.style.display="none"},n.append=function(e){void 0===e&&(e=1);var n=this._flicking;return this.insert(n.panels.length,e)},n.prepend=function(e){return void 0===e&&(e=1),this.insert(0,e)},n.insert=function(e,n){return void 0===n&&(n=1),n<=0?[]:this._flicking.renderer.batchInsert({index:e,elements:ue(n),hasDOMInElements:!1})},n.remove=function(e,n){return n<=0?[]:this._flicking.renderer.batchRemove({index:e,deleteCount:n,hasDOMInElements:!1})},n._initVirtualElements=function(){var e=this,n=this._flicking,t=n.camera.element,i=n.panelsPerView,r=document.createDocumentFragment();ue(i+1).map((function(n){var t=document.createElement("div");return t.className=e._panelClass,t.dataset.elementIndex=n.toString(),t})).forEach((function(e){r.appendChild(e)})),t.appendChild(r)},e}();function Ee(e,n){for(var t=e.length,i=0;i<t;++i)if(n(e[i],i))return!0;return!1}function ye(e,n){for(var t=e.length,i=0;i<t;++i)if(n(e[i],i))return e[i];return null}function Pe(e){var n=e;if(void 0===n){if("undefined"==typeof navigator||!navigator)return"";n=navigator.userAgent||""}return n.toLowerCase()}function xe(e,n){try{return new RegExp(e,"g").exec(n)}catch(e){return null}}function Oe(e){return e.replace(/_/g,".")}function Te(e,n){var t=null,i="-1";return Ee(e,(function(e){var r=xe("("+e.test+")((?:\\/|\\s|:)([0-9|\\.|_]+))?",n);return!(!r||e.brand)&&(t=e,i=r[3]||"-1",e.versionAlias?i=e.versionAlias:e.versionTest&&(i=function(e,n){var t=xe("("+e+")((?:\\/|\\s|:)([0-9|\\.|_]+))",n);return t?t[3]:""}(e.versionTest.toLowerCase(),n)||i),i=Oe(i),!0)})),{preset:t,version:i}}function Re(e,n){var t={brand:"",version:"-1"};return Ee(e,(function(e){var i=we(n,e);return!!i&&(t.brand=e.id,t.version=e.versionAlias||i.version,"-1"!==t.version)})),t}function we(e,n){return ye(e,(function(e){var t=e.brand;return xe(""+n.test,t.toLowerCase())}))}var Ie=[{test:"phantomjs",id:"phantomjs"},{test:"whale",id:"whale"},{test:"edgios|edge|edg",id:"edge"},{test:"msie|trident|windows phone",id:"ie",versionTest:"iemobile|msie|rv"},{test:"miuibrowser",id:"miui browser"},{test:"samsungbrowser",id:"samsung internet"},{test:"samsung",id:"samsung internet",versionTest:"version"},{test:"chrome|crios",id:"chrome"},{test:"firefox|fxios",id:"firefox"},{test:"android",id:"android browser",versionTest:"version"},{test:"safari|iphone|ipad|ipod",id:"safari",versionTest:"version"}],Ae=[{test:"(?=.*applewebkit/(53[0-7]|5[0-2]|[0-4]))(?=.*\\schrome)",id:"chrome",versionTest:"chrome"},{test:"chromium",id:"chrome"},{test:"whale",id:"chrome",versionAlias:"-1",brand:!0}],Ce=[{test:"applewebkit",id:"webkit",versionTest:"applewebkit|safari"}],Se=[{test:"(?=(iphone|ipad))(?!(.*version))",id:"webview"},{test:"(?=(android|iphone|ipad))(?=.*(naver|daum|; wv))",id:"webview"},{test:"webview",id:"webview"}],ke=[{test:"windows phone",id:"windows phone"},{test:"windows 2000",id:"window",versionAlias:"5.0"},{test:"windows nt",id:"window"},{test:"win32|windows",id:"window"},{test:"iphone|ipad|ipod",id:"ios",versionTest:"iphone os|cpu os"},{test:"macos|macintel|mac os x",id:"mac"},{test:"android|linux armv81",id:"android"},{test:"tizen",id:"tizen"},{test:"webos|web0s",id:"webos"}];function De(e){return!!Te(Se,e).preset}var Me="__observers__",Ne="__computed__",ze=1,je="__CFCS_DETECTED_DEPENDENCIES__",Le=function(e,n){return Le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},Le(e,n)};function Fe(){Object[je]=Object[je]||{};var e=Object[je];return e[ze]=e[ze]||[],e[ze]}var He=function(){function e(e){this._emitter=new d,this._current=e}var n=e.prototype;return Object.defineProperty(n,"current",{get:function(){var e,n=(e=Fe())[e.length-1];return null==n||n.push(this),this._current},set:function(e){this._setCurrent(e)},enumerable:!1,configurable:!0}),n.subscribe=function(e){return this.current,this._emitter.on("update",e),this},n.unsubscribe=function(e){return this._emitter.off("update",e),this},n._setCurrent=function(e){var n=this._current,t=e!==n;this._current=e,t&&this._emitter.trigger("update",e,n)},n.toString=function(){return"".concat(this.current)},n.valueOf=function(){return this.current},e}(),Ve=function(e){function n(n){var t=e.call(this)||this;return t._computedCallback=n,t._registered=[],t._onCheckUpdate=function(){t._setCurrent(t.current)},t._current=t.current,t}!function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}Le(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(n,e);var t=n.prototype;return Object.defineProperty(t,"current",{get:function(){var e,n,t,i,r=this;e=this,n=Fe(),i={host:e,observers:t=[],push:function(n){e!==n&&-1===t.indexOf(n)&&t.push(n)}},n.push(i);var o=this._computedCallback(),a=Fe().pop();return this._registered.forEach((function(e){e.unsubscribe(r._onCheckUpdate)})),a.observers.forEach((function(e){e.subscribe(r._onCheckUpdate)})),this._registered=a.observers,o},enumerable:!1,configurable:!0}),n}(He);function Be(e,n,t){void 0===t&&(t=n);var i={configurable:!0,get:function(){return Ye(this,t).current},set:function(e){Ye(this,t,e).current=e}};Object.defineProperty(e,n,i),t!==n&&Object.defineProperty(e,t,{configurable:!0,get:function(){return Ye(this,t).current}})}function Ge(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.length>1?Be(e[0],e[1]):function(n,t){return Be(n,t,e[0])}}function Xe(e){e.subscribe=function(e,n){this[e],Ye(this,e).subscribe(n)},e.unsubscribe=function(e,n){var t,i=this;e?e in this&&Ye(this,e).unsubscribe(n):(t=Ue(this),Object.keys(t)).forEach((function(e){i.unsubscribe(e)}))}}function We(e){Xe(e.prototype)}function Ue(e,n){var t,i;e[Me]||function(e){var n={};Object.defineProperty(e,Me,{get:function(){return n}})}(e);var r=e[Me];if(!n){var o=null===(i=null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.prototype)||void 0===i?void 0:i[Ne];o&&o.forEach((function(n){!(n in r)&&n in e&&e[n]}))}return r}function Ye(e,n,t){var i=Ue(e);return i[n]||(i[n]=function(e){return new He(e)}(t)),i[n]}function qe(e,n,t){var i=t.get;var r={configurable:!0,get:function(){var e,t=Ue(this,!0);return n in t||(t[n]=(e=i.bind(this),new Ve(e))),Ye(this,n).current}};e[Ne]||(e[Ne]=[]);var o=e[Ne];return-1===o.indexOf(n)&&o.push(n),Object.defineProperty(e,n,r),r}var Ke=function(e,n){return Ke=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t])},Ke(e,n)};function Ze(e,n){function t(){this.constructor=e}Ke(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var Qe,Je=function(){return Je=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},Je.apply(this,arguments)};function $e(e,n,t,i){var r,o=arguments.length,a=o<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,t):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,t,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(o<3?r(a):o>3?r(n,t,a):r(n,t))||a);return o>3&&a&&Object.defineProperty(n,t,a),a}Qe="undefined"==typeof window?{navigator:{userAgent:""}}:window;var en,nn=24,tn="left",rn="right",on="middle",an={1:tn,2:on,3:rn},sn="ontouchstart"in Qe&&"safari"===(void 0===en&&function(){if("undefined"==typeof navigator||!navigator||!navigator.userAgentData)return!1;var e=navigator.userAgentData,n=e.brands||e.uaList;return!(!n||!n.length)}()?function(e){var n=navigator.userAgentData,t=(n.uaList||n.brands).slice(),i=e&&e.fullVersionList,r=n.mobile||!1,o=t[0],a=(e&&e.platform||n.platform||navigator.platform).toLowerCase(),s={name:o.brand,version:o.version,majorVersion:-1,webkit:!1,webkitVersion:"-1",chromium:!1,chromiumVersion:"-1",webview:!!Re(Se,t).brand||De(Pe())},u={name:"unknown",version:"-1",majorVersion:-1};s.webkit=!s.chromium&&Ee(Ce,(function(e){return we(t,e)}));var l=Re(Ae,t);if(s.chromium=!!l.brand,s.chromiumVersion=l.version,!s.chromium){var c=Re(Ce,t);s.webkit=!!c.brand,s.webkitVersion=c.version}var h=ye(ke,(function(e){return new RegExp(""+e.test,"g").exec(a)}));if(u.name=h?h.id:"",e&&(u.version=e.platformVersion),i&&i.length){var f=Re(Ie,i);s.name=f.brand||s.name,s.version=f.version||s.version}else{var d=Re(Ie,t);s.name=d.brand||s.name,s.version=d.brand&&e?e.uaFullVersion:d.version}return s.webkit&&(u.name=r?"ios":"mac"),"ios"===u.name&&s.webview&&(s.version="-1"),u.version=Oe(u.version),s.version=Oe(s.version),u.majorVersion=parseInt(u.version,10),s.majorVersion=parseInt(s.version,10),{browser:s,os:u,isMobile:r,isHints:!0}}():function(e){var n=Pe(e),t=!!/mobi/g.exec(n),i={name:"unknown",version:"-1",majorVersion:-1,webview:De(n),chromium:!1,chromiumVersion:"-1",webkit:!1,webkitVersion:"-1"},r={name:"unknown",version:"-1",majorVersion:-1},o=Te(Ie,n),a=o.preset,s=o.version,u=Te(ke,n),l=u.preset,c=u.version,h=Te(Ae,n);if(i.chromium=!!h.preset,i.chromiumVersion=h.version,!i.chromium){var f=Te(Ce,n);i.webkit=!!f.preset,i.webkitVersion=f.version}return l&&(r.name=l.id,r.version=c,r.majorVersion=parseInt(c,10)),a&&(i.name=a.id,i.version=s,i.webview&&"ios"===r.name&&"safari"!==i.name&&(i.webview=!1)),i.majorVersion=parseInt(i.version,10),{browser:i,os:r,isMobile:t,isHints:!1}}(en)).browser.name,un=function(){if("undefined"==typeof document)return"";for(var e=(document.head||document.getElementsByTagName("head")[0]).style,n=["transform","webkitTransform","msTransform","mozTransform"],t=0,i=n.length;t<i;t++)if(n[t]in e)return n[t];return""}(),ln={"-webkit-user-select":"none","-ms-user-select":"none","-moz-user-select":"none","user-select":"none","-webkit-user-drag":"none"},cn=function(e){for(var n=[],t=0,i=e.length;t<i;t++)n.push(e[t]);return n},hn=function(e,n){var t;if(void 0===n&&(n=!1),"string"==typeof e){if(e.match(/^<([a-z]+)\s*([^>]*)>/)){var i=document.createElement("div");i.innerHTML=e,t=cn(i.childNodes)}else t=cn(document.querySelectorAll(e));n||(t=t.length>=1?t[0]:void 0)}else e===Qe?t=e:"value"in e||"current"in e?t=e.value||e.current:!e.nodeName||1!==e.nodeType&&9!==e.nodeType?"jQuery"in Qe&&e instanceof jQuery||e.constructor.prototype.jquery?t=n?e.toArray():e.get(0):Array.isArray(e)&&(t=e.map((function(e){return hn(e)})),n||(t=t.length>=1?t[0]:void 0)):t=e;return t},fn=Qe.requestAnimationFrame||Qe.webkitRequestAnimationFrame,dn=Qe.cancelAnimationFrame||Qe.webkitCancelAnimationFrame;if(fn&&!dn){var gn={},pn=fn;fn=function(e){var n=pn((function(t){gn[n]&&e(t)}));return gn[n]=!0,n},dn=function(e){delete gn[e]}}else fn&&dn||(fn=function(e){return Qe.setTimeout((function(){e(Qe.performance&&Qe.performance.now&&Qe.performance.now()||(new Date).getTime())}),16)},dn=Qe.clearTimeout);var vn=function(e,n){var t={};for(var i in e)i&&(t[i]=n(e[i],i));return t},_n=function(e,n){var t={};for(var i in e)i&&n(e[i],i)&&(t[i]=e[i]);return t},mn=function(e,n){for(var t in e)if(t&&!n(e[t],t))return!1;return!0},bn=function(e,n){return mn(e,(function(e,t){return e===n[t]}))},En={},yn=function(e,n){return En[n]||(En[n]=On(n)),En[n](e)},Pn=function(e,n){return e&&n?vn(e,(function(e,t){return yn(e,"number"==typeof n?n:n[t])})):e},xn=function(e){if(!isFinite(e))return 0;var n="".concat(e);if(n.indexOf("e")>=0){for(var t=0,i=1;Math.round(e*i)/i!==e;)i*=10,t++;return t}return n.indexOf(".")>=0?n.length-n.indexOf(".")-1:0},On=function(e){var n=e<1?Math.pow(10,xn(e)):1;return function(t){return 0===e?0:Math.round(Math.round(t/e)*e*n)/n}},Tn=function(e,n,t){return t?!!(30===n||n&e&&t&e):!!(n&e)},Rn=function(){function e(e){this._axes=e,this.holdingCount=0}var n=e.prototype;return n.hold=function(e,n){var t=this._getRoundPos(e).roundPos;this._axes.trigger(new g("hold",{pos:t,input:n.input||null,inputEvent:n.event||null,isTrusted:!0}))},n.triggerRelease=function(e){var n=this._getRoundPos(e.destPos,e.depaPos),t=n.roundPos,i=n.roundDepa;e.destPos=t,e.depaPos=i,e.setTo=this._createUserControll(e.destPos,e.duration),this._axes.trigger(new g("release",Je(Je({},e),{bounceRatio:this._getBounceRatio(t)})))},n.triggerChange=function(e,n,t,i){var r=this;void 0===i&&(i=!1);var o=this.animationManager,a=o.axisManager,s=o.getEventInfo(),u=this._getRoundPos(e,n),l=u.roundPos,c=u.roundDepa,h=a.moveTo(l,c),f=(null==t?void 0:t.event)||(null==s?void 0:s.event)||null,d={pos:h.pos,delta:h.delta,bounceRatio:this._getBounceRatio(h.pos),holding:i,inputEvent:f,isTrusted:!!f,input:(null==t?void 0:t.input)||(null==s?void 0:s.input)||null,set:f?this._createUserControll(h.pos):function(){}},p=new g("change",d);return this._axes.trigger(p),Object.keys(h.pos).forEach((function(e){var n=h.pos[e];Ye(r._axes,e,n).current=n})),f&&a.set(d.set().destPos),!p.isCanceled()},n.triggerAnimationStart=function(e){var n=this._getRoundPos(e.destPos,e.depaPos),t=n.roundPos,i=n.roundDepa;e.destPos=t,e.depaPos=i,e.setTo=this._createUserControll(e.destPos,e.duration);var r=new g("animationStart",e);return this._axes.trigger(r),!r.isCanceled()},n.triggerAnimationEnd=function(e){void 0===e&&(e=!1),this._axes.trigger(new g("animationEnd",{isTrusted:e}))},n.triggerFinish=function(e){void 0===e&&(e=!1),this._axes.trigger(new g("finish",{isTrusted:e}))},n.setAnimationManager=function(e){this.animationManager=e},n.destroy=function(){this._axes.off()},n._createUserControll=function(e,n){void 0===n&&(n=0);var t={destPos:Je({},e),duration:n};return function(e,n){return e&&(t.destPos=Je({},e)),void 0!==n&&(t.duration=n),t}},n._getRoundPos=function(e,n){var t=this._axes.options.round;return{roundPos:Pn(e,t),roundDepa:Pn(n,t)}},n._getBounceRatio=function(e){return this._axes.axisManager.map(e,(function(e,n){return e<n.range[0]&&0!==n.bounce[0]?(n.range[0]-e)/n.bounce[0]:e>n.range[1]&&0!==n.bounce[1]?(e-n.range[1])/n.bounce[1]:0}))},$e([Ge],e.prototype,"holdingCount",void 0),e}(),wn=function(){function e(e){this._options=e,this._prevented=!1}var n=e.prototype;return n.isInterrupting=function(){return this._options.interruptable||this._prevented},n.isInterrupted=function(){return!this._options.interruptable&&this._prevented},n.setInterrupt=function(e){this._options.interruptable||(this._prevented=e)},e}(),In=function(e,n,t,i){var r=e,o=[t[0]?n[0]:i?n[0]-i[0]:n[0],t[1]?n[1]:i?n[1]+i[1]:n[1]];return r=Math.max(o[0],r),r=Math.min(o[1],r)},An=function(e,n){return e<n[0]||e>n[1]},Cn=function(e,n,t){return t[1]&&e>n[1]||t[0]&&e<n[0]},Sn=function(e,n,t){var i=e,r=n[0],o=n[1],a=o-r;return t[1]&&e>o&&(i=(i-o)%a+r),t[0]&&e<r&&(i=(i-r)%a+o),i},kn=function(){function e(e){var n=this;this._axis=e,this._complementOptions(),this._pos=Object.keys(this._axis).reduce((function(e,t){return e[t]=n._axis[t].startPos,e}),{})}var n=e.prototype;return n.getDelta=function(e,n){var t=this.get(e);return vn(this.get(n),(function(e,n){return e-t[n]}))},n.get=function(e){var n=this;return e&&Array.isArray(e)?e.reduce((function(e,t){return t&&t in n._pos&&(e[t]=n._pos[t]),e}),{}):Je(Je({},this._pos),e||{})},n.moveTo=function(e,n){void 0===n&&(n=this._pos);var t=vn(this._pos,(function(t,i){return i in e&&i in n?e[i]-n[i]:0}));return this.set(this.map(e,(function(e,n){return n?Sn(e,n.range,n.circular):0}))),{pos:Je({},this._pos),delta:t}},n.set=function(e){for(var n in e)n&&n in this._pos&&(this._pos[n]=e[n])},n.every=function(e,n){var t=this._axis;return mn(e,(function(e,i){return n(e,t[i],i)}))},n.filter=function(e,n){var t=this._axis;return _n(e,(function(e,i){return n(e,t[i],i)}))},n.map=function(e,n){var t=this._axis;return vn(e,(function(e,i){return n(e,t[i],i)}))},n.isOutside=function(e){return!this.every(e?this.get(e):this._pos,(function(e,n){return!An(e,n.range)}))},n.getAxisOptions=function(e){return this._axis[e]},n.setAxis=function(e){var n=this;Object.keys(e).forEach((function(t){if(!n._axis[t])throw new Error("Axis ".concat(t," does not exist in Axes instance"));n._axis[t]=Je(Je({},n._axis[t]),e[t])})),this._complementOptions()},n._complementOptions=function(){var e=this;Object.keys(this._axis).forEach((function(n){e._axis[n]=Je({range:[0,100],startPos:e._axis[n].range[0],bounce:[0,0],circular:[!1,!1]},e._axis[n]),["bounce","circular"].forEach((function(t){var i=e._axis,r=i[n][t];/string|number|boolean/.test(typeof r)&&(i[n][t]=[r,r])}))}))},e}(),Dn="ontouchstart"in Qe,Mn="PointerEvent"in Qe,Nn=Mn||"MSPointerEvent"in Qe,zn=function(){function e(){var e=this;this._stopContextMenu=function(n){n.preventDefault(),Qe.removeEventListener("contextmenu",e._stopContextMenu)}}var n=e.prototype;return n.extendEvent=function(e){var n,t,i,r=this.prevEvent,o=this._getCenter(e),a=r?this._getMovement(e):{x:0,y:0},s=r?this._getScale(e):1,u=r?(t=o.x-r.center.x,i=o.y-r.center.y,180*Math.atan2(i,t)/Math.PI):0,l=r?r.deltaX+a.x:a.x,c=r?r.deltaY+a.y:a.y,h=a.x,f=a.y,d=this._latestInterval,g=Date.now(),p=d?g-d.timestamp:0,v=r?r.velocityX:0,_=r?r.velocityY:0;return(!d||p>=16)&&(d&&(v=(n=[(l-d.deltaX)/p,(c-d.deltaY)/p])[0],_=n[1]),this._latestInterval={timestamp:g,deltaX:l,deltaY:c}),{srcEvent:e,scale:s,angle:u,center:o,deltaX:l,deltaY:c,offsetX:h,offsetY:f,velocityX:v,velocityY:_,preventSystemEvent:!0}},n._getDistance=function(e,n){var t=n.clientX-e.clientX,i=n.clientY-e.clientY;return Math.sqrt(t*t+i*i)},n._getButton=function(e){var n={1:tn,2:rn,4:on},t=this._isTouchEvent(e)?tn:n[e.buttons];return t||null},n._isTouchEvent=function(e){return e.type&&e.type.indexOf("touch")>-1},n._isValidButton=function(e,n){return n.indexOf(e)>-1},n._isValidEvent=function(e,n,t){return(!n||function(e,n){return!!(!n||n.indexOf("any")>-1||n.indexOf("none")>-1&&!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey||n.indexOf("shift")>-1&&e.shiftKey||n.indexOf("ctrl")>-1&&e.ctrlKey||n.indexOf("alt")>-1&&e.altKey||n.indexOf("meta")>-1&&e.metaKey)}(e,n))&&(!t||this._isValidButton(this._getButton(e),t))},n._preventMouseButton=function(e,n){n===rn?Qe.addEventListener("contextmenu",this._stopContextMenu):n===on&&e.preventDefault()},e}(),jn=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.start=["mousedown"],n.move=["mousemove"],n.end=["mouseup"],n}Ze(n,e);var t=n.prototype;return t.onEventStart=function(e,n,t){var i=this._getButton(e);return this._isValidEvent(e,n,t)?(this._preventMouseButton(e,i),this.extendEvent(e)):null},t.onEventMove=function(e,n,t){return this._isValidEvent(e,n,t)?this.extendEvent(e):null},t.onEventEnd=function(){},t.onRelease=function(){this.prevEvent=null},t.getTouches=function(e,n){return n&&this._isValidButton(an[e.which],n)&&-1===this.end.indexOf(e.type)?1:0},t._getScale=function(){return 1},t._getCenter=function(e){return{x:e.clientX,y:e.clientY}},t._getMovement=function(e){var n=this.prevEvent.srcEvent;return{x:e.clientX-n.clientX,y:e.clientY-n.clientY}},n}(zn),Ln=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.start=["touchstart"],n.move=["touchmove"],n.end=["touchend","touchcancel"],n}Ze(n,e);var t=n.prototype;return t.onEventStart=function(e,n){return this._baseTouches=e.touches,this._isValidEvent(e,n)?this.extendEvent(e):null},t.onEventMove=function(e,n){return this._isValidEvent(e,n)?this.extendEvent(e):null},t.onEventEnd=function(e){this._baseTouches=e.touches},t.onRelease=function(){this.prevEvent=null,this._baseTouches=null},t.getTouches=function(e){return e.touches.length},t._getScale=function(e){return 2!==e.touches.length||this._baseTouches.length<2?null:this._getDistance(e.touches[0],e.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1])},t._getCenter=function(e){return{x:e.touches[0].clientX,y:e.touches[0].clientY}},t._getMovement=function(e){var n=this.prevEvent.srcEvent;return e.touches[0].identifier!==n.touches[0].identifier?{x:0,y:0}:{x:e.touches[0].clientX-n.touches[0].clientX,y:e.touches[0].clientY-n.touches[0].clientY}},n}(zn),Fn=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.start=Mn?["pointerdown"]:["MSPointerDown"],n.move=Mn?["pointermove"]:["MSPointerMove"],n.end=Mn?["pointerup","pointercancel"]:["MSPointerUp","MSPointerCancel"],n._firstInputs=[],n._recentInputs=[],n}Ze(n,e);var t=n.prototype;return t.onEventStart=function(e,n,t){var i=this._getButton(e);return this._isValidEvent(e,n,t)?(this._preventMouseButton(e,i),this._updatePointerEvent(e),this.extendEvent(e)):null},t.onEventMove=function(e,n,t){return this._isValidEvent(e,n,t)?(this._updatePointerEvent(e),this.extendEvent(e)):null},t.onEventEnd=function(e){this._removePointerEvent(e)},t.onRelease=function(){this.prevEvent=null,this._firstInputs=[],this._recentInputs=[]},t.getTouches=function(){return this._recentInputs.length},t._getScale=function(){return 2!==this._recentInputs.length?null:this._getDistance(this._recentInputs[0],this._recentInputs[1])/this._getDistance(this._firstInputs[0],this._firstInputs[1])},t._getCenter=function(e){return{x:e.clientX,y:e.clientY}},t._getMovement=function(e){var n=this.prevEvent.srcEvent;return e.pointerId!==n.pointerId?{x:0,y:0}:{x:e.clientX-n.clientX,y:e.clientY-n.clientY}},t._updatePointerEvent=function(e){var n=this,t=!1;this._recentInputs.forEach((function(i,r){i.pointerId===e.pointerId&&(t=!0,n._recentInputs[r]=e)})),t||(this._firstInputs.push(e),this._recentInputs.push(e))},t._removePointerEvent=function(e){this._firstInputs=this._firstInputs.filter((function(n){return n.pointerId!==e.pointerId})),this._recentInputs=this._recentInputs.filter((function(n){return n.pointerId!==e.pointerId}))},n}(zn),Hn=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.start=["mousedown","touchstart"],n.move=["mousemove","touchmove"],n.end=["mouseup","touchend","touchcancel"],n}Ze(n,e);var t=n.prototype;return t.onEventStart=function(e,n,t){var i=this._getButton(e);return this._isTouchEvent(e)&&(this._baseTouches=e.touches),this._isValidEvent(e,n,t)?(this._preventMouseButton(e,i),this.extendEvent(e)):null},t.onEventMove=function(e,n,t){return this._isValidEvent(e,n,t)?this.extendEvent(e):null},t.onEventEnd=function(e){this._isTouchEvent(e)&&(this._baseTouches=e.touches)},t.onRelease=function(){this.prevEvent=null,this._baseTouches=null},t.getTouches=function(e,n){return this._isTouchEvent(e)?e.touches.length:this._isValidButton(an[e.which],n)&&-1===this.end.indexOf(e.type)?1:0},t._getScale=function(e){return this._isTouchEvent(e)?2!==e.touches.length||this._baseTouches.length<2?1:this._getDistance(e.touches[0],e.touches[1])/this._getDistance(this._baseTouches[0],this._baseTouches[1]):this.prevEvent.scale},t._getCenter=function(e){return this._isTouchEvent(e)?{x:e.touches[0].clientX,y:e.touches[0].clientY}:{x:e.clientX,y:e.clientY}},t._getMovement=function(e){var n=this,t=[e,this.prevEvent.srcEvent].map((function(e){return n._isTouchEvent(e)?{id:e.touches[0].identifier,x:e.touches[0].clientX,y:e.touches[0].clientY}:{id:null,x:e.clientX,y:e.clientY}})),i=t[0],r=t[1];return i.id===r.id?{x:i.x-r.x,y:i.y-r.y}:{x:0,y:0}},n}(zn),Vn=function(e,n){return n.reduce((function(n,t,i){return e[i]&&(n[e[i]]=t),n}),{})};function Bn(e){return e.indexOf("touch")>-1&&{passive:!1}}var Gn,Xn=function(){function e(e){var n=e.options,t=e.interruptManager,i=e.eventManager,r=e.axisManager,o=e.animationManager;this._isOutside=!1,this._moveDistance=null,this._isStopped=!1,this.options=n,this._interruptManager=t,this._eventManager=i,this._axisManager=r,this._animationManager=o}var n=e.prototype;return n.get=function(e){return this._axisManager.get(e.axes)},n.hold=function(e,n){if(!this._interruptManager.isInterrupted()&&e.axes.length){var t={input:e,event:n};this._isStopped=!1,this._interruptManager.setInterrupt(!0),this._animationManager.stopAnimation(t),++this._eventManager.holdingCount,this._moveDistance||this._eventManager.hold(this._axisManager.get(),t),this._isOutside=this._axisManager.isOutside(e.axes),this._moveDistance=this._axisManager.get(e.axes)}},n.change=function(e,n,t,i){if(!this._isStopped&&this._interruptManager.isInterrupting()&&!this._axisManager.every(t,(function(e){return 0===e}))){var r=n.srcEvent?n.srcEvent:n;if(!r.__childrenAxesAlreadyChanged){var o,a=this._moveDistance||this._axisManager.get(e.axes);o=vn(a,(function(e,n){return e+(t[n]||0)})),this._moveDistance&&(this._moveDistance=this._axisManager.map(o,(function(e,n){var t=n.circular,i=n.range;return t&&(t[0]||t[1])?Sn(e,i,t):e}))),this._isOutside&&this._axisManager.every(a,(function(e,n){return!An(e,n.range)}))&&(this._isOutside=!1),a=this._atOutside(a),o=this._atOutside(o),this.options.nested&&this._isEndofAxis(t,a,o)||(r.__childrenAxesAlreadyChanged=!0);var s={input:e,event:n};if(i){var u=this._animationManager.getDuration(o,a);this._animationManager.animateTo(o,u,s)}else{!this._eventManager.triggerChange(o,a,s,!0)&&(this._isStopped=!0,this._moveDistance=null,this._animationManager.finish(!1))}}}},n.release=function(e,n,t,i){if(!this._isStopped&&this._interruptManager.isInterrupting()&&this._moveDistance){var r=n.srcEvent?n.srcEvent:n;r.__childrenAxesAlreadyReleased&&(t=t.map((function(){return 0})));var o=this._axisManager.get(e.axes),a=this._axisManager.get(),s=this._animationManager.getDisplacement(t),u=Vn(e.axes,s),l=this._axisManager.get(this._axisManager.map(u,(function(e,n,t){return n.circular&&(n.circular[0]||n.circular[1])?o[t]+e:In(o[t]+e,n.range,n.circular,n.bounce)})));r.__childrenAxesAlreadyReleased=!0;var c=this._animationManager.getDuration(l,o,i);0===c&&(l=Je({},a));var h={depaPos:a,destPos:l,duration:c,delta:this._axisManager.getDelta(a,l),inputEvent:n,input:e,isTrusted:!0};--this._eventManager.holdingCount,this._eventManager.triggerRelease(h),0===this._eventManager.holdingCount&&(this._moveDistance=null);var f=this._animationManager.getUserControl(h),d=bn(f.destPos,a),g={input:e,event:n};d||0===f.duration?(d||this._eventManager.triggerChange(f.destPos,a,g,!0),this._interruptManager.setInterrupt(!1),this._axisManager.isOutside()?this._animationManager.restore(g):this._eventManager.triggerFinish(!0)):this._animationManager.animateTo(f.destPos,f.duration,g)}},n._atOutside=function(e){var n=this;return this._isOutside?this._axisManager.map(e,(function(e,n){var t=n.range[0]-n.bounce[0],i=n.range[1]+n.bounce[1];return e>i?i:e<t?t:e})):this._axisManager.map(e,(function(e,t){var i=t.range[0],r=t.range[1],o=t.bounce,a=t.circular;return a[0]&&e<i||a[1]&&e>r?e:e<i?i-n._animationManager.interpolate(i-e,o[0]):e>r?r+n._animationManager.interpolate(e-r,o[1]):e}))},n._isEndofAxis=function(e,n,t){return this._axisManager.every(n,(function(i,r,o){return 0===e[o]||n[o]===t[o]&&function(e,n,t,i){return!i[0]&&e===n[0]-t[0]||!i[1]&&e===n[1]+t[1]}(i,r.range,r.bounce,r.circular)}))},e}(),Wn=function(e,n,t){return Math.max(Math.min(e,t),n)},Un=function(){function e(e){var n=e.options,t=e.interruptManager,i=e.eventManager,r=e.axisManager;this._options=n,this.interruptManager=t,this.eventManager=i,this.axisManager=r,this.animationEnd=this.animationEnd.bind(this)}var n=e.prototype;return n.getDuration=function(e,n,t){var i,r=this;if(void 0!==t)i=t;else{var o=vn(n,(function(n,t){return function(e,n){var t=Math.sqrt(e/n*2);return t<100?0:t}(Math.abs(n-e[t]),r._options.deceleration)}));i=Object.keys(o).reduce((function(e,n){return Math.max(e,o[n])}),-1/0)}return Wn(i,this._options.minimumDuration,this._options.maximumDuration)},n.getDisplacement=function(e){var n=Math.pow(e.reduce((function(e,n){return e+n*n}),0),1/e.length),t=Math.abs(n/-this._options.deceleration);return e.map((function(e){return e/2*t}))},n.stopAnimation=function(e){if(this._animateParam){var n=this.axisManager.get(),t=this.axisManager.map(n,(function(e,n){return Sn(e,n.range,n.circular)}));mn(t,(function(e,t){return n[t]===e}))||this.eventManager.triggerChange(t,n,e,!!e),this._animateParam=null,this._raf&&(i=this._raf,dn(i)),this._raf=null,this.eventManager.triggerAnimationEnd(!!(null==e?void 0:e.event))}var i},n.getEventInfo=function(){return this._animateParam&&this._animateParam.input&&this._animateParam.inputEvent?{input:this._animateParam.input,event:this._animateParam.inputEvent}:null},n.restore=function(e){var n=this.axisManager.get(),t=this.axisManager.map(n,(function(e,n){return Math.min(n.range[1],Math.max(n.range[0],e))}));this.stopAnimation(),this.animateTo(t,this.getDuration(n,t),e)},n.animationEnd=function(){var e=this.getEventInfo();this._animateParam=null;var n=this.axisManager.filter(this.axisManager.get(),(function(e,n){return Cn(e,n.range,n.circular)}));Object.keys(n).length>0&&this.setTo(this.axisManager.map(n,(function(e,n){return Sn(e,n.range,n.circular)}))),this.interruptManager.setInterrupt(!1),this.eventManager.triggerAnimationEnd(!!e),this.axisManager.isOutside()?this.restore(e):this.finish(!!e)},n.finish=function(e){this._animateParam=null,this.interruptManager.setInterrupt(!1),this.eventManager.triggerFinish(e)},n.getUserControl=function(e){var n=e.setTo();return n.destPos=this.axisManager.get(n.destPos),n.duration=Wn(n.duration,this._options.minimumDuration,this._options.maximumDuration),n},n.animateTo=function(e,n,t){var i=this;this.stopAnimation();var r=this._createAnimationParam(e,n,t),o=Je({},r.depaPos),a=this.eventManager.triggerAnimationStart(r),s=this.getUserControl(r);if(!a&&this.axisManager.every(s.destPos,(function(e,n){return Cn(e,n.range,n.circular)}))&&console.warn("You can't stop the 'animation' event when 'circular' is true."),a&&!bn(s.destPos,o)){var u=(null==t?void 0:t.event)||null;this._animateLoop({depaPos:o,destPos:s.destPos,duration:s.duration,delta:this.axisManager.getDelta(o,s.destPos),isTrusted:!!u,inputEvent:u,input:(null==t?void 0:t.input)||null},(function(){return i.animationEnd()}))}},n.setTo=function(e,n){void 0===n&&(n=0);var t=Object.keys(e),i=this.axisManager.get(t);if(bn(e,i))return this;this.interruptManager.setInterrupt(!0);var r=_n(e,(function(e,n){return i[n]!==e}));return Object.keys(r).length?(r=this.axisManager.map(r,(function(e,n){var t=n.range,i=n.circular;return i&&(i[0]||i[1])?e:In(e,t,i)})),bn(r,i)||(n>0?this.animateTo(r,n):(this.stopAnimation(),this.eventManager.triggerChange(r),this.finish(!1))),this):this},n.setBy=function(e,n){return void 0===n&&(n=0),this.setTo(vn(this.axisManager.get(Object.keys(e)),(function(n,t){return n+e[t]})),n)},n.setOptions=function(e){this._options=Je(Je({},this._options),e)},n._createAnimationParam=function(e,n,t){var i=this.axisManager.get(),r=e,o=(null==t?void 0:t.event)||null;return{depaPos:i,destPos:r,duration:Wn(n,this._options.minimumDuration,this._options.maximumDuration),delta:this.axisManager.getDelta(i,r),inputEvent:o,input:(null==t?void 0:t.input)||null,isTrusted:!!o,done:this.animationEnd}},n._animateLoop=function(e,n){var t=this;if(e.duration){this._animateParam=Je(Je({},e),{startTime:(new Date).getTime()});var i=vn(e.destPos,(function(e){return e})),r=this._initState(this._animateParam),o=function(){t._raf=null;var e=t._animateParam,a=t._getNextState(r),s=!t.eventManager.triggerChange(a.pos,r.pos);if(r=a,a.finished)return e.destPos=t._getFinalPos(e.destPos,i),bn(e.destPos,t.axisManager.get(Object.keys(e.destPos)))||t.eventManager.triggerChange(e.destPos,a.pos),void n