window.noZensmooth=!0,function(t,e){"function"==typeof define&&define.amd?define([],e()):"object"==typeof module&&module.exports?module.exports=e():t.zenscroll=e()}(this,function(){"use strict";if(!window||!document)return{};var t=function(t,e,o){e=e||999,o||0===o||(o=9);var n,i=document.documentElement,r=function(){return"getComputedStyle"in window&&"smooth"===window.getComputedStyle(t?t:document.body)["scroll-behavior"]},c=function(){return t?t.scrollTop:window.scrollY||i.scrollTop},u=function(){return t?Math.min(t.offsetHeight,window.innerHeight):window.innerHeight||i.clientHeight},f=function(e){return t?e.offsetTop-t.offsetTop:e.getBoundingClientRect().top+c()-i.offsetTop},l=function(){clearTimeout(n),n=0},a=function(o,f,a){if(l(),r())(t||window).scrollTo(0,o),a&&a();else{var s=c(),d=Math.max(o,0)-s;f=f||Math.min(Math.abs(d),e);var m=(new Date).getTime();!function h(){n=setTimeout(function(){var e=Math.min(((new Date).getTime()-m)/f,1),o=Math.max(Math.floor(s+d*(.5>e?2*e*e:e*(4-2*e)-1)),0);t?t.scrollTop=o:window.scrollTo(0,o),1>e&&u()+o<(t||i).scrollHeight?h():(setTimeout(l,99),a&&a())},9)}()}},s=function(t,e,n,i){a(f(t)-(n||o),e,i)},d=function(t,e,n){var i=t.getBoundingClientRect().height+2*o,r=u(),l=f(t),d=l+i-o,m=c();o>l-m||i>r?s(t,e,n):0>m+r-d?a(d-r,e,n):n&&n()},m=function(t,e,o,n){a(Math.max(f(t)-u()/2+(o||t.getBoundingClientRect().height/2),0),e,n)},h=function(t,n){t&&(e=t),(0===n||n)&&(o=n)};return{setup:h,to:s,toY:a,intoView:d,center:m,stop:l,moving:function(){return!!n}}},e=t();if("addEventListener"in window&&"smooth"!==document.body.style.scrollBehavior&&!window.noZensmooth){var o=function(t){try{history.replaceState({},"",window.location.href.split("#")[0]+t)}catch(e){}};window.addEventListener("click",function(t){for(var n=t.target;n&&"A"!==n.tagName;)n=n.parentNode;if(!(!n||1!==t.which||t.shiftKey||t.metaKey||t.ctrlKey||t.altKey)){var i=n.getAttribute("href")||"";if(0===i.indexOf("#"))if("#"===i)t.preventDefault(),e.toY(0),o("");else{var r=n.hash.substring(1),c=document.getElementById(r);c&&(t.preventDefault(),e.to(c),o("#"+r))}}},!1)}return{createScroller:t,setup:e.setup,to:e.to,toY:e.toY,intoView:e.intoView,center:e.center,stop:e.stop,moving:e.moving}});