text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.rafscroll=e():t.rafscroll=e()}(window,(function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}n.r(e);var s=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,t),this.options=Object.assign({duration:500,easing:"quadratic"},e),this.el=this.options.el,this._ticking=!1,this.scrolls={x:{},y:{}},this._complete=function(){},this._promise=Promise.resolve()}var e,n,o;return e=t,(n=[{key:"animate",value:function(){var t=this;return this._ticking||(this._promise=new Promise((function(e,n){t._complete=e,t._ticking=window.performance.now(),t.tick(t._ticking)}))),this._promise}},{key:"scrollLeft",value:function(t,e){return this.createScroll(t,e,"x")}},{key:"scrollTop",value:function(t,e){return this.createScroll(t,e)}},{key:"createScroll",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"y",o="x"===n?"scrollLeft":"scrollTop",r=this.el[o],i=window.performance.now();return this.scrolls[n]={posStart:r,posTarget:t,posDelta:t-r,timeStart:i,timeEnd:i+(e||this.options.duration),duration:e||this.options.duration,ease:this.getEasing(),prop:o},this.animate()}},{key:"getEasing",value:function(){var t={quadratic:this._quadratic,linear:this._linear,none:this._noease};return"string"==typeof this.options.easing&&Object.keys(t).includes(this.options.easing)?t[this.options.easing]:"function"==typeof this.options.easing?this.options.easing:this._quadratic}},{key:"setEasing",value:function(t){return this.options.easing=t,this}},{key:"setDuration",value:function(t){return this.options.duration=t,this}},{key:"tick",value:function(t){var e=this;this._ticking?window.requestAnimationFrame((function(){Object.keys(e.scrolls).map((function(n){return e.setProp(e.scrolls[n],t)})),e.tick(window.performance.now()),e.isExpired(t)&&(e._ticking=!1)})):this._complete()}},{key:"isExpired",value:function(t){var e=!this.scrolls.y.timeEnd||this.scrolls.y.timeEnd<t,n=!this.scrolls.x.timeEnd||this.scrolls.x.timeEnd<t;return e&&n}},{key:"setProp",value:function(t,e){if(!t.timeEnd)return!1;t.timeEnd>e?(t.current=e-t.timeStart,this.el[t.prop]=t.ease(t)):this.el[t.prop]=t.posTarget}},{key:"_linear",value:function(t){return t.current/t.duration*t.posDelta+t.posStart}},{key:"_quadratic",value:function(t){var e=t.current,n=t.duration,o=t.posDelta,r=t.posStart,i=e/(n/2);return i<1?o/2*i*i+r:-o/2*(--i*(i-2)-1)+r}},{key:"_noease",value:function(t){return t.current,t.duration,t.posDelta+t.posStart}}])&&i(e.prototype,n),o&&i(e,o),t}();e.default=function(t,e){return!t||"object"!==o(t)||t instanceof Element||e||(t=(e=t).el instanceof Element?e.el:null),"undefined"==typeof window||t instanceof Element||(t=function(){if("scrollingElement"in document)return document.scrollingElement;var t=document.documentElement.scrollTop;document.documentElement.scrollTop=t+1;var e=document.documentElement.scrollTop;return document.documentElement.scrollTop=t,e>t?document.documentElement:document.body}()),new s(Object.assign(e||{},{el:t}))}}])}));