!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).BScroll={})}(this,function(t){"use strict";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])})(t,e)};function e(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;odocument.documentElement.clientWidth-i||o>document.documentElement.clientHeight-i||ethis.minScrollPos||othis.minScrollPos&&this.options.bounces[0]||othis.minScrollPos?this.minScrollPos:this.maxScrollPos:o},at.prototype.end=function(t){var e={duration:0},o=Math.abs(this.currentPos-this.startPos);return this.options.momentum&&tthis.options.momentumLimitDistance?(o=-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,o,this.options):{destination:this.currentPos,duration:0}):this.hooks.trigger(this.hooks.eventTypes.end,e),e},at.prototype.momentum=function(t,e,o,i,n,s,r){void 0===r&&(r=this.options);var h=t-e,a=Math.abs(h)/o,e=r.deceleration,o=r.swipeBounceTime,r=r.swipeTime,e={destination:t+a*a/e*(h<0?-1:1),duration:Math.min(r,2*a/e),rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,e,h),e.destinationn&&(e.destination=s?Math.min(n+s/4,n+s/e.rate*a):n,e.duration=o),e.destination=Math.round(e.destination),e},at.prototype.updateDirection=function(){var t=this.currentPos-this.absStartPos;this.setDirection(t)},at.prototype.refresh=function(t){var e=this.options.rect,o=e.size,i=e.position,n="static"===window.getComputedStyle(this.wrapper,null).position,e=X(this.wrapper);this.wrapperSize=this.wrapper["width"===o?"clientWidth":"clientHeight"],this.setContent(t);t=X(this.content);this.contentSize=t[o],this.relativeOffset=t[i],n&&(this.relativeOffset-=e[i]),this.computeBoundary(),this.setDirection(0)},at.prototype.setContent=function(t){t!==this.content&&(this.content=t,this.resetState())},at.prototype.resetState=function(){this.currentPos=0,this.startPos=0,this.dist=0,this.setDirection(0),this.setMovingDirection(0),this.resetStartPos()},at.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,0===this.options.specifiedIndexAsContent&&(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.maxScrollPosthis.minScrollPos?t=this.minScrollPos:te+this.directionLockThreshold?this.directionLocked="horizontal":e>=t+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},ut.prototype.handleEventPassthrough=function(t){var e=lt[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return ct.yes(t);if(this.eventPassthrough===e.no)return ct.no(t)}return!1},ut);function ut(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var dt=(ft.prototype.bindActionsHandler=function(){var n=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!n.enabled||n.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var e=t.deltaX,o=t.deltaY,i=t.e;if(!n.enabled)return!0;t=e,e=o,e=2===(o=n.options.quadrant)?[e,-t]:3===o?[-t,-e]:4===o?[-e,t]:[t,e],e={deltaX:e[0],deltaY:e[1]};return n.hooks.trigger(n.hooks.eventTypes.coordinateTransformation,e),n.handleMove(e.deltaX,e.deltaY,i)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!n.enabled||n.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){n.enabled&&!t._constructed&&n.handleClick(t)})},ft.prototype.handleStart=function(t){var e=f();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)},ft.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var i=this.scrollBehaviorX.getAbsDist(t),n=this.scrollBehaviorY.getAbsDist(e),s=f();if(this.checkMomentum(i,n,s))return!0;if(this.directionLockAction.checkMovingDirection(i,n,o))return this.actionsHandler.setInitiated(),!0;n=this.directionLockAction.adjustDelta(t,e),o=this.scrollBehaviorX.getCurrentPos(),t=this.scrollBehaviorX.move(n.deltaX),e=this.scrollBehaviorY.getCurrentPos(),n=this.scrollBehaviorY.move(n.deltaY);this.hooks.trigger(this.hooks.eventTypes.detectMovingDirection)||(this.fingerMoved||(this.fingerMoved=!0),e=t!==o||n!==e,this.contentMoved||e||this.hooks.trigger(this.hooks.eventTypes.contentNotMoved),!this.contentMoved&&e&&(this.contentMoved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.contentMoved&&e&&(this.animater.translate({x:t,y:n}),this.dispatchScroll(s)))}},ft.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())),1this.options.momentumLimitTime&&ethis.scrollBehaviorX.minScrollPos||o.newXthis.scrollBehaviorY.minScrollPos||o.newY