UNPKG

@egjs/flicking

Version:

Everyday 30 million people experience. It's reliable, flexible and extendable carousel.

9 lines 99.3 kB
/* 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(require("@egjs/component"),require("@egjs/axes"),require("@egjs/imready")):"function"==typeof define&&define.amd?define(["@egjs/component","@egjs/axes","@egjs/imready"],n):(e="undefined"!=typeof globalThis?globalThis:e||self).Flicking=n(e.eg.Component,e.eg.Axes,e.eg.ImReady)}(this,(function(e,n,t){"use strict";var i=function(e,n){return i=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])},i(e,n)};function r(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}i(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var o=function(){return o=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},o.apply(this,arguments)};function a(e,n,t,i){return new(t||(t=Promise))((function(r,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,s)}l((i=i.apply(e,n||[])).next())}))}function s(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(l){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,l])}}}function l(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 u(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(u(arguments[n]));return e}"function"==typeof SuppressedError&&SuppressedError;var h,f={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},d=function(e,n){return e+"("+typeof e+") is not a "+n.map((function(e){return'"'+e+'"'})).join(" or ")+"."},g=function(e){return'Element with selector "'+e+'" not found.'},p=function(e,n){return n+" should be provided. Given: "+e},_='This module is not attached to the Flicking instance. "init()" should be called first.',v=function(e,n){return'Option "'+e+'" is not in correct format, given: '+n},m=function(e,n,t){return'Index "'+e+'" is out of range: should be between '+n+" and "+t+"."},b=function(e){return'Position "'+e+'" is not reachable.'},P="Browser does not support CSS transform.",E="Event stop() is called by user.",O="Animation is interrupted by user input.",y="Animation is already playing.",x="This behavior is not allowed in the frameworks like React, Vue, or Angular.",T="Flicking is not initialized yet, call init() first.",R={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"},I={PREV:"prev",CENTER:"center",NEXT:"next"},A={PREV:"PREV",NEXT:"NEXT",NONE:null},w={SNAP:"snap",FREE_SCROLL:"freeScroll",STRICT:"strict"},C={VIEWPORT:"flicking-viewport",CAMERA:"flicking-camera",VERTICAL:"vertical",HIDDEN:"flicking-hidden",DEFAULT_VIRTUAL:"flicking-panel"},S={LINEAR:"linear",BOUND:"bound"},N={LTR:"ltr",RTL:"rtl"},z={HORIZONTAL:"horizontal",VERTICAL:"vertical"},k={__proto__:null,EVENTS:R,ALIGN:I,DIRECTION:A,MOVE_TYPE:w,CLASS:C,CIRCULAR_FALLBACK:S,ORDER:N,MOVE_DIRECTION:z,ERROR_CODE:f},D=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},j=function(e,n){var t=null;if(q(e)){var i=(n||document).querySelector(e);if(!i)throw new he(g(e),f.ELEMENT_NOT_FOUND);t=i}else e&&e.nodeType===Node.ELEMENT_NODE&&(t=e);if(!t)throw new he(d(e,["HTMLElement","string"]),f.WRONG_TYPE);return t},L=function(e,n){if(null==e)throw new he(p(e,n),f.VAL_MUST_NOT_NULL)},M=function(e,n,t){return Math.max(Math.min(e,t),n)},H=function(e){if(!e)throw new he(_,f.NOT_ATTACHED_TO_FLICKING);return e},F=function(e){return[].slice.call(e)},V=function(e,n){var t;if(q(e))switch(e){case I.PREV:t=0;break;case I.CENTER:t=.5*n;break;case I.NEXT:t=n;break;default:if(null==(t=B(e,n)))throw new he(v("align",e),f.WRONG_OPTION)}else t=e;return t},G=function(e,n){var t;if(Array.isArray(e))t=e.map((function(e){return B(e,n)}));else{var i=B(e,n);t=[i,i]}return t.map((function(n){if(null==n)throw new he(v("bounce",e),f.WRONG_OPTION);return n}))},B=function(e,n){var t=W(e);return null==t?null:t.percentage*n+t.absolute},W=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],l=parseFloat(a);if(i<=0&&(o=o||"+"),!o)return null;var u="+"===o?1:-1;"%"===s?t.percentage+=u*(l/100):t.absolute+=u*l,++i,r=n.exec(e)}return 0===i?null:t},U=function(e){return"object"==typeof e?e.panel:e},X=function(e,n){return e===n?A.NONE:e<n?A.NEXT:A.PREV},Y=function(e){Array.isArray(e)||(e=[e]);var n=[];return e.forEach((function(e){if(q(e)){var t=document.createElement("div");for(t.innerHTML=e,n.push.apply(n,c(F(t.children)));t.firstChild;)t.removeChild(t.firstChild)}else{if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new he(d(e,["HTMLElement","string"]),f.WRONG_TYPE);n.push(e)}})),n},Z=function(e,n){return M(e<0?e+n:e,0,n)},K=function(e,n){var t,i;try{for(var r=l(e),o=r.next();!o.done;o=r.next()){if(o.value===n)return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return!1},q=function(e){return"string"==typeof e},J=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},Q=function(e,n){var t,i;try{for(var r=l(e),o=r.next();!o.done;o=r.next()){var a=o.value;if(n(a))return a}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}return null},$=function(e,n){for(var t=0;t<e.length;t++)if(n(e[t]))return t;return-1},ee=function(e,n,t){return(e-n)/(t-n)},ne=function(e){return e?window.getComputedStyle(e)||e.currentStyle:{}},te=function(e,n){var t=n.width,i=n.height;e&&(null!=t&&(q(t)?e.style.width=t:e.style.width=t+"px"),null!=i&&(q(i)?e.style.height=i:e.style.height=i+"px"))},ie=function(e,n,t){return e>=n&&e<=t},re=function(e,n){return e>=n?e%n:e<0?Z((e+1)%n-1,n):e},oe=function(e){for(var n=new Array(e),t=0;t<e;t++)n[t]=t;return n},ae=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,l="border-box"===o.boxSizing,u=t?parseFloat(o.borderLeftWidth||"0")+parseFloat(o.borderRightWidth||"0"):parseFloat(o.borderTopWidth||"0")+parseFloat(o.borderBottomWidth||"0");if(l)a=r?s:s-u;else{var c=t?parseFloat(o.paddingLeft||"0")+parseFloat(o.paddingRight||"0"):parseFloat(o.paddingTop||"0")+parseFloat(o.paddingBottom||"0");a=r?s+c+u:s+c}}else{var h=t?"Width":"Height";a=r?n["offset"+h]:n["client"+h]}return Math.max(a,0)},se=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},le=function(e){return e.replace(/[\s-_]([a-z])/g,(function(e,n){return n.toUpperCase()}))},ue=function(e,n){for(var t={},i=e.attributes,r=i.length,o=0;o<r;++o){var a=i[o],s=a.name,l=a.value;-1!==s.indexOf(n)&&(t[le(s.replace(n,""))]=l)}return t},ce={__proto__:null,merge:D,getElement:j,checkExistence:L,clamp:M,getFlickingAttached:H,toArray:F,parseAlign:V,parseBounce:G,parseArithmeticSize:B,parseArithmeticExpression:W,parseCSSSizeValue:function(e){return q(e)?e:e+"px"},parsePanelAlign:U,getDirection:X,parseElement:Y,getMinusCompensatedIndex:Z,includes:K,isString:q,circulatePosition:J,find:Q,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:$,getProgress:ee,getStyle:ne,setSize:te,isBetween:ie,circulateIndex:re,range:oe,getElementSize:ae,setPrototypeOf:se,camelize:le,getDataAttributes:ue},he=function(e){function n(t,i){var r=e.call(this,t)||this;return se(r,n.prototype),r.name="FlickingError",r.code=i,r}return r(n,e),n}(Error),fe=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(q(n))i.style.width=n;else{var a=o?n+r.left+r.right:n;i.style.width=a+"px"}if(null!=t)if(q(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=ne(e),t=this._flicking.useFractionalSize;this._width=ae({el:e,horizontal:!0,useFractionalSize:t,useOffset:!1,style:n}),this._height=ae({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}(),de=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:ae({el:o,horizontal:!0,useFractionalSize:t._flicking.useFractionalSize,useOffset:!1,style:ne(o)}),height:ae({el:o,horizontal:!1,useFractionalSize:t._flicking.useFractionalSize,useOffset:!1,style:ne(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}(),ge=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}(),pe=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}(),_e=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:C.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:oe(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();oe(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}(),ve={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},me="flick";!function(e){e[e.IDLE=0]="IDLE",e[e.HOLDING=1]="HOLDING",e[e.DRAGGING=2]="DRAGGING",e[e.ANIMATING=3]="ANIMATING",e[e.DISABLED=4]="DISABLED"}(h||(h={}));var be=function(){function n(){this._delta=0,this._targetPanel=null}var t=n.prototype;return Object.defineProperty(t,"delta",{get:function(){return this._delta},enumerable:!1,configurable:!0}),Object.defineProperty(t,"targetPanel",{get:function(){return this._targetPanel},set:function(e){this._targetPanel=e},enumerable:!1,configurable:!0}),t.onEnter=function(e){this._delta=e._delta,this._targetPanel=e._targetPanel},t.onHold=function(e){},t.onChange=function(e){},t.onRelease=function(e){},t.onAnimationEnd=function(e){},t.onFinish=function(e){},t._moveToChangedPosition=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo,o=i.delta[me];if(o){this._delta+=o;var a=t.camera,s=a.position,l=i.pos[me],u=t.circularEnabled?J(l,a.range.min,a.range.max):l;a.lookAt(u);var c=new e.ComponentEvent(R.MOVE,{isTrusted:i.isTrusted,holding:this.holding,direction:X(0,i.delta[me]),axesEvent:i});t.trigger(c),c.isCanceled()&&(a.lookAt(s),r(h.DISABLED))}},n}(),Pe=function(n){function t(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!1,e}r(t,n);var i=t.prototype;return i.onEnter=function(){this._delta=0,this._targetPanel=null},i.onHold=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo;if(t.renderer.panelCount<=0)r(h.DISABLED);else{var o=new e.ComponentEvent(R.HOLD_START,{axesEvent:i});t.trigger(o),o.isCanceled()?r(h.DISABLED):r(h.HOLDING)}},i.onChange=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo,o=t.control.controller.animatingContext,a=new e.ComponentEvent(R.MOVE_START,{isTrusted:i.isTrusted,holding:this.holding,direction:X(o.start,o.end),axesEvent:i});t.trigger(a),a.isCanceled()?r(h.DISABLED):r(h.ANIMATING).onChange(n)},t}(be),Ee=function(n){function t(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!1,e._releaseEvent=null,e}r(t,n);var i=t.prototype;return i.onChange=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo,o=i.inputEvent;if(o){var a=t.horizontal?o.offsetX:o.offsetY,s=new e.ComponentEvent(R.MOVE_START,{isTrusted:i.isTrusted,holding:this.holding,direction:X(0,-a),axesEvent:i});t.trigger(s),s.isCanceled()?r(h.DISABLED):r(h.DRAGGING).onChange(n)}},i.onRelease=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo;if(t.trigger(new e.ComponentEvent(R.HOLD_END,{axesEvent:i})),0!==i.delta.flick)return i.setTo({flick:t.camera.position},0),void r(h.IDLE);this._releaseEvent=i},i.onFinish=function(n){var t,i,r=n.flicking;if((0,n.transitTo)(h.IDLE),this._releaseEvent){var o,a=this._releaseEvent.inputEvent.srcEvent;if("touchend"===a.type){var s=a.changedTouches[0];o=document.elementFromPoint(s.clientX,s.clientY)}else o=a.target;var u=r.renderer.panels,c=null;try{for(var f=l(u),d=f.next();!d.done;d=f.next()){var g=d.value;if(g.contains(o)){c=g;break}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(i=f.return)&&i.call(f)}finally{if(t)throw t.error}}if(c){var p=r.camera.position,_=c.position;r.trigger(new e.ComponentEvent(R.SELECT,{index:c.index,panel:c,direction:X(p,_)}))}}},t}(be),Oe=function(n){function t(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!0,e}r(t,n);var i=t.prototype;return i.onChange=function(e){this._moveToChangedPosition(e)},i.onRelease=function(n){var t,i=n.flicking,r=n.axesEvent,o=n.transitTo;if(i.trigger(new e.ComponentEvent(R.HOLD_END,{axesEvent:r})),i.renderer.panelCount<=0)o(h.IDLE);else{o(h.ANIMATING);var a=i.control,s=r.destPos[me],l=Math.max(r.duration,i.duration);try{a.moveToPosition(s,l,r)}catch(e){o(h.IDLE),r.setTo(((t={})[me]=i.camera.position,t),0)}}},t}(be),ye=function(n){function t(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}r(t,n);var i=t.prototype;return i.onHold=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo,o=this._targetPanel,a=t.control;this._delta=0,t.control.updateInput(),t.changeOnHold&&o&&a.setActive(o,a.activePanel,i.isTrusted);var s=new e.ComponentEvent(R.HOLD_START,{axesEvent:i});t.trigger(s),s.isCanceled()?r(h.DISABLED):r(h.DRAGGING)},i.onChange=function(e){this._moveToChangedPosition(e)},i.onFinish=function(n){var t=n.flicking,i=n.axesEvent,r=n.transitTo,o=t.control,a=o.controller.animatingContext;r(h.IDLE),t.trigger(new e.ComponentEvent(R.MOVE_END,{isTrusted:i.isTrusted,direction:X(a.start,a.end),axesEvent:i}));var s=this._targetPanel;s&&o.setActive(s,o.activePanel,i.isTrusted)},t}(be),xe=function(e){function n(){var n=null!==e&&e.apply(this,arguments)||this;return n.holding=!1,n.animating=!0,n}r(n,e);var t=n.prototype;return t.onAnimationEnd=function(e){(0,e.transitTo)(h.IDLE)},t.onChange=function(e){var n=e.axesEvent,t=e.transitTo;n.stop(),t(h.IDLE)},t.onRelease=function(e){var n=e.axesEvent,t=e.transitTo;0===n.delta.flick&&t(h.IDLE)},n}(be),Te=function(){function e(){var e=this;this.transitTo=function(n){var t;switch(n){case h.IDLE:t=new Pe;break;case h.HOLDING:t=new Ee;break;case h.DRAGGING:t=new Oe;break;case h.ANIMATING:t=new ye;break;case h.DISABLED:t=new xe}return t.onEnter(e._state),e._state=t,e._state},this._state=new Pe}var n=e.prototype;return Object.defineProperty(n,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),n.fire=function(e,n){var t=this._state,i=o(o({},n),{transitTo:this.transitTo});switch(e){case ve.HOLD:t.onHold(i);break;case ve.CHANGE:t.onChange(i);break;case ve.RELEASE:t.onRelease(i);break;case ve.ANIMATION_END:t.onAnimationEnd(i);break;case ve.FINISH:t.onFinish(i)}},e}(),Re=function(){function e(){var e=this;this._onAxesHold=function(){e._dragged=!1},this._onAxesChange=function(){var n;e._dragged=!!(null===(n=e._panInput)||void 0===n?void 0:n.isEnabled())},this._preventClickWhenDragged=function(n){e._dragged&&(n.preventDefault(),n.stopPropagation()),e._dragged=!1},this._resetInternalValues(),this._stateMachine=new Te}var t=e.prototype;return Object.defineProperty(t,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(t,"panInput",{get:function(){return this._panInput},enumerable:!1,configurable:!0}),Object.defineProperty(t,"stateMachine",{get:function(){return this._stateMachine},enumerable:!1,configurable:!0}),Object.defineProperty(t,"state",{get:function(){return this._stateMachine.state},enumerable:!1,configurable:!0}),Object.defineProperty(t,"animatingContext",{get:function(){return this._animatingContext},enumerable:!1,configurable:!0}),Object.defineProperty(t,"controlParams",{get:function(){var e=this._axes;if(!e)return{range:{min:0,max:0},position:0,circular:!1};var n=e.axis[me];return{range:{min:n.range[0],max:n.range[1]},circular:n.circular[0],position:this.position}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"enabled",{get:function(){var e,n;return null!==(n=null===(e=this._panInput)||void 0===e?void 0:e.isEnabled())&&void 0!==n&&n},enumerable:!1,configurable:!0}),Object.defineProperty(t,"position",{get:function(){var e,n;return null!==(n=null===(e=this._axes)||void 0===e?void 0:e.get([me])[me])&&void 0!==n?n:0},enumerable:!1,configurable:!0}),Object.defineProperty(t,"range",{get:function(){var e,n;return null!==(n=null===(e=this._axes)||void 0===e?void 0:e.axis[me].range)&&void 0!==n?n:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t,"bounce",{get:function(){var e;return null===(e=this._axes)||void 0===e?void 0:e.axis[me].bounce},enumerable:!1,configurable:!0}),t.init=function(e){var t,i=this;this._flicking=e,this._axes=new n(((t={})[me]={range:[0,0],circular:!1,bounce:[0,0]},t),{deceleration:e.deceleration,interruptable:e.interruptable,nested:e.nested,easing:e.easing}),this._panInput=new n.PanInput(e.viewport.element,{inputType:e.inputType,threshold:e.dragThreshold,iOSEdgeSwipeThreshold:e.iOSEdgeSwipeThreshold,preventDefaultOnDrag:e.preventDefaultOnDrag,scale:e.horizontal?[e.camera.panelOrder===N.RTL?1:-1,0]:[0,-1],releaseOnScroll:!0});var r=this._axes;r.connect(e.horizontal?[me,""]:["",me],this._panInput);var o=function(n){var t=ve[n];r.on(t,(function(n){i._stateMachine.fire(t,{flicking:e,axesEvent:n})}))};for(var a in ve)o(a);return this},t.destroy=function(){var e;this._axes&&(this.removePreventClickHandler(),this._axes.destroy()),null===(e=this._panInput)||void 0===e||e.destroy(),this._resetInternalValues()},t.enable=function(){var e;return null===(e=this._panInput)||void 0===e||e.enable(),this},t.disable=function(){var e;return null===(e=this._panInput)||void 0===e||e.disable(),this},t.release=function(){var e;return null===(e=this._panInput)||void 0===e||e.release(),this},t.updateAnimation=function(e,n){var t,i;return this._animatingContext=o(o({},this._animatingContext),{end:e}),null===(i=this._axes)||void 0===i||i.updateAnimation({destPos:(t={},t[me]=e,t),duration:n}),this},t.stopAnimation=function(){var e;return null===(e=this._axes)||void 0===e||e.stopAnimation(),this},t.update=function(e){var n,t=H(this._flicking),i=t.camera,r=this._axes,o=r.axis[me];return o.circular=[e.circular,e.circular],o.range=[e.range.min,e.range.max],o.bounce=G(t.bounce,i.size),r.axisManager.set(((n={})[me]=e.position,n)),this},t.addPreventClickHandler=function(){var e=H(this._flicking),n=this._axes,t=e.camera.element;return n.on(ve.HOLD,this._onAxesHold),n.on(ve.CHANGE,this._onAxesChange),t.addEventListener("click",this._preventClickWhenDragged,!0),this},t.removePreventClickHandler=function(){var e=H(this._flicking),n=this._axes,t=e.camera.element;return n.off(ve.HOLD,this._onAxesHold),n.off(ve.CHANGE,this._onAxesChange),t.removeEventListener("click",this._preventClickWhenDragged,!0),this},t.animateTo=function(e,n,t){var i,r=this,o=this._axes,a=this._stateMachine.state;if(!o)return Promise.reject(new he(_,f.NOT_ATTACHED_TO_FLICKING));var s=o.get([me])[me];if(s===e){var l=H(this._flicking);return l.camera.lookAt(e),a.targetPanel&&l.control.setActive(a.targetPanel,l.control.activePanel,null!==(i=null==t?void 0:t.isTrusted)&&void 0!==i&&i),Promise.resolve()}this._animatingContext={start:s,end:e,offset:0};return new Promise((function(i,a){var s=function(){o.off(ve.HOLD,l),i()},l=function(){o.off(ve.FINISH,s),a(new he(O,f.ANIMATION_INTERRUPTED))};o.once(ve.FINISH,s),o.once(ve.HOLD,l),function(){var i,a;o.once(ve.FINISH,(function(){r._animatingContext={start:0,end:0,offset:0}})),t?t.setTo(((i={})[me]=e,i),n):o.setTo(((a={})[me]=e,a),n)}()}))},t.updateDirection=function(){var e=H(this._flicking),n=this._axes,t=this._panInput;n.disconnect(t),n.connect(e.horizontal?[me,""]:["",me],t),t.options.scale=e.horizontal?[e.camera.panelOrder===N.RTL?1:-1,0]:[0,-1]},t._resetInternalValues=function(){this._flicking=null,this._axes=null,this._panInput=null,this._animatingContext={start:0,end:0,offset:0},this._dragged=!1},e}(),Ie=function(){function n(){this._flicking=null,this._controller=new Re,this._activePanel=null}var t=n.prototype;return Object.defineProperty(t,"controller",{get:function(){return this._controller},enumerable:!1,configurable:!0}),Object.defineProperty(t,"activeIndex",{get:function(){var e,n;return null!==(n=null===(e=this._activePanel)||void 0===e?void 0:e.index)&&void 0!==n?n:-1},enumerable:!1,configurable:!0}),Object.defineProperty(t,"activePanel",{get:function(){return this._activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(t,"animating",{get:function(){return this._controller.state.animating},enumerable:!1,configurable:!0}),Object.defineProperty(t,"holding",{get:function(){return this._controller.state.holding},enumerable:!1,configurable:!0}),t.init=function(e){return this._flicking=e,this._controller.init(e),this},t.destroy=function(){this._controller.destroy(),this._flicking=null,this._activePanel=null},t.enable=function(){return this._controller.enable(),this},t.disable=function(){return this._controller.disable(),this},t.release=function(){return this._controller.release(),this},t.updateAnimation=function(e,n,t){var i=this._controller.state,r=this._getPosition(e,null!=t?t:A.NONE);return i.targetPanel=e,this._controller.updateAnimation(r,n),this},t.stopAnimation=function(){return this._controller.state.targetPanel=null,this._controller.stopAnimation(),this},t.updatePosition=function(e){var n=H(this._flicking).camera,t=this._activePanel;t&&n.lookAt(n.clampToReachablePosition(t.position))},t.updateInput=function(){var e=H(this._flicking).camera;return this._controller.update(e.controlParams),this},t.resetActive=function(){return this._activePanel=null,this},t.moveToPanel=function(e,n){var t=n.duration,i=n.direction,r=void 0===i?A.NONE:i,o=n.axesEvent;return a(this,void 0,void 0,(function(){var n;return s(this,(function(i){return n=this._getPosition(e,r),this._triggerIndexChangeEvent(e,e.position,o,r),[2,this._animateToPosition({position:n,duration:t,newActivePanel:e,axesEvent:o})]}))}))},t.setActive=function(n,t,i){var r,o=H(this._flicking);this._activePanel=n,this._nextPanel=null,o.camera.updateAdaptiveHeight(),n!==t?o.trigger(new e.ComponentEvent(R.CHANGED,{index:n.index,panel:n,prevIndex:null!==(r=null==t?void 0:t.index)&&void 0!==r?r:-1,prevPanel:t,isTrusted:i,direction:t?X(t.position,n.position):A.NONE})):o.trigger(new e.ComponentEvent(R.RESTORED,{isTrusted:i}))},t.copy=function(e){this._flicking=e._flicking,this._activePanel=e._activePanel,this._controller=e._controller},t._triggerIndexChangeEvent=function(n,t,i,r){var o,a=H(this._flicking),s=n!==this._activePanel?R.WILL_CHANGE:R.WILL_RESTORE,l=a.camera,u=this._activePanel,c=new e.ComponentEvent(s,{index:n.index,panel:n,isTrusted:(null==i?void 0:i.isTrusted)||!1,direction:null!=r?r:X(null!==(o=null==u?void 0:u.position)&&void 0!==o?o:l.position,t)});if(this._nextPanel=n,a.trigger(c),c.isCanceled())throw new he(E,f.STOP_CALLED_BY_USER)},t._animateToPosition=function(e){var n=e.position,t=e.duration,i=e.newActivePanel,r=e.axesEvent;return a(this,void 0,void 0,(function(){var e,o,l=this;return s(this,(function(u){return e=H(this._flicking),o=function(){return l._controller.animateTo(n,t,r)},this._controller.state.targetPanel=i,t<=0?[2,o()]:[2,o().then((function(){return a(l,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,e.renderer.render()];case 1:return n.sent(),[2]}}))}))})).catch((function(e){if(!(r&&e instanceof he&&e.code===f.ANIMATION_INTERRUPTED))throw e}))]}))}))},t._getPosition=function(e,n){void 0===n&&(n=A.NONE);var t=H(this._flicking),i=t.camera,r=e.position,o=i.findNearestAnchor(r);if(e.removed||!o)throw new he(b(e.position),f.POSITION_NOT_REACHABLE);if(i.canReach(e)){if(t.circularEnabled){var a=this._controller.position,s=i.rangeDiff,l=[r,r+s,r-s].filter((function(e){return n===A.NONE||(n===A.PREV?e<=a:e>=a)}));r=l.reduce((function(e,n){return Math.abs(a-n)<Math.abs(a-e)?n:e}),1/0)}}else r=o.position,e=o.panel;return r},n}(),Ae=function(){function e(e){var n=e.index,t=e.position,i=e.panel;this._index=n,this._pos=t,this._panel=i}var n=e.prototype;return Object.defineProperty(n,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(n,"position",{get:function(){return this._pos},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),e}(),we=function(e){function n(n){var t=(void 0===n?{}:n).count,i=void 0===t?1/0:t,r=e.call(this)||this;return r._count=i,r}r(n,e);var t=n.prototype;return Object.defineProperty(t,"count",{get:function(){return this._count},set:function(e){this._count=e},enumerable:!1,configurable:!0}),t.moveToPosition=function(e,n,t){var i=H(this._flicking),r=i.camera,o=r.findActiveAnchor(),a=r.findNearestAnchor(r.position),s=this._controller.state;if(!o||!a)return Promise.reject(new he(b(e),f.POSITION_NOT_REACHABLE));var l,u=this._calcSnapThreshold(i.threshold,e,o),c=i.animating?s.delta:e-r.position,h=Math.abs(c),d=t&&0!==t.delta[me]?Math.abs(t.delta[me]):h;if(d>=u&&d>0)l=this._findSnappedAnchor(e,a);else{if(!(h>=i.threshold&&h>0))return this.moveToPanel(a.panel,{duration:n,axesEvent:t});l=this._findAdjacentAnchor(e,c,a)}return this._triggerIndexChangeEvent(l.panel,e,t),this._animateToPosition({position:r.clampToReachablePosition(l.position),duration:n,newActivePanel:l.panel,axesEvent:t})},t._findSnappedAnchor=function(e,n){var t=H(this._flicking),i=t.camera,r=this._count,o=i.position,a=i.clampToReachablePosition(e),s=i.findAnchorIncludePosition(a);if(!n||!s)throw new he(b(e),f.POSITION_NOT_REACHABLE);if(!isFinite(r))return s;var l=t.panelCount,u=i.anchorPoints,c=Math.sign(e-o)*Math.floor(Math.abs(e-o)/i.rangeDiff);e>o&&s.index<n.index||s.position>n.position&&s.index===n.index?c+=1:(e<o&&s.index>n.index||s.position<n.position&&s.index===n.index)&&(c-=1);var h=c*l,d=s.index+h;if(Math.abs(d-n.index)<=r){var g=u[s.index];return new Ae({index:g.index,position:g.position+c*i.rangeDiff,panel:g.panel})}if(t.circularEnabled){var p=u[re(n.index+Math.sign(e-o)*r,l)],_=Math.floor(r/l);return e>o&&p.index<n.index?_+=1:e<o&&p.index>n.index&&(_-=1),new Ae({index:p.index,position:p.position+_*i.rangeDiff,panel:p.panel})}return u[M(n.index+Math.sign(e-o)*r,0,u.length-1)]},t._findAdjacentAnchor=function(e,n,t){var i,r=H(this._flicking).camera;if(r.circularEnabled){var o=r.findAnchorIncludePosition(e);if(o&&o.position!==t.position)return o}return null!==(i=n>0?r.getNextAnchor(t):r.getPrevAnchor(t))&&void 0!==i?i:t},t._calcSnapThreshold=function(e,n,t){var i=n>t.position,r=t.panel,o=r.size,a=r.alignPosition;return Math.max(e,i?o-a+r.margin.next:a+r.margin.prev)},n}(Ie),Ce=function(e){function n(n){var t=(void 0===n?{}:n).stopAtEdge,i=void 0===t||t,r=e.call(this)||this;return r._stopAtEdge=i,r}r(n,e);var t=n.prototype;return Object.defineProperty(t,"stopAtEdge",{get:function(){return this._stopAtEdge},set:function(e){this._stopAtEdge=e},enumerable:!1,configurable:!0}),t.updatePosition=function(e){var n=H(this._flicking).camera,t=this._activePanel;if(t){var i=t.range,r=i.min+(i.max-i.min)*e;n.lookAt(n.clampToReachablePosition(r))}},t.moveToPosition=function(e,n,t){var i=H(this._flicking).camera,r=i.clampToReachablePosition(e),o=i.findAnchorIncludePosition(r);if(!o)return Promise.reject(new he(b(e),f.POSITION_NOT_REACHABLE));var a=o.panel;return a!==this._activePanel&&this._triggerIndexChangeEvent(a,e,t),this._animateToPosition({position:this._stopAtEdge?r:e,duration:n,newActivePanel:a,axesEvent:t})},n}(Ie),Se=function(e){function n(n){var t=(void 0===n?{}:n).count,i=void 0===t?1:t,r=e.call(this)||this;return r.setActive=function(n,t,i){e.prototype.setActive.call(r,n,t,i),r.updateInput()},r._count=i,r._resetIndexRange(),r}r(n,e);var t=n.prototype;return Object.defineProperty(t,"count",{get:function(){return this._count},set:function(e){this._count=e},enumerable:!1,configurable:!0}),t.destroy=function(){e.prototype.destroy.call(this),this._resetIndexRange()},t.updateInput=function(){var e,n=H(this._flicking),t=n.camera,i=n.renderer,r=this._controller,o=t.controlParams,a=this._count,s=r.state.animating?null===(e=t.findNearestAnchor(t.position))||void 0===e?void 0:e.panel:this._activePanel;if(!s)return r.update(o),this._resetIndexRange(),this;var l=o.range,u=s.position,c=s.index,h=i.panelCount,f=c-a,d=c+a;f<0&&(f=n.circularEnabled?Z((f+1)%h-1,h):M(f,0,h-1)),d>=h&&(d=n.circularEnabled?d%h:M(d,0,h-1));var g=i.panels[f],p=i.panels[d],_=Math.max(g.position,l.min),v=Math.min(p.position,l.max);return _>u&&(_-=t.rangeDiff),v<u&&(v+=t.rangeDiff),o.range={min:_,max:v},o.circular&&(o.position<_&&(o.position+=t.rangeDiff),o.position>v&&(o.position-=t.rangeDiff)),o.circular=!1,r.update(o),this._indexRange={min:g.index,max:p.index},this},t.moveToPanel=function(n,t){return a(this,void 0,void 0,(function(){var i,r;return s(this,(function(o){return i=H(this._flicking),r=i.camera,this._controller.update(r.controlParams),[2,e.prototype.moveToPanel.call(this,n,t)]}))}))},t.moveToPosition=function(e,n,t){var i,r=H(this._flicking),o=r.camera,a=null!==(i=this._nextPanel)&&void 0!==i?i:this._activePanel,s=this._controller.range,l=this._indexRange,u=o.range,c=this._controller.state,h=M(o.clampToReachablePosition(e),s[0],s[1]),d=o.findAnchorIncludePosition(h);if(!d||!a)return Promise.reject(new he(b(e),f.POSITION_NOT_REACHABLE));var g,p,_=a.position,v=r.animating?c.delta:e-o.position,m=Math.abs(v)>=r.threshold,P=e>_?o.getNextAnchor(d):o.getPrevAnchor(d),E=o.anchorPoints,O=E[0],y=E[E.length-1],x=e<=u.min&&ie(O.panel.index,l.min,l.max),T=e>=u.max&&ie(y.panel.index,l.min,l.max),R=P&&(l.min<=l.max?ie(P.index,l.min,l.max):P.index>=l.min||P.index<=l.max);if(x||T){var I=e<u.min?O:y;p=I.panel,g=I.position}else if(m&&d.position!==a.position)p=d.panel,g=d.position;else{if(!m||!R){var A=o.findNearestAnchor(o.position);return A?this.moveToPanel(A.panel,{duration:n,axesEvent:t}):Promise.reject(new he(b(e),f.POSITION_NOT_REACHABLE))}p=P.panel,g=P.position}return this._triggerIndexChangeEvent(p,e,t),this._animateToPosition({position:g,duration:n,newActivePanel:p,axesEvent:t})},t._resetIndexRange=function(){this._indexRange={min:0,max:0}},n}(Ie),Ne={__proto__:null,Control:Ie,SnapControl:we,FreeControl:Ce,StrictControl:Se,AxesController:Re,State:be,IdleState:Pe,HoldingState:Ee,DraggingState:Oe,AnimatingState:ye,DisabledState:xe,StateMachine:Te},ze=function(){function e(e){this._flicking=e}var n=e.prototype;return n.getAnchors=function(){return this._flicking.renderer.panels.map((function(e,n){return new Ae({index:n,position:e.position,panel:e})}))},n.findAnchorIncludePosition=function(e){return this._flicking.camera.anchorPoints.filter((function(n){return n.panel.includePosition(e,!0)})).reduce((function(n,t){return n&&Math.abs(n.position-e)<Math.abs(t.position-e)?n:t}),null)},n.findNearestAnchor=function(e){var n=this._flicking.camera.anchorPoints;if(n.length<=0)return null;for(var t=1/0,i=0;i<n.length;i++){var r=n[i],o=Math.abs(r.position-e);if(o>t)return n[i-1];t=o}return n[n.length-1]},n.clampToReachablePosition=function(e){var n=this._flicking.camera.range;return M(e,n.min,n.max)},n.getCircularOffset=function(){return 0},n.canReach=function(e){var n=this._flicking.camera.range;if(e.removed)return!1;var t=e.position;return t>=n.min&&t<=n.max},n.canSee=function(e){var n=this._flicking.camera.visibleRange;return e.isVisibleOnRange(n.min,n.max)},e}(),ke=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}r(n,e);var t=n.prototype;return t.checkAvailability=function(){return!0},t.getRange=function(){var e,n,t=this._flicking.renderer,i=t.getPanel(0),r=t.getPanel(t.panelCount-1);return{min:null!==(e=null==i?void 0:i.position)&&void 0!==e?e:0,max:null!==(n=null==r?void 0:r.position)&&void 0!==n?n:0}},n}(ze),De=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}r(n,e);var t=n.prototype;return t.checkAvailability=function(){var e=this._flicking,n=e.renderer.panels;if(n.length<=0)return!1;var t=n[0],i=n[n.length-1],r=t.range.min-t.margin.prev,o=i.range.max+i.margin.next,a=e.camera.size,s=o-r;return n.every((function(e){return s-e.size>=a}))},t.getRange=function(){var e=this._flicking.renderer.panels;if(e.length<=0)return{min:0,max:0};var n=e[0],t=e[e.length-1];return{min:n.range.min-n.margin.prev,max:t.range.max+t.margin.next}},t.getAnchors=function(){return this._flicking.renderer.panels.map((function(e,n){return new Ae({index:n,position:e.position,panel:e})}))},t.findNearestAnchor=function(e){var n=this._flicking.camera,t=n.anchorPoints;if(t.length<=0)return null;for(var i=n.range,r=1/0,o=-1,a=0;a<t.length;a++){var s=t[a],l=Math.min(Math.abs(s.position-e),Math.abs(s.position-i.min+i.max-e),Math.abs(e-i.min+i.max-s.position));l<r&&(r=l,o=a)}return t[o]},t.findAnchorIncludePosition=function(n){var t=this._flicking.camera,i=t.range,r=t.anchorPoints,o=t.rangeDiff,a=r.length,s=J(n,i.min,i.max),l=e.prototype.findAnchorIncludePosition.call(this,s);if(a>0&&(n===i.min||n===i.max)){var u=[l,new Ae({index:0,position:r[0].position+o,panel:r[0].panel}),new Ae({index:a-1,position:r[a-1].position-o,panel:r[a-1].panel})].filter((function(e){return!!e}));l=u.reduce((function(e,t){return e&&Math.abs(e.position-n)<Math.abs(t.position-n)?e:t}),null)}if(!l)return null;if(n<i.min){var c=-Math.floor((i.min-n)/o)-1;return new Ae({index:l.index,position:l.position+o*c,panel:l.panel})}if(n>i.max){c=Math.floor((n-i.max)/o)+1;return new Ae({index:l.index,position:l.position+o*c,panel:l.panel})}return l},t.getCircularOffset=function(){var e=this._flicking;if(!e.camera.circularEnabled)return 0;var n=e.panels.filter((function(e){return e.toggled})),t=n.filter((function(e){return e.toggleDirection===A.PREV})),i=n.filter((function(e){return e.toggleDirection===A.NEXT}));return this._calcPanelAreaSum(t)-this._calcPanelAreaSum(i)},t.clampToReachablePosition=function(e){return e},t.canReach=function(e){return!e.removed},t.canSee=function(n){var t=this._flicking.camera,i=t.range,r=t.rangeDiff,o=t.visibleRange,a=e.prototype.canSee.call(this,n);return o.min<i.min?a||n.isVisibleOnRange(o.min+r,o.max+r):o.max>i.max?a||n.isVisibleOnRange(o.min-r,o.max-r):a},t._calcPanelAreaSum=function(e){return e.reduce((function(e,n){return e+n.sizeIncludingMargin}),0)},n}(ze),je=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}r(n,e);var t=n.prototype;return t.checkAvailability=function(){var e=this._flicking,n=e.renderer,t=n.getPanel(0),i=n.getPanel(n.panelCount-1);if(!t||!i)return!1;var r=e.camera.size,o=t.range.min;return r<i.range.max-o},t.getRange=function(){var e=this._flicking,n=e.renderer,t=e.camera.alignPosition,i=n.getPanel(0),r=n.getPanel(n.panelCount-1);if(!i||!r)return{min:0,max:0};var o=e.camera.size,a=i.range.min,s=r.range.max,l=a+t,u=s-o+t;if(o<s-a)return{min:l,max:u};var c=e.camera.align,h="object"==typeof c?c.camera:c,f=l+V(h,u-l);return{min:f,max:f}},t.getAnchors=function(){var e=this._flicking,n=e.camera,t=e.renderer.panels;if(t.length<=0)return[];var i=e.camera.range,r=t.filter((function(e){return n.canReach(e)}));if(r.length>0){var o=r[0].position!==i.min,a=r[r.length-1].position!==i.max,s=o?1:0,l=r.map((function(e,n){return new Ae({index:n+s,position:e.position,panel:e})}));return o&&l.splice(0,0,new Ae({index:0,position:i.min,panel:t[r[0].index-1]})),a&&l.push(new Ae({index:l.length,position:i.max,panel:t[r[r.length-1].index+1]})),l}if(i.min!==i.max){var u=this._findNearestPanel(i.min,t),c=u.index===t.length-1?u.prev():u,h=c.next();return[new Ae({index:0,position:i.min,panel:c}),new Ae({index:1,position:i.max,panel:h})]}return[new Ae({index:0,position:i.min,panel:this._findNearestPanel(i.min,t)})]},t.findAnchorIncludePosition=function(n){var t=this._flicking.camera,i=t.range,r=t.anchorPoints;return r.length<=0?null:n<=i.min?r[0]:n>=i.max?r[r.length-1]:e.prototype.findAnchorIncludePosition.call(this,n)},t._findNearestPanel=function(e,n){for(var t=1/0,i=0;i<n.length;i++){var r=n[i],o=Math.abs(r.position-e);if(o>t)return n[i-1];t=o}return n[n.length-1]},n}(ze),Le=function(){function n(e,n){var t=this,i=(void 0===n?{}:n).align,r=void 0===i?I.CENTER:i;this._lookedOffset=0,this._checkTranslateSupport=function(){var e,n,i=document.documentElement.style,r="";try{for(var o=l(["webkitTransform","msTransform","MozTransform","OTransform","transform"]),a=o.next();!a.done;a=o.next()){var s=a.value;s in i&&(r=s)}}catch(n){e={error:n}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}if(!r)throw new he(P,f.TRANSFORM_NOT_SUPPORTED);t._transform=r},this._flicking=e,this._resetInternalValues(),this._align=r}var t=n.prototype;return Object.defineProperty(t,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(t,"children",{get:function(){return F(this._el.children)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(t,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(t,"offset",{get:function(){return this._offset-this._circularOffset},enumerable:!1,configurable:!0}),Object.defineProperty(t,"circularEnabled",{get:function(){return this._circularEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t,"mode",{get:function(){return this._mode},enumerable:!1,configurable:!0}),Object.defineProperty(t,"range",{get:function(){return this._range},enumerable:!1,configurable:!0}),Object.defineProperty(t,"rangeDiff",{get:function(){return this._range.max-this._range.min},enumerable:!1,configurable:!0}),Object.defineProperty(t,"visiblePanels",{get:function(){return this._visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(t,"visibleRange",{get:function(){return{min:this._position-this._alignPos,max:this._position-this._alignPos+this.size}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"anchorPoints",{get:function(){return this._anchors},enumerable:!1,configurable:!0}),Object.defineProperty(t,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:this._circularEnabled}},enumerable:!1,configurable:!0}),Object.defineProperty(t,"atEdge",{get:function(){return this._position<=this._range.min||this._position>=this._range.max},enumerable:!1,configurable:!0}),Object.defineProperty(t,"size",{get:function(){var e=this._flicking;return e?e.horizontal?e.viewport.width:e.viewport.height:0},enumerable:!1,configurable:!0}),Object.defineProperty(t,"progress",{get:function(){var e=this._flicking,n=this._position+this._offset,t=this.findNearestAnchor(this._position);if(!e||!t)return NaN;var i=t.panel,r=i.position+i.offset,o=e.control.controller.bounce,a=this.range,s=a.min,l=a.max,u=this.rangeDiff;if(n===r)return i.index;if(n<r){var c=i.prev(),h=c?c.position+c.offset:s-o[0];return h>r&&(h-=u),i.index-1+ee(n,h,r)}var f=i.next(),d=f?f.position+f.offset:l+o[1];return d<r&&(d+=u),i.index+ee(n,r,d)},enumerable:!1,configurable:!0}),Object.defineProperty(t,"panelOrder",{get:function(){return this._panelOrder},enumerable:!1,configurable:!0}),Object.defineProperty(t,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),t.init=function(){var e=this._flicking.viewport.element;return L(e.firstElementChild,"First element child of the viewport element"),this._el=e.firstElementChild,this._checkTranslateSupport(),this._updateMode(),this.updatePanelOrder(),this},t.destroy=function(){return this._resetInternalValues(),this},t.lookAt=function(e){var n=this,t=this._offset,i=this._lookedOffset!==t,r=H(this._flicking),o=this._position;this._position=e;var a=this._togglePanels(o,e);this._refreshVisiblePanels(),this._checkNeedPanel(),this._checkReachEnd(o,e),a?r.renderer.render().then((function(){n.updateOffset(),n._lookedOffset=n._offset})):i?(this.updateOffset(),this._lookedOffset=this._offset):this.applyTransform()},t.getPrevAnchor=function(e){if(this._circularEnabled&&0===e.index){var n=this._anchors,t=this.rangeDiff,i=n[n.length-1];return new Ae({index:i.index,position:i.position-t,panel:i.panel})}return this._anchors[e.index-1]||null},t.getNextAnchor=function(e){var n=this._anchors;if(this._circularEnabled&&e.index===n.length-1){var t=this.rangeDiff,i=n[0];return new Ae({index:i.index,position:i.position+t,panel:i.panel})}return n[e.index+1]||null},t.getProgressInPanel=function(e){var n=e.range;return(this._position-n.min)/(n.max-n.min)},t.findAnchorIncludePosition=function(e){return this._mode.findAnchorIncludePosition(e)},t.findNearestAnchor=function(e){return this._mode.findNearestAnchor(e)},t.findActiveAnchor=function(){var e,n=H(this._flicking).control.activePanel;return n?null!==(e=Q(this._anchors,(function(e){return e.panel.index===n.index})))&&void 0!==e?e:this.findNearestAnchor(n.position):null},t.clampToReachablePosition=function(e){return this._mode.clampToReachablePosition(e)},t.canReach=function(e){return this._mode.canReach(e)},t.canSee=function(e){return this._mode.canSee(e)},t.updateRange=function(){var e=H(this._flicking).renderer.panels;return this._updateMode(),this._range=this._mode.getRange(),e.forEach((function(e){return e.updateCircularToggleDirection()})),this},t.updateAlignPos=function(){var e=this._align,n="object"==typeof e?e.camera:e;return this._alignPos=V(n,this.size),this},t.updateAnchors=function(){return this._anchors=this._mode.getAnchors(),this},t.updateAdaptiveHeight=function(){var e=H(this._flicking),n=e.control.activePanel,t=c(e.visiblePanels);if(n&&t.push(n),e.horizontal&&e.adaptive&&t.length){var i=Math.max.apply(Math,c(t.map((function(e){return e.height}))));e.viewport.setSize({height:i})}},t.updateOffset=f