(function(){var t,e,n,i,o,r,s,a,u,l,d,h,p,c,m,f,g,v,w,M,y,b,T,E,x,S,D,L,F,A,C,H,O=[].slice;g='<span class="odometer-value"></span>',c='<span class="odometer-ribbon"><span class="odometer-ribbon-inner">'+g+"</span></span>",i='<span class="odometer-digit"><span class="odometer-digit-spacer">8</span><span class="odometer-digit-inner">'+c+"</span></span>",s='<span class="odometer-formatting-mark"></span>',n="(,ddd).dd",a=/^\(?([^)]*)\)?(?:(.)(d+))?$/,u=30,r=2e3,t=20,l=2,o=.5,d=1e3/u,e=1e3/t,m="transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",x=document.createElement("div").style,f=null!=x.transition||null!=x.webkitTransition||null!=x.mozTransition||null!=x.oTransition,T=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame,h=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,w=function(t){var e;return e=document.createElement("div"),e.innerHTML=t,e.children[0]},b=function(t,e){return t.className=t.className.replace(new RegExp("(^|)"+e.split(" ").join("|")+"(|$)","gi")," ")},v=function(t,e){return b(t,e),t.className+=" "+e},S=function(t,e){var n;if(null!=document.createEvent)return n=document.createEvent("HTMLEvents"),n.initEvent(e,!0,!0),t.dispatchEvent(n)},y=function(){var t,e;return null!=(t=null!=(e=window.performance)&&"function"==typeof e.now?e.now():void 0)?t:+new Date},E=function(t,e){return null==e&&(e=0),e?(t*=Math.pow(10,e),t+=.5,t=Math.floor(t),t/Math.pow(10,e)):Math.round(t)},D=function(t){return t<0?Math.ceil(t):Math.floor(t)},M=function(t){return t-E(t)},F=!1,(L=function(){var t,e,n,i,o;if(!F&&null!=window.jQuery){for(F=!0,i=["html","text"],o=[],e=0,n=i.length;e<n;e++)t=i[e],o.push(function(t){var e;return e=window.jQuery.fn[t],window.jQuery.fn[t]=function(t){var n;return null==t||null==(null!=(n=this[0])?n.odometer:void 0)?e.apply(this,arguments):this[0].odometer.update(t)}}(t));return o}})(),setTimeout(L,0),p=function(){function t(e){var n,i,o,s,a,u,h,p,c,m=this;if(this.options=e,this.el=this.options.el,null!=this.el.odometer)return this.el.odometer;for(n in this.el.odometer=this,h=t.options,h)o=h[n],null==this.options[n]&&(this.options[n]=o);null==(s=this.options).duration&&(s.duration=r),this.MAX_VALUES=this.options.duration/d/l|0,this.resetFormat(),this.value=this.cleanValue(null!=(p=this.options.value)?p:""),this.renderInside(),this.render();try{for(c=["innerHTML","innerText","textContent"],a=0,u=c.length;a<u;a++)i=c[a],null!=this.el[i]&&function(t){Object.defineProperty(m.el,t,{get:function(){var e;return"innerHTML"===t?m.inside.outerHTML:null!=(e=m.inside.innerText)?e:m.inside.textContent},set:function(t){return m.update(t)}})}(i)}catch(t){t,this.watchForMutations()}}return t.prototype.renderInside=function(){return this.inside=document.createElement("div"),this.inside.className="odometer-inside",this.el.innerHTML="",this.el.appendChild(this.inside)},t.prototype.watchForMutations=function(){var t=this;if(null!=h)try{return null==this.observer&&(this.observer=new h(function(e){var n;return n=t.el.innerText,t.renderInside(),t.render(t.value),t.update(n)})),this.watchMutations=!0,this.startWatchingMutations()}catch(t){t}},t.prototype.startWatchingMutations=function(){if(this.watchMutations)return this.observer.observe(this.el,{childList:!0})},t.prototype.stopWatchingMutations=function(){var t;return null!=(t=this.observer)?t.disconnect():void 0},t.prototype.cleanValue=function(t){var e;return"string"==typeof t&&(t=t.replace(null!=(e=this.format.radix)?e:".","<radix>"),t=t.replace(/[.,]/g,""),t=t.replace("<radix>","."),t=parseFloat(t,10)||0),E(t,this.format.precision)},t.prototype.bindTransitionEnd=function(){var t,e,n,i,o,r,s=this;if(!this.transitionEndBound){for(this.transitionEndBound=!0,e=!1,o=m.split(" "),r=[],n=0,i=o.length;n<i;n++)t=o[n],r.push(this.el.addEventListener(t,function(){return!!e||(e=!0,setTimeout(function(){return s.render(),e=!1,S(s.el,"odometerdone")},0),!0)},!1));return r}},t.prototype.resetFormat=function(){var t,e,i,o,r,s,u,l;if(t=null!=(u=this.options.format)?u:n,t||(t="d"),i=a.exec(t),!i)throw new Error("Odometer: Unparsable digit format");return l=i.slice(1,4),s=l[0],r=l[1],e=l[2],o=(null!=e?e.length:void 0)||0,this.format={repeating:s,radix:r,precision:o}},t.prototype.render=function(t){var e,n,i,o,r,s,a;for(null==t&&(t=this.value),this.stopWatchingMutations(),this.resetFormat(),this.inside.innerHTML="",r=this.options.theme,e=this.el.className.split(" "),o=[],s=0,a=e.length;s<a;s++)n=e[s],n.length&&((i=/^odometer-theme-(.+)$/.exec(n))?r=i[1]:/^odometer(-|$)/.test(n)||o.push(n));return o.push("odometer"),f||o.push("odometer-no-transitions"),r?o.push("odometer-theme-"+r):o.push("odometer-auto-theme"),this.el.className=o.join(" "),this.ribbons={},this.formatDigits(t),this.startWatchingMutations()},t.prototype.formatDigits=function(t){var e,n,i,o,r,s,a,u,l,d;if(this.digits=[],this.options.formatFunction)for(i=this.options.formatFunction(t),l=i.split("").reverse(),r=0,a=l.length;r<a;r++)n=l[r],n.match(/0-9/)?(e=this.renderDigit(),e.querySelector(".odometer-value").innerHTML=n,this.digits.push(e),this.insertDigit(e)):this.addSpacer(n);else for(o=!this.format.precision||!M(t)||!1,d=t.toString().split("").reverse(),s=0,u=d.length;s<u;s++)e=d[s],"."===e&&(o=!0),this.addDigit(e,o)},t.prototype.update=function(t){var e,n=this;if(t=this.cleanValue(t),e=t-this.value)return b(this.el,"odometer-animating-up odometer-animating-down odometer-animating"),v(this.el,e>0?"odometer-animating-up":"odometer-animating-down"),this.stopWatchingMutations(),this.animate(t),this.startWatchingMutations(),setTimeout(function(){return n.el.offsetHeight,v(n.el,"odometer-animating")},0),this.value=t},t.prototype.renderDigit=function(){return w(i)},t.prototype.insertDigit=function(t,e){return null!=e?this.inside.insertBefore(t,e):this.inside.children.length?this.inside.insertBefore(t,this.inside.children[0]):this.inside.appendChild(t)},t.prototype.addSpacer=function(t,e,n){var i;return i=w(s),i.innerHTML=t,n&&v(i,n),this.insertDigit(i,e)},t.prototype.addDigit=function(t,e){var n,i,o,r;if(null==e&&(e=!0),"-"===t)return this.addSpacer(t,null,"odometer-negation-mark");if("."===t)return this.addSpacer(null!=(r=this.format.radix)?r:".",null,"odometer-radix-mark");if(e)for(o=!1;;){if(!this.format.repeating.length){if(o)throw new Error("Bad odometer format without digits");this.resetFormat(),o=!0}if(n=this.format.repeating[this.format.repeating.length-1],this.format.repeating=this.format.repeating.substring(0,this.format.repeating.length-1),"d"===n)break;this.addSpacer(n)}return i=this.renderDigit(),i.querySelector(".odometer-value").innerHTML=t,this.digits.push(i),this.insertDigit(i)},t.prototype.animate=function(t){return f&&"count"!==this.options.animation?this.animateSlide(t):this.animateCount(t)},t.prototype.animateCount=function(t){var n,i,o,r,s,a=this;if(i=+t-this.value)return r=o=y(),n=this.value,(s=function(){var u,l,d;return y()-r>a.options.duration?(a.value=t,a.render(),void S(a.el,"odometerdone")):(u=y()-o,u>e&&(o=y(),d=u/a.options.duration,l=i*d,n+=l,a.render(Math.round(n))),null!=T?T(s):setTimeout(s,e))})()},t.prototype.getDigitCount=function(){var t,e,n,i,o,r;for(i=1<=arguments.length?O.call(arguments,0):[],t=o=0,r=i.length;o<r;t=++o)n=i[t],i[t]=Math.abs(n);return e=Math.max.apply(Math,i),Math.ceil(Math.log(e+1)/Math.log(10))},t.prototype.getFractionalDigitCount=function(){var t,e,n,i,o,r,s;for(o=1<=arguments.length?O.call(arguments,0):[],e=/^\-?\d*\.(\d*?)0*$/,t=r=0,s=o.length;r<s;t=++r)i=o[t],o[t]=i.toString(),n=e.exec(o[t]),o[t]=null==n?0:n[1].length;return Math.max.apply(Math,o)},t.prototype.resetDigits=function(){return this.digits=[],this.ribbons=[],this.inside.innerHTML="",this.resetFormat()},t.prototype.animateSlide=function(t){var e,n,i,r,s,a,u,l,d,h,p,c,m,f,g,w,M,y,b,T,E,x,S,L,F,A,C;if(w=this.value,l=this.getFractionalDigitCount(w,t),l&&(t*=Math.pow(10,l),w*=Math.pow(10,l)),i=t-w){for(this.bindTransitionEnd(),r=this.getDigitCount(w,t),s=[],e=0,p=b=0;0<=r?b<r:b>r;p=0<=r?++b:--b){if(M=D(w/Math.pow(10,r-p-1)),u=D(t/Math.pow(10,r-p-1)),a=u-M,Math.abs(a)>this.MAX_VALUES){for(h=[],c=a/(this.MAX_VALUES+this.MAX_VALUES*e*o),n=M;a>0&&n<u||a<0&&n>u;)h.push(Math.round(n)),n+=c;h[h.length-1]!==u&&h.push(u),e++}else h=function(){C=[];for(var t=M;M<=u?t<=u:t>=u;M<=u?t++:t--)C.push(t);return C}.apply(this);for(p=T=0,x=h.length;T<x;p=++T)d=h[p],h[p]=Math.abs(d%10);s.push(h)}for(this.resetDigits(),A=s.reverse(),p=E=0,S=A.length;E<S;p=++E)for(h=A[p],this.digits[p]||this.addDigit(" ",p>=l),null==(y=this.ribbons)[p]&&(y[p]=this.digits[p].querySelector(".odometer-ribbon-inner")),this.ribbons[p].innerHTML="",i<0&&(h=h.reverse()),m=F=0,L=h.length;F<L;m=++F)d=h[m],g=document.createElement("div"),g.className="odometer-value",g.innerHTML=d,this.ribbons[p].appendChild(g),m===h.length-1&&v(g,"odometer-last-value"),0===m&&v(g,"odometer-first-value");return M<0&&this.addDigit("-"),f=this.inside.querySelector(".odometer-radix-mark"),null!=f&&f.parent.removeChild(f),l?this.addSpacer(this.format.radix,this.digits[l-1],"odometer-radix-mark"):void 0}},t}(),p.options=null!=(C=window.odometerOptions)?C:{},setTimeout(function(){var t,e,n,i,o;if(window.odometerOptions){for(t in i=window.odometerOptions,o=[],i)e=i[t],o.push(null!=(n=p.options)[t]?(n=p.options)[t]:n[t]=e);return o}},0),p.init=function(){var t,e,n,i,o,r;if(null!=document.querySelectorAll){for(e=document.querySelectorAll(p.options.selector||".odometer"),r=[],n=0,i=e.length;n<i;n++)t=e[n],r.push(t.odometer=new p({el:t,value:null!=(o=t.innerText)?o:t.textContent}));return r}},null!=(null!=(H=document.documentElement)?H.doScroll:void 0)&&null!=document.createEventObject?(A=document.onreadystatechange,document.onreadystatechange=function(){return"complete"===document.readyState&&!1!==p.options.auto&&p.init(),null!=A?A.apply(this,arguments):void 0}):document.addEventListener("DOMContentLoaded",function(){if(!1!==p.options.auto)return p.init()},!1),"function"==typeof define&&define.amd?define([],function(){return p}):"undefined"!=typeof exports&&null!==exports?module.exports=p:window.Odometer=p}).call(this);