1 |
- (()=>{"use strict";var t=function(){return t=Object.assign||function(t){for(var n,i=1,s=arguments.length;i<s;i++)for(var a in n=arguments[i])Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a]);return t},t.apply(this,arguments)},n=function(){function n(n,i,s){var a=this;this.endVal=i,this.options=s,this.version="2.3.2",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:"",enableScrollSpy:!1,scrollSpyDelay:200,scrollSpyOnce:!1},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.once=!1,this.count=function(t){a.startTime||(a.startTime=t);var n=t-a.startTime;a.remaining=a.duration-n,a.useEasing?a.countDown?a.frameVal=a.startVal-a.easingFn(n,0,a.startVal-a.endVal,a.duration):a.frameVal=a.easingFn(n,a.startVal,a.endVal-a.startVal,a.duration):a.frameVal=a.startVal+(a.endVal-a.startVal)*(n/a.duration);var i=a.countDown?a.frameVal<a.endVal:a.frameVal>a.endVal;a.frameVal=i?a.endVal:a.frameVal,a.frameVal=Number(a.frameVal.toFixed(a.options.decimalPlaces)),a.printValue(a.frameVal),n<a.duration?a.rAF=requestAnimationFrame(a.count):null!==a.finalEndVal?a.update(a.finalEndVal):a.callback&&a.callback()},this.formatNumber=function(t){var n,i,s,e,o=t<0?"-":"";n=Math.abs(t).toFixed(a.options.decimalPlaces);var r=(n+="").split(".");if(i=r[0],s=r.length>1?a.options.decimal+r[1]:"",a.options.useGrouping){e="";for(var l=0,u=i.length;l<u;++l)0!==l&&l%3==0&&(e=a.options.separator+e),e=i[u-l-1]+e;i=e}return a.options.numerals&&a.options.numerals.length&&(i=i.replace(/[0-9]/g,(function(t){return a.options.numerals[+t]})),s=s.replace(/[0-9]/g,(function(t){return a.options.numerals[+t]}))),o+a.options.prefix+i+s+a.options.suffix},this.easeOutExpo=function(t,n,i,s){return i*(1-Math.pow(2,-10*t/s))*1024/1023+n},this.options=t(t({},this.defaults),s),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(i),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.resetDuration(),this.options.separator=String(this.options.separator),this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el="string"==typeof n?document.getElementById(n):n,this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined","undefined"!=typeof window&&this.options.enableScrollSpy&&(this.error?console.error(this.error,n):(window.onScrollFns=window.onScrollFns||[],window.onScrollFns.push((function(){return a.handleScroll(a)})),window.onscroll=function(){window.onScrollFns.forEach((function(t){return t()}))},this.handleScroll(this)))}return n.prototype.handleScroll=function(t){if(t&&window&&!t.once){var n=window.innerHeight+window.scrollY,i=t.el.getBoundingClientRect(),s=i.top+i.height+window.pageYOffset;s<n&&s>window.scrollY&&t.paused?(t.paused=!1,setTimeout((function(){return t.start()}),t.options.scrollSpyDelay),t.options.scrollSpyOnce&&(t.once=!0)):window.scrollY>s&&!t.paused&&t.reset()}},n.prototype.determineDirectionAndSmartEasing=function(){var t=this.finalEndVal?this.finalEndVal:this.endVal;this.countDown=this.startVal>t;var n=t-this.startVal;if(Math.abs(n)>this.options.smartEasingThreshold&&this.options.useEasing){this.finalEndVal=t;var i=this.countDown?1:-1;this.endVal=t+i*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;null!==this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},n.prototype.start=function(t){this.error||(this.callback=t,this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},n.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},n.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},n.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,null==this.finalEndVal&&this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},n.prototype.printValue=function(t){var n=this.formattingFn(t);"INPUT"===this.el.tagName?this.el.value=n:"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=n:this.el.innerHTML=n},n.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},n.prototype.validateValue=function(t){var n=Number(t);return this.ensureNumber(n)?n:(this.error="[CountUp] invalid start or end value: ".concat(t),null)},n.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},n}();!function(){const t={counter(){const t=document.querySelectorAll(".bsb-about-pro-1-counter");null!=t&&t.forEach((function(t){t.classList.contains("counter-initiated")||(new n(t,t.getAttribute("data-counter")).start(),t.classList.add("counter-initiated"))}))},handleIntersect(n,i){n.forEach((n=>{n.isIntersecting&&t.counter()}))},init(){const n={root:null,rootMargin:"0px",threshold:[.5]},i=document.querySelector("#bsb-about-pro-1-observer");null!=i&&new IntersectionObserver(t.handleIntersect,n).observe(i)}};"loading"===document.readyState&&document.addEventListener("DOMContentLoaded",(function(){})),window.addEventListener("load",(function(){t.init()}),!1)}()})();
|