(function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K=[].slice,Q={}.hasOwnProperty,G=function(e,t){function r(){this.constructor=e}for(var n in t){if(Q.call(t,n))e[n]=t[n]}r.prototype=t.prototype;e.prototype=new r;e.__super__=t.prototype;return e},Y=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1};w={catchupTime:100,initialRate:.03,minTime:250,ghostTime:100,maxProgressPerFrame:20,easeFactor:1.25,startOnPageLoad:true,restartOnPushState:true,restartOnRequestAfter:500,target:"body","class":"pace-effect-1",elements:{checkInterval:100,selectors:["body"]},eventLag:{minSamples:10,sampleCount:3,lagThreshold:3},ajax:{trackMethods:["GET"],trackWebSockets:true,ignoreURLs:[]}};L=function(){var e;return(e=typeof performance!=="undefined"&&performance!==null?typeof performance.now==="function"?performance.now():void 0:void 0)!=null?e:+(new Date)};O=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;b=window.cancelAnimationFrame||window.mozCancelAnimationFrame;if(O==null){O=function(e){return setTimeout(e,50)};b=function(e){return clearTimeout(e)}}_=function(e){var t,n;t=L();n=function(){var r;r=L()-t;if(r>=33){t=L();return e(r,function(){return O(n)})}else{return setTimeout(n,33-r)}};return n()};M=function(){var e,t,n;n=arguments[0],t=arguments[1],e=3<=arguments.length?K.call(arguments,2):[];if(typeof n[t]==="function"){return n[t].apply(n,e)}else{return n[t]}};E=function(){var e,t,n,r,i,s,o;t=arguments[0],r=2<=arguments.length?K.call(arguments,1):[];for(s=0,o=r.length;s<o;s++){n=r[s];if(n){for(e in n){if(!Q.call(n,e))continue;i=n[e];if(t[e]!=null&&typeof t[e]==="object"&&i!=null&&typeof i==="object"){E(t[e],i)}else{t[e]=i}}}}return t};m=function(e){var t,n,r,i,s;n=t=0;for(i=0,s=e.length;i<s;i++){r=e[i];n+=Math.abs(r);t++}return n/t};x=function(e,t){var n,r,i;if(e==null){e="options"}if(t==null){t=true}i=document.querySelector("[data-pace-"+e+"]");if(!i){return}n=i.getAttribute("data-pace-"+e);if(!t){return n}try{return JSON.parse(n)}catch(s){r=s;return typeof console!=="undefined"&&console!==null?console.error("Error parsing inline pace options",r):void 0}};o=function(){function e(){}e.prototype.on=function(e,t,n,r){var i;if(r==null){r=false}if(this.bindings==null){this.bindings={}}if((i=this.bindings)[e]==null){i[e]=[]}return this.bindings[e].push({handler:t,ctx:n,once:r})};e.prototype.once=function(e,t,n){return this.on(e,t,n,true)};e.prototype.off=function(e,t){var n,r,i;if(((r=this.bindings)!=null?r[e]:void 0)==null){return}if(t==null){return delete this.bindings[e]}else{n=0;i=[];while(n<this.bindings[e].length){if(this.bindings[e][n].handler===t){i.push(this.bindings[e].splice(n,1))}else{i.push(n++)}}return i}};e.prototype.trigger=function(){var e,t,n,r,i,s,o,u,a;n=arguments[0],e=2<=arguments.length?K.call(arguments,1):[];if((o=this.bindings)!=null?o[n]:void 0){i=0;a=[];while(i<this.bindings[n].length){u=this.bindings[n][i],r=u.handler,t=u.ctx,s=u.once;r.apply(t!=null?t:this,e);if(s){a.push(this.bindings[n].splice(i,1))}else{a.push(i++)}}return a}};return e}();f=window.Pace||{};window.Pace=f;E(f,o.prototype);A=f.options=E({},w,window.paceOptions,x());V=["ajax","document","eventLag","elements"];for(U=0,W=V.length;U<W;U++){B=V[U];if(A[B]===true){A[B]=w[B]}}a=function(e){function t(){$=t.__super__.constructor.apply(this,arguments);return $}G(t,e);return t}(Error);t=function(){function e(){this.progress=0}e.prototype.getElement=function(){var e;if(this.el==null){e=document.querySelector(A.target);targetClass=A.class;if(!e){throw new a}this.el=document.createElement("div");this.el.className=targetClass+" pace pace-active";document.body.className=document.body.className.replace(/pace-done/g,"");document.body.className+=" pace-running";this.el.innerHTML='<div class="pace-progress">\n  <div class="pace-progress-inner"></div>\n</div>\n<div class="pace-activity"></div>';if(e.firstChild!=null){e.insertBefore(this.el,e.firstChild)}else{e.appendChild(this.el)}}return this.el};e.prototype.finish=function(){var e;e=this.getElement();e.className=e.className.replace("pace-active","");e.className+=" pace-inactive";document.body.className=document.body.className.replace("pace-running","");return document.body.className+=" pace-done"};e.prototype.update=function(e){this.progress=e;return this.render()};e.prototype.destroy=function(){try{this.getElement().parentNode.removeChild(this.getElement())}catch(e){a=e}return this.el=void 0};e.prototype.render=function(){var e,t,n,r,i,s,o;if(document.querySelector(A.target)==null){return false}e=this.getElement();r="translate3d("+this.progress+"%, 0, 0)";o=["webkitTransform","msTransform","transform"];for(i=0,s=o.length;i<s;i++){t=o[i];e.children[0].style[t]=r}if(!this.lastRenderedProgress||this.lastRenderedProgress|0!==this.progress|0){e.children[0].setAttribute("data-progress-text",""+(this.progress|0)+"%");if(this.progress>=100){n="99"}else{n=this.progress<10?"0":"";n+=this.progress|0}e.children[0].setAttribute("data-progress",""+n)}return this.lastRenderedProgress=this.progress};e.prototype.done=function(){return this.progress>=100};return e}();u=function(){function e(){this.bindings={}}e.prototype.trigger=function(e,t){var n,r,i,s,o;if(this.bindings[e]!=null){s=this.bindings[e];o=[];for(r=0,i=s.length;r<i;r++){n=s[r];o.push(n.call(this,t))}return o}};e.prototype.on=function(e,t){var n;if((n=this.bindings)[e]==null){n[e]=[]}return this.bindings[e].push(t)};return e}();R=window.XMLHttpRequest;q=window.XDomainRequest;I=window.WebSocket;S=function(e,t){var n,r,i;i=[];for(r in t.prototype){try{if(e[r]==null&&typeof t[r]!=="function"){if(typeof Object.defineProperty==="function"){i.push(Object.defineProperty(e,r,{get:function(){return t.prototype[r]},configurable:true,enumerable:true}))}else{i.push(e[r]=t.prototype[r])}}else{i.push(void 0)}}catch(s){n=s}}return i};C=[];f.ignore=function(){var e,t,n;t=arguments[0],e=2<=arguments.length?K.call(arguments,1):[];C.unshift("ignore");n=t.apply(null,e);C.shift();return n};f.track=function(){var e,t,n;t=arguments[0],e=2<=arguments.length?K.call(arguments,1):[];C.unshift("track");n=t.apply(null,e);C.shift();return n};H=function(e){var t;if(e==null){e="GET"}if(C[0]==="track"){return"force"}if(!C.length&&A.ajax){if(e==="socket"&&A.ajax.trackWebSockets){return true}else if(t=e.toUpperCase(),Y.call(A.ajax.trackMethods,t)>=0){return true}}return false};l=function(e){function t(){var e,n=this;t.__super__.constructor.apply(this,arguments);e=function(e){var t;t=e.open;return e.open=function(r,i,s){if(H(r)){n.trigger("request",{type:r,url:i,request:e})}return t.apply(e,arguments)}};window.XMLHttpRequest=function(t){var n;n=new R(t);e(n);return n};try{S(window.XMLHttpRequest,R)}catch(r){}if(q!=null){window.XDomainRequest=function(){var t;t=new q;e(t);return t};try{S(window.XDomainRequest,q)}catch(r){}}if(I!=null&&A.ajax.trackWebSockets){window.WebSocket=function(e,t){var r;if(t!=null){r=new I(e,t)}else{r=new I(e)}if(H("socket")){n.trigger("request",{type:"socket",url:e,protocols:t,request:r})}return r};try{S(window.WebSocket,I)}catch(r){}}}G(t,e);return t}(u);z=null;T=function(){if(z==null){z=new l}return z};P=function(e){var t,n,r,i;i=A.ajax.ignoreURLs;for(n=0,r=i.length;n<r;n++){t=i[n];if(typeof t==="string"){if(e.indexOf(t)!==-1){return true}}else{if(t.test(e)){return true}}}return false};T().on("request",function(t){var n,r,i,s,o;s=t.type,i=t.request,o=t.url;if(P(o)){return}if(!f.running&&(A.restartOnRequestAfter!==false||H(s)==="force")){r=arguments;n=A.restartOnRequestAfter||0;if(typeof n==="boolean"){n=0}return setTimeout(function(){var t,n,o,u,a,l;if(s==="socket"){t=i.readyState<2}else{t=0<(u=i.readyState)&&u<4}if(t){f.restart();a=f.sources;l=[];for(n=0,o=a.length;n<o;n++){B=a[n];if(B instanceof e){B.watch.apply(B,r);break}else{l.push(void 0)}}return l}},n)}});e=function(){function e(){var e=this;this.elements=[];T().on("request",function(){return e.watch.apply(e,arguments)})}e.prototype.watch=function(e){var t,n,r,i;r=e.type,t=e.request,i=e.url;if(P(i)){return}if(r==="socket"){n=new p(t)}else{n=new d(t)}return this.elements.push(n)};return e}();d=function(){function e(e){var t,n,r,i,s,o,u=this;this.progress=0;if(window.ProgressEvent!=null){n=null;e.addEventListener("progress",function(e){if(e.lengthComputable){return u.progress=100*e.loaded/e.total}else{return u.progress=u.progress+(100-u.progress)/2}},false);o=["load","abort","timeout","error"];for(r=0,i=o.length;r<i;r++){t=o[r];e.addEventListener(t,function(){return u.progress=100},false)}}else{s=e.onreadystatechange;e.onreadystatechange=function(){var t;if((t=e.readyState)===0||t===4){u.progress=100}else if(e.readyState===3){u.progress=50}return typeof s==="function"?s.apply(null,arguments):void 0}}}return e}();p=function(){function e(e){var t,n,r,i,s=this;this.progress=0;i=["error","open"];for(n=0,r=i.length;n<r;n++){t=i[n];e.addEventListener(t,function(){return s.progress=100},false)}}return e}();r=function(){function e(e){var t,n,r,s;if(e==null){e={}}this.elements=[];if(e.selectors==null){e.selectors=[]}s=e.selectors;for(n=0,r=s.length;n<r;n++){t=s[n];this.elements.push(new i(t))}}return e}();i=function(){function e(e){this.selector=e;this.progress=0;this.check()}e.prototype.check=function(){var e=this;if(document.querySelector(this.selector)){return this.done()}else{return setTimeout(function(){return e.check()},A.elements.checkInterval)}};e.prototype.done=function(){return this.progress=100};return e}();n=function(){function e(){var e,t,n=this;this.progress=(t=this.states[document.readyState])!=null?t:100;e=document.onreadystatechange;document.onreadystatechange=function(){if(n.states[document.readyState]!=null){n.progress=n.states[document.readyState]}return typeof e==="function"?e.apply(null,arguments):void 0}}e.prototype.states={loading:0,interactive:50,complete:100};return e}();s=function(){function e(){var e,t,n,r,i,s=this;this.progress=0;e=0;i=[];r=0;n=L();t=setInterval(function(){var o;o=L()-n-50;n=L();i.push(o);if(i.length>A.eventLag.sampleCount){i.shift()}e=m(i);if(++r>=A.eventLag.minSamples&&e<A.eventLag.lagThreshold){s.progress=100;return clearInterval(t)}else{return s.progress=100*(3/(e+3))}},50)}return e}();h=function(){function e(e){this.source=e;this.last=this.sinceLastUpdate=0;this.rate=A.initialRate;this.catchup=0;this.progress=this.lastProgress=0;if(this.source!=null){this.progress=M(this.source,"progress")}}e.prototype.tick=function(e,t){var n;if(t==null){t=M(this.source,"progress")}if(t>=100){this.done=true}if(t===this.last){this.sinceLastUpdate+=e}else{if(this.sinceLastUpdate){this.rate=(t-this.last)/this.sinceLastUpdate}this.catchup=(t-this.progress)/A.catchupTime;this.sinceLastUpdate=0;this.last=t}if(t>this.progress){this.progress+=this.catchup*e}n=1-Math.pow(this.progress/100,A.easeFactor);this.progress+=n*this.rate*e;this.progress=Math.min(this.lastProgress+A.maxProgressPerFrame,this.progress);this.progress=Math.max(0,this.progress);this.progress=Math.min(100,this.progress);this.lastProgress=this.progress;return this.progress};return e}();j=null;D=null;g=null;F=null;v=null;y=null;f.running=false;N=function(){if(A.restartOnPushState){return f.restart()}};if(window.history.pushState!=null){X=window.history.pushState;window.history.pushState=function(){N();return X.apply(window.history,arguments)}}if(window.history.replaceState!=null){J=window.history.replaceState;window.history.replaceState=function(){N();return J.apply(window.history,arguments)}}c={ajax:e,elements:r,document:n,eventLag:s};(k=function(){var e,n,r,i,s,o,u,a;f.sources=j=[];o=["ajax","elements","document","eventLag"];for(n=0,i=o.length;n<i;n++){e=o[n];if(A[e]!==false){j.push(new c[e](A[e]))}}a=(u=A.extraSources)!=null?u:[];for(r=0,s=a.length;r<s;r++){B=a[r];j.push(new B(A))}f.bar=g=new t;D=[];return F=new h})();f.stop=function(){f.trigger("stop");f.running=false;g.destroy();y=true;if(v!=null){if(typeof b==="function"){b(v)}v=null}return k()};f.restart=function(){f.trigger("restart");f.stop();return f.start()};f.go=function(){var e;f.running=true;g.render();e=L();y=false;return v=_(function(t,n){var r,i,s,o,u,a,l,c,p,d,v,m,b,w,E,S;c=100-g.progress;i=v=0;s=true;for(a=m=0,w=j.length;m<w;a=++m){B=j[a];d=D[a]!=null?D[a]:D[a]=[];u=(S=B.elements)!=null?S:[B];for(l=b=0,E=u.length;b<E;l=++b){o=u[l];p=d[l]!=null?d[l]:d[l]=new h(o);s&=p.done;if(p.done){continue}i++;v+=p.tick(t)}}r=v/i;g.update(F.tick(t,r));if(g.done()||s||y){g.update(100);f.trigger("done");return setTimeout(function(){g.finish();f.running=false;return f.trigger("hide")},Math.max(A.ghostTime,Math.max(A.minTime-(L()-e),0)))}else{return n()}})};f.start=function(e){E(A,e);f.running=true;try{g.render()}catch(t){a=t}if(!document.querySelector(".pace")){return setTimeout(f.start,50)}else{f.trigger("start");return f.go()}};if(typeof define==="function"&&define.amd){define(["pace"],function(){return f})}else if(typeof exports==="object"){module.exports=f}else{if(A.startOnPageLoad){f.start()}}}).call(this)