PageSourceSearch

https://www.axinter.com/wp-content/themes/axel-johnson-internation…/dist/vendor/countUp.umd.js?ver=1788193046

js axinter.com collected 2026-10-07 11:51:19 UTC 12,693 bytes, 293 lines download raw bytes

vendor: 6,095 bytes, lines 1-130
1(function (global, factory) {
2    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3    typeof define === 'function' && define.amd ? define(['exports'], factory) :
4    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.countUp = {}));
5})(this, (function (exports) { 'use strict';
6
7    var __assign = (undefined && undefined.__assign) || function () {
8        __assign = Object.assign || function(t) {
9            for (var s, i = 1, n = arguments.length; i < n; i++) {
10                s = arguments[i];
11                for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
12                    t[p] = s[p];
13            }
14            return t;
15        };
16        return __assign.apply(this, arguments);
17    };
18    // playground: stackblitz.com/edit/countup-typescript
19    var CountUp = /** @class */ (function () {
20        function CountUp(target, endVal, options) {
21            var _this = this;
22            this.endVal = endVal;
23            this.options = options;
24            this.version = '2.3.2';
25            this.defaults = {
26                startVal: 0,
27                decimalPlaces: 0,
28                duration: 2,
29                useEasing: true,
30                useGrouping: true,
31                smartEasingThreshold: 999,
32                smartEasingAmount: 333,
33                separator: ',',
34                decimal: '.',
35                prefix: '',
36                suffix: '',
37                enableScrollSpy: false,
38                scrollSpyDelay: 200,
39                scrollSpyOnce: false,
40            };
41            this.finalEndVal = null; // for smart easing
42            this.useEasing = true;
43            this.countDown = false;
44            this.error = '';
45            this.startVal = 0;
46            this.paused = true;
47            this.once = false;
48            this.count = function (timestamp) {
49                if (!_this.startTime) {
50                    _this.startTime = timestamp;
51                }
52                var progress = timestamp - _this.startTime;
53                _this.remaining = _this.duration - progress;
54                // to ease or not to ease
55                if (_this.useEasing) {
56                    if (_this.countDown) {
57                        _this.frameVal = _this.startVal - _this.easingFn(progress, 0, _this.startVal - _this.endVal, _this.duration);
58                    }
59                    else {
60                        _this.frameVal = _this.easingFn(progress, _this.startVal, _this.endVal - _this.startVal, _this.duration);
61                    }
62                }
63                else {
64                    _this.frameVal = _this.startVal + (_this.endVal - _this.startVal) * (progress / _this.duration);
65                }
66                // don't go past endVal since progress can exceed duration in the last frame
67                var wentPast = _this.countDown ? _this.frameVal < _this.endVal : _this.frameVal > _this.endVal;
68                _this.frameVal = wentPast ? _this.endVal : _this.frameVal;
69                // decimal
70                _this.frameVal = Number(_this.frameVal.toFixed(_this.options.decimalPlaces));
71                // format and print value
72                _this.printValue(_this.frameVal);
73                // whether to continue
74                if (progress < _this.duration) {
75                    _this.rAF = requestAnimationFrame(_this.count);
76                }
77                else if (_this.finalEndVal !== null) {
78                    // smart easing
79                    _this.update(_this.finalEndVal);
80                }
81                else {
82                    if (_this.callback) {
83                        _this.callback();
84                    }
85                }
86            };
87            // default format and easing functions
88            this.formatNumber = function (num) {
89                var neg = (num < 0) ? '-' : '';
90                var result, x1, x2, x3;
91                result = Math.abs(num).toFixed(_this.options.decimalPlaces);
92                result += '';
93                var x = result.split('.');
94                x1 = x[0];
95                x2 = x.length > 1 ? _this.options.decimal + x[1] : '';
96                if (_this.options.useGrouping) {
97                    x3 = '';
98                    for (var i = 0, len = x1.length; i < len; ++i) {
99                        if (i !== 0 && (i % 3) === 0) {
100                            x3 = _this.options.separator + x3;
101                        }
102                        x3 = x1[len - i - 1] + x3;
103                    }
104                    x1 = x3;
105                }
106                // optional numeral substitution
107                if (_this.options.numerals && _this.options.numerals.length) {
108                    x1 = x1.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
109                    x2 = x2.replace(/[0-9]/g, function (w) { return _this.options.numerals[+w]; });
110                }
111                return neg + _this.options.prefix + x1 + x2 + _this.options.suffix;
112            };
113            // t: current time, b: beginning value, c: change in value, d: duration
114            this.easeOutExpo = function (t, b, c, d) {
115                return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
116            };
117            this.options = __assign(__assign({}, this.defaults), options);
118            this.formattingFn = (this.options.formattingFn) ?
119                this.options.formattingFn : this.formatNumber;
120            this.easingFn = (this.options.easingFn) ?
121                this.options.easingFn : this.easeOutExpo;
122            this.startVal = this.validateValue(this.options.startVal);
123            this.frameVal = this.startVal;
124            this.endVal = this.validateValue(endVal);
125            this.options.decimalPlaces = Math.max(this.options.decimalPlaces);
126            this.resetDuration();
127            this.options.separator = String(this.options.separator);
128            this.useEasing = this.options.useEasing;
129            if (this.options.separator === '') {
130                this.options.useGrouping = false;
131            }
132            this.el = (typeof target === 'string') ? document.getElementById(target) : target;
133            if (this.el) {
134                this.printValue(this.startVal);
135            }
136            else {
137                this.error = '[CountUp] target is null or undefined';
138            }
139            // scroll spy
140            if (typeof window !== 'undefined' && this.options.enableScrollSpy) {
141                if (!this.error) {
142                    // set up global array of onscroll functions to handle multiple instances
143                    window['onScrollFns'] = window['onScrollFns'] || [];
144                    window['onScrollFns'].push(function () { return _this.handleScroll(_this); });
145                    window.onscroll = function () {
146                        window['onScrollFns'].forEach(function (fn) { return fn(); });
147                    };
148                    this.handleScroll(this);
149                }
150                else {
151                    console.error(this.error, target);
152                }
153            }
154        }
155        CountUp.prototype.handleScroll = function (self) {
156            if (!self || !window || self.once)
157                return;
158            var bottomOfScroll = window.innerHeight + window.scrollY;
159            var rect = self.el.getBoundingClientRect();
160            var bottomOfEl = rect.top + rect.height + window.pageYOffset;
161            if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
162                // in view
163                self.paused = false;
164                setTimeout(function () { return self.start(); }, self.options.scrollSpyDelay);
165                if (self.options.scrollSpyOnce)
166                    self.once = true;
167            }
168            else if (window.scrollY > bottomOfEl && !self.paused) {
169                // scrolled past
170                self.reset();
171            }
172        };
173        /**
174         * Smart easing works by breaking the animation into 2 parts, the second part being the
175         * smartEasingAmount and first part being the total amount minus the smartEasingAmount. It works
176         * by disabling easing for the first part and enabling it on the second part. It is used if
177         * usingEasing is true and the total animation amount exceeds the smartEasingThreshold.
178         */
179        CountUp.prototype.determineDirectionAndSmartEasing = function () {
180            var end = (this.finalEndVal) ? this.finalEndVal : this.endVal;
181            this.countDown = (this.startVal > end);
182            var animateAmount = end - this.startVal;
183            if (Math.abs(animateAmount) > this.options.smartEasingThreshold && this.options.useEasing) {
184                this.finalEndVal = end;
185                var up = (this.countDown) ? 1 : -1;
186                this.endVal = end + (up * this.options.smartEasingAmount);
187                this.duration = this.duration / 2;
188            }
189            else {
190                this.endVal = end;
191                this.finalEndVal = null;
192            }
193            if (this.finalEndVal !== null) {
194                // setting finalEndVal indicates smart easing
195                this.useEasing = false;
196            }
197            else {
198                this.useEasing = this.options.useEasing;
199            }
200        };
201        // start animation
202        CountUp.prototype.start = function (callback) {
203            if (this.error) {
204                return;
205            }
206            this.callback = callback;
207            if (this.duration > 0) {
208                this.determineDirectionAndSmartEasing();
209                this.paused = false;
210                this.rAF = requestAnimationFrame(this.count);
211            }
212            else {
213                this.printValue(this.endVal);
214            }
215        };
216        // pause/resume animation
217        CountUp.prototype.pauseResume = function () {
218            if (!this.paused) {
219                cancelAnimationFrame(this.rAF);
220            }
221            else {
222                this.startTime = null;
223                this.duration = this.remaining;
224                this.startVal = this.frameVal;
225                this.determineDirectionAndSmartEasing();
226                this.rAF = requestAnimationFrame(this.count);
227            }
228            this.paused = !this.paused;
229        };
230        // reset to startVal so animation can be run again
231        CountUp.prototype.reset = function () {
232            cancelAnimationFrame(this.rAF);
233            this.paused = true;
234            this.resetDuration();
235            this.startVal = this.validateValue(this.options.startVal);
236            this.frameVal = this.startVal;
237            this.printValue(this.startVal);
238        };
239        // pass a new endVal and start animation
240        CountUp.prototype.update = function (newEndVal) {
241            cancelAnimationFrame(this.rAF);
242            this.startTime = null;
243            this.endVal = this.validateValue(newEndVal);
244            if (this.endVal === this.frameVal) {
245                return;
246            }
247            this.startVal = this.frameVal;
248            if (this.finalEndVal == null) {
249                this.resetDuration();
250            }
251            this.finalEndVal = null;
252            this.determineDirectionAndSmartEasing();
253            this.rAF = requestAnimationFrame(this.count);
254        };
255        CountUp.prototype.printValue = function (val) {
256            var result = this.formattingFn(val);
257            if (this.el.tagName === 'INPUT') {
258                var input = this.el;
259                input.value = result;
260            }
261            else if (this.el.tagName === 'text' || this.el.tagName === 'tspan') {
262                this.el.textContent = result;
263            }
264            else {
265                this.el.innerHTML = result;
266            }
267        };
268        CountUp.prototype.ensureNumber = function (n) {
269            return (typeof n === 'number' && !isNaN(n));
270        };
271        CountUp.prototype.validateValue = function (value) {
272            var newValue = Number(value);
273            if (!this.ensureNumber(newValue)) {
274                this.error = "[CountUp] invalid start or end value: ".concat(value);
275                return null;
276            }
277            else {
278                return newValue;
279            }
280        };
281        CountUp.prototype.resetDuration = function () {
282            this.startTime = null;
283            this.duration = Number(this.options.duration) * 1000;
284            this.remaining = this.duration;
285        };
286        return CountUp;
287    }());
288
289    exports.CountUp = CountUp;
290
291    Object.defineProperty(exports, '__esModule', { value: true });
292
293}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.