window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;0<=--t&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}"function"!=typeof window.CustomEvent&&(e.prototype=window.Event.prototype,window.CustomEvent=e)}(),function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;ny.durationMax?y.durationMax:y.durationMin&&v=q)return d.cancelScroll(!0),c=n,s=f,0===(a=o)&&document.body.focus(),s||(a.focus(),document.activeElement!==a&&(a.setAttribute("tabindex","-1"),a.focus(),a.style.outline="none"),e.scrollTo(0,c)),r("scrollStop",u,o,i),!(m=w=null)}(E,C)||(m=e.requestAnimationFrame(L),w=t)};0===e.pageYOffset&&e.scrollTo(0,0),b=o,A=u,f||history.pushState&&A.updateURL&&history.pushState({smoothScroll:JSON.stringify(A),anchor:b.id},document.title,b===document.documentElement?"#top":"#"+b.id),"matchMedia"in e&&e.matchMedia("(prefers-reduced-motion)").matches?e.scrollTo(0,Math.floor(C)):(r("scrollStart",u,o,i),d.cancelScroll(!0),e.requestAnimationFrame(L))}};var f=function(t){if(!t.defaultPrevented&&!(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey)&&"closest"in t.target&&(u=t.target.closest(i))&&"a"===u.tagName.toLowerCase()&&!t.target.closest(s.ignore)&&u.hostname===e.location.hostname&&u.pathname===e.location.pathname&&/#/.test(u.href)){var n,a;try{n=o(decodeURIComponent(u.hash))}catch(t){n=o(u.hash)}if(console.log(n),"#"===n){if(!s.topOnEmptyHash)return;a=document.documentElement}else a=document.querySelector(n);(a=a||"#top"!==n?a:document.documentElement)&&(t.preventDefault(),function(t){if(history.replaceState&&t.updateURL&&!history.state){var n=e.location.hash;n=n||"",history.replaceState({smoothScroll:JSON.stringify(t),anchor:n||e.pageYOffset},document.title,n||e.location.href)}}(s),d.animateScroll(a,u))}},h=function(e){if(null!==history.state&&history.state.smoothScroll&&history.state.smoothScroll===JSON.stringify(s)){var t=history.state.anchor;"string"==typeof t&&t&&!(t=document.querySelector(o(history.state.anchor)))||d.animateScroll(t,null,{updateURL:!1})}};return d.destroy=function(){s&&(document.removeEventListener("click",f,!1),e.removeEventListener("popstate",h,!1),d.cancelScroll(),m=l=u=s=null)},function(){if(!("querySelector"in document&&"addEventListener"in e&&"requestAnimationFrame"in e&&"closest"in e.Element.prototype))throw"Smooth Scroll: This browser does not support the required JavaScript methods and browser APIs.";d.destroy(),s=n(t,c||{}),l=s.header?document.querySelector(s.header):null,document.addEventListener("click",f,!1),s.updateURL&&s.popstate&&e.addEventListener("popstate",h,!1)}(),d}});