|
|
***************************************************************************** */var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])},i(t,e)};function s(t,e){function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var r=function(){return r=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var s in e=arguments[o],e)Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},r.apply(this,arguments)};function n(t,e,o,i){function s(t){return t instanceof o?t:new o((function(e){e(t)}))}return new(o||(o=Promise))((function(o,r){function n(t){try{l(i.next(t))}catch(e){r(e)}}function h(t){try{l(i["throw"](t))}catch(e){r(e)}}function l(t){t.done?o(t.value):s(t.value).then(n,h)}l((i=i.apply(t,e||[])).next())}))}function h(t,e){var o,i,s,r,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:h(0),throw:h(1),return:h(2)},"function"===typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function h(t){return function(e){return l([t,e])}}function l(r){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,i&&(s=2&r[0]?i["return"]:r[0]?i["throw"]||((s=i["return"])&&s.call(i),0):i.next)&&!(s=s.call(i,r[1])).done)return s;switch(i=0,s&&(r=[2&r[0],s.value]),r[0]){case 0:case 1:s=r;break;case 4:return n.label++,{value:r[1],done:!1};case 5:n.label++,i=r[1],r=[0];continue;case 7:r=n.ops.pop(),n.trys.pop();continue;default:if(s=n.trys,!(s=s.length>0&&s[s.length-1])&&(6===r[0]||2===r[0])){n=0;continue}if(3===r[0]&&(!s||r[1]>s[0]&&r[1]<s[3])){n.label=r[1];break}if(6===r[0]&&n.label<s[1]){n.label=s[1],s=r;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(r);break}s[2]&&n.ops.pop(),n.trys.pop();continue}r=e.call(t,n)}catch(h){r=[6,h],i=0}finally{o=s=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}}function l(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;var i=Array(t),s=0;for(e=0;e<o;e++)for(var r=arguments[e],n=0,h=r.length;n<h;n++,s++)i[s]=r[n];return i}var a=[{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 c(t){console.error("[BScroll warn]: "+t)}var p="undefined"!==typeof window,u=p&&navigator.userAgent.toLowerCase(),d=!(!u||!/wechatdevtools/.test(u)),f=u&&u.indexOf("android")>0,g=function(){if("string"===typeof u){var t=/os (\d\d?_\d(_\d)?)/,e=t.exec(u);if(!e)return!1;var o=e[1].split("_").map((function(t){return parseInt(t,10)}));return!!(o[0]>=13&&o[1]>=4)}return!1}();function y(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var v=function(t,e){for(var o in e)t[o]=e[o];return t};function m(t){return void 0===t||null===t}function k(t,e){return Math.sqrt(t*t+e*e)}function T(t,e,o){return t<e?e:t>o?o:t}var b=p&&document.createElement("div").style,w=function(){if(!p)return!1;for(var t=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}],e=0,o=t;e<o.length;e++){var i=o[e];if(void 0!==b[i.value])return i.key}return!1}();function P(t){return!1===w?t:"standard"===w?"transitionEnd"===t?"transitionend":t:w+t.charAt(0).toUpperCase()+t.substr(1)}function S(t){return"string"===typeof t?document.querySelector(t):t}function x(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function M(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function Y(t){var e=0,o=0;while(t)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}function E(t){var e=t.getBoundingClientRect();return{left:-(e.left+window.pageXOffset),top:-(e.top+window.pageYOffset)}}var B=w&&"standard"!==w?"-"+w.toLowerCase()+"-":"",X=P("transform"),D=P("transition"),O=p&&P("perspective")in b,H=p&&("ontouchstart"in window||d),z=p&&D in b,C={transform:X,transition:D,transitionTimingFunction:P("transitionTimingFunction"),transitionDuration:P("transitionDuration"),transitionDelay:P("transitionDelay"),transformOrigin:P("transformOrigin"),transitionEnd:P("transitionEnd"),transitionProperty:P("transitionProperty")},F={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function I(t){if(t instanceof window.SVGElement){var e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height}}return{top:t.offsetTop,left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight}}function L(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}var _=L;function N(t,e){var o=document.createEvent("Event");o.initEvent(e,!0,!0),o.pageX=t.pageX,o.pageY=t.pageY,t.target.dispatchEvent(o)}function A(t,e){var o;void 0===e&&(e="click"),"mouseup"===t.type?o=t:"touchend"!==t.type&&"touchcancel"!==t.type||(o=t.changedTouches[0]);var i,s={};o&&(s.screenX=o.screenX||0,s.screenY=o.screenY||0,s.clientX=o.clientX||0,s.clientY=o.clientY||0);var r=!0,n=!0;if("undefined"!==typeof MouseEvent)try{i=new MouseEvent(e,v({bubbles:r,cancelable:n},s))}catch(t){h()}else h();function h(){i=document.createEvent("Event"),i.initEvent(e,r,n),v(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}function R(t){A(t,"dblclick")}function W(t,e){var o=e.firstChild;o?K(t,o):e.appendChild(t)}function K(t,e){e.parentNode.insertBefore(t,e)}function U(t,e){t.removeChild(e)}function V(t,e){var o=new RegExp("(^|\\s)"+e+"(\\s|$)");return o.test(t.className)}var j={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(t){return 1+--t*t*t*t*t}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(t){return t*(2-t)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(t){return 1- --t*t*t*t}}},Z=100/60,q=p&&window;function G(){}var $=function(){return p?q.requestAnimationFrame||q.webkitRequestAnimationFrame||q.mozRequestAnimationFrame||q.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||Z)/2)}:G}(),J=function(){return p?q.cancelAnimationFrame||q.webkitCancelAnimationFrame||q.mozCancelAnimationFrame||q.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:G}(),Q=function(t){},tt={enumerable:!0,configurable:!0,get:Q,set:Q},et=function(t,e){for(var o=e.split("."),i=0;i<o.length-1;i++)if(t=t[o[i]],"object"!==typeof t||!t)return;var s=o.pop();return"function"===typeof t[s]?function(){return t[s].apply(t,arguments)}:t[s]},ot=function(t,e,o){for(var i,s=e.split("."),r=0;r<s.length-1;r++)i=s[r],t[i]||(t[i]={}),t=t[i];t[s.pop()]=o};function it(t,e,o){tt.get=function(){return et(this,e)},tt.set=function(t){ot(this,e,t)},Object.defineProperty(t,o,tt)}var st=function(){function t(t){this.events={},this.eventTypes={},this.registerType(t)}return t.prototype.on=function(t,e,o){return void 0===o&&(o=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},t.prototype.once=function(t,e,o){var i=this;void 0===o&&(o=this),this.hasType(t);var s=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];i.off(t,s),e.apply(o,r)};return s.fn=e,this.on(t,s),this},t.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;var i=o.length;while(i--)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,1);return this}},t.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,r=i.length,n=l(i),h=0;h<r;h++){var a=n[h],c=a[0],p=a[1];if(c&&(s=c.apply(p,e),!0===s))return s}},t.prototype.registerType=function(t){var e=this;t.forEach((function(t){e.eventTypes[t]=t}))},t.prototype.destroy=function(){this.events={},this.eventTypes={}},t.prototype.hasType=function(t){var e=this.eventTypes,o=e[t]===t;o||c('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e).map((function(t){return JSON.stringify(t)}))+"]")},t}(),rt=function(){function t(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}return t.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},t.prototype.addDOMEvents=function(){this.handleDOMEvents(x)},t.prototype.removeDOMEvents=function(){this.handleDOMEvents(M)},t.prototype.handleDOMEvents=function(t){var e=this,o=this.wrapper;this.events.forEach((function(i){t(o,i.name,e,!!i.capture)}))},t.prototype.handleEvent=function(t){var e=t.type;this.events.some((function(o){return o.name===e&&(o.handler(t),!0)}))},t}(),nt=function(){function t(){}return t}(),ht=function(t){function e(){var e=t.call(this)||this;return e.startX=0,e.startY=0,e.scrollX=!1,e.scrollY=!0,e.freeScroll=!1,e.directionLockThreshold=5,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=H,e.disableTouch=!H,e.autoBlur=!0,e.autoEndDistance=5,e.outOfBoundaryDampingFactor=1/3,e}return s(e,t),e.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},e.prototype.process=function(){return this.translateZ=this.HWCompositing&&O?" translateZ(1px)":"",this.useTransition=this.useTransition&&z,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.resolveBounce(),this.scrollX="horizontal"!==this.eventPassthrough&&this.scrollX,this.scrollY="vertical"!==this.eventPassthrough&&this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=!!this.freeScroll||this.scrollX,this.scrollY=!!this.freeScroll||this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},e.prototype.resolveBounce=function(){var t=["top","right","bottom","left"],e=this.bounce;"boolean"===typeof e&&(this.bounce=lt(t,e))},e}(nt);function lt(t,e){void 0===e&&(e=!0);var o={};return t.forEach((function(t){o[t]=e})),o}var at=function(){function t(t,e){this.wrapper=t,this.options=e,this.hooks=new st(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}return t.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=t.disableTouch,s=t.click,r=this.wrapper,n=e?r:window,h=[],l=[],a=!i,c=!o;s&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),a&&(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)})),c&&(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 rt(r,h),this.targetEventRegister=new rt(n,l)},t.prototype.beforeHandler=function(t,e){var o=this.options,i=o.preventDefault,s=o.stopPropagation,r=o.preventDefaultException,n={start:function(){return i&&!L(t.target,r)},end:function(){return i&&!L(t.target,r)},move:function(){return i}};n[e]()&&t.preventDefault(),s&&t.stopPropagation()},t.prototype.setInitiated=function(t){void 0===t&&(t=0),this.initiated=t},t.prototype.start=function(t){var e=F[t.type];if(!this.initiated||this.initiated===e)if(this.setInitiated(e),_(t.target,this.options.tagException))this.setInitiated();else if((2!==e||0===t.button)&&!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)}},t.prototype.move=function(t){if(F[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,r=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,n=this.pointX-s,h=this.pointY-r,l=this.options.autoEndDistance;(n>document.documentElement.clientWidth-l||h>document.documentElement.clientHeight-l||n<l||h<l)&&this.end(t)}}},t.prototype.end=function(t){F[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},t.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},t.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},t}(),ct={x:["translateX","px"],y:["translateY","px"]},pt=function(){function t(t){this.content=t,this.style=t.style,this.hooks=new st(["beforeTranslate","translate"])}return t.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null),e=t[C.transform].split(")")[0].split(", "),o=+(e[12]||e[4]),i=+(e[13]||e[5]);return{x:o,y:i}},t.prototype.translate=function(t){var e=[];Object.keys(t).forEach((function(o){if(ct[o]){var i=ct[o][0];if(i){var s=ct[o][1],r=t[o];e.push(i+"("+r+s+")")}}})),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,e,t),this.style[C.transform]=e.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,t)},t.prototype.destroy=function(){this.hooks.destroy()},t}(),ut=function(){function t(t,e,o){this.content=t,this.translater=e,this.options=o,this.timer=0,this.hooks=new st(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.style=t.style}return t.prototype.translate=function(t){this.translater.translate(t)},t.prototype.setPending=function(t){this.pending=t},t.prototype.setForceStopped=function(t){this.forceStopped=t},t.prototype.destroy=function(){this.hooks.destroy(),J(this.timer)},t}(),dt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.startProbe=function(){var t=this,e=function(){var o=t.translater.getComputedPosition();t.hooks.trigger(t.hooks.eventTypes.move,o),t.pending||t.forceStopped||t.hooks.trigger(t.hooks.eventTypes.end,o),t.pending&&(t.timer=$(e))};J(this.timer),e()},e.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[C.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},e.prototype.transitionTimingFunction=function(t){this.style[C.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},e.prototype.transitionProperty=function(){this.style[C.transitionProperty]=C.transform},e.prototype.move=function(t,e,o,i){this.setPending(o>0),this.transitionTimingFunction(i),this.transitionProperty(),this.transitionTime(o),this.translate(e),o&&3===this.options.probeType&&this.startProbe(),o||(this._reflow=this.content.offsetHeight,this.hooks.trigger(this.hooks.eventTypes.move,e),this.hooks.trigger(this.hooks.eventTypes.end,e))},e.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),J(this.timer);var e=this.translater.getComputedPosition(),o=e.x,i=e.y;if(this.transitionTime(),this.translate({x:o,y:i}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:o,y:i}))return!0;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:o,y:i})}return t},e.prototype.stop=function(){var t=this.doStop();t&&this.hooks.trigger(this.hooks.eventTypes.callStop)},e}(ut),ft=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.move=function(t,e,o,i){if(!o)return this.translate(e),this.hooks.trigger(this.hooks.eventTypes.move,e),void this.hooks.trigger(this.hooks.eventTypes.end,e);this.animate(t,e,o,i)},e.prototype.animate=function(t,e,o,i){var s=this,r=y(),n=r+o,h=function(){var l=y();if(l>=n)return s.translate(e),s.hooks.trigger(s.hooks.eventTypes.move,e),void s.hooks.trigger(s.hooks.eventTypes.end,e);l=(l-r)/o;var a=i(l),c={};Object.keys(e).forEach((function(o){var i=t[o],s=e[o];c[o]=(s-i)*a+i})),s.translate(c),3===s.options.probeType&&s.hooks.trigger(s.hooks.eventTypes.move,c),s.pending&&(s.timer=$(h)),s.pending||s.forceStopped||(console.log(s.forceStopped),s.hooks.trigger(s.hooks.eventTypes.end,e))};this.setPending(!0),J(this.timer),h()},e.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),J(this.timer);var e=this.translater.getComputedPosition();if(this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,e))return!0;this.hooks.trigger(this.hooks.eventTypes.forceStop,e)}return t},e.prototype.stop=function(){var t=this.doStop();t&&this.hooks.trigger(this.hooks.eventTypes.callStop)},e}(ut);function gt(t,e,o){var i=o.useTransition,s={};return Object.defineProperty(s,"probeType",{enumerable:!0,configurable:!1,get:function(){return o.probeType}}),i?new dt(t,e,s):new ft(t,e,s)}var yt,vt,mt,kt,Tt=function(){function t(t,e){this.wrapper=t,this.options=e,this.hooks=new st(["beforeComputeBoundary","computeBoundary","momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0,this.refresh()}return t.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},t.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},t.prototype.setMovingDirection=function(t){this.movingDirection=t>0?-1:t<0?1:0},t.prototype.setDirection=function(t){this.direction=t>0?-1:t<0?1:0},t.prototype.performDampingAlgorithm=function(t,e){var o=this.currentPos+t;return(o>this.minScrollPos||o<this.maxScrollPos)&&(o=o>this.minScrollPos&&this.options.bounces[0]||o<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+t*e:o>this.minScrollPos?this.minScrollPos:this.maxScrollPos),o},t.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=-1===this.direction&&this.options.bounces[0]||1===this.direction&&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},t.prototype.momentum=function(t,e,o,i,s,r,n){void 0===n&&(n=this.options);var h=t-e,l=Math.abs(h)/o,a=n.deceleration,c=n.swipeBounceTime,p=n.swipeTime,u={destination:t+l/a*(h<0?-1:1),duration:p,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,u,h),u.destination<i?(u.destination=r?Math.max(i-r/4,i-r/u.rate*l):i,u.duration=c):u.destination>s&&(u.destination=r?Math.min(s+r/4,s+r/u.rate*l):s,u.duration=c),u.destination=Math.round(u.destination),u},t.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.setDirection(t)},t.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=I(this.wrapper);this.wrapperSize=s[e];var r=I(this.content);this.contentSize=r[e],this.relativeOffset=r[o],i&&(this.relativeOffset-=s[o]),this.computeBoundary(),this.setDirection(0)},t.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,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.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize)},t.prototype.updatePosition=function(t){this.currentPos=t},t.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},t.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos),e=t===this.getCurrentPos();return{position:t,inBoundary:e}},t.prototype.adjustPosition=function(t){var e=Math.round(t);return!this.hasScroll||e>this.minScrollPos?e=this.minScrollPos:e<this.maxScrollPos&&(e=this.maxScrollPos),e},t.prototype.updateStartPos=function(){this.startPos=this.currentPos},t.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},t.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},t.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},t.prototype.destroy=function(){this.hooks.destroy()},t}(),bt=(yt={},yt["yes"]=function(t){return!0},yt["no"]=function(t){return t.preventDefault(),!1},yt),wt=(vt={},vt["horizontal"]=(mt={},mt["yes"]="horizontal",mt["no"]="vertical",mt),vt["vertical"]=(kt={},kt["yes"]="vertical",kt["no"]="horizontal",kt),vt),Pt=function(){function t(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}return t.prototype.reset=function(){this.directionLocked=""},t.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},t.prototype.adjustDelta=function(t,e){return"horizontal"===this.directionLocked?e=0:"vertical"===this.directionLocked&&(t=0),{deltaX:t,deltaY:e}},t.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")},t.prototype.handleEventPassthrough=function(t){var e=wt[this.directionLocked];if(e){if(this.eventPassthrough===e["yes"])return bt["yes"](t);if(this.eventPassthrough===e["no"])return bt["no"](t)}return!1},t}(),St=function(){function t(t,e,o,i,s){this.hooks=new st(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=i,this.options=s,this.directionLockAction=new Pt(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}return t.prototype.bindActionsHandler=function(){var t=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,(function(e){return!t.enabled||t.handleStart(e)})),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,(function(e){var o=e.deltaX,i=e.deltaY,s=e.e;return!t.enabled||t.handleMove(o,i,s)})),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,(function(e){return!t.enabled||t.handleEnd(e)})),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,(function(e){t.enabled&&!e._constructed&&t.handleClick(e)}))},t.prototype.handleStart=function(t){var e=y();this.moved=!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)},t.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),r=y();if(this.checkMomentum(i,s,r))return!0;if(this.directionLockAction.checkMovingDirection(i,s,o))return this.actionsHandler.setInitiated(),!0;var n=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.move(n.deltaX),l=this.scrollBehaviorY.move(n.deltaY);this.moved||(this.moved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.animater.translate({x:h,y:l}),this.dispatchScroll(r)}},t.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),1===this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>1&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},t.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},t.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;this.animater.translate(e),this.endTime=y();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},t.prototype.handleClick=function(t){L(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},t.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},t.prototype.refresh=function(){this.endTime=0},t.prototype.destroy=function(){this.hooks.destroy()},t}();function xt(t){var e=["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce((function(e,o){return e[o]=t[o],e}),{});return e}function Mt(t,e,o,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor"].reduce((function(e,o){return e[o]=t[o],e}),{});return s.scrollable=!!t[e],s.bounces=o,s.rect=i,s}function Yt(t,e,o){o.forEach((function(o){var i,s;"string"===typeof o?i=s=o:(i=o.source,s=o.target),t.on(i,(function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return e.trigger.apply(e,l([s],t))}))}))}function Et(t,e){for(var o=Object.keys(t),i=0,s=o;i<s.length;i++){var r=s[i];if(t[r]!==e[r])return!1}return!0}var Bt=function(){function t(t,e){this.resizeTimeout=0,this.hooks=new st(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","scrollToElement","beforeRefresh"]),this.wrapper=t,this.content=t.children[0],this.options=e;var o=this.options.bounce,i=o.left,s=void 0===i||i,r=o.right,n=void 0===r||r,h=o.top,l=void 0===h||h,a=o.bottom,c=void 0===a||a;this.scrollBehaviorX=new Tt(t,Mt(e,"scrollX",[s,n],{size:"width",position:"left"})),this.scrollBehaviorY=new Tt(t,Mt(e,"scrollY",[l,c],{size:"height",position:"top"})),this.translater=new pt(this.content),this.animater=gt(this.content,this.translater,this.options),this.actionsHandler=new at(this.options.bindToTarget?this.content:t,xt(this.options)),this.actions=new St(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var p=this.resize.bind(this);this.resizeRegister=new rt(window,[{name:"orientationchange",handler:p},{name:"resize",handler:p}]),this.transitionEndRegister=new rt(this.content,[{name:C.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}return t.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,(function(){t.togglePointerEvents(!0)}))},t.prototype.bindTranslater=function(){var t=this,e=this.translater.hooks;e.on(e.eventTypes.beforeTranslate,(function(e){t.options.translateZ&&e.push(t.options.translateZ)})),e.on(e.eventTypes.translate,(function(e){var o=t.getCurrentPos();t.updatePositions(e),e.x===o.x&&e.y===o.y||t.togglePointerEvents(!1)}))},t.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))})),Yt(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}])},t.prototype.bindActions=function(){var t=this,e=this.actions;Yt(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){return t.hooks.trigger(t.hooks.eventTypes.touchEnd,i),!!t.hooks.trigger(t.hooks.eventTypes.end,i)||(!e.moved&&t.checkClick(o)?(t.hooks.trigger(t.hooks.eventTypes.scrollCancel),!0):t.resetPosition(t.options.bounceTime,j.bounce)?(t.animater.setForceStopped(!1),!0):void 0)})),e.hooks.on(e.hooks.eventTypes.scrollEnd,(function(o,i){var s=Math.abs(o.x-t.scrollBehaviorX.startPos),r=Math.abs(o.y-t.scrollBehaviorY.startPos);t.checkFlick(i,s,r)?t.hooks.trigger(t.hooks.eventTypes.flick):t.momentum(o,i)||(!t.animater.forceStopped||e.moved?t.hooks.trigger(t.hooks.eventTypes.scrollEnd,o):t.animater.setForceStopped(!1))}))},t.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},t.prototype.momentum=function(t,e){var o={time:0,easing:j.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=m(i.destination)?o.newX:i.destination,o.newY=m(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=j.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},t.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,r=void 0===s?300:s;y()-this.lastClickTime<r&&(i=!0,R(t))}return this.options.tap&&N(t,this.options.tap),this.options.click&&!L(t.target,this.options.preventDefaultException)&&A(t),this.lastClickTime=i?null:y(),!0}return!1},t.prototype.resize=function(){var t=this;this.actions.enabled&&(f&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout((function(){t.hooks.trigger(t.hooks.eventTypes.resize)}),this.options.resizePolling))},t.prototype.transitionEnd=function(t){if(t.target===this.content&&this.animater.pending){var e=this.animater;e.transitionTime(),this.resetPosition(this.options.bounceTime,j.bounce)||(this.animater.setPending(!1),3!==this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos()))}},t.prototype.togglePointerEvents=function(t){void 0===t&&(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)}},t.prototype.refresh=function(){this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=Y(this.wrapper)},t.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),r=s.x,n=s.y;i=i||j.bounce,t+=r,e+=n,this.scrollTo(t,e,o,i)},t.prototype.scrollTo=function(t,e,o,i,s){void 0===o&&(o=0),void 0===i&&(i=j.bounce),void 0===s&&(s={start:{},end:{}});var n=this.options.useTransition?i.style:i.fn,h=this.getCurrentPos(),l=r({x:h.x,y:h.y},s.start),a=r({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,a),Et(l,a)||this.animater.move(l,a,o,n)},t.prototype.scrollToElement=function(t,e,o,i,s){var r=S(t),n=Y(r),h=function(t,e,o){return"number"===typeof t?t:t?Math.round(e/2-o/2):0};o=h(o,r.offsetWidth,this.wrapper.offsetWidth),i=h(i,r.offsetHeight,this.wrapper.offsetHeight);var l=function(t,e,o,i){return t-=e,t=i.adjustPosition(t-o),t};n.left=l(n.left,this.wrapperOffset.left,o,this.scrollBehaviorX),n.top=l(n.top,this.wrapperOffset.top,i,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,r,n)||this.scrollTo(n.left,n.top,e,s)},t.prototype.resetPosition=function(t,e){void 0===t&&(t=0),void 0===e&&(e=j.bounce);var o=this.scrollBehaviorX.checkInBoundary(),i=o.position,s=o.inBoundary,r=this.scrollBehaviorY.checkInBoundary(),n=r.position,h=r.inBoundary;return(!s||!h)&&(g&&(this._reflow=this.content.offsetHeight),this.scrollTo(i,n,t,e),!0)},t.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},t.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},t.prototype.enable=function(){this.actions.enabled=!0},t.prototype.disable=function(){J(this.animater.timer),this.actions.enabled=!1},t.prototype.destroy=function(){var t=this,e=["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"];e.forEach((function(e){return t[e].destroy()}))},t}(),Xt=function(t){function e(e,o){var i=t.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,s=S(e);if(!s)return c("Can not resolve the wrapper DOM."),i;var r=s.children[0];return r?(i.plugins={},i.options=(new ht).merge(o).process(),i.hooks=new st(["refresh","enable","disable","destroy","beforeInitialScrollTo"]),i.init(s),i):(c("The wrapper need at least one child element to be scroller."),i)}return s(e,t),e.use=function(t){var o=t.pluginName,i=e.plugins.some((function(e){return t===e.ctor}));return i?e:m(o)?(c("Plugin Class must specify plugin's name in static property by 'pluginName' field."),e):e.pluginsMap[o]?(c("This plugin has been registered, maybe you need change plugin's name"),e):(e.pluginsMap[o]=!0,e.plugins.push({name:o,applyOrder:t.applyOrder,ctor:t}),e)},e.prototype.init=function(t){var e=this;this.wrapper=t,t.isBScrollContainer=!0,this.scroller=new Bt(t,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,(function(){e.refresh()})),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(a),this.applyPlugins(),this.refreshWithoutReset();var o=this.options,i=o.startX,s=o.startY,r={x:i,y:s};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,r)||this.scroller.scrollTo(r.x,r.y)},e.prototype.applyPlugins=function(){var t=this,o=this.options;e.plugins.sort((function(t,e){var o,i=(o={},o["pre"]=-1,o["post"]=1,o),s=t.applyOrder?i[t.applyOrder]:0,r=e.applyOrder?i[e.applyOrder]:0;return s-r})).forEach((function(e){var i=e.ctor;o[e.name]&&"function"===typeof i&&(t.plugins[e.name]=new i(t))}))},e.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,(function(){var t=document.activeElement;!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||t.blur()}))},e.prototype.eventBubbling=function(){Yt(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])},e.prototype.refreshWithoutReset=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},e.prototype.proxy=function(t){var e=this;t.forEach((function(t){var o=t.key,i=t.sourceKey;it(e,i,o)}))},e.prototype.refresh=function(){this.refreshWithoutReset(),this.scroller.resetPosition()},e.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},e.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},e.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},e.prototype.eventRegister=function(t){this.registerType(t)},e.plugins=[],e.pluginsMap={},e}(st);function Dt(t,e){var o=new Xt(t,e);return o}Dt.use=Xt.use,Dt.plugins=Xt.plugins,Dt.pluginsMap=Xt.pluginsMap;var Ot=Dt,Ht=function(){function t(t){this.scroll=t,this.wheelEndTimer=0,this.wheelMoveTimer=0,this.wheelStart=!1,this.init()}return t.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.registerEvent()},t.prototype.handleBScroll=function(){this.scroll.registerType(["alterOptions","mousewheelStart","mousewheelMove","mousewheelEnd"])},t.prototype.handleOptions=function(){var t=!0===this.scroll.options.mouseWheel?{}:this.scroll.options.mouseWheel,e={speed:20,invert:!1,easeTime:300,discreteTime:400,throttleTime:0,dampingFactor:.1};this.mouseWheelOpt=v(e,t)},t.prototype.handleHooks=function(){this.hooksFn=[],this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},t.prototype.registerEvent=function(){this.eventRegister=new rt(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)}])},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.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)}},t.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)},t.prototype.cleanCache=function(){this.deltaCache=[]},t.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 r=this.deltaCache.reduce((function(t,e){return{x:t.x+e.x,y:t.y+e.y}}),{x:0,y:0});this.cleanCache();var n=this.scroll.scroller,h=n.scrollBehaviorX,l=n.scrollBehaviorY;h.setMovingDirection(-t.directionX),l.setMovingDirection(-t.directionY),h.setDirection(t.x),l.setDirection(t.y);var a=h.performDampingAlgorithm(Math.round(t.x)+r.x,s),c=l.performDampingAlgorithm(Math.round(t.y)+r.x,s);if(!this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:a,y:c})){var p=this.getEaseTime();a===this.scroll.x&&c===this.scroll.y||this.scroll.scrollTo(a,c,p)}i&&(this.wheelMoveTimer=window.setTimeout((function(){e.wheelMoveTimer=0}),i))}},t.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)},t.prototype.getWheelDelta=function(t){var e=this.mouseWheelOpt,o=e.speed,i=e.invert,s=0,r=0,n=i?-1:1;switch(!0){case"deltaX"in t:1===t.deltaMode?(s=-t.deltaX*o,r=-t.deltaY*o):(s=-t.deltaX,r=-t.deltaY);break;case"wheelDeltaX"in t:s=t.wheelDeltaX/120*o,r=t.wheelDeltaY/120*o;break;case"wheelDelta"in t:s=r=t.wheelDelta/120*o;break;case"detail"in t:s=r=-t.detail/3*o;break}s*=n,r*=n,this.scroll.hasVerticalScroll||(s=r,r=0),this.scroll.hasHorizontalScroll||(s=0);var h=s>0?-1:s<0?1:0,l=r>0?-1:r<0?1:0;return{x:s,y:r,directionX:h,directionY:l}},t.prototype.beforeHandler=function(t){var e=this.scroll.options,o=e.preventDefault,i=e.stopPropagation,s=e.preventDefaultException;o&&!L(t.target,s)&&t.preventDefault(),i&&t.stopPropagation()},t.prototype.getEaseTime=function(){var t=100,e=this.mouseWheelOpt.easeTime;return e<t&&c("easeTime should be greater than 100.If mouseWheel easeTime is too small,scrollEnd will be triggered many times."),Math.max(e,t)},t.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)}))},t.pluginName="mouseWheel",t.applyOrder="pre",t}(),zt=function(){function t(t){this.scroll=t,this.stopObserver=!1,this.init()}return t.prototype.init=function(){this.handleMutationObserver(),this.handleHooks()},t.prototype.handleMutationObserver=function(){var t=this;if("undefined"!==typeof MutationObserver){var e=0;this.observer=new MutationObserver((function(o){t.mutationObserverHandler(o,e)})),this.startObserve(this.observer)}else this.checkDOMUpdate()},t.prototype.handleHooks=function(){var t=this;this.hooksFn=[],this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.enable,(function(){t.stopObserver&&t.init()})),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()}))},t.prototype.mutationObserverHandler=function(t,e){var o=this;if(!this.shouldNotRefresh()){for(var i=!1,s=!1,r=0;r<t.length;r++){var n=t[r];if("attributes"!==n.type){i=!0;break}if(n.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))}},t.prototype.startObserve=function(t){var e={attributes:!0,childList:!0,subtree:!0};t.observe(this.scroll.scroller.content,e)},t.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},t.prototype.checkDOMUpdate=function(){var t=this,e=this.scroll.scroller.content,o=I(e),i=o.width,s=o.height,r=function(){if(!t.stopObserver){o=I(e);var r=o.width,h=o.height;i===r&&s===h||t.scroll.refresh(),i=r,s=h,n()}},n=function(){setTimeout((function(){r()}),1e3)};n()},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.prototype.stopObserve=function(){this.stopObserver=!0,this.observer&&this.observer.disconnect()},t.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},t.pluginName="observeDOM",t}(),Ct="plugins.pullDownRefresh",Ft=[{key:"finishPullDown",name:"finishPullDown"},{key:"openPullDown",name:"openPullDown"},{key:"closePullDown",name:"closePullDown"},{key:"autoPullDownRefresh",name:"autoPullDownRefresh"}],It=Ft.map((function(t){return{key:t.key,sourceKey:Ct+"."+t.name}})),Lt="pullingDown",_t=function(){function t(t){this.scroll=t,this.pulling=!1,this.init()}return t.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullDownRefresh),this.handleHooks(),this.watch()},t.prototype.handleBScroll=function(){this.scroll.registerType([Lt]),this.scroll.proxy(It)},t.prototype.handleOptions=function(t){void 0===t&&(t={}),t=!0===t?{}:t;var e={threshold:90,stop:40};this.options=v(e,t),this.scroll.options.probeType=3},t.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var e=this.scroll.scroller,o=e.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY=o.minScrollPos,this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,(function(e){e.maxScrollPos>0&&(e.maxScrollPos=-1),e.minScrollPos=t.currentMinScrollY})),this.scroll.eventTypes.alterOptions&&(this.registerHooks(this.scroll,this.scroll.eventTypes.alterOptions,(function(t){var e=300,o=350;t.discreteTime=e,t.easeTime=o})),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,(function(){e.hooks.trigger(e.hooks.eventTypes.end)})))},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.prototype.watch=function(){var t=this.scroll.scroller;this.watching=!0,this.registerHooks(t.hooks,t.hooks.eventTypes.end,this.checkPullDown)},t.prototype.unwatch=function(){var t=this.scroll.scroller;this.watching=!1,t.hooks.off(t.hooks.eventTypes.end,this.checkPullDown)},t.prototype.checkPullDown=function(){var t=this.options,e=t.threshold,o=t.stop;return!(-1!==this.scroll.directionY||this.scroll.y<e)&&(this.pulling||(this.modifyBehaviorYBoundary(o),this.pulling=!0,this.scroll.trigger(Lt)),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,j.bounce),this.pulling)},t.prototype.modifyBehaviorYBoundary=function(t){var e=this.scroll.scroller.scrollBehaviorY;this.cachedOriginanMinScrollY=e.minScrollPos,this.currentMinScrollY=t,e.computeBoundary()},t.prototype.finishPullDown=function(){var t=this.scroll.scroller.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY,t.computeBoundary(),this.pulling=!1,this.scroll.resetPosition(this.scroll.options.bounceTime,j.bounce)},t.prototype.openPullDown=function(t){void 0===t&&(t={}),this.handleOptions(t),this.watching||this.watch()},t.prototype.closePullDown=function(){this.unwatch()},t.prototype.autoPullDownRefresh=function(){var t=this.options,e=t.threshold,o=t.stop;!this.pulling&&this.watching&&(this.pulling=!0,this.modifyBehaviorYBoundary(o),this.scroll.scrollTo(this.scroll.x,e),this.scroll.trigger(Lt),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,j.bounce))},t.pluginName="pullDownRefresh",t}(),Nt="plugins.pullUpLoad",At=[{key:"finishPullUp",name:"finishPullUp"},{key:"openPullUp",name:"openPullUp"},{key:"closePullUp",name:"closePullUp"},{key:"autoPullUpLoad",name:"autoPullUpLoad"}],Rt=At.map((function(t){return{key:t.key,sourceKey:Nt+"."+t.name}})),Wt="pullingUp",Kt=function(){function t(t){this.scroll=t,this.pulling=!1,this.watching=!1,this.init()}return t.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullUpLoad),this.handleHooks(),this.watch()},t.prototype.handleBScroll=function(){this.scroll.registerType([Wt]),this.scroll.proxy(Rt)},t.prototype.handleOptions=function(t){void 0===t&&(t={}),t=!0===t?{}:t;var e={threshold:0};this.options=v(e,t),this.scroll.options.probeType=3},t.prototype.handleHooks=function(){this.hooksFn=[];var t=this.scroll.scroller.scrollBehaviorY;this.registerHooks(t.hooks,t.hooks.eventTypes.computeBoundary,(function(t){t.maxScrollPos>0&&(t.maxScrollPos=-1)}))},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.prototype.watch=function(){this.watching||(this.watching=!0,this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkPullUp))},t.prototype.unwatch=function(){this.watching=!1,this.scroll.off(this.scroll.eventTypes.scroll,this.checkPullUp)},t.prototype.checkPullUp=function(t){var e=this,o=this.options.threshold;1===this.scroll.movingDirectionY&&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(Wt))},t.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()},t.prototype.openPullUp=function(t){void 0===t&&(t={}),this.handleOptions(t),this.watch()},t.prototype.closePullUp=function(){this.unwatch()},t.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)}},t.pluginName="pullUpLoad",t}(),Ut=function(){function t(t,e){this.indicator=t,this.options=e,this.bscroll=t.bscroll,this.startEventRegister=new rt(this.indicator.el,[{name:e.disableMouse?"touchstart":"mousedown",handler:this._start.bind(this)}]),this.endEventRegister=new rt(window,[{name:e.disableMouse?"touchend":"mouseup",handler:this._end.bind(this)}]),this.hooks=new st(["touchStart","touchMove","touchEnd"])}return t.prototype._start=function(t){if(this.bscroll.scroller.actions.enabled){var e=t.touches?t.touches[0]:t;t.preventDefault(),t.stopPropagation(),this.initiated=!0,this.moved=!1,this.lastPoint=e[this.indicator.keysMap.pointPos];var o=this.bscroll.options.disableMouse;this.moveEventRegister=new rt(window,[{name:o?"touchmove":"mousemove",handler:this._move.bind(this)}]),this.hooks.trigger("touchStart")}},t.prototype._move=function(t){var e=t.touches?t.touches[0]:t,o=e[this.indicator.keysMap.pointPos];t.preventDefault(),t.stopPropagation();var i=o-this.lastPoint;if(this.lastPoint=o,!this.moved)return this.hooks.trigger("touchMove",this.moved,i),void(this.moved=!0);this.hooks.trigger("touchMove",this.moved,i)},t.prototype._end=function(t){this.initiated&&(this.initiated=!1,t.preventDefault(),t.stopPropagation(),this.moveEventRegister.destroy(),this.hooks.trigger("touchEnd",this.moved))},t.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister&&this.moveEventRegister.destroy(),this.endEventRegister.destroy()},t}(),Vt=8,jt=function(){function t(t,e){this.bscroll=t,this.options=e,this.keyVals={sizeRatio:1,maxPos:0,initialSize:0},this.curPos=0,this.hooksHandlers=[],this.wrapper=e.wrapper,this.wrapperStyle=this.wrapper.style,this.el=this.wrapper.children[0],this.elStyle=this.el.style,this.bscroll=t,this.direction=e.direction,this.keysMap=this._getKeysMap(),e.fade?(this.visible=0,this.wrapperStyle.opacity="0"):this.visible=1,this._listenHooks(e.fade,e.interactive),this.refresh()}return t.prototype._listenHooks=function(t,e){var o=this,i=this.bscroll,s=i,r=i.scroller.translater.hooks,n=i.scroller.animater.hooks;if(this._listen(s,"refresh",this.refresh),this._listen(r,"translate",this.updatePosAndSize),this._listen(n,"time",(function(t){o.setTransitionTime(t)})),this._listen(n,"timeFunction",(function(t){o.setTransitionTimingFunction(t)})),t&&(this._listen(s,"scrollEnd",(function(){o.fade()})),this._listen(s,"scrollStart",(function(){o.fade(!0)})),i.eventTypes.mousewheelStart&&i.eventTypes.mousewheelEnd&&(this._listen(s,"mousewheelStart",(function(){o.fade(!0)})),this._listen(s,"mousewheelEnd",(function(){o.fade()})))),e){var h=this.bscroll.options.disableMouse;this.eventHandler=new Ut(this,{disableMouse:h});var l=this.eventHandler.hooks;this._listen(l,"touchStart",this.startHandler),this._listen(l,"touchMove",this.moveHandler),this._listen(l,"touchEnd",this.endHandler)}},t.prototype._getKeysMap=function(){return"vertical"===this.direction?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScroll:"maxScrollY",pos:"y",pointPos:"pageY",translate:"translateY"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScroll:"maxScrollX",pos:"x",pointPos:"pageX",translate:"translateX"}},t.prototype.fade=function(t){var e=t?250:500;this.wrapperStyle[C.transitionDuration]=e+"ms",this.wrapperStyle.opacity=t?"1":"0",this.visible=t?1:0},t.prototype.refresh=function(){var t=this.keysMap.hasScroll;if(this._setShowBy(this.bscroll[t])){var e=this.keysMap,o=e.wrapperSize,i=e.scrollerSize,s=e.maxScroll;this.keyVals=this._refreshKeyValues(this.wrapper[o],this.bscroll[i],this.bscroll[s]),this.updatePosAndSize({x:this.bscroll.x,y:this.bscroll.y})}},t.prototype._setShowBy=function(t){return t?(this.wrapper.style.display="",!0):(this.wrapper.style.display="none",!1)},t.prototype._refreshKeyValues=function(t,e,o){var i=Math.max(Math.round(t*t/(e||t||1)),Vt),s=t-i,r=s/o;return{initialSize:i,maxPos:s,sizeRatio:r}},t.prototype.updatePosAndSize=function(t){var e=this._refreshPosAndSizeValue(t,this.keyVals),o=e.pos,i=e.size;this.curPos=o,this._refreshPosAndSizeStyle(i,o)},t.prototype._refreshPosAndSizeValue=function(t,e){var o,i=this.keysMap.pos,s=e.sizeRatio,r=e.initialSize,n=e.maxPos,h=Math.round(s*t[i]);return h<0?(o=Math.max(r+3*h,Vt),h=0):h>n?(o=Math.max(r-3*(h-n),Vt),h=n+r-o):o=r,{pos:h,size:o}},t.prototype._refreshPosAndSizeStyle=function(t,e){var o=this.keysMap,i=o.translate,s=o.size;this.elStyle[s]=t+"px",this.elStyle[C.transform]=i+"("+e+"px)"+this.bscroll.options.translateZ},t.prototype.setTransitionTime=function(t){void 0===t&&(t=0),this.elStyle[C.transitionDuration]=t+"ms"},t.prototype.setTransitionTimingFunction=function(t){this.elStyle[C.transitionTimingFunction]=t},t.prototype.startHandler=function(){this.setTransitionTime(),this.bscroll.trigger("beforeScrollStart")},t.prototype.moveHandler=function(t,e){t||this.bscroll.trigger("scrollStart");var o=this._calScrollDesPos(this.curPos,e,this.keyVals);"vertical"===this.direction?this.bscroll.scrollTo(this.bscroll.x,o):this.bscroll.scrollTo(o,this.bscroll.y),this.bscroll.trigger("scroll",{x:this.bscroll.x,y:this.bscroll.y})},t.prototype._calScrollDesPos=function(t,e,o){var i=o.maxPos,s=o.sizeRatio,r=t+e;return r<0?r=0:r>i&&(r=i),Math.round(r/s)},t.prototype.endHandler=function(t){t&&this.bscroll.trigger("scrollEnd",{x:this.bscroll.x,y:this.bscroll.y})},t.prototype.destroy=function(){this.options.interactive&&this.eventHandler.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),this.hooksHandlers.forEach((function(t){var e=t[0],o=t[1],i=t[2];e.off(o,i)})),this.hooksHandlers.length=0},t.prototype._listen=function(t,e,o){t.on(e,o,this),this.hooksHandlers.push([t,e,o])},t}(),Zt=function(){function t(t){this.indicators=[],this.indicators=this.createIndicators(t),t.on(t.eventTypes.destroy,this.destroy,this)}return t.prototype.createIndicators=function(t){var e,o=this,i=t.options.scrollbar,s=i.fade,r=void 0===s||s,n=i.interactive,h=void 0!==n&&n,l={scrollX:"horizontal",scrollY:"vertical"},a=[];return Object.keys(l).forEach((function(i){var s=l[i];t.options[i]&&(e={wrapper:o.createIndicatorElement(s),direction:s,fade:r,interactive:h},t.wrapper.appendChild(e.wrapper),a.push(new jt(t,e)))})),a},t.prototype.createIndicatorElement=function(t){var e=document.createElement("div"),o=document.createElement("div");return e.style.cssText="position:absolute;z-index:9999;pointerEvents:none",o.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;",o.className="bscroll-indicator","horizontal"===t?(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",o.style.height="100%",e.className="bscroll-horizontal-scrollbar"):(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",o.style.width="100%",e.className="bscroll-vertical-scrollbar"),e.style.cssText+=";overflow:hidden",e.appendChild(o),e},t.prototype.destroy=function(){for(var t=0,e=this.indicators;t<e.length;t++){var o=e[t];o.destroy()}},t.pluginName="scrollbar",t}(),qt=function(){function t(t){this.scroll=t,this.init()}return t.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},t.prototype.getPageStats=function(t,e){return this.pages[t][e]},t.prototype.getNearestPageIndex=function(t,e){for(var o=0,i=0,s=this.pages.length;o<s-1;o++)if(t>=this.pages[o][0].cx)break;for(s=this.pages[o].length;i<s-1;i++)if(e>=this.pages[0][i].cy)break;return{pageX:o,pageY:i}},t.prototype.buildPagesMatrix=function(t,e){var o,i,s,r,n=[],h=0,l=0,a=this.scroll.scroller.scrollBehaviorX.maxScrollPos,c=this.scroll.scroller.scrollBehaviorY.maxScrollPos;i=Math.round(t/2),s=Math.round(e/2);while(h>-this.scrollerWidth){n[l]=[],r=0,o=0;while(o>-this.scrollerHeight)n[l][r]={x:Math.max(h,a),y:Math.max(o,c),width:t,height:e,cx:h-i,cy:o-s},o-=e,r++;h-=t,l++}return n},t}(),Gt={pageX:0,pageY:0,x:0,y:0},$t=function(){function t(t,e){this.scroll=t,this.slideOptions=e,this.slideX=!1,this.slideY=!1,this.currentPage=v({},Gt)}return t.prototype.refresh=function(){this.pagesMatrix=new qt(this.scroll);var t=this.currentPage,e=t.pageX,o=t.pageY,i=this.pagesMatrix.getPageStats(e,o),s=i.x,r=i.y;this.currentPage={pageX:e,pageY:o,x:s,y:r},this.checkSlideLoop()},t.prototype.setCurrentPage=function(t){this.currentPage=t},t.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}},t.prototype.getInitialPage=function(){var t=this.loopX?1:0,e=this.loopY?1:0,o=this.currentPage.pageX||t,i=this.currentPage.pageY||e,s=this.pagesMatrix.getPageStats(o,i),r=s.x,n=s.y;return{pageX:o,pageY:i,x:r,y:n}},t.prototype.getExposedPage=function(){var t=v({},this.currentPage);return this.loopX&&(t.pageX=this.fixedPage(t.pageX,this.pagesMatrix.pageLengthOfX-2)),this.loopY&&(t.pageY=this.fixedPage(t.pageY,this.pagesMatrix.pageLengthOfY-2)),t},t.prototype.getWillChangedPage=function(t){return t=v({},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},t.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]},t.prototype.getPageStats=function(){return this.pagesMatrix.getPageStats(this.currentPage.pageX,this.currentPage.pageY)},t.prototype.getValidPageIndex=function(t,e){var o=this.pagesMatrix.pageLengthOfX-1,i=this.pagesMatrix.pageLengthOfY-1,s=0,r=0;return this.loopX&&(t+=1,s+=1,o-=1),this.loopY&&(e+=1,r+=1,i-=1),t=T(t,s,o),e=T(e,r,i),{pageX:t,pageY:e}},t.prototype.nextPageIndex=function(){return this.getPageIndexByDirection("positive")},t.prototype.prevPageIndex=function(){return this.getPageIndexByDirection("negative")},t.prototype.nearestPage=function(t,e,o,i){var s,r,n=this.pagesMatrix.getNearestPageIndex(t,e),h=n.pageX,l=n.pageY;return h===this.currentPage.pageX&&(h+=o,h=T(h,0,this.pagesMatrix.pageLengthOfX-1)),l===this.currentPage.pageY&&(l+=i,l=T(l,0,this.pagesMatrix.pageLengthOfY-1)),s=this.pagesMatrix.getPageStats(h,0).x,r=this.pagesMatrix.getPageStats(0,l).y,{x:s,y:r,pageX:h,pageY:l}},t.prototype.resetLoopPage=function(){if(this.loopX){if(0===this.currentPage.pageX)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(0===this.currentPage.pageY)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}}},t.prototype.getPageIndexByDirection=function(t){var e=this.currentPage.pageX,o=this.currentPage.pageY;return this.slideX&&(e="negative"===t?e-1:e+1),this.slideY&&(o="negative"===t?o-1:o+1),{pageX:e,pageY:o}},t.prototype.checkSlideLoop=function(){this.needLoop=this.slideOptions.loop,this.pagesMatrix.pageLengthOfX>1&&(this.slideX=!0),this.pagesMatrix.pages[0]&&this.pagesMatrix.pageLengthOfY>1&&(this.slideY=!0),this.loopX=this.needLoop&&this.slideX,this.loopY=this.needLoop&&this.slideY,this.slideX&&this.slideY&&c("slide does not support two direction at the same time.")},t}(),Jt="plugins.slide",Qt=[{key:"next",name:"next"},{key:"prev",name:"prev"},{key:"goToPage",name:"goToPage"},{key:"getCurrentPage",name:"getCurrentPage"}],te=Qt.map((function(t){return{key:t.key,sourceKey:Jt+"."+t.name}})),ee=function(t,e){return t.pageX===e.pageX&&t.pageY===e.pageY},oe=function(){function t(t){this.scroll=t,this.resetLooping=!1,this.isTouching=!1,this.autoplayTimer=0,this.satisfyInitialization()&&this.init()}return t.prototype.satisfyInitialization=function(){return!(this.scroll.scroller.content.children.length<=0)||(c("slide need at least one slide page to be initialised.please check your DOM layout."),!1)},t.prototype.init=function(){this.willChangeToPage=v({},Gt),this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.createPages()},t.prototype.createPages=function(){this.pages=new $t(this.scroll,this.options)},t.prototype.handleBScroll=function(){this.scroll.registerType(["slideWillChange"]),this.scroll.proxy(te)},t.prototype.handleOptions=function(){var t=!0===this.scroll.options.slide?{}:this.scroll.options.slide,e={loop:!0,threshold:.1,speed:400,easing:j.bounce,listenFlick:!0,autoplay:!0,interval:3e3};this.options=v(e,t)},t.prototype.handleLoop=function(){var t=this.options.loop;if(t){var e=this.scroll.scroller.content,o=e.children;o.length>1&&this.cloneFirstAndLastSlidePage(e)}},t.prototype.handleHooks=function(){var t=this,e=this.scroll.hooks,o=this.scroll.scroller.hooks,i=this.options.listenFlick;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(e){1!==e.directionX&&1!==e.directionY||t.next(),-1!==e.directionX&&-1!==e.directionY||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.setSlideInlineStyle()})),this.registerHooks(o,o.eventTypes.momentum,this.modifyScrollMetaHandler),this.registerHooks(o,o.eventTypes.beforeStart,this.setTouchFlag),this.registerHooks(o,o.eventTypes.scroll,this.scrollMoving),this.registerHooks(o,o.eventTypes.checkClick,this.startPlay),i&&this.registerHooks(o,o.eventTypes.flick,this.flickHandler)},t.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))},t.prototype.pausePlay=function(){this.options.autoplay&&clearTimeout(this.autoplayTimer)},t.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(t){var e=t.direction,r=t.sizeType,n=t.styleType;if(s[e]){for(var h=i[r],l=o.children,a=l.length,c=0;c<a;c++){var p=l[c];p.style[n]=h+"px"}o.style[n]=h*a+"px"}}))},t.prototype.next=function(t,e){var o=this.pages.nextPageIndex(),i=o.pageX,s=o.pageY;this.goTo(i,s,t,e)},t.prototype.prev=function(t,e){var o=this.pages.prevPageIndex(),i=o.pageX,s=o.pageY;this.goTo(i,s,t,e)},t.prototype.goToPage=function(t,e,o,i){var s=this.pages.getValidPageIndex(t,e);s&&this.goTo(s.pageX,s.pageY,o,i)},t.prototype.getCurrentPage=function(){return this.pages.getExposedPage()},t.prototype.nearestPage=function(t,e){var o=this.scroll.scroller,i=o.scrollBehaviorX,s=o.scrollBehaviorY,r=i.absStartPos,n=i.maxScrollPos,h=i.minScrollPos,l=i.direction,a=s.absStartPos,c=s.maxScrollPos,p=s.minScrollPos,u=s.direction,d=!0;return Math.abs(t-r)<=this.thresholdX&&Math.abs(e-a)<=this.thresholdY&&(d=!1),d?this.pages.nearestPage(T(t,n,h),T(e,c,p),l,u):this.pages.currentPage},t.prototype.refreshHandler=function(){var t=this;if(this.satisfyInitialization()){this.pages.refresh(),this.computeThreshold();var e=this.pages.getInitialPage();this.initialised?this.goTo(e.pageX,e.pageY,0):this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.beforeInitialScrollTo,(function(o){t.initialised=!0,o.x=e.x,o.y=e.y,t.pages.setCurrentPage(e)})),this.startPlay()}},t.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)}},t.prototype.cloneFirstAndLastSlidePage=function(t){this.initialised&&this.removeClonedSlidePage(t);var e=t.children;W(e[e.length-1].cloneNode(!0),t),t.appendChild(e[1].cloneNode(!0))},t.prototype.removeClonedSlidePage=function(t){var e=t.children;e.length>2&&(U(t,e[e.length-1]),U(t,e[0]))},t.prototype.modifyCurrentPage=function(){if(this.isTouching=!1,this.options.loop)if(this.resetLooping)this.resetLooping=!1;else{var t=this.pages.resetLoopPage();if(t)return this.resetLooping=!0,this.goTo(t.pageX,t.pageY,0),!0;this.pageWillChangeTo(this.pages.currentPage)}},t.prototype.goTo=function(t,e,o,i){var s=this.pages.getInternalPage(t,e);if(s){var r=i||this.options.easing||j.bounce,n=s.x,h=s.y,l=n-this.scroll.scroller.scrollBehaviorX.currentPos,a=h-this.scroll.scroller.scrollBehaviorY.currentPos;(l||a)&&(o=void 0===o?this.getEaseTime(l,a):o,this.pages.setCurrentPage(s),this.pageWillChangeTo(this.pages.currentPage),this.scroll.scroller.scrollTo(n,h,o,r))}},t.prototype.flickHandler=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY,i=e.currentPos,s=e.startPos,r=e.direction,n=o.currentPos,h=o.startPos,l=o.direction,a=this.pages.currentPage,c=a.pageX,p=a.pageY,u=this.getEaseTime(i-s,n-h);this.goTo(c+r,p+l,u)},t.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)},t.prototype.modifyScrollMetaHandler=function(t){var e=this.nearestPage(t.newX,t.newY);t.time=this.getEaseTime(t.newX-e.x,t.newY-e.y),t.newX=e.x,t.newY=e.y,t.easing=this.options.easing||j.bounce,this.pages.setCurrentPage(e),this.pageWillChangeTo(this.pages.currentPage)},t.prototype.scrollMoving=function(t){if(this.isTouching){var e=this.nearestPage(t.x,t.y);this.pageWillChangeTo(e)}},t.prototype.pageWillChangeTo=function(t){var e=this.pages.getWillChangedPage(t);ee(this.willChangeToPage,e)||(this.willChangeToPage=e,this.scroll.trigger(this.scroll.eventTypes.slideWillChange,this.willChangeToPage))},t.prototype.setTouchFlag=function(){this.isTouching=!0},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.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(t){var e=t[0],o=t[1],i=t[2];e.eventTypes[o]&&e.off(o,i)})),this.hooksFn.length=0},t.pluginName="slide",t}(),ie="plugins.wheel",se=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"}],re=se.map((function(t){return{key:t.key,sourceKey:ie+"."+t.name}})),ne={rate:4},he=function(){function t(t){this.scroll=t,this.init()}return t.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.handleSelectedIndex()},t.prototype.handleBScroll=function(){this.scroll.proxy(re)},t.prototype.handleOptions=function(){var t=!0===this.scroll.options.wheel?{}:this.scroll.options.wheel,e={wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"};this.options=v(e,t)},t.prototype.handleHooks=function(){var t=this,e=this.scroll.scroller,o=e.actionsHandler,i=e.scrollBehaviorX,s=e.scrollBehaviorY,r=e.animater;this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,(function(e){e.x=0,e.y=-t.selectedIndex*t.itemHeight})),e.hooks.on(e.hooks.eventTypes.checkClick,(function(){var e=Array.prototype.slice.call(t.items,0).indexOf(t.target);return-1===e||t.wheelToAfterClick(e,t.options.adjustTime,j.swipe),!0})),e.hooks.on(e.hooks.eventTypes.scrollTo,(function(e){e.y=t.findNearestValidWheel(e.y).y})),e.hooks.on(e.hooks.eventTypes.scrollToElement,(function(e,o){if(!V(e,t.options.wheelItemClass))return!0;o.top=t.findNearestValidWheel(o.top).y})),o.hooks.on(o.hooks.eventTypes.beforeStart,(function(e){t.target=e.target})),i.hooks.on(i.hooks.eventTypes.computeBoundary,(function(t){t.maxScrollPos=0,t.minScrollPos=0})),s.hooks.on(s.hooks.eventTypes.computeBoundary,(function(e){t.items=t.scroll.scroller.content.children,t.checkWheelAllDisabled(),t.itemHeight=t.items.length>0?s.contentSize/t.items.length:0,e.maxScrollPos=-t.itemHeight*(t.items.length-1),e.minScrollPos=0})),s.hooks.on(s.hooks.eventTypes.momentum,(function(e,o){e.rate=ne.rate,e.destination=t.findNearestValidWheel(e.destination).y;var i=1e3,s=800;o<i&&(e.duration=Math.max(s,o/i*t.scroll.options.swipeTime))})),s.hooks.on(s.hooks.eventTypes.end,(function(e){var o=t.findNearestValidWheel(s.currentPos);e.destination=o.y,e.duration=t.options.adjustTime,t.selectedIndex=o.index})),r.hooks.on(r.hooks.eventTypes.time,(function(e){t.transitionDuration(e)})),r.hooks.on(r.hooks.eventTypes.timeFunction,(function(e){t.timeFunction(e)})),r.hooks.on(r.hooks.eventTypes.beforeForceStop,(function(e){var o=e.y;return t.target=t.items[t.findNearestValidWheel(o).index],!0})),r.hooks.on(r.hooks.eventTypes.callStop,(function(){var e=Array.prototype.slice.call(t.items,0).indexOf(t.target);if(e>0){var o=-e*t.itemHeight;r.translate({x:0,y:o})}})),r.translater.hooks.on(r.translater.hooks.eventTypes.translate,(function(e){t.rotateX(e.y),t.selectedIndex=t.findNearestValidWheel(e.y).index}))},t.prototype.refreshBoundary=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY;e.refresh(),o.refresh()},t.prototype.handleSelectedIndex=function(){this.selectedIndex=this.options.selectedIndex},t.prototype.getSelectedIndex=function(){return this.selectedIndex},t.prototype.wheelTo=function(t,e,o){void 0===t&&(t=0),void 0===e&&(e=0);var i=-t*this.itemHeight,s=Math.round(this.scroll.y);return this.scroll.scrollTo(0,i,e,o),i===s},t.prototype.wheelToAfterClick=function(t,e,o){void 0===t&&(t=0),void 0===e&&(e=0);var i=this.wheelTo(t,e,o);if(i){var s=this.scroll.scroller.hooks;s.trigger(s.eventTypes.scrollEnd)}},t.prototype.transitionDuration=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[C.transitionDuration]=t+"ms"},t.prototype.timeFunction=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[C.transitionTimingFunction]=t},t.prototype.rotateX=function(t){for(var e=this.options.rotate,o=void 0===e?25:e,i=0;i<this.items.length;i++){var s=o*(t/this.itemHeight+i),r=s.toFixed(3);this.items[i].style[C.transform]="rotateX("+r+"deg)"}},t.prototype.findNearestValidWheel=function(t){t=t>0?0:t<this.scroll.maxScrollY?this.scroll.maxScrollY:t;var e=Math.abs(Math.round(-t/this.itemHeight)),o=e,i=this.items,s=this.options.wheelDisabledItemClass;while(e>=0){if(!V(i[e],s))break;e--}if(e<0){e=o;while(e<=i.length-1){if(!V(i[e],s))break;e++}}return e===i.length&&(e=o),{index:this.wheelItemsAllDisabled?-1:e,y:-e*this.itemHeight}},t.prototype.checkWheelAllDisabled=function(){var t=this.options.wheelDisabledItemClass,e=this.items;this.wheelItemsAllDisabled=!0;for(var o=0;o<e.length;o++)if(!V(e[o],t)){this.wheelItemsAllDisabled=!1;break}},t.pluginName="wheel",t}(),le="plugins.zoom",ae=[{key:"zoomTo",name:"zoomTo"}],ce=ae.map((function(t){return{key:t.key,sourceKey:le+"."+t.name}})),pe=2,ue=function(){function t(t){this.scroll=t,this.scale=1,this.prevScale=1,this.init()}return t.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.tryInitialZoomTo(this.zoomOpt)},t.prototype.zoomTo=function(t,e,o,i){var s=this.resolveOrigin(e,o),r=s.originX,n=s.originY,h={x:r,y:n,baseScale:this.scale};this._doZoomTo(t,h,i,!0)},t.prototype.handleBScroll=function(){this.scroll.proxy(ce),this.scroll.registerType(["beforeZoomStart","zoomStart","zooming","zoomEnd"])},t.prototype.handleOptions=function(){var t=!0===this.scroll.options.zoom?{}:this.scroll.options.zoom,e={start:1,min:1,max:4,initialOrigin:[0,0],minimalZoomDistance:5,bounceTime:800};this.zoomOpt=v(e,t)},t.prototype.handleHooks=function(){var t=this,e=this.scroll,o=this.scroll.scroller;this.wrapper=this.scroll.scroller.wrapper,this.scaleElement=this.scroll.scroller.content,this.scaleElement.style[C.transformOrigin]="0 0",this.scaleElementInitSize=I(this.scaleElement);var i=o.scrollBehaviorX,s=o.scrollBehaviorY;this.hooksFn=[],this.registerHooks(e.hooks,e.hooks.eventTypes.beforeInitialScrollTo,(function(){return!0})),this.registerHooks(i.hooks,i.hooks.eventTypes.beforeComputeBoundary,(function(){i.contentSize=Math.floor(t.scaleElementInitSize.width*t.scale)})),this.registerHooks(s.hooks,s.hooks.eventTypes.beforeComputeBoundary,(function(){s.contentSize=Math.floor(t.scaleElementInitSize.height*t.scale)})),this.registerHooks(o.actions.hooks,o.actions.hooks.eventTypes.start,(function(e){var o=e.touches&&e.touches.length||0;t.fingersOperation(o),o===pe&&t.zoomStart(e)})),this.registerHooks(o.actions.hooks,o.actions.hooks.eventTypes.beforeMove,(function(e){var o=e.touches&&e.touches.length||0;if(t.fingersOperation(o),o===pe)return t.zoom(e),!0})),this.registerHooks(o.actions.hooks,o.actions.hooks.eventTypes.beforeEnd,(function(e){var o=t.fingersOperation();if(o===pe)return t.zoomEnd(),!0})),this.registerHooks(o.translater.hooks,o.translater.hooks.eventTypes.beforeTranslate,(function(e,o){var i=o.scale?o.scale:t.prevScale;t.prevScale=i,e.push("scale("+i+")")})),this.registerHooks(o.hooks,o.hooks.eventTypes.scrollEnd,(function(){t.fingersOperation()===pe&&t.scroll.trigger(t.scroll.eventTypes.zoomEnd,{scale:t.scale})})),this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},t.prototype.tryInitialZoomTo=function(t){var e=t.start,o=t.initialOrigin;this.zoomTo(e,o[0],o[1],0)},t.prototype.fingersOperation=function(t){if("number"!==typeof t)return this.numberOfFingers;this.numberOfFingers=t},t.prototype._doZoomTo=function(t,e,o,i){var s=this;void 0===o&&(o=this.zoomOpt.bounceTime),void 0===i&&(i=!1);var r=this.zoomOpt,n=r.min,h=r.max,l=this.scale,a=T(t,n,h);(function(){if(0!==o){if(o>0){var t,e=y(),i=e+o,r=function(){var n=y();if(n>=i)return s.scroll.trigger(s.scroll.eventTypes.zooming,{scale:a}),void J(t);var h=j.bounce.fn((n-e)/o),c=h*(a-l)+l;s.scroll.trigger(s.scroll.eventTypes.zooming,{scale:c}),t=$(r)};r()}}else s.scroll.trigger(s.scroll.eventTypes.zooming,{scale:a})})(),this.fingersOperation(2),this._zoomTo(a,l,e,o,i)},t.prototype._zoomTo=function(t,e,o,i,s){void 0===s&&(s=!1);var r=t/o.baseScale;this.setScale(t);var n=this.scroll.scroller,h=n.scrollBehaviorX,l=n.scrollBehaviorY;this.resetBoundaries([h,l]);var a=this.getNewPos(o.x,r,h,!0,s),c=this.getNewPos(o.y,r,l,!0,s);h.currentPos===Math.round(a)&&l.currentPos===Math.round(c)&&t===e||n.scrollTo(a,c,i,j.bounce,{start:{scale:e},end:{scale:t}})},t.prototype.resolveOrigin=function(t,e){var o=this.scroll.scroller,i=o.scrollBehaviorX,s=o.scrollBehaviorY,r={left:function(){return 0},top:function(){return 0},right:function(){return i.contentSize},bottom:function(){return s.contentSize},center:function(t){var e=0===t?i.contentSize:s.contentSize;return e/2}};return{originX:"number"===typeof t?t:r[t](0),originY:"number"===typeof e?e:r[e](1)}},t.prototype.zoomStart=function(t){var e=t.touches[0],o=t.touches[1];this.startDistance=this.getFingerDistance(t),this.startScale=this.scale;var i=E(this.wrapper),s=i.left,r=i.top;this.origin={x:Math.abs(e.pageX+o.pageX)/2+s-this.scroll.x,y:Math.abs(e.pageY+o.pageY)/2+r-this.scroll.y,baseScale:this.startScale},this.scroll.trigger(this.scroll.eventTypes.beforeZoomStart)},t.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,r=s.scrollBehaviorX,n=s.scrollBehaviorY,h=this.getNewPos(this.origin.x,i,r,!1,!1),l=this.getNewPos(this.origin.y,i,n,!1,!1);this.scroll.trigger(this.scroll.eventTypes.zooming,{scale:this.scale}),s.translater.translate({x:h,y:l,scale:o})}},t.prototype.zoomEnd=function(){this.zoomed&&(this.shouldRebound()?this._doZoomTo(this.scale,this.origin,this.zoomOpt.bounceTime):this.scroll.trigger(this.scroll.eventTypes.zoomEnd,{scale:this.scale}))},t.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 k(i,s)},t.prototype.shouldRebound=function(){var t=this.zoomOpt,e=t.min,o=t.max,i=this.scale;if(i!==T(i,e,o))return!0;var s=this.scroll.scroller,r=s.scrollBehaviorX,n=s.scrollBehaviorY;this.resetBoundaries([r,n]);var h=r.checkInBoundary().inBoundary,l=r.checkInBoundary().inBoundary;return!(h&&l)},t.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},t.prototype.setScale=function(t){this.scale=t},t.prototype.resetBoundaries=function(t){t.forEach((function(t){return t.computeBoundary()}))},t.prototype.getNewPos=function(t,e,o,i,s){void 0===s&&(s=!1);var r=t-t*e+(s?o.currentPos:o.startPos);return i&&(r=T(r,o.maxScrollPos,o.minScrollPos)),r>0?Math.floor(r):Math.ceil(r)},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.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},t.pluginName="zoom",t}(),de={duplicateClick:function(t){var e=t[0],o=t[1];e.options.click&&o.options.click&&(o.options.click=!1)},nestedScroll:function(t){var e=t[0],o=t[1],i=e.options.scrollX,s=e.options.scrollY,r=o.options.scrollX,n=o.options.scrollY;i!==r&&s!==n||(t.forEach((function(e,o){var i=t[(o+1)%2];e.on(e.eventTypes.beforeScrollStart,(function(){i.pending&&(i.stop(),i.resetPosition()),ve(i),i.disable()})),e.on(e.eventTypes.touchEnd,(function(){i.enable()}))})),o.on(o.eventTypes.scrollStart,(function(){ye(o)&&(o.disable(),e.enable())})))}},fe=function(){function t(e){var o=t.nestedScroll;return o instanceof t||(o=t.nestedScroll=this,o.stores=[]),o.setup(e),o.addHooks(e),o}return t.prototype.setup=function(t){this.appendBScroll(t),this.handleContainRelationship(),this.handleCompatible()},t.prototype.addHooks=function(t){var e=this;t.on("destroy",(function(){e.teardown(t)}))},t.prototype.teardown=function(t){this.removeBScroll(t),this.handleContainRelationship(),this.handleCompatible()},t.prototype.appendBScroll=function(t){this.stores.push(t)},t.prototype.removeBScroll=function(t){var e=this.stores.indexOf(t);-1!==e&&(t.wrapper.isBScrollContainer=void 0,this.stores.splice(e,1))},t.prototype.handleContainRelationship=function(){var t=this.stores;if(t.length<=1)t[0]&&t[0].__parentInfo&&(t[0].__parentInfo=void 0);else for(var e,o,i,s,r=0;r<t.length;r++){e=t[r],o=e.wrapper;for(var n=0;n<t.length;n++)if(i=t[n],s=i.wrapper,e!==i&&s.contains(o))if(e.__parentInfo){var h=ge(o,s),l=e.__parentInfo.depth;l>h&&(e.__parentInfo={parent:i,depth:h})}else e.__parentInfo={parent:i,depth:ge(o,s)}}},t.prototype.handleCompatible=function(){var t=this.availableBScrolls(),e=["duplicateClick","nestedScroll"];t.forEach((function(t){e.forEach((function(e){de[e](t)}))}))},t.prototype.availableBScrolls=function(){var t=[];return t=this.stores.filter((function(t){return!!t.__parentInfo})).map((function(t){return[t.__parentInfo.parent,t]})),t},t.pluginName="nestedScroll",t}();function ge(t,e){var o=0,i=t.parentNode;while(i&&i!==e)o++,i=i.parentNode;return o}function ye(t){var e=me(t),o=e.hasHorizontalScroll,i=e.hasVerticalScroll,s=t.scroller,r=s.scrollBehaviorX,n=s.scrollBehaviorY,h=t.x>=t.minScrollX&&-1===r.movingDirection,l=t.x<=t.maxScrollX&&1===r.movingDirection,a=t.y>=t.minScrollY&&-1===n.movingDirection,c=t.y<=t.maxScrollY&&1===n.movingDirection;return i?a||c:!!o&&(h||l)}function ve(t){var e=me(t),o=e.hasHorizontalScroll,i=e.hasVerticalScroll,s=t.scroller,r=s.actions,n=s.scrollBehaviorX,h=s.scrollBehaviorY;r.startTime=+new Date,i?h.startPos=h.currentPos:o&&(n.startPos=n.currentPos)}function me(t){return{hasHorizontalScroll:t.hasHorizontalScroll,hasVerticalScroll:t.hasVerticalScroll}}var ke=10,Te=30,be=function(){function t(t,e){this.wrapperHeight=t,this.tombstoneHeight=e,this.lastDirection=1,this.lastPos=0}return t.prototype.calculate=function(t,e){var o=t-this.lastPos;this.lastPos=t;var i=this.getDirection(o),s=this.calculateIndex(0,t,e),r=this.calculateIndex(s,t+this.wrapperHeight,e);return 1===i?(s-=ke,r+=Te):(s-=Te,r+=ke),s<0&&(s=0),{start:s,end:r}},t.prototype.getDirection=function(t){var e;if(t>0)e=1;else{if(!(t<0))return this.lastDirection;e=0}return this.lastDirection=e,e},t.prototype.calculateIndex=function(t,e,o){if(e<=0)return t;var i=t,s=o[i]&&-1!==o[i].pos?o[i].pos:0,r=s,n=0;while(i<o.length&&o[i].pos<e)r=o[i].pos,i++;return i===o.length&&(n=Math.floor((e-r)/this.tombstoneHeight)),i+=n,i},t}(),we=function(){function t(){this.data=null,this.dom=null,this.tombstone=null,this.width=0,this.height=0,this.pos=0}return t}(),Pe=function(){function t(t,e,o){this.fetchFn=e,this.onFetchFinish=o,this.loadedNum=0,this.fetching=!1,this.hasMore=!0,this.list=t||[]}return t.prototype.update=function(t){return n(this,void 0,void 0,(function(){var e;return h(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)]}))}))},t.prototype.add=function(t){for(var e=0;e<t.length;e++)this.list[this.loadedNum]?this.list[this.loadedNum]=r(r({},this.list[this.loadedNum]),{data:t[e]}):this.list[this.loadedNum]={data:t[e]},this.loadedNum++;return this.list},t.prototype.addEmptyData=function(t){for(var e=0;e<t;e++)this.list.push(new we);return this.list},t.prototype.fetch=function(t){return n(this,void 0,void 0,(function(){var e;return h(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]}}))}))},t.prototype.checkToFetch=function(t){return n(this,void 0,void 0,(function(){var e,o,i;return h(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)]):("boolean"===typeof o&&!1===o&&(this.hasMore=!1,this.list.splice(this.loadedNum),this.onFetchFinish(this.list,!1)),[2])}}))}))},t.prototype.getList=function(){return this.list},t}(),Se=function(){function t(t){this.create=t,this.cached=[],this.width=0,this.height=0,this.initialed=!1,this.getSize()}return t.isTombstone=function(t){return!(!t||!t.classList)&&t.classList.contains("tombstone")},t.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)}},t.prototype.getOne=function(){var t=this.cached.pop();if(t){var e=t.style;return e.display="",e.opacity="1",e[C.transform]="",e[C.transition]="",t}return this.create()},t.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},t.prototype.recycleOne=function(t){return this.cached.push(t),this.cached},t}(),xe=200,Me=function(){function t(t,e,o){this.content=t,this.renderFn=e,this.tombstone=o,this.unusedDom=[],this.timers=[]}return t.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,r=i.startDelta,n=i.endPos;return{start:e,startPos:s,startDelta:r,end:o,endPos:n}},t.prototype.collectUnusedDom=function(t,e,o){for(var i=0;i<t.length;i++)if(i!==e){if(t[i].dom){var s=t[i].dom;Se.isTombstone(s)?(this.tombstone.recycleOne(s),s.style.display="none"):this.unusedDom.push(s),t[i].dom=null}}else i=o-1;return t},t.prototype.createDom=function(t,e,o){for(var i=e;i<o;i++){var s=t[i].dom,r=t[i].data;if(s){if(!Se.isTombstone(s)||!r)continue;t[i].tombstone=s,t[i].dom=null}s=r?this.renderFn(r,this.unusedDom.pop()):this.tombstone.getOne(),s.style.position="absolute",t[i].dom=s,t[i].pos=-1,this.content.appendChild(s)}},t.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)},t.prototype.positionDom=function(t,e,o){for(var i=this,s=[],r=this.getStartPos(t,e,o),n=r.start,h=r.delta,l=n,a=e;a<o;a++){var c=t[a].tombstone;if(c){var p=c.style;p[C.transition]=B+"transform "+xe+"ms, opacity "+xe+"ms",p[C.transform]="translateY("+l+"px)",p.opacity="0",t[a].tombstone=null,s.push(c)}t[a].dom&&t[a].pos!==l&&(t[a].dom.style[C.transform]="translateY("+l+"px)",t[a].pos=l),l+=t[a].height||this.tombstone.height}var u=window.setTimeout((function(){i.tombstone.recycle(s)}),xe);return this.timers.push(u),{startPos:n,startDelta:h,endPos:l}},t.prototype.getStartPos=function(t,e,o){if(t[e]&&-1!==t[e].pos)return{start:t[e].pos,delta:0};for(var i=-1===t[0].pos?0:t[0].pos,s=0;s<e;s++)i+=t[s].height||this.tombstone.height;var r,n=i;for(r=e;r<o;r++)if(!Se.isTombstone(t[r].dom)&&-1!==t[r].pos){i=t[r].pos;break}var h=r;if(h<o)while(h>e)i-=t[h-1].height,h--;var l=n-i;return{start:i,delta:l}},t.prototype.removeTombstone=function(){for(var t=this.content.querySelectorAll(".tombstone"),e=t.length-1;e>=0;e--)this.content.removeChild(t[e])},t.prototype.destroy=function(){this.removeTombstone(),this.timers.forEach((function(t){clearTimeout(t)}))},t}(),Ye=-2e3,Ee=function(){function t(t){this.scroll=t,this.start=0,this.end=0,this.init()}return t.prototype.init=function(){this.handleOptions();var t=this.options,e=t.fetch,o=t.render,i=t.createTombstone;this.tombstone=new Se(i),this.indexCalculator=new be(this.scroll.scroller.scrollBehaviorY.wrapperSize,this.tombstone.height),this.domManager=new Me(this.scroll.scroller.content,o,this.tombstone),this.dataManager=new Pe([],e,this.onFetchFinish.bind(this)),this.scroll.on(this.scroll.eventTypes.destroy,this.destroy,this),this.scroll.on(this.scroll.eventTypes.scroll,this.update,this);var s=this.scroll.scroller.scrollBehaviorY;s.hooks.on(s.hooks.eventTypes.computeBoundary,this.modifyBoundary,this),this.update({y:0})},t.prototype.modifyBoundary=function(t){t.maxScrollPos=Ye},t.prototype.handleOptions=function(){var t=this.scroll.options.infinity;t&&("function"!==typeof t.fetch&&c("Infinity plugin need fetch Function to new data."),"function"!==typeof t.render&&c("Infinity plugin need render Function to render each item."),"function"!==typeof t.render&&c("Infinity plugin need createTombstone Function to create tombstone."),this.options=t),this.scroll.options.probeType=3},t.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())},t.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},t.prototype.updateDom=function(t){var e=this.domManager.update(t,this.start,this.end),o=e.end,i=e.startPos,s=e.endPos,r=e.startDelta;return r&&(this.scroll.minScrollY=r),s>this.scroll.maxScrollY&&(this.scroll.maxScrollY=-(s-this.scroll.scroller.scrollBehaviorY.wrapperSize)),{end:o,startPos:i,endPos:s}},t.prototype.destroy=function(){var t=this.scroll.scroller,e=t.content,o=t.scrollBehaviorY;while(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)},t.pluginName="infinity",t}(),Be=function(){function t(t){this.scroll=t,this.handleHooks()}return t.prototype.handleHooks=function(){var t=this;this.hooksFn=[];var e=this.scroll.scroller,o=e.scrollBehaviorX,i=e.scrollBehaviorY,s=function(t,e){e.options.scrollable&&t.maxScrollPos>0&&(t.minScrollPos=e.wrapperSize-e.contentSize,t.maxScrollPos=0)};this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,(function(t){s(t,o)})),this.registerHooks(i.hooks,i.hooks.eventTypes.computeBoundary,(function(t){s(t,i)})),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.destroy,(function(){t.destroy()}))},t.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},t.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},t.pluginName="movable",t}();Ot.use(Ht).use(zt).use(_t).use(Kt).use(Zt).use(oe).use(he).use(ue).use(fe).use(Ee).use(Be),e["a"]=Ot}}]);
|