text: !function(n){"use strict";function t(){var n,t=document.createElement("fakeelement"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",MSTransition:"msTransitionEnd",OTransition:"otransitionend",transition:"transitionend"};for(n in i)if(i.hasOwnProperty(n)&&void 0!==t.style[n])return i[n]}function i(n){for(var t=n.target;t.parentNode;){if(t.href)return t;t=t.parentNode}}function o(n){return n.href.replace(window.location.origin,"")}function e(n,t,i,o,e){return(t/=e/2)<1?o/2*t*t+i:-o/2*(--t*(t-2)-1)+i}function s(n){return this.defaults={shouldScroll:n.shouldScroll||!0,scrollTiming:n.scrollTiming||"before",scrollDuration:n.scrollDuration||200},this.settings={animateLinksToSelf:n.animateLinksToSelf||!1},this.cb={computeScrollOffset:n.computeScrollOffset||function(){return 0},shouldAnimate:n.shouldAnimate||function(){return!0},beforeAnimationStart:n.beforeAnimationStart||function(){},onTransitionEnd:n.onTransitionEnd||function(){}},this.animations={},this.body=document.getElementsByTagName("body")[0],this.transitionEndEvent=t(),this.links=document.getElementsByTagName("a"),this.currentAnimation=null,this.boundOnTransitionEnd=this._onTransitionEnd.bind(this),this.boundOnClick=this._onClick.bind(this),0===this.links.length&&console.error("No links found in page."),this}s.prototype.register=function(n,t,i,o){var e=o||{},s={anchor:null,bodyClass:" "+i+" ",finalElement:document.getElementById(t),path:null,regex:new RegExp(n),shouldScroll:e.shouldScroll||this.defaults.shouldScroll,scrollTiming:e.scrollTiming||this.defaults.scrollTiming,scrollDuration:e.scrollDuration||this.defaults.scrollDuration};return s.finalElement||console.error("No element with ID "+t),this.animations[n]=s,this},s.prototype.deregister=function(n){return this.animations[n]||console.error("No animation registered with regex "+n),delete this.animations[n],this},s.prototype.enable=function(){for(var n=0;n<this.links.length;n++)this.links[n].addEventListener("click",this.boundOnClick)},s.prototype.disable=function(){for(var n=0;n<this.links.length;n++)this.links[n].removeEventListener("click",this.boundOnClick)},s.scrollTo=function(n,t,i){function o(){setTimeout(function(){1>h?(s=Date.now()-a,h=s/t,r=e(h,s,0,1,t),l=r*u+c,window.scrollTo(0,l),requestAnimationFrame(o)):(window.scrollTo(0,n),i())},15)}i=i||function(){};var s,r,l,a=Date.now(),c=window.scrollY,u=n-c,h=0;o()},s.prototype._onTransitionEnd=function(n){if(this.currentAnimation){var t=this.currentAnimation,i=function(){setTimeout(function(){this.body.className=this.body.className.replace(t.bodyClass,""),t.finalElement.removeEventListener(this.transitionEndEvent,this.boundOnTransitionEnd),this.currentAnimation=null}.bind(this),100),window.location.pathname===t.path?window.location.reload():window.location=t.path}.bind(this);t.shouldScroll&&"after"===t.scrollTiming?s.scrollTo(this.cb.computeScrollOffset(t),t.scrollDuration,i):i()}},s.prototype._animate=function(n){this.cb.beforeAnimationStart(n),n.finalElement.addEventListener(this.transitionEndEvent,this.boundOnTransitionEnd),this.currentAnimation=n;var t=function(){this.body.className+=n.bodyClass}.bind(this);n.shouldScroll&&"before"===n.scrollTiming?s.scrollTo(this.cb.computeScrollOffset(n),n.scrollDuration,t):n.shouldScroll&&"during"===n.scrollTiming?(setTimeout(t,0),s.scrollTo(this.cb.computeScrollOffset(n),n.scrollDuration)):t()},s.prototype._onClick=function(n){var t=i(n),e=o(t);if(!this.currentAnimation&&this.cb.shouldAnimate(t,e)&&(this.settings.animateLinksToSelf||this.path!==window.location.pathname))for(var s in this.animations)if(this.animations.hasOwnProperty(s)&&this.animations[s].regex.test(e)){n.preventDefault();var r=this.animations[s];return r.anchor=t,r.path=e,void this._animate(r)}},"function"==typeof define&&define.amd?define(s):"undefined"!=typeof module&&module.exports?module.exports=s:n.Pangea=s}(this);