/*!
 * better-scroll / better-scroll
 * (c) 2016-2023 ustbhuangyi
 * Released under the MIT License.
 *//*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var it=function(r,t){return it=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])},it(r,t)};function V(r,t){it(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var b=function(){return b=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++){e=arguments[o];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s])}return t},b.apply(this,arguments)};function G(r,t,e,o){function i(s){return s instanceof e?s:new e(function(n){n(s)})}return new(e||(e=Promise))(function(s,n){function a(c){try{l(o.next(c))}catch(p){n(p)}}function h(c){try{l(o.throw(c))}catch(p){n(p)}}function l(c){c.done?s(c.value):i(c.value).then(a,h)}l((o=o.apply(r,t||[])).next())})}function q(r,t){var e={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},o,i,s,n;return n={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function a(l){return function(c){return h([l,c])}}function h(l){if(o)throw new TypeError("Generator is already executing.");for(;e;)try{if(o=1,i&&(s=l[0]&2?i.return:l[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,l[1])).done)return s;switch(i=0,s&&(l=[l[0]&2,s.value]),l[0]){case 0:case 1:s=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,i=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(s=e.trys,!(s=s.length>0&&s[s.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]<s[3])){e.label=l[1];break}if(l[0]===6&&e.label<s[1]){e.label=s[1],s=l;break}if(s&&e.label<s[2]){e.label=s[2],e.ops.push(l);break}s[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(r,e)}catch(c){l=[6,c],i=0}finally{o=s=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function U(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var o=Array(r),i=0,t=0;t<e;t++)for(var s=arguments[t],n=0,a=s.length;n<a;n++,i++)o[i]=s[n];return o}var Ct=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];function P(r){console.error("[BScroll warn]: "+r)}function ht(r,t){if(!r)throw new Error("[BScroll] "+t)}var w=typeof window<"u",C=w&&navigator.userAgent.toLowerCase(),It=!!(C&&/wechatdevtools/.test(C)),zt=C&&C.indexOf("android")>0,Lt=function(){if(typeof C=="string"){var r=/os (\d\d?_\d(_\d)?)/,t=r.exec(C);if(!t)return!1;var e=t[1].split("_").map(function(o){return parseInt(o,10)});return e[0]===13&&e[1]>=4}return!1}(),xt=!1;if(w){var Ft="test-passive";try{var ct={};Object.defineProperty(ct,"passive",{get:function(){xt=!0}}),window.addEventListener(Ft,function(){},ct)}catch{}}function S(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var m=function(r,t){for(var e in t)r[e]=t[e];return r};function st(r){return r==null}function _t(r,t){return Math.sqrt(r*r+t*t)}function g(r,t,e){return r<t?t:r>e?e:r}function O(r,t){if(r.findIndex)return r.findIndex(t);var e=-1;return r.some(function(o,i,s){var n=t(o,i,s);if(n)return e=i,n}),e}var at=w&&document.createElement("div").style,H=function(){if(!w)return!1;for(var r=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],t=0,e=r;t<e.length;t++){var o=e[t];if(at[o.value]!==void 0)return o.key}return!1}();function x(r){return H===!1?r:H==="standard"?r==="transitionEnd"?"transitionend":r:H+r.charAt(0).toUpperCase()+r.substr(1)}function Et(r){return typeof r=="string"?document.querySelector(r):r}function At(r,t,e,o){var i=xt?{passive:!1,capture:!!o}:!!o;r.addEventListener(t,e,i)}function Nt(r,t,e,o){r.removeEventListener(t,e,{capture:!!o})}function X(r){r.cancelable&&r.preventDefault()}function pt(r){for(var t=0,e=0;r;)t-=r.offsetLeft,e-=r.offsetTop,r=r.offsetParent;return{left:t,top:e}}function Rt(r){var t=r.getBoundingClientRect();return{left:-(t.left+window.pageXOffset),top:-(t.top+window.pageYOffset)}}var Wt=H&&H!=="standard"?"-"+H.toLowerCase()+"-":"",Kt=x("transform"),Mt=x("transition"),Ut=w&&x("perspective")in at,ut=w&&("ontouchstart"in window||It),Vt=w&&Mt in at,d={transform:Kt,transition:Mt,transitionTimingFunction:x("transitionTimingFunction"),transitionDuration:x("transitionDuration"),transitionDelay:x("transitionDelay"),transformOrigin:x("transformOrigin"),transitionEnd:x("transitionEnd"),transitionProperty:x("transitionProperty")},J={touchstart:1,touchmove:1,touchend:1,touchcancel:1,mousedown:2,mousemove:2,mouseup:2};function D(r){if(r instanceof window.SVGElement){var t=r.getBoundingClientRect();return{top:t.top,left:t.left,width:t.width,height:t.height}}else return{top:r.offsetTop,left:r.offsetLeft,width:r.offsetWidth,height:r.offsetHeight}}function I(r,t){for(var e in t)if(t[e].test(r[e]))return!0;return!1}var $t=I;function Zt(r,t){var e=document.createEvent("Event");e.initEvent(t,!0,!0),e.pageX=r.pageX,e.pageY=r.pageY,r.target.dispatchEvent(e)}function Bt(r,t){t===void 0&&(t="click");var e;r.type==="mouseup"?e=r:(r.type==="touchend"||r.type==="touchcancel")&&(e=r.changedTouches[0]);var o={};e&&(o.screenX=e.screenX||0,o.screenY=e.screenY||0,o.clientX=e.clientX||0,o.clientY=e.clientY||0);var i,s=!0,n=!0,a=r.ctrlKey,h=r.shiftKey,l=r.altKey,c=r.metaKey,p={ctrlKey:a,shiftKey:h,altKey:l,metaKey:c};if(typeof MouseEvent<"u")try{i=new MouseEvent(t,m(b({bubbles:s,cancelable:n},p),o))}catch{u()}else u();function u(){i=document.createEvent("Event"),i.initEvent(t,s,n),m(i,o)}i.forwardedTouchEvent=!0,i._constructed=!0,r.target.dispatchEvent(i)}function jt(r){Bt(r,"dblclick")}function Gt(r,t){var e=t.firstChild;e?qt(r,e):t.appendChild(r)}function qt(r,t){var e=t.parentNode;e.insertBefore(r,t)}function Jt(r,t){r.removeChild(t)}function z(r,t){var e=new RegExp("(^|\\s)"+t+"(\\s|$)");return e.test(r.className)}function Qt(r){return Array.prototype.slice.call(r,0)}function te(r){return{width:r.clientWidth,height:r.clientHeight}}var y={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(r){return 1+--r*r*r*r*r}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(r){return r*(2-r)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(r){return 1- --r*r*r*r}}},ee=1e3/60,M=w&&window;function Yt(){}var lt=function(){return w?M.requestAnimationFrame||M.webkitRequestAnimationFrame||M.mozRequestAnimationFrame||M.oRequestAnimationFrame||function(r){return window.setTimeout(r,r.interval||ee)}:Yt}(),B=function(){return w?M.cancelAnimationFrame||M.webkitCancelAnimationFrame||M.mozCancelAnimationFrame||M.oCancelAnimationFrame||function(r){window.clearTimeout(r)}:Yt}(),ft=function(r){},Q={enumerable:!0,configurable:!0,get:ft,set:ft},oe=function(r,t){for(var e=t.split("."),o=0;o<e.length-1;o++)if(r=r[e[o]],typeof r!="object"||!r)return;var i=e.pop();return typeof r[i]=="function"?function(){return r[i].apply(r,arguments)}:r[i]},re=function(r,t,e){for(var o=t.split("."),i,s=0;s<o.length-1;s++)i=o[s],r[i]||(r[i]={}),r=r[i];r[o.pop()]=e};function ie(r,t,e){Q.get=function(){return oe(this,t)},Q.set=function(i){re(this,t,i)},Object.defineProperty(r,e,Q)}var E=function(){function r(t){this.events={},this.eventTypes={},this.registerType(t)}return r.prototype.on=function(t,e,o){return o===void 0&&(o=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},r.prototype.once=function(t,e,o){var i=this;o===void 0&&(o=this),this.hasType(t);var s=function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];i.off(t,s);var h=e.apply(o,n);if(h===!0)return h};return s.fn=e,this.on(t,s),this},r.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var o=this.events[t];if(!o)return this;for(var i=o.length;i--;)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,1);return this}},r.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this.hasType(t);var i=this.events[t];if(!!i)for(var s=i.length,n=U(i),a,h=0;h<s;h++){var l=n[h],c=l[0],p=l[1];if(c&&(a=c.apply(p,e),a===!0))return a}},r.prototype.registerType=function(t){var e=this;t.forEach(function(o){e.eventTypes[o]=o})},r.prototype.destroy=function(){this.events={},this.eventTypes={}},r.prototype.hasType=function(t){var e=this.eventTypes,o=e[t]===t;o||P('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+(""+Object.keys(e).map(function(i){return JSON.stringify(i)}))+"]")},r}(),T=function(){function r(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}return r.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},r.prototype.addDOMEvents=function(){this.handleDOMEvents(At)},r.prototype.removeDOMEvents=function(){this.handleDOMEvents(Nt)},r.prototype.handleDOMEvents=function(t){var e=this,o=this.wrapper;this.events.forEach(function(i){t(o,i.name,e,!!i.capture)})},r.prototype.handleEvent=function(t){var e=t.type;this.events.some(function(o){return o.name===e?(o.handler(t),!0):!1})},r}(),se=function(){function r(){}return r}(),ne=function(r){V(t,r);function t(){var e=r.call(this)||this;return e.startX=0,e.startY=0,e.scrollX=!1,e.scrollY=!0,e.freeScroll=!1,e.directionLockThreshold=0,e.eventPassthrough="",e.click=!1,e.dblclick=!1,e.tap="",e.bounce={top:!0,bottom:!0,left:!0,right:!0},e.bounceTime=800,e.momentum=!0,e.momentumLimitTime=300,e.momentumLimitDistance=15,e.swipeTime=2500,e.swipeBounceTime=500,e.deceleration=.0015,e.flickLimitTime=200,e.flickLimitDistance=100,e.resizePolling=60,e.probeType=0,e.stopPropagation=!1,e.preventDefault=!0,e.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},e.tagException={tagName:/^TEXTAREA$/},e.HWCompositing=!0,e.useTransition=!0,e.bindToWrapper=!1,e.bindToTarget=!1,e.disableMouse=ut,e.disableTouch=!ut,e.autoBlur=!0,e.autoEndDistance=5,e.outOfBoundaryDampingFactor=1/3,e.specifiedIndexAsContent=0,e.quadrant=1,e}return t.prototype.merge=function(e){if(!e)return this;for(var o in e){if(o==="bounce"){this.bounce=this.resolveBounce(e[o]);continue}this[o]=e[o]}return this},t.prototype.process=function(){return this.translateZ=this.HWCompositing&&Ut?" translateZ(1px)":"",this.useTransition=this.useTransition&&Vt,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX=this.eventPassthrough==="horizontal"?!1:this.scrollX,this.scrollY=this.eventPassthrough==="vertical"?!1:this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=this.freeScroll?!0:this.scrollX,this.scrollY=this.freeScroll?!0:this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},t.prototype.resolveBounce=function(e){var o={top:!0,right:!0,bottom:!0,left:!0},i={top:!1,right:!1,bottom:!1,left:!1},s;return typeof e=="object"?s=m(o,e):s=e?o:i,s},t}(se),ae=function(){function r(t,e){this.wrapper=t,this.options=e,this.hooks=new E(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}return r.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=t.disableTouch,s=t.click,n=this.wrapper,a=e?n:window,h=[],l=[],c=!i,p=!o;s&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),c&&(h.push({name:"touchstart",handler:this.start.bind(this)}),l.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),p&&(h.push({name:"mousedown",handler:this.start.bind(this)}),l.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new T(n,h),this.targetEventRegister=new T(a,l)},r.prototype.beforeHandler=function(t,e){var o=this.options,i=o.preventDefault,s=o.stopPropagation,n=o.preventDefaultException,a={start:function(){return i&&!I(t.target,n)},end:function(){return i&&!I(t.target,n)},move:function(){return i}};a[e]()&&t.preventDefault(),s&&t.stopPropagation()},r.prototype.setInitiated=function(t){t===void 0&&(t=0),this.initiated=t},r.prototype.start=function(t){var e=J[t.type];if(!(this.initiated&&this.initiated!==e)){if(this.setInitiated(e),$t(t.target,this.options.tagException)){this.setInitiated();return}if(!(e===2&&t.button!==0)&&!this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)){this.beforeHandler(t,"start");var o=t.touches?t.touches[0]:t;this.pointX=o.pageX,this.pointY=o.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}}},r.prototype.move=function(t){if(J[t.type]===this.initiated){this.beforeHandler(t,"move");var e=t.touches?t.touches[0]:t,o=e.pageX-this.pointX,i=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})){var s=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,n=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,a=this.pointX-s,h=this.pointY-n,l=this.options.autoEndDistance;(a>document.documentElement.clientWidth-l||h>document.documentElement.clientHeight-l||a<l||h<l)&&this.end(t)}}},r.prototype.end=function(t){J[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},r.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},r.prototype.setContent=function(t){t!==this.wrapper&&(this.wrapper=t,this.rebindDOMEvents())},r.prototype.rebindDOMEvents=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.handleDOMEvents()},r.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},r}(),tt={x:["translateX","px"],y:["translateY","px"]},le=function(){function r(t){this.setContent(t),this.hooks=new E(["beforeTranslate","translate"])}return r.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null),e=t[d.transform].split(")")[0].split(", "),o=+(e[12]||e[4])||0,i=+(e[13]||e[5])||0;return{x:o,y:i}},r.prototype.translate=function(t){var e=[];Object.keys(t).forEach(function(o){if(!!tt[o]){var i=tt[o][0];if(i){var s=tt[o][1],n=t[o];e.push(i+"("+n+s+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,e,t),this.style[d.transform]=e.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,t)},r.prototype.setContent=function(t){this.content!==t&&(this.content=t,this.style=t.style)},r.prototype.destroy=function(){this.hooks.destroy()},r}(),Xt=function(){function r(t,e,o){this.translater=e,this.options=o,this.timer=0,this.hooks=new E(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.setContent(t)}return r.prototype.translate=function(t){this.translater.translate(t)},r.prototype.setPending=function(t){this.pending=t},r.prototype.setForceStopped=function(t){this.forceStopped=t},r.prototype.setCallStop=function(t){this.callStopWhenPending=t},r.prototype.setContent=function(t){this.content!==t&&(this.content=t,this.style=t.style,this.stop())},r.prototype.clearTimer=function(){this.timer&&(B(this.timer),this.timer=0)},r.prototype.destroy=function(){this.hooks.destroy(),B(this.timer)},r}(),he=function(r,t,e,o){var i=function(l,c){var p=l-c,u=p>0?-1:p<0?1:0;return u},s=i(t.x,r.x),n=i(t.y,r.y),a=e.x-o.x,h=e.y-o.y;return s*a<=0&&n*h<=0},ce=function(r){V(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.startProbe=function(e,o){var i=this,s=e,n=function(){var a=i.translater.getComputedPosition();he(e,o,a,s)&&i.hooks.trigger(i.hooks.eventTypes.move,a),i.pending||(i.callStopWhenPending?i.callStopWhenPending=!1:i.hooks.trigger(i.hooks.eventTypes.end,a)),s=a,i.pending&&(i.timer=lt(n))};this.callStopWhenPending&&this.setCallStop(!1),B(this.timer),n()},t.prototype.transitionTime=function(e){e===void 0&&(e=0),this.style[d.transitionDuration]=e+"ms",this.hooks.trigger(this.hooks.eventTypes.time,e)},t.prototype.transitionTimingFunction=function(e){this.style[d.transitionTimingFunction]=e,this.hooks.trigger(this.hooks.eventTypes.timeFunction,e)},t.prototype.transitionProperty=function(){this.style[d.transitionProperty]=d.transform},t.prototype.move=function(e,o,i,s){this.setPending(i>0),this.transitionTimingFunction(s),this.transitionProperty(),this.transitionTime(i),this.translate(o);var n=this.options.probeType===3;i&&n&&this.startProbe(e,o),i||(this._reflow=this.content.offsetHeight,n&&this.hooks.trigger(this.hooks.eventTypes.move,o),this.hooks.trigger(this.hooks.eventTypes.end,o))},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),B(this.timer);var o=this.translater.getComputedPosition(),i=o.x,s=o.y;this.transitionTime(),this.translate({x:i,y:s}),this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:i,y:s})}return e},t.prototype.stop=function(){var e=this.doStop();e&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(Xt),pe=function(r){V(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.move=function(e,o,i,s){if(!i){this.translate(o),this.options.probeType===3&&this.hooks.trigger(this.hooks.eventTypes.move,o),this.hooks.trigger(this.hooks.eventTypes.end,o);return}this.animate(e,o,i,s)},t.prototype.animate=function(e,o,i,s){var n=this,a=S(),h=a+i,l=this.options.probeType===3,c=function(){var p=S();if(p>=h){n.translate(o),l&&n.hooks.trigger(n.hooks.eventTypes.move,o),n.hooks.trigger(n.hooks.eventTypes.end,o);return}p=(p-a)/i;var u=s(p),f={};Object.keys(o).forEach(function(v){var k=e[v],Y=o[v];f[v]=(Y-k)*u+k}),n.translate(f),l&&n.hooks.trigger(n.hooks.eventTypes.move,f),n.pending&&(n.timer=lt(c)),n.pending||(n.callStopWhenPending?n.callStopWhenPending=!1:n.hooks.trigger(n.hooks.eventTypes.end,o))};this.setPending(!0),this.callStopWhenPending&&this.setCallStop(!1),B(this.timer),c()},t.prototype.doStop=function(){var e=this.pending;if(this.setForceStopped(!1),this.setCallStop(!1),e){this.setPending(!1),B(this.timer);var o=this.translater.getComputedPosition();this.setForceStopped(!0),this.setCallStop(!0),this.hooks.trigger(this.hooks.eventTypes.forceStop,o)}return e},t.prototype.stop=function(){var e=this.doStop();e&&this.hooks.trigger(this.hooks.eventTypes.callStop)},t}(Xt);function ue(r,t,e){var o=e.useTransition,i={};return Object.defineProperty(i,"probeType",{enumerable:!0,configurable:!1,get:function(){return e.probeType}}),o?new ce(r,t,i):new pe(r,t,i)}var vt=function(){function r(t,e,o){this.wrapper=t,this.options=o,this.hooks=new E(["beforeComputeBoundary","computeBoundary","momentum","end","ignoreHasScroll"]),this.refresh(e)}return r.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},r.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},r.prototype.setMovingDirection=function(t){this.movingDirection=t>0?-1:t<0?1:0},r.prototype.setDirection=function(t){this.direction=t>0?-1:t<0?1:0},r.prototype.performDampingAlgorithm=function(t,e){var o=this.currentPos+t;return(o>this.minScrollPos||o<this.maxScrollPos)&&(o>this.minScrollPos&&this.options.bounces[0]||o<this.maxScrollPos&&this.options.bounces[1]?o=this.currentPos+t*e:o=o>this.minScrollPos?this.minScrollPos:this.maxScrollPos),o},r.prototype.end=function(t){var e={duration:0},o=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&o>this.options.momentumLimitDistance){var i=this.direction===-1&&this.options.bounces[0]||this.direction===1&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},r.prototype.momentum=function(t,e,o,i,s,n,a){a===void 0&&(a=this.options);var h=t-e,l=Math.abs(h)/o,c=a.deceleration,p=a.swipeBounceTime,u=a.swipeTime,f=Math.min(u,l*2/c),v={destination:t+l*l/c*(h<0?-1:1),duration:f,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,v,h),v.destination<i?(v.destination=n?Math.max(i-n/4,i-n/v.rate*l):i,v.duration=p):v.destination>s&&(v.destination=n?Math.min(s+n/4,s+n/v.rate*l):s,v.duration=p),v.destination=Math.round(v.destination),v},r.prototype.updateDirection=function(){var t=this.currentPos-this.absStartPos;this.setDirection(t)},r.prototype.refresh=function(t){var e=this.options.rect,o=e.size,i=e.position,s=window.getComputedStyle(this.wrapper,null).position==="static",n=D(this.wrapper);this.wrapperSize=this.wrapper[o==="width"?"clientWidth":"clientHeight"],this.setContent(t);var a=D(this.content);this.contentSize=a[o],this.relativeOffset=a[i],s&&(this.relativeOffset-=n[i]),this.computeBoundary(),this.setDirection(0)},r.prototype.setContent=function(t){t!==this.content&&(this.content=t,this.resetState())},r.prototype.resetState=function(){this.currentPos=0,this.startPos=0,this.dist=0,this.setDirection(0),this.setMovingDirection(0),this.resetStartPos()},r.prototype.computeBoundary=function(){this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);var t={minScrollPos:0,maxScrollPos:this.wrapperSize-this.contentSize};t.maxScrollPos<0&&(t.maxScrollPos-=this.relativeOffset,this.options.specifiedIndexAsContent===0&&(t.minScrollPos=-this.relativeOffset)),this.hooks.trigger(this.hooks.eventTypes.computeBoundary,t),this.minScrollPos=t.minScrollPos,this.maxScrollPos=t.maxScrollPos,this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,!this.hasScroll&&this.minScrollPos<this.maxScrollPos&&(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize)},r.prototype.updatePosition=function(t){this.currentPos=t},r.prototype.getCurrentPos=function(){return this.currentPos},r.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos),e=t===this.getCurrentPos();return{position:t,inBoundary:e}},r.prototype.adjustPosition=function(t){return!this.hasScroll&&!this.hooks.trigger(this.hooks.eventTypes.ignoreHasScroll)?t=this.minScrollPos:t>this.minScrollPos?t=this.minScrollPos:t<this.maxScrollPos&&(t=this.maxScrollPos),t},r.prototype.updateStartPos=function(){this.startPos=this.currentPos},r.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},r.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},r.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},r.prototype.destroy=function(){this.hooks.destroy()},r}(),L,F,_,A,dt=(L={},L.yes=function(r){return!0},L.no=function(r){return X(r),!1},L),fe=(F={},F.horizontal=(_={},_.yes="horizontal",_.no="vertical",_),F.vertical=(A={},A.yes="vertical",A.no="horizontal",A),F),ve=function(){function r(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}return r.prototype.reset=function(){this.directionLocked=""},r.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},r.prototype.adjustDelta=function(t,e){return this.directionLocked==="horizontal"?e=0:this.directionLocked==="vertical"&&(t=0),{deltaX:t,deltaY:e}},r.prototype.computeDirectionLock=function(t,e){this.directionLocked===""&&!this.freeScroll&&(t>e+this.directionLockThreshold?this.directionLocked="horizontal":e>=t+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},r.prototype.handleEventPassthrough=function(t){var e=fe[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return dt.yes(t);if(this.eventPassthrough===e.no)return dt.no(t)}return!1},r}(),de=function(r,t,e){return e===2?[t,-r]:e===3?[-r,-t]:e===4?[-t,r]:[r,t]},ge=function(){function r(t,e,o,i,s){this.hooks=new E(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd","contentNotMoved","detectMovingDirection","coordinateTransformation"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=i,this.options=s,this.directionLockAction=new ve(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}return r.prototype.bindActionsHandler=function(){var t=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(e){return t.enabled?t.handleStart(e):!0}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(e){var o=e.deltaX,i=e.deltaY,s=e.e;if(!t.enabled)return!0;var n=de(o,i,t.options.quadrant),a=n[0],h=n[1],l={deltaX:a,deltaY:h};return t.hooks.trigger(t.hooks.eventTypes.coordinateTransformation,l),t.handleMove(l.deltaX,l.deltaY,s)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(e){return t.enabled?t.handleEnd(e):!0}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(e){t.enabled&&!e._constructed&&t.handleClick(e)})},r.prototype.handleStart=function(t){var e=S();this.fingerMoved=!1,this.contentMoved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.doStop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},r.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var i=this.scrollBehaviorX.getAbsDist(t),s=this.scrollBehaviorY.getAbsDist(e),n=S();if(this.checkMomentum(i,s,n))return!0;if(this.directionLockAction.checkMovingDirection(i,s,o))return this.actionsHandler.setInitiated(),!0;var a=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.getCurrentPos(),l=this.scrollBehaviorX.move(a.deltaX),c=this.scrollBehaviorY.getCurrentPos(),p=this.scrollBehaviorY.move(a.deltaY);if(!this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)){this.fingerMoved||(this.fingerMoved=!0);var u=l!==h||p!==c;!this.contentMoved&&!u&&this.hooks.trigger(this.hooks.eventTypes.contentNotMoved),!this.contentMoved&&u&&(this.contentMoved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.contentMoved&&u&&(this.animater.translate({x:l,y:p}),this.dispatchScroll(n))}}},r.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),this.options.probeType===1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},r.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},r.prototype.handleEnd=function(t){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,t)){var e=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,t,e))return!0;e=this.ensureIntegerPos(e),this.animater.translate(e),this.endTime=S();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},r.prototype.ensureIntegerPos=function(t){this.ensuringInteger=!0;var e=t.x,o=t.y,i=this.scrollBehaviorX,s=i.minScrollPos,n=i.maxScrollPos,a=this.scrollBehaviorY,h=a.minScrollPos,l=a.maxScrollPos;return e=e>0?Math.ceil(e):Math.floor(e),o=o>0?Math.ceil(o):Math.floor(o),e=g(e,n,s),o=g(o,l,h),{x:e,y:o}},r.prototype.handleClick=function(t){I(t.target,this.options.preventDefaultException)||(X(t),t.stopPropagation())},r.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},r.prototype.refresh=function(){this.endTime=0},r.prototype.destroy=function(){this.hooks.destroy()},r}();function ye(r){var t=["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce(function(e,o){return e[o]=r[o],e},{});return t}function gt(r,t,e,o){var i=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor","specifiedIndexAsContent"].reduce(function(s,n){return s[n]=r[n],s},{});return i.scrollable=!!r[t],i.bounces=e,i.rect=o,i}function nt(r,t,e){e.forEach(function(o){var i,s;typeof o=="string"?i=s=o:(i=o.source,s=o.target),r.on(i,function(){for(var n=[],a=0;a<arguments.length;a++)n[a]=arguments[a];return t.trigger.apply(t,U([s],n))})})}function me(r,t){for(var e=Object.keys(r),o=0,i=e;o<i.length;o++){var s=i[o];if(r[s]!==t[s])return!1}return!0}var yt=1,ke=function(){function r(t,e,o){this.wrapper=t,this.content=e,this.resizeTimeout=0,this.hooks=new E(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","minDistanceScroll","scrollToElement","beforeRefresh"]),this.options=o;var i=this.options.bounce,s=i.left,n=i.right,a=i.top,h=i.bottom;this.scrollBehaviorX=new vt(t,e,gt(o,"scrollX",[s,n],{size:"width",position:"left"})),this.scrollBehaviorY=new vt(t,e,gt(o,"scrollY",[a,h],{size:"height",position:"top"})),this.translater=new le(this.content),this.animater=ue(this.content,this.translater,this.options),this.actionsHandler=new ae(this.options.bindToTarget?this.content:t,ye(this.options)),this.actions=new ge(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var l=this.resize.bind(this);this.resizeRegister=new T(window,[{name:"orientationchange",handler:l},{name:"resize",handler:l}]),this.registerTransitionEnd(),this.init()}return r.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},r.prototype.registerTransitionEnd=function(){this.transitionEndRegister=new T(this.content,[{name:d.transitionEnd,handler:this.transitionEnd.bind(this)}])},r.prototype.bindTranslater=function(){var t=this,e=this.translater.hooks;e.on(e.eventTypes.beforeTranslate,function(o){t.options.translateZ&&o.push(t.options.translateZ)}),e.on(e.eventTypes.translate,function(o){var i=t.getCurrentPos();if(t.updatePositions(o),t.actions.ensuringInteger===!0){t.actions.ensuringInteger=!1;return}(o.x!==i.x||o.y!==i.y)&&t.togglePointerEvents(!1)})},r.prototype.bindAnimater=function(){var t=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(e){t.resetPosition(t.options.bounceTime)||(t.animater.setPending(!1),t.hooks.trigger(t.hooks.eventTypes.scrollEnd,e))}),nt(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},r.prototype.bindActions=function(){var t=this,e=this.actions;nt(e.hooks,this.hooks,[{source:e.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:e.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:e.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:e.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:e.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:e.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),e.hooks.on(e.hooks.eventTypes.end,function(o,i){if(t.hooks.trigger(t.hooks.eventTypes.touchEnd,i),t.hooks.trigger(t.hooks.eventTypes.end,i)||!e.fingerMoved&&(t.hooks.trigger(t.hooks.eventTypes.scrollCancel),t.checkClick(o)))return!0;if(t.resetPosition(t.options.bounceTime,y.bounce))return t.animater.setForceStopped(!1),!0}),e.hooks.on(e.hooks.eventTypes.scrollEnd,function(o,i){var s=Math.abs(o.x-t.scrollBehaviorX.startPos),n=Math.abs(o.y-t.scrollBehaviorY.startPos);if(t.checkFlick(i,s,n)){t.animater.setForceStopped(!1),t.hooks.trigger(t.hooks.eventTypes.flick);return}if(t.momentum(o,i)){t.animater.setForceStopped(!1);return}e.contentMoved&&t.hooks.trigger(t.hooks.eventTypes.scrollEnd,o),t.animater.forceStopped&&t.animater.setForceStopped(!1)})},r.prototype.checkFlick=function(t,e,o){var i=1;if(this.hooks.events.flick.length>1&&t<this.options.flickLimitTime&&e<this.options.flickLimitDistance&&o<this.options.flickLimitDistance&&(o>i||e>i))return!0},r.prototype.momentum=function(t,e){var o={time:0,easing:y.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=st(i.destination)?o.newX:i.destination,o.newY=st(s.destination)?o.newY:s.destination,o.time=Math.max(i.duration,s.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,o,this),o.newX!==t.x||o.newY!==t.y)return(o.newX>this.scrollBehaviorX.minScrollPos||o.newX<this.scrollBehaviorX.maxScrollPos||o.newY>this.scrollBehaviorY.minScrollPos||o.newY<this.scrollBehaviorY.maxScrollPos)&&(o.easing=y.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},r.prototype.checkClick=function(t){var e={preventClick:this.animater.forceStopped};if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(!e.preventClick){var o=this.options.dblclick,i=!1;if(o&&this.lastClickTime){var s=o.delay,n=s===void 0?300:s;S()-this.lastClickTime<n&&(i=!0,jt(t))}return this.options.tap&&Zt(t,this.options.tap),this.options.click&&!I(t.target,this.options.preventDefaultException)&&Bt(t),this.lastClickTime=i?null:S(),!0}return!1},r.prototype.resize=function(){var t=this;!this.actions.enabled||(zt&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.hooks.trigger(t.hooks.eventTypes.resize)},this.options.resizePolling))},r.prototype.transitionEnd=function(t){if(!(t.target!==this.content||!this.animater.pending)){var e=this.animater;e.transitionTime(),this.resetPosition(this.options.bounceTime,y.bounce)||(this.animater.setPending(!1),this.options.probeType!==3&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos()))}},r.prototype.togglePointerEvents=function(t){t===void 0&&(t=!0);for(var e=this.content.children.length?this.content.children:[this.content],o=t?"auto":"none",i=0;i<e.length;i++){var s=e[i];s.isBScrollContainer||(s.style.pointerEvents=o)}},r.prototype.refresh=function(t){var e=this.setContent(t);this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(t),this.scrollBehaviorY.refresh(t),e&&(this.translater.setContent(t),this.animater.setContent(t),this.transitionEndRegister.destroy(),this.registerTransitionEnd(),this.options.bindToTarget&&this.actionsHandler.setContent(t)),this.actions.refresh(),this.wrapperOffset=pt(this.wrapper)},r.prototype.setContent=function(t){var e=t!==this.content;return e&&(this.content=t),e},r.prototype.scrollBy=function(t,e,o,i){o===void 0&&(o=0);var s=this.getCurrentPos(),n=s.x,a=s.y;i=i||y.bounce,t+=n,e+=a,this.scrollTo(t,e,o,i)},r.prototype.scrollTo=function(t,e,o,i,s){o===void 0&&(o=0),i===void 0&&(i=y.bounce),s===void 0&&(s={start:{},end:{}});var n=this.options.useTransition?i.style:i.fn,a=this.getCurrentPos(),h=b({x:a.x,y:a.y},s.start),l=b({x:t,y:e},s.end);if(this.hooks.trigger(this.hooks.eventTypes.scrollTo,l),!me(h,l)){var c=Math.abs(l.x-h.x),p=Math.abs(l.y-h.y);c<yt&&p<yt&&(o=0,this.hooks.trigger(this.hooks.eventTypes.minDistanceScroll)),this.animater.move(h,l,o,n)}},r.prototype.scrollToElement=function(t,e,o,i,s){var n=Et(t),a=pt(n),h=function(c,p,u){return typeof c=="number"?c:c?Math.round(p/2-u/2):0};o=h(o,n.offsetWidth,this.wrapper.offsetWidth),i=h(i,n.offsetHeight,this.wrapper.offsetHeight);var l=function(c,p,u,f){return c-=p,c=f.adjustPosition(c-u),c};a.left=l(a.left,this.wrapperOffset.left,o,this.scrollBehaviorX),a.top=l(a.top,this.wrapperOffset.top,i,this.scrollBehaviorY),!this.hooks.trigger(this.hooks.eventTypes.scrollToElement,n,a)&&this.scrollTo(a.left,a.top,e,s)},r.prototype.resetPosition=function(t,e){t===void 0&&(t=0),e===void 0&&(e=y.bounce);var o=this.scrollBehaviorX.checkInBoundary(),i=o.position,s=o.inBoundary,n=this.scrollBehaviorY.checkInBoundary(),a=n.position,h=n.inBoundary;return s&&h?!1:(Lt&&this.reflow(),this.scrollTo(i,a,t,e),!0)},r.prototype.reflow=function(){this._reflow=this.content.offsetHeight},r.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},r.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},r.prototype.enable=function(){this.actions.enabled=!0},r.prototype.disable=function(){B(this.animater.timer),this.actions.enabled=!1},r.prototype.destroy=function(){var t=this,e=["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"];e.forEach(function(o){return t[o].destroy()})},r}(),$=function(r){V(t,r);function t(e,o){var i=r.call(this,["refresh","contentChanged","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,s=Et(e);return s?(i.plugins={},i.options=new ne().merge(o).process(),i.setContent(s).valid&&(i.hooks=new E(["refresh","enable","disable","destroy","beforeInitialScrollTo","contentChanged"]),i.init(s)),i):(P("Can not resolve the wrapper DOM."),i)}return t.use=function(e){var o=e.pluginName,i=t.plugins.some(function(s){return e===s.ctor});return i?t:st(o)?(P("Plugin Class must specify plugin's name in static property by 'pluginName' field."),t):(t.pluginsMap[o]=!0,t.plugins.push({name:o,applyOrder:e.applyOrder,ctor:e}),t)},t.prototype.setContent=function(e){var o=!1,i=!0,s=e.children[this.options.specifiedIndexAsContent];return s?(o=this.content!==s,o&&(this.content=s)):(P("The wrapper need at least one child element to be content element to scroll."),i=!1),{valid:i,contentChanged:o}},t.prototype.init=function(e){var o=this;this.wrapper=e,e.isBScrollContainer=!0,this.scroller=new ke(e,this.content,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){o.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(Ct),this.applyPlugins(),this.refreshWithoutReset(this.content);var i=this.options,s=i.startX,n=i.startY,a={x:s,y:n};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,a)||this.scroller.scrollTo(a.x,a.y)},t.prototype.applyPlugins=function(){var e=this,o=this.options;t.plugins.sort(function(i,s){var n,a=(n={},n.pre=-1,n.post=1,n),h=i.applyOrder?a[i.applyOrder]:0,l=s.applyOrder?a[s.applyOrder]:0;return h-l}).forEach(function(i){var s=i.ctor;o[i.name]&&typeof s=="function"&&(e.plugins[i.name]=new s(e))})},t.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var e=document.activeElement;e&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA")&&e.blur()})},t.prototype.eventBubbling=function(){nt(this.scroller.hooks,this,[this.eventTypes.beforeScrollStart,this.eventTypes.scrollStart,this.eventTypes.scroll,this.eventTypes.scrollEnd,this.eventTypes.scrollCancel,this.eventTypes.touchEnd,this.eventTypes.flick])},t.prototype.refreshWithoutReset=function(e){this.scroller.refresh(e),this.hooks.trigger(this.hooks.eventTypes.refresh,e),this.trigger(this.eventTypes.refresh,e)},t.prototype.proxy=function(e){var o=this;e.forEach(function(i){var s=i.key,n=i.sourceKey;ie(o,n,s)})},t.prototype.refresh=function(){var e=this.setContent(this.wrapper),o=e.contentChanged,i=e.valid;if(i){var s=this.content;this.refreshWithoutReset(s),o&&(this.hooks.trigger(this.hooks.eventTypes.contentChanged,s),this.trigger(this.eventTypes.contentChanged,s)),this.scroller.resetPosition()}},t.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},t.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},t.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},t.prototype.eventRegister=function(e){this.registerType(e)},t.plugins=[],t.pluginsMap={},t}(E);function Z(r,t){var e=new $(r,t);return e}Z.use=$.use;Z.plugins=$.plugins;Z.pluginsMap=$.pluginsMap;var Te=Z,Se=function(){function r(t){this.scroll=t,this.wheelEndTimer=0,this.wheelMoveTimer=0,this.wheelStart=!1,this.init()}return r.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.registerEvent()},r.prototype.handleBScroll=function(){this.scroll.registerType(["alterOptions","mousewheelStart","mousewheelMove","mousewheelEnd"])},r.prototype.handleOptions=function(){var t=this.scroll.options.mouseWheel===!0?{}:this.scroll.options.mouseWheel,e={speed:20,invert:!1,easeTime:300,discreteTime:400,throttleTime:0,dampingFactor:.1};this.mouseWheelOpt=m(e,t)},r.prototype.handleHooks=function(){this.hooksFn=[],this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},r.prototype.registerEvent=function(){this.eventRegister=new T(this.scroll.scroller.wrapper,[{name:"wheel",handler:this.wheelHandler.bind(this)},{name:"mousewheel",handler:this.wheelHandler.bind(this)},{name:"DOMMouseScroll",handler:this.wheelHandler.bind(this)}])},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.wheelHandler=function(t){if(!!this.scroll.enabled){this.beforeHandler(t),this.wheelStart||(this.wheelStartHandler(t),this.wheelStart=!0);var e=this.getWheelDelta(t);this.wheelMoveHandler(e),this.wheelEndDetector(e)}},r.prototype.wheelStartHandler=function(t){this.cleanCache();var e=this.scroll.scroller,o=e.scrollBehaviorX,i=e.scrollBehaviorY;o.setMovingDirection(0),i.setMovingDirection(0),o.setDirection(0),i.setDirection(0),this.scroll.trigger(this.scroll.eventTypes.alterOptions,this.mouseWheelOpt),this.scroll.trigger(this.scroll.eventTypes.mousewheelStart)},r.prototype.cleanCache=function(){this.deltaCache=[]},r.prototype.wheelMoveHandler=function(t){var e=this,o=this.mouseWheelOpt,i=o.throttleTime,s=o.dampingFactor;if(i&&this.wheelMoveTimer)this.deltaCache.push(t);else{var n=this.deltaCache.reduce(function(f,v){return{x:f.x+v.x,y:f.y+v.y}},{x:0,y:0});this.cleanCache();var a=this.scroll.scroller,h=a.scrollBehaviorX,l=a.scrollBehaviorY;h.setMovingDirection(-t.directionX),l.setMovingDirection(-t.directionY),h.setDirection(t.x),l.setDirection(t.y);var c=h.performDampingAlgorithm(Math.round(t.x)+n.x,s),p=l.performDampingAlgorithm(Math.round(t.y)+n.x,s);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:c,y:p})){var u=this.getEaseTime();(c!==this.scroll.x||p!==this.scroll.y)&&this.scroll.scrollTo(c,p,u)}i&&(this.wheelMoveTimer=window.setTimeout(function(){e.wheelMoveTimer=0},i))}},r.prototype.wheelEndDetector=function(t){var e=this;window.clearTimeout(this.wheelEndTimer),this.wheelEndTimer=window.setTimeout(function(){e.wheelStart=!1,window.clearTimeout(e.wheelMoveTimer),e.wheelMoveTimer=0,e.scroll.trigger(e.scroll.eventTypes.mousewheelEnd,t)},this.mouseWheelOpt.discreteTime)},r.prototype.getWheelDelta=function(t){var e=this.mouseWheelOpt,o=e.speed,i=e.invert,s=0,n=0,a=i?-1:1;switch(!0){case"deltaX"in t:t.deltaMode===1?(s=-t.deltaX*o,n=-t.deltaY*o):(s=-t.deltaX,n=-t.deltaY);break;case"wheelDeltaX"in t:s=t.wheelDeltaX/120*o,n=t.wheelDeltaY/120*o;break;case"wheelDelta"in t:s=n=t.wheelDelta/120*o;break;case"detail"in t:s=n=-t.detail/3*o;break}s*=a,n*=a,this.scroll.hasVerticalScroll||(Math.abs(n)>Math.abs(s)&&(s=n),n=0),this.scroll.hasHorizontalScroll||(s=0);var h=s>0?-1:s<0?1:0,l=n>0?-1:n<0?1:0;return{x:s,y:n,directionX:h,directionY:l}},r.prototype.beforeHandler=function(t){var e=this.scroll.options,o=e.preventDefault,i=e.stopPropagation,s=e.preventDefaultException;o&&!I(t.target,s)&&X(t),i&&t.stopPropagation()},r.prototype.getEaseTime=function(){var t=100,e=this.mouseWheelOpt.easeTime;return e<t&&P("easeTime should be greater than 100.If mouseWheel easeTime is too small,scrollEnd will be triggered many times."),Math.max(e,t)},r.prototype.destroy=function(){this.eventRegister.destroy(),window.clearTimeout(this.wheelEndTimer),window.clearTimeout(this.wheelMoveTimer),this.hooksFn.forEach(function(t){var e=t[0],o=t[1],i=t[2];e.off(o,i)})},r.pluginName="mouseWheel",r.applyOrder="pre",r}(),Pe=function(){function r(t){this.scroll=t,this.stopObserver=!1,this.init()}return r.prototype.init=function(){this.handleMutationObserver(),this.handleHooks()},r.prototype.handleMutationObserver=function(){var t=this;if(typeof MutationObserver<"u"){var e=0;this.observer=new MutationObserver(function(o){t.mutationObserverHandler(o,e)}),this.startObserve(this.observer)}else this.checkDOMUpdate()},r.prototype.handleHooks=function(){var t=this;this.hooksFn=[],this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,function(){t.stopObserve(),t.handleMutationObserver()}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.enable,function(){t.stopObserver&&t.handleMutationObserver()}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.disable,function(){t.stopObserve()}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.destroy,function(){t.destroy()})},r.prototype.mutationObserverHandler=function(t,e){var o=this;if(!this.shouldNotRefresh()){for(var i=!1,s=!1,n=0;n<t.length;n++){var a=t[n];if(a.type!=="attributes"){i=!0;break}else if(a.target!==this.scroll.scroller.content){s=!0;break}}i?this.scroll.refresh():s&&(clearTimeout(e),e=window.setTimeout(function(){o.shouldNotRefresh()||o.scroll.refresh()},60))}},r.prototype.startObserve=function(t){var e={attributes:!0,childList:!0,subtree:!0};t.observe(this.scroll.scroller.content,e)},r.prototype.shouldNotRefresh=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY,i=e.currentPos>e.minScrollPos||e.currentPos<e.maxScrollPos||o.currentPos>o.minScrollPos||o.currentPos<o.maxScrollPos;return t.animater.pending||i},r.prototype.checkDOMUpdate=function(){var t=this,e=this.scroll.scroller.content,o=D(e),i=o.width,s=o.height,n=function(){if(!t.stopObserver){o=D(e);var h=o.width,l=o.height;(i!==h||s!==l)&&t.scroll.refresh(),i=h,s=l,a()}},a=function(){setTimeout(function(){n()},1e3)};a()},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.stopObserve=function(){this.stopObserver=!0,this.observer&&this.observer.disconnect()},r.prototype.destroy=function(){this.stopObserve(),this.hooksFn.forEach(function(t){var e=t[0],o=t[1],i=t[2];e.off(o,i)}),this.hooksFn.length=0},r.pluginName="observeDOM",r}(),be="plugins.pullDownRefresh",we=[{key:"finishPullDown",name:"finishPullDown"},{key:"openPullDown",name:"openPullDown"},{key:"closePullDown",name:"closePullDown"},{key:"autoPullDownRefresh",name:"autoPullDownRefresh"}],xe=we.map(function(r){return{key:r.key,sourceKey:be+"."+r.name}}),et="pullingDown",mt="enterThreshold",kt="leaveThreshold",Ee=function(){function r(t){this.scroll=t,this.pulling=0,this.thresholdBoundary=0,this.init()}return r.prototype.setPulling=function(t){this.pulling=t},r.prototype.setThresholdBoundary=function(t){this.thresholdBoundary=t},r.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullDownRefresh),this.handleHooks(),this.watch()},r.prototype.handleBScroll=function(){this.scroll.registerType([et,mt,kt]),this.scroll.proxy(xe)},r.prototype.handleOptions=function(t){t===void 0&&(t={}),t=t===!0?{}:t;var e={threshold:90,stop:40};this.options=m(e,t),this.scroll.options.probeType=3},r.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var e=this.scroll.scroller,o=e.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY=o.minScrollPos,this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,function(){t.finishPullDown()}),this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,function(i){i.maxScrollPos>0&&(i.maxScrollPos=-1),i.minScrollPos=t.currentMinScrollY}),this.hasMouseWheelPlugin()&&(this.registerHooks(this.scroll,this.scroll.eventTypes.alterOptions,function(i){var s=300,n=350;i.discreteTime=s,i.easeTime=n}),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,function(){e.hooks.trigger(e.hooks.eventTypes.end)}))},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.hasMouseWheelPlugin=function(){return!!this.scroll.eventTypes.alterOptions},r.prototype.watch=function(){var t=this.scroll.scroller;this.watching=!0,this.registerHooks(t.hooks,t.hooks.eventTypes.end,this.checkPullDown),this.registerHooks(this.scroll,this.scroll.eventTypes.scrollStart,this.resetStateBeforeScrollStart),this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkLocationOfThresholdBoundary),this.hasMouseWheelPlugin()&&this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelStart,this.resetStateBeforeScrollStart)},r.prototype.resetStateBeforeScrollStart=function(){this.isFetchingStatus()||(this.setPulling(1),this.setThresholdBoundary(0))},r.prototype.checkLocationOfThresholdBoundary=function(){if(this.pulling===1){var t=this.scroll,e=this.thresholdBoundary!==1&&this.locateInsideThresholdBoundary(),o=this.thresholdBoundary!==2&&!this.locateInsideThresholdBoundary();e&&(this.setThresholdBoundary(1),t.trigger(mt)),o&&(this.setThresholdBoundary(2),t.trigger(kt))}},r.prototype.locateInsideThresholdBoundary=function(){return this.scroll.y<=this.options.threshold},r.prototype.unwatch=function(){var t=this.scroll,e=t.scroller;this.watching=!1,e.hooks.off(e.hooks.eventTypes.end,this.checkPullDown),t.off(t.eventTypes.scrollStart,this.resetStateBeforeScrollStart),t.off(t.eventTypes.scroll,this.checkLocationOfThresholdBoundary),this.hasMouseWheelPlugin()&&t.off(t.eventTypes.mousewheelStart,this.resetStateBeforeScrollStart)},r.prototype.checkPullDown=function(){var t=this.options,e=t.threshold,o=t.stop;return this.scroll.y<e?!1:(this.pulling===1&&(this.modifyBehaviorYBoundary(o),this.setPulling(2),this.scroll.trigger(et)),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,y.bounce),this.isFetchingStatus())},r.prototype.isFetchingStatus=function(){return this.pulling===2},r.prototype.modifyBehaviorYBoundary=function(t){var e=this.scroll.scroller.scrollBehaviorY;this.cachedOriginanMinScrollY=e.minScrollPos,this.currentMinScrollY=t,e.computeBoundary()},r.prototype.finishPullDown=function(){if(this.isFetchingStatus()){var t=this.scroll.scroller.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY,t.computeBoundary(),this.setPulling(0),this.scroll.resetPosition(this.scroll.options.bounceTime,y.bounce)}},r.prototype.openPullDown=function(t){t===void 0&&(t={}),this.handleOptions(t),this.watching||this.watch()},r.prototype.closePullDown=function(){this.unwatch()},r.prototype.autoPullDownRefresh=function(){var t=this.options,e=t.threshold,o=t.stop;this.isFetchingStatus()||!this.watching||(this.modifyBehaviorYBoundary(o),this.scroll.trigger(this.scroll.eventTypes.scrollStart),this.scroll.scrollTo(this.scroll.x,e),this.setPulling(2),this.scroll.trigger(et),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,y.bounce))},r.pluginName="pullDownRefresh",r}(),Me="plugins.pullUpLoad",Be=[{key:"finishPullUp",name:"finishPullUp"},{key:"openPullUp",name:"openPullUp"},{key:"closePullUp",name:"closePullUp"},{key:"autoPullUpLoad",name:"autoPullUpLoad"}],Ye=Be.map(function(r){return{key:r.key,sourceKey:Me+"."+r.name}}),Tt="pullingUp",Xe=function(){function r(t){this.scroll=t,this.pulling=!1,this.watching=!1,this.init()}return r.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullUpLoad),this.handleHooks(),this.watch()},r.prototype.handleBScroll=function(){this.scroll.registerType([Tt]),this.scroll.proxy(Ye)},r.prototype.handleOptions=function(t){t===void 0&&(t={}),t=t===!0?{}:t;var e={threshold:0};this.options=m(e,t),this.scroll.options.probeType=3},r.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var e=this.scroll.scroller.scrollBehaviorY;this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.contentChanged,function(){t.finishPullUp()}),this.registerHooks(e.hooks,e.hooks.eventTypes.computeBoundary,function(o){o.maxScrollPos>0&&(o.maxScrollPos=-1)})},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.watch=function(){this.watching||(this.watching=!0,this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkPullUp))},r.prototype.unwatch=function(){this.watching=!1,this.scroll.off(this.scroll.eventTypes.scroll,this.checkPullUp)},r.prototype.checkPullUp=function(t){var e=this,o=this.options.threshold;this.scroll.movingDirectionY===1&&t.y<=this.scroll.maxScrollY+o&&(this.pulling=!0,this.scroll.once(this.scroll.eventTypes.scrollEnd,function(){e.pulling=!1}),this.unwatch(),this.scroll.trigger(Tt))},r.prototype.finishPullUp=function(){var t=this;this.scroll.scroller.scrollBehaviorY.setMovingDirection(0),this.pulling?this.scroll.once(this.scroll.eventTypes.scrollEnd,function(){t.watch()}):this.watch()},r.prototype.openPullUp=function(t){t===void 0&&(t={}),this.handleOptions(t),this.watch()},r.prototype.closePullUp=function(){this.unwatch()},r.prototype.autoPullUpLoad=function(){var t=this.options.threshold,e=this.scroll.scroller.scrollBehaviorY;if(!(this.pulling||!this.watching)){var o=-1,i=e.maxScrollPos+t+o;this.scroll.scroller.scrollBehaviorY.setMovingDirection(o),this.scroll.scrollTo(this.scroll.x,i,this.scroll.options.bounceTime)}},r.pluginName="pullUpLoad",r}(),De=function(){function r(t,e){this.indicator=t,this.options=e,this.hooks=new E(["touchStart","touchMove","touchEnd"]),this.registerEvents()}return r.prototype.registerEvents=function(){var t=this.options,e=t.disableMouse,o=t.disableTouch,i=[],s=[],n=[];e||(i.push({name:"mousedown",handler:this.start.bind(this)}),s.push({name:"mousemove",handler:this.move.bind(this)}),n.push({name:"mouseup",handler:this.end.bind(this)})),o||(i.push({name:"touchstart",handler:this.start.bind(this)}),s.push({name:"touchmove",handler:this.move.bind(this)}),n.push({name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),this.startEventRegister=new T(this.indicator.indicatorEl,i),this.moveEventRegister=new T(window,s),this.endEventRegister=new T(window,n)},r.prototype.BScrollIsDisabled=function(){return!this.indicator.scroll.enabled},r.prototype.start=function(t){if(!this.BScrollIsDisabled()){var e=t.touches?t.touches[0]:t;X(t),t.stopPropagation(),this.initiated=!0,this.lastPoint=e[this.indicator.keysMap.point],this.hooks.trigger(this.hooks.eventTypes.touchStart)}},r.prototype.move=function(t){if(!!this.initiated){var e=t.touches?t.touches[0]:t,o=e[this.indicator.keysMap.point];X(t),t.stopPropagation();var i=o-this.lastPoint;this.lastPoint=o,this.hooks.trigger(this.hooks.eventTypes.touchMove,i)}},r.prototype.end=function(t){!this.initiated||(this.initiated=!1,X(t),t.stopPropagation(),this.hooks.trigger(this.hooks.eventTypes.touchEnd))},r.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister.destroy(),this.endEventRegister.destroy()},r}(),Oe=function(){function r(t,e){this.scroll=t,this.options=e,this.hooksFn=[],this.wrapper=e.wrapper,this.direction=e.direction,this.indicatorEl=this.wrapper.children[0],this.keysMap=this.getKeysMap(),this.handleFade(),this.handleHooks()}return r.prototype.handleFade=function(){this.options.fade&&(this.wrapper.style.opacity="0")},r.prototype.handleHooks=function(){var t=this,e=this.options,o=e.fade,i=e.interactive,s=e.scrollbarTrackClickable,n=this.scroll,a=n.hooks,h=n.scroller.translater.hooks,l=n.scroller.animater.hooks;if(this.registerHooks(a,a.eventTypes.refresh,this.refresh),this.registerHooks(h,h.eventTypes.translate,function(v){var k=t.keysMap.hasScroll;t.scroll[k]&&t.updatePosition(v)}),this.registerHooks(l,l.eventTypes.time,this.transitionTime),this.registerHooks(l,l.eventTypes.timeFunction,this.transitionTimingFunction),o&&(this.registerHooks(n,n.eventTypes.scrollEnd,function(){t.fade()}),this.registerHooks(n,n.eventTypes.scrollStart,function(){t.fade(!0)}),n.eventTypes.mousewheelStart&&n.eventTypes.mousewheelEnd&&(this.registerHooks(n,n.eventTypes.mousewheelStart,function(){t.fade(!0)}),this.registerHooks(n,n.eventTypes.mousewheelMove,function(){t.fade(!0)}),this.registerHooks(n,n.eventTypes.mousewheelEnd,function(){t.fade()}))),i){var c=this.scroll.options,p=c.disableMouse,u=c.disableTouch;this.eventHandler=new De(this,{disableMouse:p,disableTouch:u});var f=this.eventHandler.hooks;this.registerHooks(f,f.eventTypes.touchStart,this.startHandler),this.registerHooks(f,f.eventTypes.touchMove,this.moveHandler),this.registerHooks(f,f.eventTypes.touchEnd,this.endHandler)}s&&this.bindClick()},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.bindClick=function(){var t=this.wrapper;this.clickEventRegister=new T(t,[{name:"click",handler:this.handleClick.bind(this)}])},r.prototype.handleClick=function(t){var e=this.calculateclickOffsetPos(t),o=this.scroll,i=o.x,s=o.y;i=this.direction==="horizontal"?e:i,s=this.direction==="vertical"?e:s,this.scroll.scrollTo(i,s,this.options.scrollbarTrackOffsetTime)},r.prototype.calculateclickOffsetPos=function(t){var e=this.keysMap,o=e.point,i=e.domRect,s=this.options.scrollbarTrackOffsetType,n=t[o]-this.wrapperRect[i],a=n<this.currentPos?-1:1,h=0,l=this.currentPos;return s==="step"?h=this.scrollInfo.baseSize*a:(h=0,l=n),this.newPos(l,h,this.scrollInfo)},r.prototype.getKeysMap=function(){return this.direction==="vertical"?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScrollPos:"maxScrollY",pos:"y",point:"pageY",translateProperty:"translateY",domRect:"top"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScrollPos:"maxScrollX",pos:"x",point:"pageX",translateProperty:"translateX",domRect:"left"}},r.prototype.fade=function(t){var e=this.options,o=e.fadeInTime,i=e.fadeOutTime,s=t?o:i,n=this.wrapper;n.style[d.transitionDuration]=s+"ms",n.style.opacity=t?"1":"0"},r.prototype.refresh=function(){var t=this.keysMap.hasScroll,e=this.scroll,o=e.x,i=e.y;if(this.wrapperRect=this.wrapper.getBoundingClientRect(),this.canScroll(e[t])){var s=this.keysMap,n=s.wrapperSize,a=s.scrollerSize,h=s.maxScrollPos;this.scrollInfo=this.refreshScrollInfo(this.wrapper[n],e[a],e[h],this.indicatorEl[n]),this.updatePosition({x:o,y:i})}},r.prototype.transitionTime=function(t){t===void 0&&(t=0),this.indicatorEl.style[d.transitionDuration]=t+"ms"},r.prototype.transitionTimingFunction=function(t){this.indicatorEl.style[d.transitionTimingFunction]=t},r.prototype.canScroll=function(t){return this.wrapper.style.display=t?"block":"none",t},r.prototype.refreshScrollInfo=function(t,e,o,i){var s=Math.max(Math.round(t*t/(e||t||1)),this.options.minSize);this.options.isCustom&&(s=i);var n=t-s,a=n/o;return{baseSize:s,maxScrollPos:n,minScrollPos:0,sizeRatio:a}},r.prototype.updatePosition=function(t){var e=this.caculatePosAndSize(t,this.scrollInfo),o=e.pos,i=e.size;this.refreshStyle(i,o),this.currentPos=o},r.prototype.caculatePosAndSize=function(t,e){var o=this.keysMap.pos,i=e.sizeRatio,s=e.baseSize,n=e.maxScrollPos,a=e.minScrollPos,h=this.options.minSize,l=Math.round(i*t[o]),c;return l<a?(c=Math.max(s+l*3,h),l=a):l>n?(c=Math.max(s-(l-n)*3,h),l=n+s-c):c=s,{pos:l,size:c}},r.prototype.refreshStyle=function(t,e){var o=this.keysMap,i=o.translateProperty,s=o.size,n=this.scroll.options.translateZ;this.indicatorEl.style[s]=t+"px",this.indicatorEl.style[d.transform]=i+"("+e+"px)"+n},r.prototype.startHandler=function(){this.moved=!1,this.startTime=S(),this.transitionTime(),this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.beforeScrollStart)},r.prototype.moveHandler=function(t){if(!this.moved&&!this.indicatorNotMoved(t)&&(this.moved=!0,this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.scrollStart)),this.moved){var e=this.newPos(this.currentPos,t,this.scrollInfo);this.syncBScroll(e)}},r.prototype.endHandler=function(){if(this.moved){var t=this.scroll,e=t.x,o=t.y;this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.scrollEnd,{x:e,y:o})}},r.prototype.indicatorNotMoved=function(t){var e=this.currentPos,o=this.scrollInfo,i=o.maxScrollPos,s=o.minScrollPos,n=e===s&&t<=0||e===i&&t>=0;return n},r.prototype.syncBScroll=function(t){var e=S(),o=this.scroll,i=o.x,s=o.y,n=o.options,a=o.scroller,h=o.maxScrollY,l=o.minScrollY,c=o.maxScrollX,p=o.minScrollX,u=n.probeType,f=n.momentumLimitTime,v={x:i,y:s};this.direction==="vertical"?v.y=g(t,h,l):v.x=g(t,c,p),a.translater.translate(v),e-this.startTime>f&&(this.startTime=e,u===1&&a.hooks.trigger(a.hooks.eventTypes.scroll,v)),u>1&&a.hooks.trigger(a.hooks.eventTypes.scroll,v)},r.prototype.newPos=function(t,e,o){var i=o.maxScrollPos,s=o.sizeRatio,n=o.minScrollPos,a=t+e;return a=g(a,n,i),Math.round(a/s)},r.prototype.destroy=function(){var t=this.options,e=t.interactive,o=t.scrollbarTrackClickable,i=t.isCustom;e&&this.eventHandler.destroy(),o&&this.clickEventRegister.destroy(),i||this.wrapper.parentNode.removeChild(this.wrapper),this.hooksFn.forEach(function(s){var n=s[0],a=s[1],h=s[2];n.off(a,h)}),this.hooksFn.length=0},r}(),He=function(){function r(t){this.scroll=t,this.handleOptions(),this.createIndicators(),this.handleHooks()}return r.prototype.handleHooks=function(){var t=this,e=this.scroll;e.hooks.on(e.hooks.eventTypes.destroy,function(){for(var o=0,i=t.indicators;o<i.length;o++){var s=i[o];s.destroy()}})},r.prototype.handleOptions=function(){var t=this.scroll.options.scrollbar===!0?{}:this.scroll.options.scrollbar,e={fade:!0,fadeInTime:250,fadeOutTime:500,interactive:!1,customElements:[],minSize:8,scrollbarTrackClickable:!1,scrollbarTrackOffsetType:"step",scrollbarTrackOffsetTime:300};this.options=m(e,t)},r.prototype.createIndicators=function(){for(var t,e=this.scroll,o=[],i=["scrollX","scrollY"],s=["horizontal","vertical"],n=this.options.customElements,a=0;a<i.length;a++){var h=i[a];if(e.options[h]){var l=n.shift(),c=s[a],p=!1,u=l||this.createScrollbarElement(c);u!==l?e.wrapper.appendChild(u):p=!0,t=b(b({wrapper:u,direction:c},this.options),{isCustom:p}),o.push(new Oe(e,t))}}this.indicators=o},r.prototype.createScrollbarElement=function(t,e){e===void 0&&(e=this.options.scrollbarTrackClickable);var o=document.createElement("div"),i=document.createElement("div");return o.style.cssText="position:absolute;z-index:9999;overflow:hidden;",i.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",i.className="bscroll-indicator",t==="horizontal"?(o.style.cssText+="height:7px;left:2px;right:2px;bottom:0;",i.style.height="100%",o.className="bscroll-horizontal-scrollbar"):(o.style.cssText+="width:7px;bottom:2px;top:2px;right:1px;",i.style.width="100%",o.className="bscroll-vertical-scrollbar"),e||(o.style.cssText+="pointer-events:none;"),o.appendChild(i),o},r.pluginName="scrollbar",r}(),Dt={pageX:0,pageY:0,x:0,y:0},Ce={x:0,y:0,width:0,height:0,cx:0,cy:0},Ie=function(){function r(t){this.scroll=t,this.init()}return r.prototype.init=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY;this.wrapperWidth=e.wrapperSize,this.wrapperHeight=o.wrapperSize,this.scrollerHeight=o.contentSize,this.scrollerWidth=e.contentSize,this.pages=this.buildPagesMatrix(this.wrapperWidth,this.wrapperHeight),this.pageLengthOfX=this.pages?this.pages.length:0,this.pageLengthOfY=this.pages&&this.pages[0]?this.pages[0].length:0},r.prototype.getPageStats=function(t,e){return this.pages[t]&&this.pages[t][e]?this.pages[t][e]:Ce},r.prototype.getNearestPageIndex=function(t,e){for(var o=0,i=0,s=this.pages.length;o<s-1&&!(t>=this.pages[o][0].cx);o++);for(s=this.pages[o]?this.pages[o].length:0;i<s-1&&!(e>=this.pages[0][i].cy);i++);return{pageX:o,pageY:i}},r.prototype.buildPagesMatrix=function(t,e){var o=[],i=0,s,n,a,h=0,l,c=this.scroll.scroller.scrollBehaviorX.maxScrollPos,p=this.scroll.scroller.scrollBehaviorY.maxScrollPos;for(n=Math.round(t/2),a=Math.round(e/2);i>-this.scrollerWidth;){for(o[h]=[],l=0,s=0;s>-this.scrollerHeight;)o[h][l]={x:Math.max(i,c),y:Math.max(s,p),width:t,height:e,cx:i-n,cy:s-a},s-=e,l++;i-=t,h++}return o},r}(),ze=function(){function r(t,e){this.scroll=t,this.slideOptions=e,this.slideX=!1,this.slideY=!1,this.currentPage=m({},Dt)}return r.prototype.refresh=function(){this.pagesMatrix=new Ie(this.scroll),this.checkSlideLoop(),this.currentPage=this.getAdjustedCurrentPage()},r.prototype.getAdjustedCurrentPage=function(){var t=this.currentPage,e=t.pageX,o=t.pageY;e=Math.min(e,this.pagesMatrix.pageLengthOfX-1),o=Math.min(o,this.pagesMatrix.pageLengthOfY-1),this.loopX&&(e=Math.min(e,this.pagesMatrix.pageLengthOfX-2)),this.loopY&&(o=Math.min(o,this.pagesMatrix.pageLengthOfY-2));var i=this.pagesMatrix.getPageStats(e,o),s=i.x,n=i.y;return{pageX:e,pageY:o,x:s,y:n}},r.prototype.setCurrentPage=function(t){this.currentPage=t},r.prototype.getInternalPage=function(t,e){t>=this.pagesMatrix.pageLengthOfX?t=this.pagesMatrix.pageLengthOfX-1:t<0&&(t=0),e>=this.pagesMatrix.pageLengthOfY?e=this.pagesMatrix.pageLengthOfY-1:e<0&&(e=0);var o=this.pagesMatrix.getPageStats(t,e),i=o.x,s=o.y;return{pageX:t,pageY:e,x:i,y:s}},r.prototype.getInitialPage=function(t,e){t===void 0&&(t=!1),e===void 0&&(e=!1);var o=this.slideOptions,i=o.startPageXIndex,s=o.startPageYIndex,n=this.loopX?1:0,a=this.loopY?1:0,h=t?n:this.currentPage.pageX,l=t?a:this.currentPage.pageY;e?(h=this.loopX?i+1:i,l=this.loopY?s+1:s):(h=t?n:this.currentPage.pageX,l=t?a:this.currentPage.pageY);var c=this.pagesMatrix.getPageStats(h,l),p=c.x,u=c.y;return{pageX:h,pageY:l,x:p,y:u}},r.prototype.getExposedPage=function(t){var e=m({},t);return this.loopX&&(e.pageX=this.fixedPage(e.pageX,this.pagesMatrix.pageLengthOfX-2)),this.loopY&&(e.pageY=this.fixedPage(e.pageY,this.pagesMatrix.pageLengthOfY-2)),e},r.prototype.getExposedPageByPageIndex=function(t,e){var o={pageX:t,pageY:e};this.loopX&&(o.pageX=t+1),this.loopY&&(o.pageY=e+1);var i=this.pagesMatrix.getPageStats(o.pageX,o.pageY),s=i.x,n=i.y;return{x:s,y:n,pageX:t,pageY:e}},r.prototype.getWillChangedPage=function(t){return t=m({},t),this.loopX&&(t.pageX=this.fixedPage(t.pageX,this.pagesMatrix.pageLengthOfX-2),t.x=this.pagesMatrix.getPageStats(t.pageX+1,0).x),this.loopY&&(t.pageY=this.fixedPage(t.pageY,this.pagesMatrix.pageLengthOfY-2),t.y=this.pagesMatrix.getPageStats(0,t.pageY+1).y),t},r.prototype.fixedPage=function(t,e){for(var o=[],i=0;i<e;i++)o.push(i);return o.unshift(e-1),o.push(0),o[t]},r.prototype.getPageStats=function(){return this.pagesMatrix.getPageStats(this.currentPage.pageX,this.currentPage.pageY)},r.prototype.getValidPageIndex=function(t,e){var o=this.pagesMatrix.pageLengthOfX-1,i=this.pagesMatrix.pageLengthOfY-1,s=0,n=0;return this.loopX&&(t+=1,s=s+1,o=o-1),this.loopY&&(e+=1,n=n+1,i=i-1),t=g(t,s,o),e=g(e,n,i),{pageX:t,pageY:e}},r.prototype.nextPageIndex=function(){return this.getPageIndexByDirection("positive")},r.prototype.prevPageIndex=function(){return this.getPageIndexByDirection("negative")},r.prototype.getNearestPage=function(t,e){var o=this.pagesMatrix.getNearestPageIndex(t,e),i=o.pageX,s=o.pageY,n=this.pagesMatrix.getPageStats(i,0).x,a=this.pagesMatrix.getPageStats(0,s).y;return{x:n,y:a,pageX:i,pageY:s}},r.prototype.getPageByDirection=function(t,e,o){var i=t.pageX,s=t.pageY;i===this.currentPage.pageX&&(i=g(i+e,0,this.pagesMatrix.pageLengthOfX-1)),s===this.currentPage.pageY&&(s=g(s+o,0,this.pagesMatrix.pageLengthOfY-1));var n=this.pagesMatrix.getPageStats(i,0).x,a=this.pagesMatrix.getPageStats(0,s).y;return{x:n,y:a,pageX:i,pageY:s}},r.prototype.resetLoopPage=function(){if(this.loopX){if(this.currentPage.pageX===0)return{pageX:this.pagesMatrix.pageLengthOfX-2,pageY:this.currentPage.pageY};if(this.currentPage.pageX===this.pagesMatrix.pageLengthOfX-1)return{pageX:1,pageY:this.currentPage.pageY}}if(this.loopY){if(this.currentPage.pageY===0)return{pageX:this.currentPage.pageX,pageY:this.pagesMatrix.pageLengthOfY-2};if(this.currentPage.pageY===this.pagesMatrix.pageLengthOfY-1)return{pageX:this.currentPage.pageX,pageY:1}}},r.prototype.getPageIndexByDirection=function(t){var e=this.currentPage.pageX,o=this.currentPage.pageY;return this.slideX&&(e=t==="negative"?e-1:e+1),this.slideY&&(o=t==="negative"?o-1:o+1),{pageX:e,pageY:o}},r.prototype.checkSlideLoop=function(){this.wannaLoop=this.slideOptions.loop,this.pagesMatrix.pageLengthOfX>1?this.slideX=!0:this.slideX=!1,this.pagesMatrix.pages[0]&&this.pagesMatrix.pageLengthOfY>1?this.slideY=!0:this.slideY=!1,this.loopX=this.wannaLoop&&this.slideX,this.loopY=this.wannaLoop&&this.slideY,this.slideX&&this.slideY&&P("slide does not support two direction at the same time.")},r}(),Le="plugins.slide",Fe=[{key:"next",name:"next"},{key:"prev",name:"prev"},{key:"goToPage",name:"goToPage"},{key:"getCurrentPage",name:"getCurrentPage"},{key:"startPlay",name:"startPlay"},{key:"pausePlay",name:"pausePlay"}],_e=Fe.map(function(r){return{key:r.key,sourceKey:Le+"."+r.name}}),Ae=function(r,t){return r.pageX===t.pageX&&r.pageY===t.pageY},Ne=function(){function r(t){this.scroll=t,this.cachedClonedPageDOM=[],this.resetLooping=!1,this.autoplayTimer=0,this.satisfyInitialization()&&this.init()}return r.prototype.satisfyInitialization=function(){return this.scroll.scroller.content.children.length<=0?(P("slide need at least one slide page to be initialised.please check your DOM layout."),!1):!0},r.prototype.init=function(){this.willChangeToPage=m({},Dt),this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.createPages()},r.prototype.createPages=function(){this.pages=new ze(this.scroll,this.options)},r.prototype.handleBScroll=function(){this.scroll.registerType(["slideWillChange","slidePageChanged"]),this.scroll.proxy(_e)},r.prototype.handleOptions=function(){var t=this.scroll.options.slide===!0?{}:this.scroll.options.slide,e={loop:!0,threshold:.1,speed:400,easing:y.bounce,listenFlick:!0,autoplay:!0,interval:3e3,startPageXIndex:0,startPageYIndex:0};this.options=m(e,t)},r.prototype.handleLoop=function(t){var e=this.options.loop,o=this.scroll.scroller.content,i=o.children.length;e&&(o!==t?(this.resetLoopChangedStatus(),this.removeClonedSlidePage(t),i>1&&this.cloneFirstAndLastSlidePage(o)):i===3&&this.initialised?(this.removeClonedSlidePage(o),this.moreToOnePageInLoop=!0,this.oneToMorePagesInLoop=!1):i>1?(this.initialised&&this.cachedClonedPageDOM.length===0?(this.oneToMorePagesInLoop=!0,this.moreToOnePageInLoop=!1):(this.removeClonedSlidePage(o),this.resetLoopChangedStatus()),this.cloneFirstAndLastSlidePage(o)):this.resetLoopChangedStatus())},r.prototype.resetLoopChangedStatus=function(){this.moreToOnePageInLoop=!1,this.oneToMorePagesInLoop=!1},r.prototype.handleHooks=function(){var t=this,e=this.scroll.hooks,o=this.scroll.scroller.hooks,i=this.options.listenFlick;this.prevContent=this.scroll.scroller.content,this.hooksFn=[],this.registerHooks(this.scroll,this.scroll.eventTypes.beforeScrollStart,this.pausePlay),this.registerHooks(this.scroll,this.scroll.eventTypes.scrollEnd,this.modifyCurrentPage),this.registerHooks(this.scroll,this.scroll.eventTypes.scrollEnd,this.startPlay),this.scroll.eventTypes.mousewheelMove&&(this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelMove,function(){return!0}),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,function(s){(s.directionX===1||s.directionY===1)&&t.next(),(s.directionX===-1||s.directionY===-1)&&t.prev()})),this.registerHooks(e,e.eventTypes.refresh,this.refreshHandler),this.registerHooks(e,e.eventTypes.destroy,this.destroy),this.registerHooks(o,o.eventTypes.beforeRefresh,function(){t.handleLoop(t.prevContent),t.setSlideInlineStyle()}),this.registerHooks(o,o.eventTypes.momentum,this.modifyScrollMetaHandler),this.registerHooks(o,o.eventTypes.scroll,this.scrollHandler),this.registerHooks(o,o.eventTypes.checkClick,this.startPlay),i&&this.registerHooks(o,o.eventTypes.flick,this.flickHandler)},r.prototype.startPlay=function(){var t=this,e=this.options,o=e.interval,i=e.autoplay;i&&(clearTimeout(this.autoplayTimer),this.autoplayTimer=window.setTimeout(function(){t.next()},o))},r.prototype.pausePlay=function(){this.options.autoplay&&clearTimeout(this.autoplayTimer)},r.prototype.setSlideInlineStyle=function(){var t=[{direction:"scrollX",sizeType:"offsetWidth",styleType:"width"},{direction:"scrollY",sizeType:"offsetHeight",styleType:"height"}],e=this.scroll.scroller,o=e.content,i=e.wrapper,s=this.scroll.options;t.forEach(function(n){var a=n.direction,h=n.sizeType,l=n.styleType;if(s[a]){for(var c=i[h],p=o.children,u=p.length,f=0;f<u;f++){var v=p[f];v.style[l]=c+"px"}o.style[l]=c*u+"px"}})},r.prototype.next=function(t,e){var o=this.pages.nextPageIndex(),i=o.pageX,s=o.pageY;this.goTo(i,s,t,e)},r.prototype.prev=function(t,e){var o=this.pages.prevPageIndex(),i=o.pageX,s=o.pageY;this.goTo(i,s,t,e)},r.prototype.goToPage=function(t,e,o,i){var s=this.pages.getValidPageIndex(t,e);this.goTo(s.pageX,s.pageY,o,i)},r.prototype.getCurrentPage=function(){return this.exposedPage||this.pages.getInitialPage(!1,!0)},r.prototype.setCurrentPage=function(t){this.pages.setCurrentPage(t),this.exposedPage=this.pages.getExposedPage(t)},r.prototype.nearestPage=function(t,e){var o=this.scroll.scroller,i=o.scrollBehaviorX,s=o.scrollBehaviorY,n=i.maxScrollPos,a=i.minScrollPos,h=s.maxScrollPos,l=s.minScrollPos;return this.pages.getNearestPage(g(t,n,a),g(e,h,l))},r.prototype.satisfyThreshold=function(t,e){var o=this.scroll.scroller,i=o.scrollBehaviorX,s=o.scrollBehaviorY,n=!0;return Math.abs(t-i.absStartPos)<=this.thresholdX&&Math.abs(e-s.absStartPos)<=this.thresholdY&&(n=!1),n},r.prototype.refreshHandler=function(t){var e=this;if(!!this.satisfyInitialization()){this.pages.refresh(),this.computeThreshold();var o=this.contentChanged=this.prevContent!==t;o&&(this.prevContent=t);var i=this.pages.getInitialPage(this.oneToMorePagesInLoop||this.moreToOnePageInLoop,o||!this.initialised);this.initialised?this.goTo(i.pageX,i.pageY,0):this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(s){e.initialised=!0,s.x=i.x,s.y=i.y}),this.startPlay()}},r.prototype.computeThreshold=function(){var t=this.options.threshold;if(t%1===0)this.thresholdX=t,this.thresholdY=t;else{var e=this.pages.getPageStats(),o=e.width,i=e.height;this.thresholdX=Math.round(o*t),this.thresholdY=Math.round(i*t)}},r.prototype.cloneFirstAndLastSlidePage=function(t){var e=t.children,o=e[e.length-1].cloneNode(!0),i=e[0].cloneNode(!0);Gt(o,t),t.appendChild(i),this.cachedClonedPageDOM=[o,i]},r.prototype.removeClonedSlidePage=function(t){var e=t&&t.children||[];e.length&&this.cachedClonedPageDOM.forEach(function(o){Jt(t,o)}),this.cachedClonedPageDOM=[]},r.prototype.modifyCurrentPage=function(t){var e=this.getCurrentPage(),o=e.pageX,i=e.pageY,s=this.nearestPage(t.x,t.y);if(this.setCurrentPage(s),this.contentChanged)return this.contentChanged=!1,!0;var n=this.getCurrentPage(),a=n.pageX,h=n.pageY;if(this.pageWillChangeTo(s),this.oneToMorePagesInLoop)return this.oneToMorePagesInLoop=!1,!0;if(this.moreToOnePageInLoop&&o===0&&i===0)return this.moreToOnePageInLoop=!1,!0;if(o!==a||i!==h){var l=this.pages.getExposedPageByPageIndex(a,h);this.scroll.trigger(this.scroll.eventTypes.slidePageChanged,l)}if(this.resetLooping){this.resetLooping=!1;return}var c=this.pages.resetLoopPage();if(c)return this.resetLooping=!0,this.goTo(c.pageX,c.pageY,0),!0},r.prototype.goTo=function(t,e,o,i){var s=this.pages.getInternalPage(t,e),n=i||this.options.easing||y.bounce,a=s.x,h=s.y,l=a-this.scroll.scroller.scrollBehaviorX.currentPos,c=h-this.scroll.scroller.scrollBehaviorY.currentPos;if(!l&&!c){this.scroll.scroller.togglePointerEvents(!0);return}o=o===void 0?this.getEaseTime(l,c):o,this.scroll.scroller.scrollTo(a,h,o,n)},r.prototype.flickHandler=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY,i=e.currentPos,s=e.startPos,n=e.direction,a=o.currentPos,h=o.startPos,l=o.direction,c=this.pages.currentPage,p=c.pageX,u=c.pageY,f=this.getEaseTime(i-s,a-h);this.goTo(p+n,u+l,f)},r.prototype.getEaseTime=function(t,e){return this.options.speed||Math.max(Math.max(Math.min(Math.abs(t),1e3),Math.min(Math.abs(e),1e3)),300)},r.prototype.modifyScrollMetaHandler=function(t){var e=this.scroll.scroller,o=e.scrollBehaviorX,i=e.scrollBehaviorY,s=e.animater,n=t.newX,a=t.newY,h=this.satisfyThreshold(n,a)||s.forceStopped?this.pages.getPageByDirection(this.nearestPage(n,a),o.direction,i.direction):this.pages.currentPage;t.time=this.getEaseTime(t.newX-h.x,t.newY-h.y),t.newX=h.x,t.newY=h.y,t.easing=this.options.easing||y.bounce},r.prototype.scrollHandler=function(t){var e=t.x,o=t.y;if(this.satisfyThreshold(e,o)){var i=this.nearestPage(e,o);this.pageWillChangeTo(i)}},r.prototype.pageWillChangeTo=function(t){var e=this.pages.getWillChangedPage(t);Ae(this.willChangeToPage,e)||(this.willChangeToPage=e,this.scroll.trigger(this.scroll.eventTypes.slideWillChange,this.willChangeToPage))},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.destroy=function(){var t=this.scroll.scroller.content,e=this.options,o=e.loop,i=e.autoplay;o&&this.removeClonedSlidePage(t),i&&clearTimeout(this.autoplayTimer),this.hooksFn.forEach(function(s){var n=s[0],a=s[1],h=s[2];n.eventTypes[a]&&n.off(a,h)}),this.hooksFn.length=0},r.pluginName="slide",r}(),Re="plugins.wheel",We=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"},{key:"restorePosition",name:"restorePosition"}],Ke=We.map(function(r){return{key:r.key,sourceKey:Re+"."+r.name}}),St="wheelIndexChanged",Ue={rate:4},Ve=function(){function r(t){this.scroll=t,this.init()}return r.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.setSelectedIndex(this.options.selectedIndex)},r.prototype.handleBScroll=function(){this.scroll.proxy(Ke),this.scroll.registerType([St])},r.prototype.handleOptions=function(){var t=this.scroll.options.wheel===!0?{}:this.scroll.options.wheel,e={wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"};this.options=m(e,t)},r.prototype.handleHooks=function(){var t=this,e=this.scroll,o=this.scroll.scroller,i=o.actionsHandler,s=o.scrollBehaviorX,n=o.scrollBehaviorY,a=o.animater,h=o.content;e.on(e.eventTypes.scrollEnd,function(l){var c=t.findNearestValidWheel(l.y).index;if(o.animater.forceStopped&&!t.isAdjustingPosition)return t.target=t.items[c],!0;t.setSelectedIndex(c),t.isAdjustingPosition&&(t.isAdjustingPosition=!1)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.refresh,function(l){l!==h&&(h=l,t.setSelectedIndex(t.options.selectedIndex,!0)),t.rotateX(t.scroll.y),t.wheelTo(t.selectedIndex,0)}),this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(l){l.x=0,l.y=-(t.selectedIndex*t.itemHeight)}),o.hooks.on(o.hooks.eventTypes.checkClick,function(){var l=Qt(t.items).indexOf(t.target);return l===-1||t.wheelTo(l,t.options.adjustTime,y.swipe),!0}),o.hooks.on(o.hooks.eventTypes.scrollTo,function(l){l.y=t.findNearestValidWheel(l.y).y}),o.hooks.on(o.hooks.eventTypes.minDistanceScroll,function(){var l=o.animater;l.forceStopped===!0&&(l.forceStopped=!1)}),o.hooks.on(o.hooks.eventTypes.scrollToElement,function(l,c){if(z(l,t.options.wheelItemClass))c.top=t.findNearestValidWheel(c.top).y;else return!0}),i.hooks.on(i.hooks.eventTypes.beforeStart,function(l){t.target=l.target}),s.hooks.on(s.hooks.eventTypes.computeBoundary,function(l){l.maxScrollPos=0,l.minScrollPos=0}),n.hooks.on(n.hooks.eventTypes.computeBoundary,function(l){t.items=t.scroll.scroller.content.children,t.checkWheelAllDisabled(),t.itemHeight=t.items.length>0?n.contentSize/t.items.length:0,l.maxScrollPos=-t.itemHeight*(t.items.length-1),l.minScrollPos=0}),n.hooks.on(n.hooks.eventTypes.momentum,function(l){l.rate=Ue.rate,l.destination=t.findNearestValidWheel(l.destination).y}),n.hooks.on(n.hooks.eventTypes.end,function(l){var c=t.findNearestValidWheel(n.currentPos);l.destination=c.y,l.duration=t.options.adjustTime}),a.hooks.on(a.hooks.eventTypes.time,function(l){t.transitionDuration(l)}),a.hooks.on(a.hooks.eventTypes.timeFunction,function(l){t.timeFunction(l)}),a.hooks.on(a.hooks.eventTypes.callStop,function(){var l=t.findNearestValidWheel(t.scroll.y).index;t.isAdjustingPosition=!0,t.wheelTo(l,0)}),a.translater.hooks.on(a.translater.hooks.eventTypes.translate,function(l){t.rotateX(l.y)})},r.prototype.refreshBoundary=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY,i=t.content;e.refresh(i),o.refresh(i)},r.prototype.setSelectedIndex=function(t,e){e===void 0&&(e=!1);var o=this.selectedIndex;this.selectedIndex=t,o!==t&&!e&&this.scroll.trigger(St,t)},r.prototype.getSelectedIndex=function(){return this.selectedIndex},r.prototype.wheelTo=function(t,e,o){t===void 0&&(t=0),e===void 0&&(e=0);var i=-t*this.itemHeight;this.scroll.scrollTo(0,i,e,o)},r.prototype.restorePosition=function(){var t=this.scroll.pending;if(t){var e=this.getSelectedIndex();this.scroll.scroller.animater.clearTimer(),this.wheelTo(e,0)}},r.prototype.transitionDuration=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[d.transitionDuration]=t+"ms"},r.prototype.timeFunction=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[d.transitionTimingFunction]=t},r.prototype.rotateX=function(t){for(var e=this.options.rotate,o=e===void 0?25:e,i=0;i<this.items.length;i++){var s=o*(t/this.itemHeight+i),n=s.toFixed(3);this.items[i].style[d.transform]="rotateX("+n+"deg)"}},r.prototype.findNearestValidWheel=function(t){t=t>0?0:t<this.scroll.maxScrollY?this.scroll.maxScrollY:t;for(var e=Math.abs(Math.round(-t/this.itemHeight)),o=e,i=this.items,s=this.options.wheelDisabledItemClass;e>=0&&z(i[e],s);)e--;if(e<0)for(e=o;e<=i.length-1&&z(i[e],s);)e++;return e===i.length&&(e=o),{index:this.wheelItemsAllDisabled?-1:e,y:-e*this.itemHeight}},r.prototype.checkWheelAllDisabled=function(){var t=this.options.wheelDisabledItemClass,e=this.items;this.wheelItemsAllDisabled=!0;for(var o=0;o<e.length;o++)if(!z(e[o],t)){this.wheelItemsAllDisabled=!1;break}},r.pluginName="wheel",r}(),$e="plugins.zoom",Ze=[{key:"zoomTo",name:"zoomTo"}],je=Ze.map(function(r){return{key:r.key,sourceKey:$e+"."+r.name}}),N=2,R=1,Ge=function(){function r(t){this.scroll=t,this.scale=R,this.prevScale=1,this.init()}return r.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.tryInitialZoomTo(this.zoomOpt)},r.prototype.zoomTo=function(t,e,o,i){var s=this.resolveOrigin(e,o),n=s.originX,a=s.originY,h={x:n,y:a,baseScale:this.scale};this._doZoomTo(t,h,i,!0)},r.prototype.handleBScroll=function(){this.scroll.proxy(je),this.scroll.registerType(["beforeZoomStart","zoomStart","zooming","zoomEnd"])},r.prototype.handleOptions=function(){var t=this.scroll.options.zoom===!0?{}:this.scroll.options.zoom,e={start:1,min:1,max:4,initialOrigin:[0,0],minimalZoomDistance:5,bounceTime:800};this.zoomOpt=m(e,t)},r.prototype.handleHooks=function(){var t=this,e=this.scroll,o=this.scroll.scroller;this.wrapper=this.scroll.scroller.wrapper,this.setTransformOrigin(this.scroll.scroller.content);var i=o.scrollBehaviorX,s=o.scrollBehaviorY;this.hooksFn=[],this.registerHooks(e.hooks,e.hooks.eventTypes.contentChanged,function(n){t.setTransformOrigin(n),t.scale=R,t.tryInitialZoomTo(t.zoomOpt)}),this.registerHooks(e.hooks,e.hooks.eventTypes.beforeInitialScrollTo,function(){if(t.zoomOpt.start!==R)return!0}),this.registerHooks(i.hooks,i.hooks.eventTypes.beforeComputeBoundary,function(){var n=D(t.scroll.scroller.content);i.contentSize=Math.floor(n.width*t.scale)}),this.registerHooks(s.hooks,s.hooks.eventTypes.beforeComputeBoundary,function(){var n=D(t.scroll.scroller.content);s.contentSize=Math.floor(n.height*t.scale)}),this.registerHooks(o.actions.hooks,o.actions.hooks.eventTypes.start,function(n){var a=n.touches&&n.touches.length||0;t.fingersOperation(a),a===N&&t.zoomStart(n)}),this.registerHooks(o.actions.hooks,o.actions.hooks.eventTypes.beforeMove,function(n){var a=n.touches&&n.touches.length||0;if(t.fingersOperation(a),a===N)return t.zoom(n),!0}),this.registerHooks(o.actions.hooks,o.actions.hooks.eventTypes.beforeEnd,function(n){var a=t.fingersOperation();if(a===N)return t.zoomEnd(),!0}),this.registerHooks(o.translater.hooks,o.translater.hooks.eventTypes.beforeTranslate,function(n,a){var h=a.scale?a.scale:t.prevScale;t.prevScale=h,n.push("scale("+h+")")}),this.registerHooks(o.hooks,o.hooks.eventTypes.scrollEnd,function(){t.fingersOperation()===N&&t.scroll.trigger(t.scroll.eventTypes.zoomEnd,{scale:t.scale})}),this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},r.prototype.setTransformOrigin=function(t){t.style[d.transformOrigin]="0 0"},r.prototype.tryInitialZoomTo=function(t){var e=t.start,o=t.initialOrigin,i=this.scroll.scroller,s=i.scrollBehaviorX,n=i.scrollBehaviorY;e!==R&&(this.resetBoundaries([s,n]),this.zoomTo(e,o[0],o[1],0))},r.prototype.fingersOperation=function(t){if(typeof t=="number")this.numberOfFingers=t;else return this.numberOfFingers},r.prototype._doZoomTo=function(t,e,o,i){var s=this;o===void 0&&(o=this.zoomOpt.bounceTime),i===void 0&&(i=!1);var n=this.zoomOpt,a=n.min,h=n.max,l=this.scale,c=g(t,a,h);(function(){if(o===0){s.scroll.trigger(s.scroll.eventTypes.zooming,{scale:c});return}if(o>0){var p,u=S(),f=u+o,v=function(){var k=S();if(k>=f){s.scroll.trigger(s.scroll.eventTypes.zooming,{scale:c}),B(p);return}var Y=y.bounce.fn((k-u)/o),j=Y*(c-l)+l;s.scroll.trigger(s.scroll.eventTypes.zooming,{scale:j}),p=lt(v)};v()}})(),this.fingersOperation(2),this._zoomTo(c,l,e,o,i)},r.prototype._zoomTo=function(t,e,o,i,s){s===void 0&&(s=!1);var n=t/o.baseScale;this.setScale(t);var a=this.scroll.scroller,h=a.scrollBehaviorX,l=a.scrollBehaviorY;this.resetBoundaries([h,l]);var c=this.getNewPos(o.x,n,h,!0,s),p=this.getNewPos(o.y,n,l,!0,s);(h.currentPos!==Math.round(c)||l.currentPos!==Math.round(p)||t!==e)&&a.scrollTo(c,p,i,y.bounce,{start:{scale:e},end:{scale:t}})},r.prototype.resolveOrigin=function(t,e){var o=this.scroll.scroller,i=o.scrollBehaviorX,s=o.scrollBehaviorY,n={left:function(){return 0},top:function(){return 0},right:function(){return i.contentSize},bottom:function(){return s.contentSize},center:function(a){var h=a===0?i.contentSize:s.contentSize;return h/2}};return{originX:typeof t=="number"?t:n[t](0),originY:typeof e=="number"?e:n[e](1)}},r.prototype.zoomStart=function(t){var e=t.touches[0],o=t.touches[1];this.startDistance=this.getFingerDistance(t),this.startScale=this.scale;var i=Rt(this.wrapper),s=i.left,n=i.top;this.origin={x:Math.abs(e.pageX+o.pageX)/2+s-this.scroll.x,y:Math.abs(e.pageY+o.pageY)/2+n-this.scroll.y,baseScale:this.startScale},this.scroll.trigger(this.scroll.eventTypes.beforeZoomStart)},r.prototype.zoom=function(t){var e=this.getFingerDistance(t);if(!(!this.zoomed&&Math.abs(e-this.startDistance)<this.zoomOpt.minimalZoomDistance)){var o=this.dampingScale(e/this.startDistance*this.startScale),i=o/this.startScale;this.setScale(o),this.zoomed||(this.zoomed=!0,this.scroll.trigger(this.scroll.eventTypes.zoomStart));var s=this.scroll.scroller,n=s.scrollBehaviorX,a=s.scrollBehaviorY,h=this.getNewPos(this.origin.x,i,n,!1,!1),l=this.getNewPos(this.origin.y,i,a,!1,!1);this.scroll.trigger(this.scroll.eventTypes.zooming,{scale:this.scale}),s.translater.translate({x:h,y:l,scale:o})}},r.prototype.zoomEnd=function(){if(!!this.zoomed){if(this.shouldRebound()){this._doZoomTo(this.scale,this.origin,this.zoomOpt.bounceTime);return}this.scroll.trigger(this.scroll.eventTypes.zoomEnd,{scale:this.scale})}},r.prototype.getFingerDistance=function(t){var e=t.touches[0],o=t.touches[1],i=Math.abs(e.pageX-o.pageX),s=Math.abs(e.pageY-o.pageY);return _t(i,s)},r.prototype.shouldRebound=function(){var t=this.zoomOpt,e=t.min,o=t.max,i=this.scale;if(i!==g(i,e,o))return!0;var s=this.scroll.scroller,n=s.scrollBehaviorX,a=s.scrollBehaviorY;this.resetBoundaries([n,a]);var h=n.checkInBoundary().inBoundary,l=n.checkInBoundary().inBoundary;return!(h&&l)},r.prototype.dampingScale=function(t){var e=this.zoomOpt,o=e.min,i=e.max;return t<o?t=.5*o*Math.pow(2,t/o):t>i&&(t=2*i*Math.pow(.5,i/t)),t},r.prototype.setScale=function(t){this.scale=t},r.prototype.resetBoundaries=function(t){t.forEach(function(e){return e.computeBoundary()})},r.prototype.getNewPos=function(t,e,o,i,s){s===void 0&&(s=!1);var n=t-t*e+(s?o.currentPos:o.startPos);return i&&(n=g(n,o.maxScrollPos,o.minScrollPos)),n>0?Math.floor(n):Math.ceil(n)},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.destroy=function(){this.hooksFn.forEach(function(t){var e=t[0],o=t[1],i=t[2];e.off(o,i)}),this.hooksFn.length=0},r.pluginName="zoom",r}(),qe=function(){function r(t){this.ancestors=[],this.descendants=[],this.hooksManager=[],this.analyzed=!1,this.selfScroll=t}return r.create=function(t){return new r(t)},r.prototype.hasAncestors=function(t){var e=O(this.ancestors,function(o){var i=o[0];return i===t});return e>-1},r.prototype.hasDescendants=function(t){var e=O(this.descendants,function(o){var i=o[0];return i===t});return e>-1},r.prototype.addAncestor=function(t,e){var o=this.ancestors;o.push([t,e]),o.sort(function(i,s){return i[1]-s[1]})},r.prototype.addDescendant=function(t,e){var o=this.descendants;o.push([t,e]),o.sort(function(i,s){return i[1]-s[1]})},r.prototype.removeAncestor=function(t){var e=this.ancestors;if(e.length){var o=O(this.ancestors,function(i){var s=i[0];return s===t});if(o>-1)return e.splice(o,1)}},r.prototype.removeDescendant=function(t){var e=this.descendants;if(e.length){var o=O(this.descendants,function(i){var s=i[0];return s===t});if(o>-1)return e.splice(o,1)}},r.prototype.registerHooks=function(t,e,o){t.on(e,o),this.hooksManager.push([t,e,o])},r.prototype.setAnalyzed=function(t){t===void 0&&(t=!1),this.analyzed=t},r.prototype.purge=function(){var t=this;this.ancestors.forEach(function(e){var o=e[0];o.removeDescendant(t)}),this.descendants.forEach(function(e){var o=e[0];o.removeAncestor(t)}),this.hooksManager.forEach(function(e){var o=e[0],i=e[1],s=e[2];o.off(i,s)}),this.hooksManager=[]},r}(),Je="plugins.nestedScroll",Qe=[{key:"purgeNestedScroll",name:"purgeNestedScroll"}],to=Qe.map(function(r){return{key:r.key,sourceKey:Je+"."+r.name}}),eo="INTERNAL_NESTED_SCROLL",oo=function(r){r.forEach(function(t){t.pending&&(t.stop(),t.resetPosition())})},Pt=function(r){r.forEach(function(t){t.enable()})},W=function(r,t){r.forEach(function(e){(e.hasHorizontalScroll===t.hasHorizontalScroll||e.hasVerticalScroll===t.hasVerticalScroll)&&e.disable()})},ro=function(r){r.forEach(function(t){var e=t.scroller,o=e.actions,i=e.scrollBehaviorX,s=e.scrollBehaviorY;o.fingerMoved=!0,o.contentMoved=!1,o.directionLockAction.reset(),i.start(),s.start(),i.resetStartPos(),s.resetStartPos(),o.startTime=+new Date})},io=function(r){var t=r.hasHorizontalScroll,e=r.hasVerticalScroll,o=r.x,i=r.y,s=r.minScrollX,n=r.maxScrollX,a=r.minScrollY,h=r.maxScrollY,l=r.movingDirectionX,c=r.movingDirectionY,p=!1,u=o>=s&&l===-1,f=o<=n&&l===1,v=i>=a&&c===-1,k=i<=h&&c===1;return e?p=v||k:t&&(p=u||f),p},so=function(r){var t=r.hasHorizontalScroll,e=r.hasVerticalScroll,o=r.x,i=r.y,s=r.minScrollX,n=r.maxScrollX,a=r.minScrollY,h=r.maxScrollY,l=!1,c=o>s,p=o<n,u=i>a,f=i<h;return e?l=u||f:t&&(l=c||p),l},no=function(r){r.scroller.reflow(),r.resetPosition(0)},ao=function(r,t){for(var e=0,o=r.parentNode;o&&o!==t;)e++,o=o.parentNode;return e},lo=function(){function r(t){var e=this.handleOptions(t),o=r.instancesMap[e];return o||(o=r.instancesMap[e]=this,o.store=[],o.hooksFn=[]),o.init(t),o}return r.getAllNestedScrolls=function(){var t=r.instancesMap;return Object.keys(t).map(function(e){return t[e]})},r.purgeAllNestedScrolls=function(){var t=r.getAllNestedScrolls();t.forEach(function(e){return e.purgeNestedScroll()})},r.prototype.handleOptions=function(t){var e=t.options.nestedScroll===!0?{}:t.options.nestedScroll,o={groupId:eo};this.options=m(o,e);var i=typeof this.options.groupId;return i!=="string"&&i!=="number"&&P("groupId must be string or number for NestedScroll plugin"),this.options.groupId},r.prototype.init=function(t){t.proxy(to),this.addBScroll(t),this.buildBScrollGraph(),this.analyzeBScrollGraph(),this.ensureEventInvokeSequence(),this.handleHooks(t)},r.prototype.handleHooks=function(t){var e=this;this.registerHooks(t.hooks,t.hooks.eventTypes.destroy,function(){e.deleteScroll(t)})},r.prototype.deleteScroll=function(t){var e=t.wrapper;e.isBScrollContainer=void 0;var o=this.store,i=this.hooksFn,s=O(o,function(u){return u.selfScroll===t});if(s>-1){var n=o[s];n.purge(),o.splice(s,1)}var a=O(i,function(u){var f=u[0];return f===t.hooks});if(a>-1){var h=i[a],l=h[0],c=h[1],p=h[2];l.off(c,p),i.splice(a,1)}},r.prototype.addBScroll=function(t){this.store.push(qe.create(t))},r.prototype.buildBScrollGraph=function(){for(var t=this.store,e,o,i,s,n=this.store.length,a=0;a<n;a++){e=t[a],i=e.selfScroll.wrapper;for(var h=0;h<n;h++)if(o=t[h],s=o.selfScroll.wrapper,e!==o&&!!i.contains(s)){var l=ao(s,i);e.hasDescendants(o)||e.addDescendant(o,l),o.hasAncestors(e)||o.addAncestor(e,l)}}},r.prototype.analyzeBScrollGraph=function(){this.store.forEach(function(t){if(!t.analyzed){var e=t.ancestors,o=t.descendants,i=t.selfScroll,s=function(){var h=e.map(function(c){var p=c[0];return p.selfScroll}),l=o.map(function(c){var p=c[0];return p.selfScroll});oo(U(h,l)),so(i)&&no(i),ro(h),W(h,i)},n=function(){var h=e.map(function(c){var p=c[0];return p.selfScroll}),l=o.map(function(c){var p=c[0];return p.selfScroll});Pt(U(h,l))};t.registerHooks(i,i.eventTypes.beforeScrollStart,s),t.registerHooks(i,i.eventTypes.touchEnd,n);var a=i.scroller.actions.hooks;t.registerHooks(a,a.eventTypes.detectMovingDirection,function(){var h=e.map(function(f){var v=f[0];return v.selfScroll}),l=h[0],c=h.slice(1),p=i.scroller.actions.contentMoved,u=h.length===0;if(p)W(h,i);else if(!u&&io(i))return W([i],i),l&&Pt([l]),W(c,i),!0}),t.setAnalyzed(!0)}})},r.prototype.ensureEventInvokeSequence=function(){var t=this.store.slice(),e=t.sort(function(o,i){return o.descendants.length-i.descendants.length});e.forEach(function(o){var i=o.selfScroll;i.scroller.actionsHandler.rebindDOMEvents()})},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.purgeNestedScroll=function(){var t=this.options.groupId;this.store.forEach(function(e){e.purge()}),this.store=[],this.hooksFn.forEach(function(e){var o=e[0],i=e[1],s=e[2];o.off(i,s)}),this.hooksFn=[],delete r.instancesMap[t]},r.pluginName="nestedScroll",r.instancesMap={},r}(),bt=10,wt=30,ho=function(){function r(t,e){this.wrapperHeight=t,this.tombstoneHeight=e,this.lastDirection=1,this.lastPos=0}return r.prototype.calculate=function(t,e){var o=t-this.lastPos;this.lastPos=t;var i=this.getDirection(o),s=this.calculateIndex(0,t,e),n=this.calculateIndex(s,t+this.wrapperHeight,e);return i===1?(s-=bt,n+=wt):(s-=wt,n+=bt),s<0&&(s=0),{start:s,end:n}},r.prototype.getDirection=function(t){var e;if(t>0)e=1;else if(t<0)e=0;else return this.lastDirection;return this.lastDirection=e,e},r.prototype.calculateIndex=function(t,e,o){if(e<=0)return t;for(var i=t,s=o[i]&&o[i].pos!==-1?o[i].pos:0,n=s,a=0;i<o.length&&o[i].pos<e;)n=o[i].pos,i++;return i===o.length&&(a=Math.floor((e-n)/this.tombstoneHeight)),i+=a,i},r.prototype.resetState=function(){this.lastDirection=1,this.lastPos=0},r}(),co=function(){function r(){this.data=null,this.dom=null,this.tombstone=null,this.width=0,this.height=0,this.pos=0}return r}(),po=function(){function r(t,e,o){this.fetchFn=e,this.onFetchFinish=o,this.loadedNum=0,this.fetching=!1,this.hasMore=!0,this.list=t||[]}return r.prototype.update=function(t){return G(this,void 0,void 0,function(){var e;return q(this,function(o){return this.hasMore||(t=Math.min(t,this.list.length)),t>this.list.length&&(e=t-this.list.length,this.addEmptyData(e)),[2,this.checkToFetch(t)]})})},r.prototype.add=function(t){for(var e=0;e<t.length;e++)this.list[this.loadedNum]?this.list[this.loadedNum]=b(b({},this.list[this.loadedNum]),{data:t[e]}):this.list[this.loadedNum]={data:t[e]},this.loadedNum++;return this.list},r.prototype.addEmptyData=function(t){for(var e=0;e<t;e++)this.list.push(new co);return this.list},r.prototype.fetch=function(t){return G(this,void 0,void 0,function(){var e;return q(this,function(o){switch(o.label){case 0:return this.fetching?[2,[]]:(this.fetching=!0,[4,this.fetchFn(t)]);case 1:return e=o.sent(),this.fetching=!1,[2,e]}})})},r.prototype.checkToFetch=function(t){return G(this,void 0,void 0,function(){var e,o,i;return q(this,function(s){switch(s.label){case 0:return this.hasMore?t<=this.loadedNum?[2]:(e=t-this.loadedNum,[4,this.fetch(e)]):[2];case 1:return o=s.sent(),o instanceof Array&&o.length?(this.add(o),i=this.onFetchFinish(this.list,!0),[2,this.checkToFetch(i)]):(typeof o=="boolean"&&o===!1&&(this.hasMore=!1,this.list.splice(this.loadedNum),this.onFetchFinish(this.list,!1)),[2])}})})},r.prototype.getList=function(){return this.list},r.prototype.resetState=function(){this.loadedNum=0,this.fetching=!1,this.hasMore=!0,this.list=[]},r}(),K=function(){function r(t){this.create=t,this.cached=[],this.width=0,this.height=0,this.initialed=!1,this.getSize()}return r.isTombstone=function(t){return t&&t.classList?t.classList.contains("tombstone"):!1},r.prototype.getSize=function(){if(!this.initialed){var t=this.create();t.style.position="absolute",document.body.appendChild(t),t.style.display="",this.height=t.offsetHeight,this.width=t.offsetWidth,document.body.removeChild(t),this.cached.push(t)}},r.prototype.getOne=function(){var t=this.cached.pop();if(t){var e=t.style;return e.display="",e.opacity="1",e[d.transform]="",e[d.transition]="",t}return this.create()},r.prototype.recycle=function(t){for(var e=0,o=t;e<o.length;e++){var i=o[e];i.style.display="none",this.cached.push(i)}return this.cached},r.prototype.recycleOne=function(t){return this.cached.push(t),this.cached},r}(),ot=200,uo=function(){function r(t,e,o){this.renderFn=e,this.tombstone=o,this.unusedDom=[],this.timers=[],this.setContent(t)}return r.prototype.update=function(t,e,o){e>=t.length&&(e=t.length-1),o>t.length&&(o=t.length),this.collectUnusedDom(t,e,o),this.createDom(t,e,o),this.cacheHeight(t,e,o);var i=this.positionDom(t,e,o),s=i.startPos,n=i.startDelta,a=i.endPos;return{start:e,startPos:s,startDelta:n,end:o,endPos:a}},r.prototype.collectUnusedDom=function(t,e,o){for(var i=0;i<t.length;i++){if(i===e){i=o-1;continue}if(t[i].dom){var s=t[i].dom;K.isTombstone(s)?(this.tombstone.recycleOne(s),s.style.display="none"):this.unusedDom.push(s),t[i].dom=null}}return t},r.prototype.createDom=function(t,e,o){for(var i=e;i<o;i++){var s=t[i].dom,n=t[i].data;if(s)if(K.isTombstone(s)&&n)t[i].tombstone=s,t[i].dom=null;else continue;s=n?this.renderFn(n,this.unusedDom.pop()):this.tombstone.getOne(),s.style.position="absolute",t[i].dom=s,t[i].pos=-1,this.content.appendChild(s)}},r.prototype.cacheHeight=function(t,e,o){for(var i=e;i<o;i++)t[i].data&&!t[i].height&&(t[i].height=t[i].dom.offsetHeight)},r.prototype.positionDom=function(t,e,o){for(var i=this,s=[],n=this.getStartPos(t,e,o),a=n.start,h=n.delta,l=a,c=e;c<o;c++){var p=t[c].tombstone;if(p){var u=p.style;u[d.transition]=Wt+"transform "+ot+"ms, opacity "+ot+"ms",u[d.transform]="translateY("+l+"px)",u.opacity="0",t[c].tombstone=null,s.push(p)}t[c].dom&&t[c].pos!==l&&(t[c].dom.style[d.transform]="translateY("+l+"px)",t[c].pos=l),l+=t[c].height||this.tombstone.height}var f=window.setTimeout(function(){i.tombstone.recycle(s)},ot);return this.timers.push(f),{startPos:a,startDelta:h,endPos:l}},r.prototype.getStartPos=function(t,e,o){if(t[e]&&t[e].pos!==-1)return{start:t[e].pos,delta:0};for(var i=t[0].pos===-1?0:t[0].pos,s=0;s<e;s++)i+=t[s].height||this.tombstone.height;var n=i,a;for(a=e;a<o;a++)if(!K.isTombstone(t[a].dom)&&t[a].pos!==-1){i=t[a].pos;break}var h=a;if(h<o)for(;h>e;)i-=t[h-1].height,h--;var l=n-i;return{start:i,delta:l}},r.prototype.removeTombstone=function(){for(var t=this.content.querySelectorAll(".tombstone"),e=t.length-1;e>=0;e--)this.content.removeChild(t[e])},r.prototype.setContent=function(t){t!==this.content&&(this.content=t)},r.prototype.destroy=function(){this.removeTombstone(),this.timers.forEach(function(t){clearTimeout(t)})},r.prototype.resetState=function(){this.destroy(),this.timers=[],this.unusedDom=[]},r}(),fo=-2e3,vo=function(){function r(t){this.scroll=t,this.start=0,this.end=0,this.init()}return r.prototype.init=function(){var t=this;this.handleOptions();var e=this.options,o=e.fetch,i=e.render,s=e.createTombstone;this.tombstone=new K(s),this.indexCalculator=new ho(this.scroll.scroller.scrollBehaviorY.wrapperSize,this.tombstone.height),this.domManager=new uo(this.scroll.scroller.content,i,this.tombstone),this.dataManager=new po([],o,this.onFetchFinish.bind(this)),this.scroll.on(this.scroll.eventTypes.destroy,this.destroy,this),this.scroll.on(this.scroll.eventTypes.scroll,this.update,this),this.scroll.on(this.scroll.eventTypes.contentChanged,function(a){t.domManager.setContent(a),t.indexCalculator.resetState(),t.domManager.resetState(),t.dataManager.resetState(),t.update({y:0})});var n=this.scroll.scroller.scrollBehaviorY;n.hooks.on(n.hooks.eventTypes.computeBoundary,this.modifyBoundary,this),this.update({y:0})},r.prototype.modifyBoundary=function(t){t.maxScrollPos=fo},r.prototype.handleOptions=function(){var t=this.scroll.options.infinity;t&&(typeof t.fetch!="function"&&P("Infinity plugin need fetch Function to new data."),typeof t.render!="function"&&P("Infinity plugin need render Function to render each item."),typeof t.render!="function"&&P("Infinity plugin need createTombstone Function to create tombstone."),this.options=t),this.scroll.options.probeType=3},r.prototype.update=function(t){var e=Math.round(-t.y),o=this.indexCalculator.calculate(e,this.dataManager.getList()),i=o.start,s=o.end;this.start=i,this.end=s,this.dataManager.update(s),this.updateDom(this.dataManager.getList())},r.prototype.onFetchFinish=function(t,e){var o=this.updateDom(t).end;return e||(this.domManager.removeTombstone(),this.scroll.scroller.animater.stop(),this.scroll.resetPosition()),o},r.prototype.updateDom=function(t){var e=this.domManager.update(t,this.start,this.end),o=e.end,i=e.startPos,s=e.endPos,n=e.startDelta;return n&&(this.scroll.minScrollY=n),s>this.scroll.maxScrollY&&(this.scroll.maxScrollY=-(s-this.scroll.scroller.scrollBehaviorY.wrapperSize)),{end:o,startPos:i,endPos:s}},r.prototype.destroy=function(){for(var t=this.scroll.scroller,e=t.content,o=t.scrollBehaviorY;e.firstChild;)e.removeChild(e.firstChild);this.domManager.destroy(),this.scroll.off("scroll",this.update),this.scroll.off("destroy",this.destroy),o.hooks.off(o.hooks.eventTypes.computeBoundary)},r.pluginName="infinity",r}(),go="plugins.movable",yo=[{key:"putAt",name:"putAt"}],mo=yo.map(function(r){return{key:r.key,sourceKey:go+"."+r.name}}),ko=function(){function r(t){this.scroll=t,this.handleBScroll(),this.handleHooks()}return r.prototype.handleBScroll=function(){this.scroll.proxy(mo)},r.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var e=this.scroll.scroller,o=e.scrollBehaviorX,i=e.scrollBehaviorY,s=function(n,a){n.maxScrollPos>0&&(n.minScrollPos=a.wrapperSize-a.contentSize,n.maxScrollPos=0)};this.registerHooks(o.hooks,o.hooks.eventTypes.ignoreHasScroll,function(){return!0}),this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,function(n){s(n,o)}),this.registerHooks(i.hooks,i.hooks.eventTypes.ignoreHasScroll,function(){return!0}),this.registerHooks(i.hooks,i.hooks.eventTypes.computeBoundary,function(n){s(n,i)}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.destroy,function(){t.destroy()})},r.prototype.putAt=function(t,e,o,i){o===void 0&&(o=this.scroll.options.bounceTime),i===void 0&&(i=y.bounce);var s=this.resolvePostion(t,e);this.scroll.scrollTo(s.x,s.y,o,i)},r.prototype.resolvePostion=function(t,e){var o=this.scroll.scroller,i=o.scrollBehaviorX,s=o.scrollBehaviorY,n={left:function(){return 0},top:function(){return 0},right:function(){return i.minScrollPos},bottom:function(){return s.minScrollPos},center:function(a){var h=a===0?i.minScrollPos:s.minScrollPos;return h/2}};return{x:typeof t=="number"?t:n[t](0),y:typeof e=="number"?e:n[e](1)}},r.prototype.destroy=function(){this.hooksFn.forEach(function(t){var e=t[0],o=t[1],i=t[2];e.off(o,i)}),this.hooksFn.length=0},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.pluginName="movable",r.applyOrder="pre",r}(),To=function(r){return r.tagName.toLowerCase()==="img"},So=function(){function r(t){this.scroll=t,this.refreshTimer=0,this.init()}return r.prototype.init=function(){this.handleOptions(this.scroll.options.observeImage),this.bindEventsToWrapper()},r.prototype.handleOptions=function(t){t===void 0&&(t={}),t=t===!0?{}:t;var e={debounceTime:100};this.options=m(e,t)},r.prototype.bindEventsToWrapper=function(){var t=this.scroll.scroller.wrapper;this.imageLoadEventRegister=new T(t,[{name:"load",handler:this.load.bind(this),capture:!0}]),this.imageErrorEventRegister=new T(t,[{name:"error",handler:this.load.bind(this),capture:!0}])},r.prototype.load=function(t){var e=this,o=t.target,i=this.options.debounceTime;o&&To(o)&&(i===0?this.scroll.refresh():(clearTimeout(this.refreshTimer),this.refreshTimer=window.setTimeout(function(){e.scroll.refresh()},this.options.debounceTime)))},r.pluginName="observeImage",r}(),Po=function(r){var t={ratioX:0,ratioY:0};return r&&(typeof r=="number"?t.ratioX=t.ratioY=r:typeof r=="object"&&r&&(t.ratioX=r.x||0,t.ratioY=r.y||0)),t},rt=function(r){X(r),r.stopPropagation()},bo=function(){function r(t,e){this.scroll=t,this.options=e,this.currentPos={x:0,y:0},this.hooksFn=[],this.handleDOM(),this.handleHooks(),this.handleInteractive()}return r.prototype.handleDOM=function(){var t=this.options,e=t.relationElement,o=t.relationElementHandleElementIndex,i=o===void 0?0:o;this.wrapper=e,this.indicatorEl=this.wrapper.children[i]},r.prototype.handleHooks=function(){var t=this,e=this.scroll,o=e.hooks,i=e.scroller.translater.hooks,s=e.scroller.animater.hooks;this.registerHooks(o,o.eventTypes.refresh,this.refresh),this.registerHooks(i,i.eventTypes.translate,function(n){t.updatePosition(n)}),this.registerHooks(s,s.eventTypes.time,this.transitionTime),this.registerHooks(s,s.eventTypes.timeFunction,this.transitionTimingFunction)},r.prototype.transitionTime=function(t){t===void 0&&(t=0),this.indicatorEl.style[d.transitionDuration]=t+"ms"},r.prototype.transitionTimingFunction=function(t){this.indicatorEl.style[d.transitionTimingFunction]=t},r.prototype.handleInteractive=function(){this.options.interactive!==!1&&this.registerEvents()},r.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},r.prototype.registerEvents=function(){var t=this.scroll.options,e=t.disableMouse,o=t.disableTouch,i=[],s=[],n=[];e||(i.push({name:"mousedown",handler:this.start.bind(this)}),s.push({name:"mousemove",handler:this.move.bind(this)}),n.push({name:"mouseup",handler:this.end.bind(this)})),o||(i.push({name:"touchstart",handler:this.start.bind(this)}),s.push({name:"touchmove",handler:this.move.bind(this)}),n.push({name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),this.startEventRegister=new T(this.indicatorEl,i),this.moveEventRegister=new T(window,s),this.endEventRegister=new T(window,n)},r.prototype.refresh=function(){var t=this.scroll,e=t.x,o=t.y,i=t.hasHorizontalScroll,s=t.hasVerticalScroll,n=t.maxScrollX,a=t.maxScrollY,h=Po(this.options.ratio),l=h.ratioX,c=h.ratioY,p=te(this.wrapper),u=p.width,f=p.height,v=D(this.indicatorEl),k=v.width,Y=v.height;i&&(this.maxScrollX=u-k,this.translateXSign=this.maxScrollX>0?-1:1,this.minScrollX=0,this.ratioX=l||Math.abs(this.maxScrollX/n)),s&&(this.maxScrollY=f-Y,this.translateYSign=this.maxScrollY>0?-1:1,this.minScrollY=0,this.ratioY=c||Math.abs(this.maxScrollY/a)),this.updatePosition({x:e,y:o})},r.prototype.start=function(t){if(!this.BScrollIsDisabled()){var e=t.touches?t.touches[0]:t;rt(t),this.initiated=!0,this.moved=!1,this.lastPointX=e.pageX,this.lastPointY=e.pageY,this.startTime=S(),this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.beforeScrollStart)}},r.prototype.BScrollIsDisabled=function(){return!this.scroll.enabled},r.prototype.move=function(t){if(!!this.initiated){var e=t.touches?t.touches[0]:t,o=e.pageX,i=e.pageY;rt(t);var s=o-this.lastPointX,n=i-this.lastPointY;if(this.lastPointX=o,this.lastPointY=i,!this.moved&&!this.indicatorNotMoved(s,n)&&(this.moved=!0,this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.scrollStart)),this.moved){var a=this.getBScrollPosByRatio(this.currentPos,s,n);this.syncBScroll(a)}}},r.prototype.end=function(t){if(!!this.initiated&&(this.initiated=!1,rt(t),this.moved)){var e=this.scroll,o=e.x,i=e.y;this.scroll.scroller.hooks.trigger(this.scroll.scroller.hooks.eventTypes.scrollEnd,{x:o,y:i})}},r.prototype.getBScrollPosByRatio=function(t,e,o){var i=t.x,s=t.y,n=this.scroll,a=n.hasHorizontalScroll,h=n.hasVerticalScroll,l=n.minScrollX,c=n.maxScrollX,p=n.minScrollY,u=n.maxScrollY,f=this.scroll,v=f.x,k=f.y;if(a){var Y=g(i+e,Math.min(this.minScrollX,this.maxScrollX),Math.max(this.minScrollX,this.maxScrollX)),j=Math.round(Y/this.ratioX*this.translateXSign);v=g(j,c,l)}if(h){var Ot=g(s+o,Math.min(this.minScrollY,this.maxScrollY),Math.max(this.minScrollY,this.maxScrollY)),Ht=Math.round(Ot/this.ratioY*this.translateYSign);k=g(Ht,u,p)}return{x:v,y:k}},r.prototype.indicatorNotMoved=function(t,e){var o=this.currentPos,i=o.x,s=o.y,n=i===this.minScrollX&&t<=0||i===this.maxScrollX&&t>=0,a=s===this.minScrollY&&e<=0||s===this.maxScrollY&&e>=0;return n&&a},r.prototype.syncBScroll=function(t){var e=S(),o=this.scroll,i=o.options,s=o.scroller,n=i.probeType,a=i.momentumLimitTime;s.translater.translate(t),e-this.startTime>a&&(this.startTime=e,n===1&&s.hooks.trigger(s.hooks.eventTypes.scroll,t)),n>1&&s.hooks.trigger(s.hooks.eventTypes.scroll,t)},r.prototype.updatePosition=function(t){var e=this.getIndicatorPosByRatio(t);this.applyTransformProperty(e),this.currentPos=b({},e)},r.prototype.applyTransformProperty=function(t){var e=this.scroll.options.translateZ,o=["translateX("+t.x+"px)","translateY("+t.y+"px)",""+e];this.indicatorEl.style[d.transform]=o.join(" ")},r.prototype.getIndicatorPosByRatio=function(t){var e=t.x,o=t.y,i=this.scroll,s=i.hasHorizontalScroll,n=i.hasVerticalScroll,a=b({},this.currentPos);if(s){var h=Math.round(this.ratioX*e*this.translateXSign);a.x=g(h,Math.min(this.minScrollX,this.maxScrollX),Math.max(this.minScrollX,this.maxScrollX))}if(n){var l=Math.round(this.ratioY*o*this.translateYSign);a.y=g(l,Math.min(this.minScrollY,this.maxScrollY),Math.max(this.minScrollY,this.maxScrollY))}return a},r.prototype.destroy=function(){this.options.interactive!==!1&&(this.startEventRegister.destroy(),this.moveEventRegister.destroy(),this.endEventRegister.destroy()),this.hooksFn.forEach(function(t){var e=t[0],o=t[1],i=t[2];e.off(o,i)}),this.hooksFn.length=0},r}(),wo=function(){function r(t){this.scroll=t,this.options=[],this.indicators=[],this.handleOptions(),this.handleHooks()}return r.prototype.handleOptions=function(){var t=this.scroll.options.indicators;ht(Array.isArray(t),"'indicators' must be an array.");for(var e=0,o=t;e<o.length;e++){var i=o[e];ht(!!i.relationElement,"'relationElement' must be a HTMLElement."),this.createIndicators(i)}},r.prototype.createIndicators=function(t){this.indicators.push(new bo(this.scroll,t))},r.prototype.handleHooks=function(){var t=this,e=this.scroll.hooks;e.on(e.eventTypes.destroy,function(){for(var o=0,i=t.indicators;o<i.length;o++){var s=i[o];s.destroy()}t.indicators=[]})},r.pluginName="indicators",r}();Te.use(Se).use(Pe).use(Ee).use(Xe).use(He).use(Ne).use(Ve).use(Ge).use(lo).use(vo).use(ko).use(So).use(wo);export{Te as B};
