UNPKG

70 kBJavaScriptView Raw
1/*
2Copyright (c) 2015-present NAVER Corp.
3name: @egjs/flicking
4license: MIT
5author: NAVER Corp.
6repository: https://github.com/naver/egjs-flicking
7version: 4.3.0
8*/
9!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(c,o,n){"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])})(e,n)};function a(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 r=function(){return(r=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}).apply(this,arguments)};function h(e,a,s,l){return new(s=s||Promise)(function(t,n){function i(e){try{o(l.next(e))}catch(e){n(e)}}function r(e){try{o(l.throw(e))}catch(e){n(e)}}function o(e){var n;e.done?t(e.value):((n=e.value)instanceof s?n:new s(function(e){e(n)})).then(i,r)}o((l=l.apply(e,a||[])).next())})}function v(t,i){var r,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:n(0),throw:n(1),return:n(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function n(n){return function(e){return function(n){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,o&&(a=2&n[0]?o.return:n[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,n[1])).done)return a;switch(o=0,(n=a?[2&n[0],a.value]:n)[0]){case 0:case 1:a=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,o=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===n[0]||2===n[0])){s=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){s.label=n[1];break}if(6===n[0]&&s.label<a[1]){s.label=a[1],a=n;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(n);break}a[2]&&s.ops.pop(),s.trys.pop();continue}n=i.call(t,s)}catch(e){n=[6,e],o=0}finally{r=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,e])}}}function f(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{value:(e=e&&i>=e.length?void 0:e)&&e[i++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(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||0<n--)&&!(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 g(e,n){for(var t=0,i=n.length,r=e.length;t<i;t++,r++)e[r]=n[t];return e}function e(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.forEach(function(n){Object.keys(n).forEach(function(e){t[e]=n[e]})}),t}function m(e,n){if(!e)throw new j(R.NOT_ATTACHED_TO_FLICKING(n),C.NOT_ATTACHED_TO_FLICKING);return e}function s(e){return[].slice.call(e)}function l(e,n){var t;if(S(e))switch(e){case w.PREV:t=0;break;case w.CENTER:t=.5*n;break;case w.NEXT:t=n;break;default:if(null==(t=u(e,n)))throw new j(R.WRONG_OPTION("align",e),C.WRONG_OPTION)}else t=e;return t}function u(e,n){return null==(e=D(e))?null:e.percentage*n+e.absolute}function _(e,n){return e===n?N.NONE:e<n?N.NEXT:N.PREV}function p(e){Array.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e){if(S(e)){var n=document.createElement("div");for(n.innerHTML=e,t.push.apply(t,g([],d(s(n.children))));n.firstChild;)n.removeChild(n.firstChild)}else{if(!e||e.nodeType!==Node.ELEMENT_NODE)throw new j(R.WRONG_TYPE(e,["HTMLElement","string"]),C.WRONG_TYPE);t.push(e)}}),t}function b(e,n){return k(e<0?e+n:e,0,n)}function E(e,n){var t,i;try{for(var r=f(e),o=r.next();!o.done;o=r.next())if(o.value===n)return 1}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}}function P(e,n,t){var i=t-n;return e<n?e=t-(n-e)%i:t<e&&(e=n+(e-t)%i),e}function O(e,n,t){return(e-n)/(t-n)}function y(e){return window.getComputedStyle(e)||e.currentStyle}function x(e,n,t){return n<=e&&e<=t}var t,C={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},R={WRONG_TYPE:function(e,n){return e+"("+typeof e+") is not a "+n.map(function(e){return'"'+e+'"'}).join(" or ")+"."},ELEMENT_NOT_FOUND:function(e){return'Element with selector "'+e+'" not found.'},VAL_MUST_NOT_NULL:function(e,n){return n+" should be provided. Given: "+e},NOT_ATTACHED_TO_FLICKING:function(e){return e+' is not attached to the Flicking instance. "init()" should be called first.'},WRONG_OPTION:function(e,n){return'Option "'+e+'" is not in correct format, given: '+n},INDEX_OUT_OF_RANGE:function(e,n,t){return'Index "'+e+'" is out of range: should be between '+n+" and "+t+"."},POSITION_NOT_REACHABLE:function(e){return'Position "'+e+'" is not reachable.'},TRANSFORM_NOT_SUPPORTED:"Browser does not support CSS transform.",STOP_CALLED_BY_USER:"Event stop() is called by user.",ANIMATION_INTERRUPTED:"Animation is interrupted by user input.",ANIMATION_ALREADY_PLAYING:"Animation is already playing.",NOT_ALLOWED_IN_FRAMEWORK:"This behavior is not allowed in the frameworks like React, Vue, or Angular.",NOT_INITIALIZED:"Flicking is not initialized yet, call init() first.",NO_ACTIVE:"There's no active panel that Flicking has selected. This may be due to the absence of any panels."},T={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"},w={PREV:"prev",CENTER:"center",NEXT:"next"},N={PREV:"PREV",NEXT:"NEXT",NONE:null},A={SNAP:"snap",FREE_SCROLL:"freeScroll",STRICT:"strict"},I={__proto__:null,EVENTS:T,ALIGN:w,DIRECTION:N,MOVE_TYPE:A,ERROR_CODE:C},k=function(e,n,t){return Math.max(Math.min(e,t),n)},D=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],a=parseFloat(a);if(!(o=i<=0?o||"+":o))return null;o="+"===o?1:-1;"%"===s?t.percentage+=a/100*o:t.absolute+=o*a,++i,r=n.exec(e)}return 0===i?null:t},S=function(e){return"string"==typeof e},L=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},j=(a(z,t=Error),z);function z(e,n){e=t.call(this,e)||this;return L(e,z.prototype),e.name="FlickingError",e.code=n,e}var M=(le=H.prototype,Object.defineProperty(le,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(le,"width",{get:function(){return this._width-this._padding.left-this._padding.right},enumerable:!1,configurable:!0}),Object.defineProperty(le,"height",{get:function(){return this._height-this._padding.top-this._padding.bottom},enumerable:!1,configurable:!0}),Object.defineProperty(le,"padding",{get:function(){return this._padding},enumerable:!1,configurable:!0}),le.setSize=function(e){var n=e.width,t=e.height,i=this._el,r=this._padding,e=this._isBorderBoxSizing;null!=n&&(S(n)?i.style.width=n:(n=e?n+r.left+r.right:n,i.style.width=n+"px")),null!=t&&(S(t)?i.style.height=t:(t=e?t+r.top+r.bottom:t,i.style.height=t+"px")),this.resize()},le.resize=function(){var e=this._el,n=y(e);this._width=e.clientWidth,this._height=e.clientHeight,this._padding={left:parseFloat(n.paddingLeft),right:parseFloat(n.paddingRight),top:parseFloat(n.paddingTop),bottom:parseFloat(n.paddingBottom)},this._isBorderBoxSizing="border-box"===n.boxSizing},H);function H(e){this._el=e,this._width=0,this._height=0,this._padding={left:0,right:0,top:0,bottom:0},this._isBorderBoxSizing=!1}var G,F={HOLD:"hold",CHANGE:"change",RELEASE:"release",ANIMATION_END:"animationEnd",FINISH:"finish"},V="flick";(ee=G=G||{})[ee.IDLE=0]="IDLE",ee[ee.HOLDING=1]="HOLDING",ee[ee.DRAGGING=2]="DRAGGING",ee[ee.ANIMATING=3]="ANIMATING",ee[ee.DISABLED=4]="DISABLED";var B=(_e=W.prototype,Object.defineProperty(_e,"delta",{get:function(){return this._delta},enumerable:!1,configurable:!0}),Object.defineProperty(_e,"targetPanel",{get:function(){return this._targetPanel},set:function(e){this._targetPanel=e},enumerable:!1,configurable:!0}),_e.onEnter=function(e){this._delta=e._delta,this._targetPanel=e._targetPanel},_e.onHold=function(e){},_e.onChange=function(e){},_e.onRelease=function(e){},_e.onAnimationEnd=function(e){},_e.onFinish=function(e){},_e._moveToChangedPosition=function(e){var n,t=e.flicking,i=e.axesEvent,r=e.transitTo,o=i.delta[V];o&&(this._delta+=o,e=(n=t.camera).position,o=i.pos[V],o=t.circularEnabled?P(o,n.range.min,n.range.max):o,n.lookAt(o),i=new c.ComponentEvent(T.MOVE,{isTrusted:i.isTrusted,holding:this.holding,direction:_(0,i.delta[V]),axesEvent:i}),t.trigger(i),i.isCanceled()&&(n.lookAt(e),r(G.DISABLED)))},W);function W(){this._delta=0,this._targetPanel=null}var U=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!1,e}a(e,n);var t=e.prototype;return t.onEnter=function(){this._delta=0,this._targetPanel=null},t.onHold=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;n.renderer.panelCount<=0?e(G.DISABLED):(t=new c.ComponentEvent(T.HOLD_START,{axesEvent:t}),n.trigger(t),t.isCanceled()?e(G.DISABLED):e(G.HOLDING))},t.onChange=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=n.control.controller.animatingContext,t=new c.ComponentEvent(T.MOVE_START,{isTrusted:t.isTrusted,holding:this.holding,direction:_(r.start,r.end),axesEvent:t});n.trigger(t),t.isCanceled()?i(G.DISABLED):i(G.ANIMATING).onChange(e)},e}(B),Y=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!1,e._releaseEvent=null,e}a(e,n);var t=e.prototype;return t.onChange=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=t.inputEvent,r=n.horizontal?r.offsetX:r.offsetY,t=new c.ComponentEvent(T.MOVE_START,{isTrusted:t.isTrusted,holding:this.holding,direction:_(0,-r),axesEvent:t});n.trigger(t),t.isCanceled()?i(G.DISABLED):i(G.DRAGGING).onChange(e)},t.onRelease=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;if(n.trigger(new c.ComponentEvent(T.HOLD_END,{axesEvent:t})),0!==t.delta.flick)return t.setTo({flick:n.camera.position},0),void e(G.IDLE);this._releaseEvent=t},t.onFinish=function(e){var n=e.flicking;if((0,e.transitTo)(G.IDLE),this._releaseEvent){var t,i=this._releaseEvent.inputEvent.srcEvent;t="touchend"===i.type?(e=i.changedTouches[0],document.elementFromPoint(e.clientX,e.clientY)):i.target;var r,o,i=n.renderer.panels,a=null;try{for(var s=f(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(u.contains(t)){a=u;break}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}a&&(r=n.camera.position,o=a.position,n.trigger(new c.ComponentEvent(T.SELECT,{index:a.index,panel:a,direction:_(r,o)})))}},e}(B),X=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!0,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onChange=function(e){this._moveToChangedPosition(e)},t.onRelease=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo;n.trigger(new c.ComponentEvent(T.HOLD_END,{axesEvent:t})),n.renderer.panelCount<=0?i(G.IDLE):(i(G.ANIMATING),e=n.control,i=t.destPos[V],n=Math.max(t.duration,n.duration),e.moveToPosition(i,n,t))},e}(B),K=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onHold=function(e){var n=e.flicking,t=e.axesEvent,e=e.transitTo;this._delta=0,n.control.updateInput();t=new c.ComponentEvent(T.HOLD_START,{axesEvent:t});n.trigger(t),t.isCanceled()?e(G.DISABLED):e(G.DRAGGING)},t.onChange=function(e){this._moveToChangedPosition(e)},t.onFinish=function(e){var n=e.flicking,t=e.axesEvent,i=e.transitTo,r=n.control,e=r.controller.animatingContext;i(G.IDLE),n.trigger(new c.ComponentEvent(T.MOVE_END,{isTrusted:t.isTrusted,direction:_(e.start,e.end),axesEvent:t})),r.setActive(this._targetPanel,r.activePanel,t.isTrusted)},e}(B),Z=function(n){function e(){var e=null!==n&&n.apply(this,arguments)||this;return e.holding=!1,e.animating=!0,e}a(e,n);var t=e.prototype;return t.onAnimationEnd=function(e){(0,e.transitTo)(G.IDLE)},t.onChange=function(e){var n=e.axesEvent,e=e.transitTo;n.stop(),e(G.IDLE)},t.onRelease=function(e){var n=e.axesEvent,e=e.transitTo;0===n.delta.flick&&e(G.IDLE)},e}(B),q=(se=J.prototype,Object.defineProperty(se,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),se.fire=function(e,n){var t=this._state,i=r(r({},n),{transitTo:this.transitTo});switch(e){case F.HOLD:t.onHold(i);break;case F.CHANGE:t.onChange(i);break;case F.RELEASE:t.onRelease(i);break;case F.ANIMATION_END:t.onAnimationEnd(i);break;case F.FINISH:t.onFinish(i)}},J);function J(){var t=this;this.transitTo=function(e){var n;switch(e){case G.IDLE:n=new U;break;case G.HOLDING:n=new Y;break;case G.DRAGGING:n=new X;break;case G.ANIMATING:n=new K;break;case G.DISABLED:n=new Z}return n.onEnter(t._state),t._state=n,t._state},this._state=new U}var Q=(Pe=$.prototype,Object.defineProperty(Pe,"axes",{get:function(){return this._axes},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"stateMachine",{get:function(){return this._stateMachine},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"state",{get:function(){return this._stateMachine.state},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"animatingContext",{get:function(){return this._animatingContext},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"controlParams",{get:function(){var e=this._axes;if(!e)return{range:{min:0,max:0},position:0,circular:!1};e=e.axis[V];return{range:{min:e.range[0],max:e.range[1]},circular:e.circular[0],position:this.position}},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"enabled",{get:function(){var e;return null!==(e=null===(e=this._panInput)||void 0===e?void 0:e.isEnable())&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"position",{get:function(){var e;return null!==(e=null===(e=this._axes)||void 0===e?void 0:e.get([V])[V])&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"range",{get:function(){var e;return null!==(e=null===(e=this._axes)||void 0===e?void 0:e.axis[V].range)&&void 0!==e?e:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"bounce",{get:function(){var e;return null===(e=this._axes)||void 0===e?void 0:e.axis[V].bounce},enumerable:!1,configurable:!0}),Pe.init=function(t){var e,i=this;this._flicking=t,this._axes=new o(((e={})[V]={range:[0,0],circular:!1,bounce:[0,0]},e),{deceleration:t.deceleration,interruptable:t.interruptable,easing:t.easing}),this._panInput=new o.PanInput(t.viewport.element,{inputType:t.inputType,iOSEdgeSwipeThreshold:t.iOSEdgeSwipeThreshold,scale:t.horizontal?[-1,0]:[0,-1],releaseOnScroll:!0});var r=this._axes;r.connect(t.horizontal?[V,""]:["",V],this._panInput);for(var n in F)!function(e){var n=F[e];r.on(n,function(e){i._stateMachine.fire(n,{flicking:t,axesEvent:e})})}(n);return this},Pe.destroy=function(){var e;this._axes&&(this.removePreventClickHandler(),this._axes.destroy()),null!==(e=this._panInput)&&void 0!==e&&e.destroy(),this._resetInternalValues()},Pe.enable=function(){var e;return null!==(e=this._panInput)&&void 0!==e&&e.enable(),this},Pe.disable=function(){var e;return null!==(e=this._panInput)&&void 0!==e&&e.disable(),this},Pe.update=function(e){var n,t,i=m(this._flicking,"Control"),r=i.camera,o=this._axes,a=o.axis[V];return a.circular=[e.circular,e.circular],a.range=[e.range.min,e.range.max],a.bounce=(n=i.bounce,t=r.size,(Array.isArray(n)?n.map(function(e){return u(e,t)}):[r=u(n,t),r]).map(function(e){if(null==e)throw new j(R.WRONG_OPTION("bounce",n),C.WRONG_OPTION);return e})),o.axm.set(((o={})[V]=e.position,o)),this},Pe.addPreventClickHandler=function(){var e=m(this._flicking,"Control"),n=this._axes,e=e.camera.element;return n.on(F.HOLD,this._onAxesHold),n.on(F.CHANGE,this._onAxesChange),e.addEventListener("click",this._preventClickWhenDragged,!0),this},Pe.removePreventClickHandler=function(){var e=m(this._flicking,"Control"),n=this._axes,e=e.camera.element;return n.off(F.HOLD,this._onAxesHold),n.off(F.CHANGE,this._onAxesChange),e.removeEventListener("click",this._preventClickWhenDragged,!0),this},Pe.animateTo=function(n,t,i){var r=this,o=this._axes;if(!o)return Promise.reject(new j(R.NOT_ATTACHED_TO_FLICKING("Control"),C.NOT_ATTACHED_TO_FLICKING));var e=o.get([V])[V];if(e===n)return(s=m(this._flicking,"Control")).camera.lookAt(n),Promise.resolve();this._animatingContext={start:e,end:n,offset:0};function a(){var e;o.once(F.FINISH,function(){r._animatingContext={start:0,end:0,offset:0}}),i?i.setTo(((e={})[V]=n,e),t):o.setTo(((e={})[V]=n,e),t)}if(0!==t)return new Promise(function(e,n){function t(){o.off(F.FINISH,i),n(new j(R.ANIMATION_INTERRUPTED,C.ANIMATION_INTERRUPTED))}var i=function(){o.off(F.HOLD,t),e()};o.once(F.FINISH,i),o.once(F.HOLD,t),a()});var e=(s=m(this._flicking,"Control")).camera;a();var s=s.circularEnabled?P(n,e.range.min,e.range.max):n;return o.axm.set(((e={})[V]=s,e)),Promise.resolve()},Pe._resetInternalValues=function(){this._flicking=null,this._axes=null,this._panInput=null,this._animatingContext={start:0,end:0,offset:0},this._dragged=!1},$);function $(){var n=this;this._onAxesHold=function(){n._dragged=!1},this._onAxesChange=function(){n._dragged=!0},this._preventClickWhenDragged=function(e){n._dragged&&(e.preventDefault(),e.stopPropagation()),n._dragged=!1},this._resetInternalValues(),this._stateMachine=new q}var ee=(le=ne.prototype,Object.defineProperty(le,"controller",{get:function(){return this._controller},enumerable:!1,configurable:!0}),Object.defineProperty(le,"activeIndex",{get:function(){var e;return null!==(e=null===(e=this._activePanel)||void 0===e?void 0:e.index)&&void 0!==e?e:-1},enumerable:!1,configurable:!0}),Object.defineProperty(le,"activePanel",{get:function(){return this._activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(le,"animating",{get:function(){return this._controller.state.animating},enumerable:!1,configurable:!0}),Object.defineProperty(le,"holding",{get:function(){return this._controller.state.holding},enumerable:!1,configurable:!0}),le.init=function(e){return this._flicking=e,this._controller.init(e),this},le.destroy=function(){this._controller.destroy(),this._flicking=null,this._activePanel=null},le.enable=function(){return this._controller.enable(),this},le.disable=function(){return this._controller.disable(),this},le.updatePosition=function(e){var n=m(this._flicking,"Control").camera,t=this._activePanel;t&&n.lookAt(n.clampToReachablePosition(t.position))},le.updateInput=function(){var e=m(this._flicking,"Control").camera;return this._controller.update(e.controlParams),this},le.resetActive=function(){return this._activePanel=null,this},le.moveToPanel=function(a,e){var s=e.duration,n=e.direction,l=void 0===n?N.NONE:n,u=e.axesEvent;return h(this,void 0,void 0,function(){var n,t,i,r,o;return v(this,function(e){return n=m(this._flicking,"Control"),o=n.camera,t=a.position,i=o.findNearestAnchor(t),a.removed||!i?[2,Promise.reject(new j(R.POSITION_NOT_REACHABLE(a.position),C.POSITION_NOT_REACHABLE))]:(o.canReach(a)?n.circularEnabled&&(r=this._controller.position,o=o.rangeDiff,t=[t,t+o,t-o].filter(function(e){return l===N.NONE||(l===N.PREV?e<=r:r<=e)}).reduce(function(e,n){return Math.abs(r-n)<Math.abs(r-e)?n:e},1/0)):(t=i.position,a=i.panel),this._triggerIndexChangeEvent(a,a.position,u),[2,this._animateToPosition({position:t,duration:s,newActivePanel:a,axesEvent:u})])})})},le.setActive=function(e,n,t){var i,r=m(this._flicking,"Control");this._activePanel=e,r.camera.updateAdaptiveHeight(),e!==n?r.trigger(new c.ComponentEvent(T.CHANGED,{index:e.index,panel:e,prevIndex:null!==(i=null==n?void 0:n.index)&&void 0!==i?i:-1,prevPanel:n,isTrusted:t,direction:n?_(n.position,e.position):N.NONE})):r.trigger(new c.ComponentEvent(T.RESTORED,{isTrusted:t}))},le._triggerIndexChangeEvent=function(e,n,t){var i=m(this._flicking,"Control"),r=e!==this._activePanel?T.WILL_CHANGE:T.WILL_RESTORE,o=i.camera,a=this._activePanel,n=new c.ComponentEvent(r,{index:e.index,panel:e,isTrusted:(null==t?void 0:t.isTrusted)||!1,direction:_(null!==(a=null==a?void 0:a.position)&&void 0!==a?a:o.position,n)});if(i.trigger(n),n.isCanceled())throw new j(R.STOP_CALLED_BY_USER,C.STOP_CALLED_BY_USER)},le._animateToPosition=function(e){var r=e.position,o=e.duration,a=e.newActivePanel,s=e.axesEvent;return h(this,void 0,void 0,function(){var n,t,i=this;return v(this,function(e){return n=m(this._flicking,"Control"),t=function(){return i._controller.animateTo(r,o,s)},this._controller.state.targetPanel=a,o<=0?[2,t()]:[2,t().then(function(){return h(i,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return[4,n.renderer.render()];case 1:return e.sent(),[2]}})})}).catch(function(e){if(!(s&&e instanceof j&&e.code===C.ANIMATION_INTERRUPTED))throw e})]})})},ne);function ne(){this._flicking=null,this._controller=new Q,this._activePanel=null}var te=(_e=ie.prototype,Object.defineProperty(_e,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(_e,"position",{get:function(){return this._pos},enumerable:!1,configurable:!0}),Object.defineProperty(_e,"panel",{get:function(){return this._panel},enumerable:!1,configurable:!0}),ie);function ie(e){var n=e.index,t=e.position,e=e.panel;this._index=n,this._pos=t,this._panel=e}var re=function(t){function e(e){var n=(void 0===e?{}:e).count,e=void 0===n?1/0:n,n=t.call(this)||this;return n._count=e,n}a(e,t);var n=e.prototype;return Object.defineProperty(n,"count",{get:function(){return this._count},set:function(e){this._count=e},enumerable:!1,configurable:!0}),n.moveToPosition=function(l,u,c){return h(this,void 0,void 0,function(){var n,t,i,r,o,a,s;return v(this,function(e){return n=m(this._flicking,"Control"),t=n.camera,o=t.findActiveAnchor(),s=t.findNearestAnchor(t.position),a=n.control.controller.state,o&&s?(i=this._calcSnapThreshold(l,o),r=n.animating?a.delta:l-t.position,o=Math.abs(r),a=c&&0!==c.delta[V]?Math.abs(c.delta[V]):o,s=i<=a&&0<a?this._findSnappedAnchor(l,s):o>=n.threshold&&0<o?this._findAdjacentAnchor(r,s):s,this._triggerIndexChangeEvent(s.panel,l,c),[2,this._animateToPosition({position:t.clampToReachablePosition(s.position),duration:u,newActivePanel:s.panel,axesEvent:c})]):[2,Promise.reject(new j(R.POSITION_NOT_REACHABLE(l),C.POSITION_NOT_REACHABLE))]})})},n._findSnappedAnchor=function(e,n){var t=m(this._flicking,"Control"),i=t.camera,r=this._count,o=i.position,a=i.clampToReachablePosition(e),s=i.findAnchorIncludePosition(a);if(!n||!s)throw new j(R.POSITION_NOT_REACHABLE(e),C.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);o<e&&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;a=s.index+c*l;if(Math.abs(a-n.index)<=r){var h=u[s.index];return new te({index:h.index,position:h.position+c*i.rangeDiff,panel:h.panel})}if(t.circularEnabled){h=u[h=n.index+Math.sign(e-o)*r,(t=l)<=h?h%t:h<0?b((h+1)%t-1,t):h],l=Math.floor(r/l);return o<e&&h.index<n.index?l+=1:e<o&&h.index>n.index&&--l,new te({index:h.index,position:h.position+l*i.rangeDiff,panel:h.panel})}return u[k(n.index+Math.sign(e-o)*r,0,u.length-1)]},n._findAdjacentAnchor=function(e,n){var t=m(this._flicking,"Control").camera;return null!==(t=0<e?t.getNextAnchor(n):t.getPrevAnchor(n))&&void 0!==t?t:n},n._calcSnapThreshold=function(e,n){var t=e>n.position,i=n.panel,e=i.size,n=i.alignPosition;return t?e-n+i.margin.next:n+i.margin.prev},e}(ee),oe=function(t){function e(e){var n=(void 0===e?{}:e).stopAtEdge,e=void 0===n||n,n=t.call(this)||this;return n._stopAtEdge=e,n}a(e,t);var n=e.prototype;return Object.defineProperty(n,"stopAtEdge",{get:function(){return this._stopAtEdge},set:function(e){this._stopAtEdge=e},enumerable:!1,configurable:!0}),n.updatePosition=function(e){var n=m(this._flicking,"Control").camera,t=this._activePanel;t&&(e=(t=t.range).min+(t.max-t.min)*e,n.lookAt(n.clampToReachablePosition(e)))},n.moveToPosition=function(i,r,o){return h(this,void 0,void 0,function(){var n,t;return v(this,function(e){return n=m(this._flicking,"Control"),t=n.camera,n=t.clampToReachablePosition(i),(t=t.findAnchorIncludePosition(n))?((t=t.panel)!==this._activePanel&&this._triggerIndexChangeEvent(t,i,o),[2,this._animateToPosition({position:this._stopAtEdge?n:i,duration:r,newActivePanel:t,axesEvent:o})]):[2,Promise.reject(new j(R.POSITION_NOT_REACHABLE(i),C.POSITION_NOT_REACHABLE))]})})},e}(ee),ae=function(r){function e(e){var e=(void 0===e?{}:e).count,e=void 0===e?1:e,i=r.call(this)||this;return i.setActive=function(e,n,t){r.prototype.setActive.call(i,e,n,t),i.updateInput()},i._count=e,i._resetIndexRange(),i}a(e,r);var n=e.prototype;return Object.defineProperty(n,"count",{get:function(){return this._count},set:function(e){this._count=e},enumerable:!1,configurable:!0}),n.destroy=function(){r.prototype.destroy.call(this),this._resetIndexRange()},n.updateInput=function(){var e=m(this._flicking,"Control"),n=e.camera,t=e.renderer,i=this._controller,r=n.controlParams,o=this._count,a=i.state.animating?null===(c=n.findNearestAnchor(n.position))||void 0===c?void 0:c.panel:this._activePanel;if(!a)return i.update(r),this._resetIndexRange(),this;var s=r.range,l=a.position,u=a.index,c=t.panelCount,a=u-o,o=u+o;a<0&&(a=e.circularEnabled?b((a+1)%c-1,c):k(a,0,c-1)),c<=o&&(o=e.circularEnabled?o%c:k(o,0,c-1));a=t.panels[a],t=t.panels[o],o=Math.max(a.position,s.min),s=Math.min(t.position,s.max);return l<o&&(o-=n.rangeDiff),s<l&&(s+=n.rangeDiff),r.range={min:o,max:s},r.circular&&(r.position<o&&(r.position+=n.rangeDiff),r.position>s&&(r.position-=n.rangeDiff)),r.circular=!1,i.update(r),this._indexRange={min:a.index,max:t.index},this},n.moveToPosition=function(g,_,p){return h(this,void 0,void 0,function(){var n,t,i,r,o,a,s,l,u,c,h,f,d;return v(this,function(e){return c=m(this._flicking,"Control"),n=c.camera,t=this._activePanel,f=this._controller.range,i=this._indexRange,r=n.range,u=k(n.clampToReachablePosition(g),f[0],f[1]),(o=n.findAnchorIncludePosition(u))&&t?(h=t.position,a=Math.abs(g-h)>=c.threshold,s=h<g?n.getNextAnchor(o):n.getPrevAnchor(o),f=n.anchorPoints,u=f[0],c=f[f.length-1],h=g<=r.min&&x(u.panel.index,i.min,i.max),f=g>=r.max&&x(c.panel.index,i.min,i.max),h||f?(d=g<r.min?u:c,l=d.panel,d=d.position):a&&o.position!==t.position?(l=o.panel,d=o.position):a&&s&&x(s.index,i.min,i.max)?(l=s.panel,d=s.position):(d=n.clampToReachablePosition(t.position),l=t),this._triggerIndexChangeEvent(l,g,p),[2,this._animateToPosition({position:d,duration:_,newActivePanel:l,axesEvent:p})]):[2,Promise.reject(new j(R.POSITION_NOT_REACHABLE(g),C.POSITION_NOT_REACHABLE))]})})},n._resetIndexRange=function(){this._indexRange={min:0,max:0}},e}(ee),se={__proto__:null,Control:ee,SnapControl:re,FreeControl:oe,StrictControl:ae,AxesController:Q,State:B,IdleState:U,HoldingState:Y,DraggingState:X,AnimatingState:K,DisabledState:Z,StateMachine:q},le=(Pe=ue.prototype,Object.defineProperty(Pe,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"offset",{get:function(){return this._offset},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"range",{get:function(){return this._range},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"rangeDiff",{get:function(){return this._range.max-this._range.min},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"visiblePanels",{get:function(){return this._visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"visibleRange",{get:function(){return{min:this._position-this._alignPos,max:this._position-this._alignPos+this.size}},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"anchorPoints",{get:function(){return this._anchors},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:!1}},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"atEdge",{get:function(){return this._position<=this._range.min||this._position>=this._range.max},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"size",{get:function(){var e=this._flicking;return e?e.horizontal?e.viewport.width:e.viewport.height:0},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"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,t=a.min,e=a.max,a=this.rangeDiff;if(n===r)return i.index;if(n<r){var s=i.prev(),s=s?s.position+s.offset:t-o[0];return r<s&&(s-=a),i.index-1+O(n,s,r)}s=i.next(),o=s?s.position+s.offset:e+o[1];return o<r&&(o+=a),i.index+O(n,r,o)},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),Pe.init=function(e){e=(this._flicking=e).viewport.element;return function(e,n){if(null==e)throw new j(R.VAL_MUST_NOT_NULL(e,n),C.VAL_MUST_NOT_NULL)}(e.firstElementChild,"First element child of the viewport element"),this._el=e.firstElementChild,this._checkTranslateSupport(),this},Pe.destroy=function(){return this._flicking=null,this._resetInternalValues(),this},Pe.lookAt=function(e){var n=this._position;this._position=e,this._refreshVisiblePanels(),this._checkNeedPanel(),this._checkReachEnd(n,e),this._applyTransform()},Pe.getPrevAnchor=function(e){return this._anchors[e.index-1]||null},Pe.getNextAnchor=function(e){return this._anchors[e.index+1]||null},Pe.getProgressInPanel=function(e){e=e.range;return(this._position-e.min)/(e.max-e.min)},Pe.findAnchorIncludePosition=function(t){return this._anchors.filter(function(e){return e.panel.includePosition(t,!0)}).reduce(function(e,n){return e&&Math.abs(e.position-t)<Math.abs(n.position-t)?e:n},null)},Pe.findNearestAnchor=function(e){var n=this._anchors;if(n.length<=0)return null;for(var t=1/0,i=0;i<n.length;i++){var r=n[i],r=Math.abs(r.position-e);if(t<r)return n[i-1];t=r}return n[n.length-1]},Pe.findActiveAnchor=function(){var n=m(this._flicking,"Camera").control.activeIndex;return function(e,n){var t,i;try{for(var r=f(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}(this._anchors,function(e){return e.panel.index===n})},Pe.clampToReachablePosition=function(e){var n=this._range;return k(e,n.min,n.max)},Pe.canReach=function(e){var n=this._range;if(e.removed)return!1;e=e.position;return e>=n.min&&e<=n.max},Pe.canSee=function(e){var n=this.visibleRange;return e.includeRange(n.min,n.max,!1)},Pe.updateAlignPos=function(){var e=this._align,e="object"==typeof e?e.camera:e;return this._alignPos=l(e,this.size),this},Pe.updateAnchors=function(){var e=m(this._flicking,"Camera").renderer.panels;return this._anchors=e.map(function(e,n){return new te({index:n,position:e.position,panel:e})}),this},Pe.updateAdaptiveHeight=function(){var e=m(this._flicking,"Camera"),n=e.control.activePanel;e.horizontal&&e.adaptive&&n&&e.viewport.setSize({height:n.height})},Pe.updateOffset=function(){var e=m(this._flicking,"Camera").panels.filter(function(e){return!e.rendered}),n=this._position;this._offset=e.filter(function(e){return e.position+e.offset<n}).reduce(function(e,n){return e+n.sizeIncludingMargin},0),this._applyTransform()},Pe.resetNeedPanelHistory=function(){return this._needPanelTriggered={prev:!1,next:!1},this},Pe._resetInternalValues=function(){this._position=0,this._alignPos=0,this._offset=0,this._range={min:0,max:0},this._visiblePanels=[],this._anchors=[],this._needPanelTriggered={prev:!1,next:!1}},Pe._refreshVisiblePanels=function(){var n=this,e=m(this._flicking,"Camera"),t=e.renderer.panels.filter(function(e){return n.canSee(e)}),i=this._visiblePanels,r=(this._visiblePanels=t).filter(function(e){return!E(i,e)}),o=i.filter(function(e){return!E(t,e)});(0<r.length||0<o.length)&&e.renderer.render().then(function(){e.trigger(new c.ComponentEvent(T.VISIBLE_CHANGE,{added:r,removed:o,visiblePanels:t}))})},Pe._checkNeedPanel=function(){var e=this._needPanelTriggered;if(!e.prev||!e.next){var n=m(this._flicking,"Camera"),t=n.renderer.panels;if(t.length<=0)return e.prev||(n.trigger(new c.ComponentEvent(T.NEED_PANEL,{direction:N.PREV})),e.prev=!0),void(e.next||(n.trigger(new c.ComponentEvent(T.NEED_PANEL,{direction:N.NEXT})),e.next=!0));var i=this._position,r=this.size,o=this._range,a=n.needPanelThreshold,s=i-this._alignPos,l=s+r,r=t[0],t=t[t.length-1];e.prev||(s<=r.range.min+a||i<=o.min+a)&&(n.trigger(new c.ComponentEvent(T.NEED_PANEL,{direction:N.PREV})),e.prev=!0),e.next||(t.range.max-a<=l||i>=o.max-a)&&(n.trigger(new c.ComponentEvent(T.NEED_PANEL,{direction:N.NEXT})),e.next=!0)}},Pe._checkReachEnd=function(e,n){var t=m(this._flicking,"Camera"),i=this._range,r=e>i.min&&e<i.max,e=n>i.min&&n<i.max;r&&!e&&(i=n<=i.min?N.PREV:N.NEXT,t.trigger(new c.ComponentEvent(T.REACH_EDGE,{direction:i})))},Pe._applyTransform=function(){var e=this._el,n=m(this._flicking,"Camera"),t=this._position-this._alignPos-this._offset;e.style[this._transform]=n.horizontal?"translate("+-t+"px)":"translate(0, "+-t+"px)"},ue);function ue(e){var s=this,e=(void 0===e?{}:e).align,e=void 0===e?w.CENTER:e;this._checkTranslateSupport=function(){var n,e,t=document.documentElement.style,i="";try{for(var r=f(["webkitTransform","msTransform","MozTransform","OTransform","transform"]),o=r.next();!o.done;o=r.next()){var a=o.value;a in t&&(i=a)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(e=r.return)&&e.call(r)}finally{if(n)throw n.error}}if(!i)throw new j(R.TRANSFORM_NOT_SUPPORTED,C.TRANSFORM_NOT_SUPPORTED);s._transform=i},this._flicking=null,this._resetInternalValues(),this._align=e}var ce,he=(a(fe,ce=le),fe.prototype.updateRange=function(){var e=m(this._flicking,"Camera").renderer,n=e.getPanel(0),e=e.getPanel(e.panelCount-1);return this._range={min:null!==(n=null==n?void 0:n.position)&&void 0!==n?n:0,max:null!==(e=null==e?void 0:e.position)&&void 0!==e?e:0},this},fe);function fe(){return null!==ce&&ce.apply(this,arguments)||this}var de=function(o){function e(){var e=null!==o&&o.apply(this,arguments)||this;return e._circularOffset=0,e._circularEnabled=!1,e}a(e,o);var n=e.prototype;return Object.defineProperty(n,"offset",{get:function(){return this._offset-this._circularOffset},enumerable:!1,configurable:!0}),Object.defineProperty(n,"controlParams",{get:function(){return{range:this._range,position:this._position,circular:this._circularEnabled}},enumerable:!1,configurable:!0}),n.getPrevAnchor=function(e){if(!this._circularEnabled||0!==e.index)return o.prototype.getPrevAnchor.call(this,e);var n=this._anchors,e=this.rangeDiff,n=n[n.length-1];return new te({index:n.index,position:n.position-e,panel:n.panel})},n.getNextAnchor=function(e){var n=this._anchors;if(!this._circularEnabled||e.index!==n.length-1)return o.prototype.getNextAnchor.call(this,e);e=this.rangeDiff,n=n[0];return new te({index:n.index,position:n.position+e,panel:n.panel})},n.findAnchorIncludePosition=function(e){if(!this._circularEnabled)return o.prototype.findAnchorIncludePosition.call(this,e);var n=this._range,t=P(e,n.min,n.max),i=o.prototype.findAnchorIncludePosition.call(this,t);if(!i)return null;t=this.rangeDiff;if(e<n.min){var r=-Math.floor((n.min-e)/t)-1;return new te({index:i.index,position:i.position+t*r,panel:i.panel})}if(e>n.max){r=Math.floor((e-n.max)/t)+1;return new te({index:i.index,position:i.position+t*r,panel:i.panel})}return i},n.clampToReachablePosition=function(e){return this._circularEnabled?e:o.prototype.clampToReachablePosition.call(this,e)},n.canReach=function(e){return!e.removed&&(!!this._circularEnabled||o.prototype.canReach.call(this,e))},n.canSee=function(e){var n=this._range,t=this.rangeDiff,i=this.visibleRange,r=o.prototype.canSee.call(this,e);return this._circularEnabled?i.min<n.min?r||e.includeRange(i.min+t,i.max+t,!1):i.max>n.max?r||e.includeRange(i.min-t,i.max-t,!1):r:r},n.updateRange=function(){var e=m(this._flicking,"Camera").renderer.panels;if(e.length<=0)return this._resetInternalValues(),this;var n=e[0],t=e[e.length-1],i=n.range.min-n.margin.prev,r=t.range.max+t.margin.next,o=this.size,a=r-i,s=e.every(function(e){return a-e.size>=o});return(this._circularEnabled=s)?(this._range={min:i,max:r},e.forEach(function(e){return e.updateCircularToggleDirection()})):this._range={min:n.position,max:t.position},this._updateCircularOffset(),this},n.lookAt=function(n){var e=m(this._flicking,"Camera"),t=this._position;if(n===t)return o.prototype.lookAt.call(this,n);var i=e.renderer.panels.map(function(e){return e.toggle(t,n)});return this._position=n,i.some(function(e){return e})&&(this._updateCircularOffset(),e.renderer.render()),o.prototype.lookAt.call(this,n)},n._applyTransform=function(){var e=this._el,n=m(this._flicking,"Camera"),t=this._position-this._alignPos-this._offset+this._circularOffset;e.style[this._transform]=n.horizontal?"translate("+-t+"px)":"translate(0, "+-t+"px)"},n._resetInternalValues=function(){o.prototype._resetInternalValues.call(this),this._circularOffset=0,this._circularEnabled=!1},n._calcPanelAreaSum=function(e){return e.reduce(function(e,n){return e+n.sizeIncludingMargin},0)},n._updateCircularOffset=function(){var e,n,t;this._circularEnabled?(e=m(this._flicking,"Camera"),n=[],t=[],e.panels.filter(function(e){return e.toggled}).forEach(function(e){(e.toggleDirection===N.PREV?n:t).push(e)}),this._circularOffset=this._calcPanelAreaSum(n)-this._calcPanelAreaSum(t)):this._circularOffset=0},e}(le),ge=function(i){function e(){return null!==i&&i.apply(this,arguments)||this}a(e,i);var n=e.prototype;return n.updateRange=function(){var e=m(this._flicking,"Camera").renderer,n=this._alignPos,t=e.getPanel(0),i=e.getPanel(e.panelCount-1);if(!t||!i)return this._range={min:0,max:0},this;var r=this.size,e=t.range.min,t=i.range.max,i=e+n,n=t-r+n;return r<t-e?this._range={min:i,max:n}:(e="object"==typeof(e=this._align)?e.camera:e,i=i+l(e,n-i),this._range={min:i,max:i}),this},n.updateAnchors=function(){var n=this,e=m(this._flicking,"Camera").renderer.panels;if(e.length<=0)return this._anchors=[],this;var t,i,r,o,a=this._range,s=e.filter(function(e){return n.canReach(e)});return 0<s.length?(t=s[0].position!==a.min,i=s[s.length-1].position!==a.max,r=t?1:0,o=s.map(function(e,n){return new te({index:n+r,position:e.position,panel:e})}),t&&o.splice(0,0,new te({index:0,position:a.min,panel:e[s[0].index-1]})),i&&o.push(new te({index:o.length,position:a.max,panel:e[s[s.length-1].index+1]})),this._anchors=o):a.min!==a.max?(s=(o=(s=this._findNearestPanel(a.min,e)).index===e.length-1?s.prev():s).next(),this._anchors=[new te({index:0,position:a.min,panel:o}),new te({index:1,position:a.max,panel:s})]):this._anchors=[new te({index:0,position:a.min,panel:this._findNearestPanel(a.min,e)})],this},n.findAnchorIncludePosition=function(e){var n=this._range,t=this._anchors;return t.length<=0?null:e<=n.min?t[0]:e>=n.max?t[t.length-1]:i.prototype.findAnchorIncludePosition.call(this,e)},n._findNearestPanel=function(e,n){for(var t=1/0,i=0;i<n.length;i++){var r=n[i],r=Math.abs(r.position-e);if(t<r)return n[i-1];t=r}return n[n.length-1]},e}(le),_e={__proto__:null,Camera:le,LinearCamera:he,CircularCamera:de,BoundCamera:ge},B=(ee=pe.prototype,Object.defineProperty(ee,"panels",{get:function(){return this._panels},enumerable:!1,configurable:!0}),Object.defineProperty(ee,"panelCount",{get:function(){return this._panels.length},enumerable:!1,configurable:!0}),Object.defineProperty(ee,"align",{get:function(){return this._align},set:function(e){this._align=e;var n=this._getPanelAlign();this._panels.forEach(function(e){e.align=n})},enumerable:!1,configurable:!0}),ee.init=function(e){return this._flicking=e,this._collectPanels(),this},ee.destroy=function(){this._flicking=null,this._panels=[]},ee.getPanel=function(e){return this._panels[e]||null},ee.updatePanelSize=function(){var e=m(this._flicking,"Renderer");return 0<e.panelsPerView?this._updatePanelSizeByGrid(e):e.panels.forEach(function(e){return e.resize()}),this},ee.batchInsert=function(){for(var o=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var a=this._panels,s=m(this._flicking,"Renderer"),t=s.control,l=this._getPanelAlign(),i=e.reduce(function(e,n){var t=b(n.index,a.length),i=a.slice(t),r=n.elements.map(function(e,n){return o._createPanel(e,{index:t+n,align:l,flicking:s})});return a.splice.apply(a,g([t,0],d(r))),o._insertPanelElements(r,null!==(n=i[0])&&void 0!==n?n:null),r.forEach(function(e){return e.resize()}),i.forEach(function(e){e.increaseIndex(r.length),e.updatePosition()}),g(g([],d(e)),d(r))},[]);return i.length<=0?[]:(this._updateCameraAndControl(),this.render(),0<i.length&&!t.animating&&t.moveToPanel(t.activePanel||i[0],{duration:0}).catch(function(){}),s.camera.updateOffset(),s.trigger(new c.ComponentEvent(T.PANEL_CHANGE,{added:i,removed:[]})),this.checkPanelContentsReady(i),i)},ee.batchRemove=function(){for(var o=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var a=this._panels,t=m(this._flicking,"Renderer"),i=t.camera,s=t.control,l=s.activePanel,r=s.activeIndex,u=e.reduce(function(e,n){var t=n.index,i=n.deleteCount,n=b(t,a.length),t=a.slice(n+i),r=a.splice(n,i);return r.length<=0?[]:(t.forEach(function(e){e.decreaseIndex(r.length),e.updatePosition()}),o._removePanelElements(r),r.forEach(function(e){return e.destroy()}),o._updateCameraAndControl(),E(r,l)&&s.resetActive(),g(g([],d(e)),d(r)))},[]);return this.render(),0<u.length&&!s.animating&&((r=E(u,l)?a[r]||a[a.length-1]:l)?s.moveToPanel(r,{duration:0}).catch(function(){}):i.lookAt(0)),t.camera.updateOffset(),t.trigger(new c.ComponentEvent(T.PANEL_CHANGE,{added:[],removed:u})),u},ee.checkPanelContentsReady=function(o){var a,s=this,e=m(this._flicking,"Renderer").resizeOnContentsReady,l=this._panels;e&&((o=o.filter(function(e){return!!e.element.querySelector("img, video")})).length<=0||(a=new n,o.forEach(function(e){e.loading=!0}),a.on("readyElement",function(e){var n,t,i,r=s._flicking;r?(n=o[e.index],t=r.camera,e=(i=r.control).activePanel?t.getProgressInPanel(i.activePanel):0,n.loading=!1,n.resize(),l.slice(n.index+1).forEach(function(e){return e.updatePosition()}),r.initialized&&(t.updateRange(),t.updateAnchors(),i.animating||(i.updatePosition(e),i.updateInput()))):a.destroy()}),a.on("preReady",function(e){s._flicking&&s.render(),e.readyCount===e.totalCount&&a.destroy()}),a.on("ready",function(){s._flicking&&s.render(),a.destroy()}),a.check(o.map(function(e){return e.element}))))},ee._getPanelAlign=function(){var e=this._align;return"object"==typeof e?e.panel:e},ee._updateCameraAndControl=function(){var e=m(this._flicking,"Renderer"),n=e.camera,e=e.control;n.updateRange(),n.updateAnchors(),n.resetNeedPanelHistory(),e.updateInput()},ee._updateRenderingPanels=function(){var e=m(this._flicking,"Renderer");e.renderOnlyVisible?this._showOnlyVisiblePanels(e):e.panels.forEach(function(e){return e.markForShow()})},ee._showOnlyVisiblePanels=function(n){var e=n.renderer.panels,t=n.camera,i=t.visiblePanels.reduce(function(e,n){return e[n.index]=!0,e},{});e.forEach(function(e){e.index in i||e.loading?e.markForShow():n.holding||e.markForHide()}),t.updateOffset()},ee._updatePanelSizeByGrid=function(e){var n,t,i=e.panels,r=e.panelsPerView;if(r<=0)throw new j(R.WRONG_OPTION("panelsPerView",r),C.WRONG_OPTION);i.length<=0||((i=i[0]).resize(),r=(e.camera.size-(i.margin.prev+i.margin.next)*(r-1))/r,n=e.horizontal?{width:r}:{height:r},t={size:r,height:i.height,margin:i.margin},e.noPanelStyleOverride||e.panels.forEach(function(e){return e.setSize(n)}),e.panels.forEach(function(e){return e.resize(t)}))},pe);function pe(e){e=(void 0===e?{}:e).align,e=void 0===e?w.CENTER:e;this._flicking=null,this._panels=[],this._align=e}Pe=ve.prototype,Object.defineProperty(Pe,"index",{get:function(){return this._index},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"position",{get:function(){return this._pos+this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"sizeIncludingMargin",{get:function(){return this._size+this._margin.prev+this._margin.next},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"margin",{get:function(){return this._margin},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"alignPosition",{get:function(){return this._alignPos},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"removed",{get:function(){return this._removed},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"loading",{get:function(){return this._loading},set:function(e){this._loading=e},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"range",{get:function(){return{min:this._pos,max:this._pos+this._size}},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"toggled",{get:function(){return this._toggled},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"toggleDirection",{get:function(){return this._toggleDirection},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"offset",{get:function(){var e=this._toggleDirection,n=this._flicking.camera.rangeDiff;return e!==N.NONE&&this._toggled?e===N.PREV?-n:n:0},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"progress",{get:function(){var e=this._flicking;return this.index-e.camera.progress},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"outsetProgress",{get:function(){var e=this.position+this.offset,n=this._alignPos,t=this._flicking.camera,i=t.position;if(i===e)return 0;if(i<e){var r=e+(t.size-t.alignPosition)+n;return-O(i,e,r)}n=e-(t.alignPosition+this._size-n);return 1-O(i,n,e)},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"visibleRatio",{get:function(){var e=this.range,n=this._size,t=this.offset,i=this._flicking.camera.visibleRange,r=e.min+t,e=e.max+t;if(e<=i.min||r>=i.max)return 0;t=n;return i.min>r&&(t-=i.min-r),i.max<e&&(t-=e-i.max),t/n},enumerable:!1,configurable:!0}),Object.defineProperty(Pe,"align",{get:function(){return this._align},set:function(e){this._align=e},enumerable:!1,configurable:!0}),Pe.resize=function(e){var n=this.element,t=y(n),i=this._flicking.horizontal;return e?(this._size=e.size,this._margin=r({},e.margin),this._height=e.height):(this._size=i?n.offsetWidth:n.offsetHeight,this._margin=i?{prev:parseFloat(t.marginLeft||"0"),next:parseFloat(t.marginRight||"0")}:{prev:parseFloat(t.marginTop||"0"),next:parseFloat(t.marginBottom||"0")},this._height=i?n.offsetHeight:this._size),this.updatePosition(),this._updateAlignPos(),this},Pe.setSize=function(e){var n=e.width,t=e.height,e=this.element;return null!=n&&(S(n)?e.style.width=n:e.style.width=n+"px"),null!=t&&(S(t)?e.style.height=t:e.style.height=t+"px"),this},Pe.contains=function(e){var n;return!(null===(n=this.element)||void 0===n||!n.contains(e))},Pe.destroy=function(){this._resetInternalStates(),this._removed=!0},Pe.includePosition=function(e,n){return this.includeRange(e,e,n=void 0===n?!1:n)},Pe.includeRange=function(e,n,t){var i=this._margin,r=this.range;return(t=void 0===t?!1:t)&&(r.min-=i.prev,r.max+=i.next),n>=r.min&&e<=r.max},Pe.focus=function(e){return this._flicking.moveTo(this._index,e)},Pe.prev=function(){var e=this._index,n=this._flicking,t=n.renderer,i=t.panelCount;return 1===i?null:n.circularEnabled?t.getPanel(0===e?i-1:e-1):t.getPanel(e-1)},Pe.next=function(){var e=this._index,n=this._flicking,t=n.renderer,i=t.panelCount;return 1===i?null:n.circularEnabled?t.getPanel(e===i-1?0:e+1):t.getPanel(e+1)},Pe.increaseIndex=function(e){return this._index+=Math.max(e,0),this},Pe.decreaseIndex=function(e){return this._index-=Math.max(e,0),this},Pe.updatePosition=function(){var e=this._flicking.renderer.panels[this._index-1];return this._pos=e?e.range.max+e.margin.next+this._margin.prev:this._margin.prev,this},Pe.toggle=function(e,n){var t=this._toggleDirection,i=this._togglePosition;if(t===N.NONE||n===e)return!1;var r=this._toggled;return e<n?e<=i&&i<=n&&(this._toggled=t===N.NEXT):i<=e&&n<=i&&(this._toggled=t!==N.NEXT),r!==this._toggled},Pe.updateCircularToggleDirection=function(){var e=this._flicking;if(!e.circularEnabled)return this._toggleDirection=N.NONE,this._toggled=!1,this;var n=e.camera,t=n.range,i=n.alignPosition,r=n.visibleRange,o=r.max-r.min,e=t.min-i,r=t.max-i+o,r=this.includeRange(r-o,r,!1),e=this.includeRange(e,e+o,!1);return this._toggled=!1,r?(this._toggleDirection=N.PREV,this._togglePosition=this.range.max+t.min-t.max+i,this.toggle(1/0,n.position)):e?(this._toggleDirection=N.NEXT,this._togglePosition=this.range.min+t.max-o+i,this.toggle(-1/0,n.position)):(this._toggleDirection=N.NONE,this._togglePosition=0),this},Pe._updateAlignPos=function(){this._alignPos=l(this._align,this._size)},Pe._resetInternalStates=function(){this._size=0,this._pos=0,this._margin={prev:0,next:0},this._height=0,this._alignPos=0,this._toggled=!1,this._togglePosition=0,this._toggleDirection=N.NONE},le=ve;function ve(e){var n=e.index,t=e.align,e=e.flicking;this._index=n,this._flicking=e,this._align=t,this._removed=!1,this._loading=!1,this._resetInternalStates()}var me,be=function(t){function e(e){var n=t.call(this,e)||this;return n._el=e.el,n._rendered=!0,n}a(e,t);var n=e.prototype;return Object.defineProperty(n,"element",{get:function(){return this._el},enumerable:!1,configurable:!0}),Object.defineProperty(n,"rendered",{get:function(){return this._rendered},enumerable:!1,configurable:!0}),n.markForShow=function(){this._rendered=!0},n.markForHide=function(){this._rendered=!1},e}(le),Ee=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t.render=function(){return h(this,void 0,void 0,function(){var n,t,i;return v(this,function(e){return i=m(this._flicking,"Renderer"),n=i.camera.element,t=this._panels.filter(function(e){return e.element.parentElement===n}),this._updateRenderingPanels(),i=this._getRenderingPanelsByOrder(),this._removePanelElements(t.filter(function(e){return!e.rendered})),this._insertPanelElements(i.filter(function(e){return e.element.parentElement!==n}),null),this._resetPanelElementOrder(i),[2]})})},t.forceRenderAllPanels=function(){return h(this,void 0,void 0,function(){var n,t;return v(this,function(e){return n=m(this._flicking,"Renderer"),n=n.camera,n=n.element,t=document.createDocumentFragment(),this._panels.forEach(function(e){return t.appendChild(e.element)}),this._removeAllChildsFromCamera(),n.appendChild(t),[2]})})},t._collectPanels=function(){var t=m(this._flicking,"Renderer"),n=t.camera.element;s(n.childNodes).forEach(function(e){e.nodeType===Node.TEXT_NODE&&n.removeChild(e)});var i=this._getPanelAlign(),e=s(n.children);this._panels=e.map(function(e,n){return new be({flicking:t,el:e,index:n,align:i})})},t._createPanel=function(e,n){return new be(r({el:e},n))},t._insertPanelElements=function(e,n){var t=m(this._flicking,"Renderer").camera.element,n=(null==n?void 0:n.element)||null,i=document.createDocumentFragment();return e.forEach(function(e){return i.appendChild(e.element)}),t.insertBefore(i,n),this},t._removePanelElements=function(e){var n=m(this._flicking,"Renderer").camera.element;return e.forEach(function(e){n.removeChild(e.element)}),this},t._resetPanelElementOrder=function(e){var t=m(this._flicking,"Renderer").camera.element,i=g([],d(e)).reverse();i.forEach(function(e,n){n=i[n-1],n=n?n.element:null;e.element.nextElementSibling!==n&&t.insertBefore(e.element,n)})},t._removeAllChildsFromCamera=function(){for(var e=m(this._flicking,"Renderer").camera.element;e.firstChild;)e.removeChild(e.firstChild)},t._getRenderingPanelsByOrder=function(){return m(this._flicking,"Renderer").renderer.panels.filter(function(e){return e.rendered}).sort(function(e,n){return e.position+e.offset-(n.position+n.offset)})},n}(B),ee=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}a(n,e);var t=n.prototype;return t._insertPanelElements=function(e,n){},t._removePanelElements=function(e){},n}(B),Pe={__proto__:null,Renderer:B,VanillaRenderer:Ee,ExternalRenderer:ee},Oe=function(I){function e(e,n){var t=void 0===n?{}:n,i=t.align,r=void 0===i?w.CENTER:i,o=t.defaultIndex,a=void 0===o?0:o,s=t.horizontal,l=void 0===s||s,u=t.circular,c=void 0!==u&&u,h=t.bound,f=void 0!==h&&h,d=t.adaptive,g=void 0!==d&&d,_=t.panelsPerView,p=void 0===_?-1:_,v=t.noPanelStyleOverride,m=void 0!==v&&v,b=t.resizeOnContentsReady,E=void 0!==b&&b,P=t.needPanelThreshold,O=void 0===P?0:P,y=t.preventEventsBeforeInit,x=void 0===y||y,T=t.deceleration,N=void 0===T?.0075:T,A=t.duration,n=void 0===A?500:A,i=t.easing,o=void 0===i?function(e){return 1-Math.pow(1-e,3)}:i,s=t.inputType,u=void 0===s?["mouse","touch"]:s,h=t.moveType,d=void 0===h?"snap":h,_=t.threshold,v=void 0===_?40:_,b=t.interruptable,P=void 0===b||b,y=t.bounce,T=void 0===y?"20%":y,A=t.iOSEdgeSwipeThreshold,i=void 0===A?30:A,s=t.preventClickOnDrag,h=void 0===s||s,_=t.disableOnInit,b=void 0!==_&&_,y=t.renderOnlyVisible,A=void 0!==y&&y,s=t.autoInit,_=void 0===s||s,y=t.autoResize,s=void 0===y||y,y=t.renderExternal,t=void 0===y?null:y,y=I.call(this)||this;return y._initialized=!1,y._plugins=[],y._align=r,y._defaultIndex=a,y._horizontal=l,y._circular=c,y._bound=f,y._adaptive=g,y._panelsPerView=p,y._noPanelStyleOverride=m,y._resizeOnContentsReady=E,y._needPanelThreshold=O,y._preventEventsBeforeInit=x,y._deceleration=N,y._duration=n,y._easing=o,y._inputType=u,y._moveType=d,y._threshold=v,y._interruptable=P,y._bounce=T,y._iOSEdgeSwipeThreshold=i,y._preventClickOnDrag=h,y._disableOnInit=b,y._renderOnlyVisible=A,y._autoResize=s,y._autoInit=_,y._renderExternal=t,y._viewport=new M(function(e,n){var t=null;if(S(e)){n=(n||document).querySelector(e);if(!n)throw new j(R.ELEMENT_NOT_FOUND(e),C.ELEMENT_NOT_FOUND);t=n}else e&&e.nodeType===Node.ELEMENT_NODE&&(t=e);if(!t)throw new j(R.WRONG_TYPE(e,["HTMLElement","string"]),C.WRONG_TYPE);return t}(e)),y._renderer=y._createRenderer(),y._camera=y._createCamera(),y._control=y._createControl(),y.resize=y.resize.bind(y),y._autoInit&&y.init(),y}a(e,I);var n=e.prototype;return Object.defineProperty(n,"control",{get:function(){return this._control},enumerable:!1,configurable:!0}),Object.defineProperty(n,"camera",{get:function(){return this._camera},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderer",{get:function(){return this._renderer},enumerable:!1,configurable:!0}),Object.defineProperty(n,"viewport",{get:function(){return this._viewport},enumerable:!1,configurable:!0}),Object.defineProperty(n,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circularEnabled",{get:function(){return this._camera.controlParams.circular},enumerable:!1,configurable:!0}),Object.defineProperty(n,"index",{get:function(){return this._control.activeIndex},enumerable:!1,configurable:!0}),Object.defineProperty(n,"element",{get:function(){return this._viewport.element},enumerable:!1,configurable:!0}),Object.defineProperty(n,"currentPanel",{get:function(){return this._control.activePanel},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panels",{get:function(){return this._renderer.panels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelCount",{get:function(){return this._renderer.panelCount},enumerable:!1,configurable:!0}),Object.defineProperty(n,"visiblePanels",{get:function(){return this._camera.visiblePanels},enumerable:!1,configurable:!0}),Object.defineProperty(n,"animating",{get:function(){return this._control.animating},enumerable:!1,configurable:!0}),Object.defineProperty(n,"holding",{get:function(){return this._control.holding},enumerable:!1,configurable:!0}),Object.defineProperty(n,"activePlugins",{get:function(){return this._plugins},enumerable:!1,configurable:!0}),Object.defineProperty(n,"align",{get:function(){return this._align},set:function(e){this._align=e,this._renderer.align=e,this._camera.align=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"defaultIndex",{get:function(){return this._defaultIndex},set:function(e){this._defaultIndex=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"horizontal",{get:function(){return this._horizontal},set:function(e){this._horizontal=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"circular",{get:function(){return this._circular},set:function(e){this._circular=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bound",{get:function(){return this._bound},set:function(e){this._bound=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"adaptive",{get:function(){return this._adaptive},set:function(e){this._adaptive=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"panelsPerView",{get:function(){return this._panelsPerView},set:function(e){this._panelsPerView=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"noPanelStyleOverride",{get:function(){return this._noPanelStyleOverride},set:function(e){this._noPanelStyleOverride=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"resizeOnContentsReady",{get:function(){return this._resizeOnContentsReady},set:function(e){this._resizeOnContentsReady=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"needPanelThreshold",{get:function(){return this._needPanelThreshold},set:function(e){this._needPanelThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"preventEventsBeforeInit",{get:function(){return this._preventEventsBeforeInit},set:function(e){this._preventEventsBeforeInit=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"deceleration",{get:function(){return this._deceleration},set:function(e){this._deceleration=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"easing",{get:function(){return this._easing},set:function(e){this._easing=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"duration",{get:function(){return this._duration},set:function(e){this._duration=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"inputType",{get:function(){return this._inputType},set:function(e){this._inputType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"moveType",{get:function(){return this._moveType},set:function(e){this._moveType=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"threshold",{get:function(){return this._threshold},set:function(e){this._threshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"interruptable",{get:function(){return this._interruptable},set:function(e){this._interruptable=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"bounce",{get:function(){return this._bounce},set:function(e){this._bounce=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"iOSEdgeSwipeThreshold",{get:function(){return this._iOSEdgeSwipeThreshold},set:function(e){this._iOSEdgeSwipeThreshold=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"preventClickOnDrag",{get:function(){return this._preventClickOnDrag},set:function(e){var n;e!==this._preventClickOnDrag&&(n=this._control.controller,e?n.addPreventClickHandler():n.removePreventClickHandler(),this._preventClickOnDrag=e)},enumerable:!1,configurable:!0}),Object.defineProperty(n,"disableOnInit",{get:function(){return this._disableOnInit},set:function(e){this._disableOnInit=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderOnlyVisible",{get:function(){return this._renderOnlyVisible},set:function(e){this._renderOnlyVisible=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"autoInit",{get:function(){return this._autoInit},enumerable:!1,configurable:!0}),Object.defineProperty(n,"autoResize",{get:function(){return this._autoResize},set:function(e){this._autoResize=e},enumerable:!1,configurable:!0}),Object.defineProperty(n,"renderExternal",{get:function(){return this._renderExternal},enumerable:!1,configurable:!0}),n.init=function(){return h(this,void 0,void 0,function(){var n,t,i,r,o,a=this;return v(this,function(e){switch(e.label){case 0:return this._initialized?[2]:(n=this._camera,t=this._renderer,i=this._control,r=this.trigger,o=this._preventEventsBeforeInit,n.init(this),t.init(this),i.init(this),o&&(this.trigger=function(){return a}),[4,this.resize()]);case 1:return e.sent(),[4,this._moveToInitialPanel()];case 2:return e.sent(),this._autoResize&&window.addEventListener("resize",this.resize),this._preventClickOnDrag&&i.controller.addPreventClickHandler(),this._disableOnInit&&this.disableInput(),t.checkPanelContentsReady(t.panels),this._plugins.forEach(function(e){return e.init(a)}),this._initialized=!0,o&&(this.trigger=r),this.trigger(new c.ComponentEvent(T.READY)),[2]}})})},n.destroy=function(){this.off(),window.removeEventListener("resize",this.resize),this._control.destroy(),this._camera.destroy(),this._renderer.destroy(),this._plugins.forEach(function(e){return e.destroy()}),this._initialized=!1},n.prev=function(e){var n;return void 0===e&&(e=this._duration),this.moveTo(null!==(n=null===(n=null===(n=this._control.activePanel)||void 0===n?void 0:n.prev())||void 0===n?void 0:n.index)&&void 0!==n?n:-1,e,N.PREV)},n.next=function(e){var n;return void 0===e&&(e=this._duration),this.moveTo(null!==(n=null===(n=null===(n=this._control.activePanel)||void 0===n?void 0:n.next())||void 0===n?void 0:n.index)&&void 0!==n?n:this._renderer.panelCount,e,N.NEXT)},n.moveTo=function(e,n,t){void 0===n&&(n=this._duration),void 0===t&&(t=N.NONE);var i=this._renderer,r=i.panelCount,i=i.getPanel(e);return i?this._control.animating?Promise.reject(new j(R.ANIMATION_ALREADY_PLAYING,C.ANIMATION_ALREADY_PLAYING)):this._control.moveToPanel(i,{duration:n,direction:t}):Promise.reject(new j(R.INDEX_OUT_OF_RANGE(e,0,r-1),C.INDEX_OUT_OF_RANGE))},n.getPanel=function(e){return this._renderer.getPanel(e)},n.enableInput=function(){return this._control.enable(),this},n.disableInput=function(){return this._control.disable(),this},n.getStatus=function(e){var n=void 0===e?{}:e,t=n.index,i=void 0===t||t,r=n.position,e=void 0===r||r,t=n.includePanelHTML,o=void 0!==t&&t,r=n.visiblePanelsOnly,t=void 0!==r&&r,n=this._camera,r={panels:(t?this.visiblePanels:this.panels).map(function(e){var n={index:e.index};return o&&(n.html=e.element.outerHTML),n})};return i&&(r.index=this.index),!e||(e=n.findNearestAnchor(n.position))&&(r.position={panel:e.panel.index,progressInPanel:n.getProgressInPanel(e.panel)}),t&&(t=this.visiblePanels,r.visibleOffset=null!==(t=null===(t=t[0])||void 0===t?void 0:t.index)&&void 0!==t?t:0),r},n.setStatus=function(e){if(!this._initialized)throw new j(R.NOT_INITIALIZED,C.NOT_INITIALIZED);var n=e.index,t=e.position,i=e.visibleOffset,r=e.panels,o=this._renderer,a=this._control;null!==(e=r[0])&&void 0!==e&&e.html&&!this._renderExternal&&(o.batchRemove({index:0,deleteCount:this.panels.length}),o.batchInsert({index:0,elements:p(r.map(function(e){return e.html}))})),n&&this.moveTo(i?n-i:n,0).catch(function(){}),t&&this._moveType===A.FREE_SCROLL&&(n=t.panel,t=t.progressInPanel,t=(n=o.panels[i?n-i:n].range).min+(n.max-n.min)*t,a.moveToPosition(t,0).catch(function(){}))},n.addPlugins=function(){for(var e,n=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return this._initialized&&t.forEach(function(e){return e.init(n)}),(e=this._plugins).push.apply(e,g([],d(t))),this},n.removePlugins=function(){for(var t=this,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.forEach(function(n){var e=function(e,n){for(var t=0;t<e.length;t++)if(n(e[t]))return t;return-1}(t._plugins,function(e){return e===n});0<=e&&(n.destroy(),t._plugins.splice(e,1))}),this},n.resize=function(){return h(this,void 0,void 0,function(){var n,t,i,r,o,a,s,l,u;return v(this,function(e){switch(e.label){case 0:return n=this._viewport,t=this._renderer,i=this._camera,r=this._control,u=r.activePanel,o=n.width,a=n.height,s=u?i.getProgressInPanel(u):0,this.trigger(new c.ComponentEvent(T.BEFORE_RESIZE,{width:o,height:a,element:n.element})),n.resize(),[4,t.forceRenderAllPanels()];case 1:return e.sent(),t.updatePanelSize(),i.updateAlignPos(),i.updateRange(),i.updateAnchors(),[4,t.render()];case 2:return e.sent(),r.animating||(r.updatePosition(s),r.updateInput()),l=n.width,u=n.height,u=l!==o||u!==a,this.trigger(new c.ComponentEvent(T.AFTER_RESIZE,{width:n.width,height:n.height,prev:{width:o,height:a},sizeChanged:u,element:n.element})),[2]}})})},n.append=function(e){return this.insert(this._renderer.panelCount,e)},n.prepend=function(e){return this.insert(0,e)},n.insert=function(e,n){if(this._renderExternal)throw new j(R.NOT_ALLOWED_IN_FRAMEWORK,C.NOT_ALLOWED_IN_FRAMEWORK);return this._renderer.batchInsert({index:e,elements:p(n)})},n.remove=function(e,n){if(void 0===n&&(n=1),this._renderExternal)throw new j(R.NOT_ALLOWED_IN_FRAMEWORK,C.NOT_ALLOWED_IN_FRAMEWORK);return this._renderer.batchRemove({index:e,deleteCount:n})},n._createControl=function(){var e,n=this._moveType,t=Object.keys(A).map(function(e){return A[e]}),i=Array.isArray(n)?n[0]:n,r=Array.isArray(n)&&null!==(e=n[1])&&void 0!==e?e:{};if(!E(t,i))throw new j(R.WRONG_OPTION("moveType",JSON.stringify(n)),C.WRONG_OPTION);switch(i){case A.SNAP:return new re(r);case A.FREE_SCROLL:return new oe(r);case A.STRICT:return new ae(r)}},n._createCamera=function(){var e={align:this._align};return this._circular?(this._bound&&console.warn('"circular" and "bound" option cannot be used together, ignoring bound.'),new de(e)):new(this._bound?ge:he)(e)},n._createRenderer=function(){var e={align:this._align},n=this._renderExternal;return n?new n.renderer(r(r({},e),n.rendererOptions)):new Ee(e)},n._moveToInitialPanel=function(){return h(this,void 0,void 0,function(){var n,t;return v(this,function(e){return t=this._renderer,n=this._control,(t=t.getPanel(this._defaultIndex)||t.getPanel(0))?(n.setActive(t,null,!1),[2,n.moveToPanel(t,{duration:0})]):[2]})})},e.VERSION="4.3.0",e}(c),B=(a(ye,me=le),ye);function ye(e){var n=me.call(this,e)||this;return n._externalComponent=e.externalComponent,n}function xe(e,t,i,n,r){e.batchInsert.apply(e,g([],d(t.added.slice(n,r).map(function(e,n){return{index:e,elements:[i[n+t.prevList.length]]}}))))}function Te(e,n,t){t=e.panels.slice(n,t),e.batchRemove({index:n,deleteCount:t.length})}var Ne=function(e){if("number"==typeof e)return e+"px";switch(e){case w.CENTER:return"50%";case w.NEXT:return"100%";case w.PREV:return"0%";default:return e}},ee={__proto__:null,withFlickingMethods:function(r,o){[c.prototype,Oe.prototype].forEach(function(t){Object.getOwnPropertyNames(t).filter(function(e){return!r[e]&&!e.startsWith("_")&&"constructor"!==e}).forEach(function(e){var n,i=Object.getOwnPropertyDescriptor(t,e);i.value?Object.defineProperty(r,e,{value:function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return(e=i.value).call.apply(e,g([this[o]],d(n)))}}):(n={},i.get&&(n.get=function(){var e;return null===(e=i.get)||void 0===e?void 0:e.call(this[o])}),i.set&&(n.set=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return null===(e=i.set)||void 0===e?void 0:e.call.apply(e,g([this[o]],d(n)))}),Object.defineProperty(r,e,n))})})},sync:function(e,t,i){var n,r,o,a,s=e.renderer,l=s.panels;0<t.removed.length&&(r=n=-1,t.removed.forEach(function(e){n<0&&(n=e),r=0<=r&&e!==r-1?(Te(s,r,n+1),n=e):e}),Te(s,r,n+1)),t.ordered.forEach(function(e){var n,t=d(e,2),i=t[0],r=t[1],e=l[i],t=r-i;0<t?(n=l.slice(i+1,r+1),e.increaseIndex(t),n.forEach(function(e){return e.decreaseIndex(1)})):(n=l.slice(r,i),e.decreaseIndex(-t),n.forEach(function(e){return e.increaseIndex(1)})),e.resize()}),0<t.ordered.length&&l.sort(function(e,n){return e.index-n.index}),0<t.added.length&&(a=o=-1,t.added.forEach(function(e,n){o<0&&(o=n),a=0<=a&&e!==a+1?(xe(s,t,i,o,n+1),o=-1):e}),0<=o&&xe(s,t,i,o))},getRenderingPanels:function(e,n){var t=n.removed.reduce(function(e,n){return e[n]=!0,e},{}),i=n.maintained.reduce(function(e,n){var t=d(n,2),n=t[0],t=t[1];return e[n]=t,e},{});return g(g([],d(e.panels.filter(function(e){return!t[e.index]}).sort(function(e,n){return e.position+e.offset-(n.position+n.offset)}).map(function(e){return n.list[i[e.index]]}))),d(n.added.map(function(e){return n.list[e]})))},getDefaultCameraTransform:function(e,n,t){void 0===n&&(n=!0);var i,i=(i="object"==typeof(i=e=void 0===e?w.CENTER:e)?i.camera:i,Ne(i)),e=(e="object"==typeof(e=e)?e.panel:e,D(Ne(e)));if(null==e)return"";e="calc("+i+" - ("+(t||"0px")+" * "+e.percentage+") - "+e.absolute+"px)";return n?"translate("+e+")":"translate(0, "+e+")"}};return e(Oe,{__proto__:null,Viewport:M,FlickingError:j,AnchorPoint:te,Panel:le,ElementPanel:be,ExternalPanel:B}),e(Oe,_e),e(Oe,se),e(Oe,Pe),e(Oe,I),e(Oe,ee),Oe});
10//# sourceMappingURL=flicking.min.js.map