!function(){"use strict";angular.module("angular-loading-bar",["cfp.loadingBarInterceptor"]),angular.module("chieffancypants.loadingBar",["cfp.loadingBarInterceptor"]),angular.module("cfp.loadingBarInterceptor",["cfp.loadingBar"]).config(["$httpProvider",function(n){var t=["$q","$cacheFactory","$timeout","$rootScope","$log","cfpLoadingBar",function(t,i,r,u,f,e){function c(){r.cancel(l),e.complete(),s=0,o=0}function h(t){var u,e=i.get("$http"),f=n.defaults,r;return(t.cache||f.cache)&&t.cache!==!1&&("GET"===t.method||"JSONP"===t.method)&&(u=angular.isObject(t.cache)?t.cache:angular.isObject(f.cache)?f.cache:e),r=void 0!==u?void 0!==u.get(t.url):!1,void 0!==t.cached&&r!==t.cached?t.cached:(t.cached=r,r)}var l,o=0,s=0,a=e.latencyThreshold;return{request:function(n){return n.ignoreLoadingBar||h(n)||(u.$broadcast("cfpLoadingBar:loading",{url:n.url}),0===o&&(l=r(function(){e.start()},a)),o++,e.set(s/o)),n},response:function(n){return n&&n.config?(n.config.ignoreLoadingBar||h(n.config)||(s++,s>=o?(u.$broadcast("cfpLoadingBar:loaded",{url:n.config.url,result:n}),c()):e.set(s/o)),n):(f.error("Broken interceptor detected: Config object not supplied in response:\n https://github.com/chieffancypants/angular-loading-bar/pull/50"),n)},responseError:function(n){return n&&n.config?(n.config.ignoreLoadingBar||h(n.config)||(s++,s>=o?(u.$broadcast("cfpLoadingBar:loaded",{url:n.config.url,result:n}),c()):e.set(s/o)),t.reject(n)):(f.error("Broken interceptor detected: Config object not supplied in rejection:\n https://github.com/chieffancypants/angular-loading-bar/pull/50"),t.reject(n))}}}];n.interceptors.push(t)}]),angular.module("cfp.loadingBar",[]).provider("cfpLoadingBar",function(){this.autoIncrement=!0,this.includeSpinner=!0,this.includeBar=!0,this.latencyThreshold=100,this.startSize=.02,this.parentSelector="body",this.spinnerTemplate='<div id="loading-bar-spinner"><div class="spinner-icon"><\/div><\/div>',this.loadingBarTemplate='<div id="loading-bar"><div class="bar"><div class="peg"><\/div><\/div><\/div>',this.$get=["$injector","$document","$timeout","$rootScope",function(n,t,i,r){function w(){var c,e,l,a;(u||(u=n.get("$animate")),i.cancel(h),s)||(c=t[0],e=c.querySelector?c.querySelector(y):t.find(y)[0],e||(e=c.getElementsByTagName("body")[0]),l=angular.element(e),a=e.lastChild&&angular.element(e.lastChild),r.$broadcast("cfpLoadingBar:started"),s=!0,nt&&u.enter(o,l,a),g&&u.enter(p,l,o),f(tt))}function f(n){if(s){var t=100*n+"%";k.css("width",t),c=n,d&&(i.cancel(v),v=i(function(){l()},250))}}function l(){var t,n,i;e()>=1||(t=0,n=e(),t=n>=0&&.25>n?(3*Math.random()+3)/100:n>=.25&&.65>n?3*Math.random()/100:n>=.65&&.9>n?Math.random()/50:n>=.9&&.99>n?.005:0,i=e()+t,f(i))}function e(){return c}function a(){c=0,s=!1}function b(){u||(u=n.get("$animate")),f(1),i.cancel(h),h=i(function(){var n=u.leave(o,a);n&&n.then&&n.then(a),u.leave(p),r.$broadcast("cfpLoadingBar:completed")},500)}var u,v,h,y=this.parentSelector,o=angular.element(this.loadingBarTemplate),k=o.find("div").eq(0),p=angular.element(this.spinnerTemplate),s=!1,c=0,d=this.autoIncrement,g=this.includeSpinner,nt=this.includeBar,tt=this.startSize;return{start:w,set:f,status:e,inc:l,complete:b,autoIncrement:this.autoIncrement,includeSpinner:this.includeSpinner,latencyThreshold:this.latencyThreshold,parentSelector:this.parentSelector,startSize:this.startSize}}]})}()