fix(es/minifier): Fix for react-countup (#2625)

swc_ecma_minifier:
 -  `analyzer`: Mark the LHS of an operator assignment as usage.
This commit is contained in:
Donny/강동윤 2021-11-02 18:42:05 +09:00 committed by GitHub
parent 9a2f729322
commit 7ea4ee81c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2335 additions and 1 deletions

View File

@ -52,6 +52,8 @@ pub(crate) struct Ctx {
pub(super) in_cond: bool,
pub(super) inline_prevented: bool,
pub(super) is_op_assign: bool,
}
pub(super) struct WithCtx<'a, S>

View File

@ -235,6 +235,7 @@ where
let ctx = Ctx {
in_assign_lhs: true,
is_exact_reassignment: true,
is_op_assign: n.op != op!("="),
..self.ctx
};
n.left.visit_with(n, &mut *self.with_ctx(ctx));

View File

@ -194,6 +194,10 @@ impl ProgramData {
if is_modify && ctx.is_exact_reassignment {
e.assign_count += 1;
if ctx.is_op_assign {
e.usage_count += 1;
}
for other in e.infects.clone() {
self.report(other, ctx, true, dejavu)
}

View File

@ -3174,7 +3174,7 @@
}
steep && (tmp = x0, x0 = y0, y0 = tmp, tmp = x1, x1 = y1, y1 = tmp), x0 > x1 && (tmp = x0, x0 = x1, x1 = tmp, tmp = y0, y0 = y1, y1 = tmp);
var deltaX = x1 - x0, deltaY = Math.abs(y1 - y0);
deltaX / 2 | 0, y = y0;
error = deltaX / 2 | 0, y = y0;
var yStep = y0 < y1 ? 1 : -1;
for(x = x0; x < x1; x++)steep ? read(y, x) : read(x, y), (error -= deltaY) < 0 && (y += yStep, error += deltaX);
return {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,858 @@
(self.webpackChunk_N_E = self.webpackChunk_N_E || []).push([
[
463
],
{
8273: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
CountUp: function() {
return CountUp;
}
});
var __assign = function() {
return (__assign = Object.assign || function(t) {
for(var i, a = 1, s = arguments.length; a < s; a++)for(var n in i = arguments[a])Object.prototype.hasOwnProperty.call(i, n) && (t[n] = i[n]);
return t;
}).apply(this, arguments);
}, CountUp = function() {
function t1(t2, i1, a1) {
var s1 = this;
this.target = t2, this.endVal = i1, this.options = a1, this.version = "2.0.8", this.defaults = {
startVal: 0,
decimalPlaces: 0,
duration: 2,
useEasing: !0,
useGrouping: !0,
smartEasingThreshold: 999,
smartEasingAmount: 333,
separator: ",",
decimal: ".",
prefix: "",
suffix: ""
}, this.finalEndVal = null, this.useEasing = !0, this.countDown = !1, this.error = "", this.startVal = 0, this.paused = !0, this.count = function(t) {
s1.startTime || (s1.startTime = t);
var i = t - s1.startTime;
s1.remaining = s1.duration - i, s1.useEasing ? s1.countDown ? s1.frameVal = s1.startVal - s1.easingFn(i, 0, s1.startVal - s1.endVal, s1.duration) : s1.frameVal = s1.easingFn(i, s1.startVal, s1.endVal - s1.startVal, s1.duration) : s1.countDown ? s1.frameVal = s1.startVal - (s1.startVal - s1.endVal) * (i / s1.duration) : s1.frameVal = s1.startVal + (s1.endVal - s1.startVal) * (i / s1.duration), s1.countDown ? s1.frameVal = s1.frameVal < s1.endVal ? s1.endVal : s1.frameVal : s1.frameVal = s1.frameVal > s1.endVal ? s1.endVal : s1.frameVal, s1.frameVal = Number(s1.frameVal.toFixed(s1.options.decimalPlaces)), s1.printValue(s1.frameVal), i < s1.duration ? s1.rAF = requestAnimationFrame(s1.count) : null !== s1.finalEndVal ? s1.update(s1.finalEndVal) : s1.callback && s1.callback();
}, this.formatNumber = function(t) {
var i, a, n, e;
i = Math.abs(t).toFixed(s1.options.decimalPlaces);
var o = (i += "").split(".");
if (a = o[0], n = o.length > 1 ? s1.options.decimal + o[1] : "", s1.options.useGrouping) {
e = "";
for(var l = 0, h = a.length; l < h; ++l)0 !== l && l % 3 == 0 && (e = s1.options.separator + e), e = a[h - l - 1] + e;
a = e;
}
return s1.options.numerals && s1.options.numerals.length && (a = a.replace(/[0-9]/g, function(t) {
return s1.options.numerals[+t];
}), n = n.replace(/[0-9]/g, function(t) {
return s1.options.numerals[+t];
})), (t < 0 ? "-" : "") + s1.options.prefix + a + n + s1.options.suffix;
}, this.easeOutExpo = function(t, i, a, s) {
return a * (1 - Math.pow(2, -10 * t / s)) * 1024 / 1023 + i;
}, this.options = __assign(__assign({
}, this.defaults), a1), 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(i1), 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 t2 ? document.getElementById(t2) : t2, this.el ? this.printValue(this.startVal) : this.error = "[CountUp] target is null or undefined";
}
return t1.prototype.determineDirectionAndSmartEasing = function() {
var t = this.finalEndVal ? this.finalEndVal : this.endVal;
if (this.countDown = this.startVal > t, Math.abs(t - this.startVal) > this.options.smartEasingThreshold) {
this.finalEndVal = t;
var a = this.countDown ? 1 : -1;
this.endVal = t + a * this.options.smartEasingAmount, this.duration = this.duration / 2;
} else this.endVal = t, this.finalEndVal = null;
this.finalEndVal ? this.useEasing = !1 : this.useEasing = this.options.useEasing;
}, t1.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));
}, t1.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;
}, t1.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);
}, t1.prototype.update = function(t) {
cancelAnimationFrame(this.rAF), this.startTime = null, this.endVal = this.validateValue(t), this.endVal !== this.frameVal && (this.startVal = this.frameVal, this.finalEndVal || this.resetDuration(), this.finalEndVal = null, this.determineDirectionAndSmartEasing(), this.rAF = requestAnimationFrame(this.count));
}, t1.prototype.printValue = function(t) {
var i = this.formattingFn(t);
"INPUT" === this.el.tagName ? this.el.value = i : "text" === this.el.tagName || "tspan" === this.el.tagName ? this.el.textContent = i : this.el.innerHTML = i;
}, t1.prototype.ensureNumber = function(t) {
return "number" == typeof t && !isNaN(t);
}, t1.prototype.validateValue = function(t) {
var i = Number(t);
return this.ensureNumber(i) ? i : (this.error = "[CountUp] invalid start or end value: " + t, null);
}, t1.prototype.resetDuration = function() {
this.startTime = null, this.duration = 1000 * Number(this.options.duration), this.remaining = this.duration;
}, t1;
}();
},
8045: function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
function _toConsumableArray(arr1) {
return (function(arr) {
if (Array.isArray(arr)) {
for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++)arr2[i] = arr[i];
return arr2;
}
})(arr1) || (function(iter) {
if (Symbol.iterator in Object(iter) || "[object Arguments]" === Object.prototype.toString.call(iter)) return Array.from(iter);
})(arr1) || (function() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
})();
}
exports.default = function(_param) {
var sizerSvg, src2 = _param.src, sizes = _param.sizes, _unoptimized = _param.unoptimized, unoptimized = void 0 !== _unoptimized && _unoptimized, _priority = _param.priority, priority = void 0 !== _priority && _priority, loading = _param.loading, _lazyBoundary = _param.lazyBoundary, lazyBoundary = void 0 === _lazyBoundary ? "200px" : _lazyBoundary, className = _param.className, quality = _param.quality, width = _param.width, height = _param.height, objectFit = _param.objectFit, objectPosition = _param.objectPosition, onLoadingComplete1 = _param.onLoadingComplete, _loader = _param.loader, loader = void 0 === _loader ? defaultImageLoader : _loader, _placeholder = _param.placeholder, placeholder1 = void 0 === _placeholder ? "empty" : _placeholder, blurDataURL = _param.blurDataURL, all = function(source, excluded) {
if (null == source) return {
};
var key, i, target = _objectWithoutPropertiesLoose(source, excluded);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for(i = 0; i < sourceSymbolKeys.length; i++)key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
}
return target;
}(_param, [
"src",
"sizes",
"unoptimized",
"priority",
"loading",
"lazyBoundary",
"className",
"quality",
"width",
"height",
"objectFit",
"objectPosition",
"onLoadingComplete",
"loader",
"placeholder",
"blurDataURL"
]), rest = all, layout = sizes ? "responsive" : "intrinsic";
"layout" in rest && (rest.layout && (layout = rest.layout), delete rest.layout);
var src1, staticSrc = "";
if ("object" == typeof (src1 = src2) && (isStaticRequire(src1) || void 0 !== src1.src)) {
var staticImageData = isStaticRequire(src2) ? src2.default : src2;
if (!staticImageData.src) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ".concat(JSON.stringify(staticImageData)));
if (blurDataURL = blurDataURL || staticImageData.blurDataURL, staticSrc = staticImageData.src, (!layout || "fill" !== layout) && (height = height || staticImageData.height, width = width || staticImageData.width, !staticImageData.height || !staticImageData.width)) throw new Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ".concat(JSON.stringify(staticImageData)));
}
src2 = "string" == typeof src2 ? src2 : staticSrc;
var widthInt = getInt(width), heightInt = getInt(height), qualityInt = getInt(quality), isLazy = !priority && ("lazy" === loading || void 0 === loading);
(src2.startsWith("data:") || src2.startsWith("blob:")) && (unoptimized = !0, isLazy = !1), loadedImageURLs.has(src2) && (isLazy = !1);
var arr2, ref2 = function(arr) {
if (Array.isArray(arr)) return arr;
}(arr2 = _useIntersection.useIntersection({
rootMargin: lazyBoundary,
disabled: !isLazy
})) || function(arr, i) {
var _arr = [], _n = !0, _d = !1, _e = void 0;
try {
for(var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !i || _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally{
try {
_n || null == _i.return || _i.return();
} finally{
if (_d) throw _e;
}
}
return _arr;
}(arr2, 2) || function() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}(), setRef = ref2[0], isIntersected = ref2[1], wrapperStyle = {
boxSizing: "border-box",
display: "block",
overflow: "hidden",
width: "initial",
height: "initial",
background: "none",
opacity: 1,
border: 0,
margin: 0,
padding: 0
}, sizerStyle = {
boxSizing: "border-box",
display: "block",
width: "initial",
height: "initial",
background: "none",
opacity: 1,
border: 0,
margin: 0,
padding: 0
}, hasSizer = !1, imgStyle = {
position: "absolute",
top: 0,
left: 0,
bottom: 0,
right: 0,
boxSizing: "border-box",
padding: 0,
border: "none",
margin: "auto",
display: "block",
width: 0,
height: 0,
minWidth: "100%",
maxWidth: "100%",
minHeight: "100%",
maxHeight: "100%",
objectFit: objectFit,
objectPosition: objectPosition
}, blurStyle = "blur" === placeholder1 ? {
filter: "blur(20px)",
backgroundSize: objectFit || "cover",
backgroundImage: "url(\"".concat(blurDataURL, "\")"),
backgroundPosition: objectPosition || "0% 0%"
} : {
};
if ("fill" === layout) wrapperStyle.display = "block", wrapperStyle.position = "absolute", wrapperStyle.top = 0, wrapperStyle.left = 0, wrapperStyle.bottom = 0, wrapperStyle.right = 0;
else if (void 0 !== widthInt && void 0 !== heightInt) {
var quotient = heightInt / widthInt, paddingTop = isNaN(quotient) ? "100%" : "".concat(100 * quotient, "%");
"responsive" === layout ? (wrapperStyle.display = "block", wrapperStyle.position = "relative", hasSizer = !0, sizerStyle.paddingTop = paddingTop) : "intrinsic" === layout ? (wrapperStyle.display = "inline-block", wrapperStyle.position = "relative", wrapperStyle.maxWidth = "100%", hasSizer = !0, sizerStyle.maxWidth = "100%", sizerSvg = "<svg width=\"".concat(widthInt, "\" height=\"").concat(heightInt, "\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\"/>")) : "fixed" === layout && (wrapperStyle.display = "inline-block", wrapperStyle.position = "relative", wrapperStyle.width = widthInt, wrapperStyle.height = heightInt);
}
var imgAttributes = {
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
srcSet: void 0,
sizes: void 0
};
(!isLazy || isIntersected) && (imgAttributes = generateImgAttrs({
src: src2,
unoptimized: unoptimized,
layout: layout,
width: widthInt,
quality: qualityInt,
sizes: sizes,
loader: loader
}));
var srcString = src2;
return _react.default.createElement("span", {
style: wrapperStyle
}, hasSizer ? _react.default.createElement("span", {
style: sizerStyle
}, sizerSvg ? _react.default.createElement("img", {
style: {
display: "block",
maxWidth: "100%",
width: "initial",
height: "initial",
background: "none",
opacity: 1,
border: 0,
margin: 0,
padding: 0
},
alt: "",
"aria-hidden": !0,
src: "data:image/svg+xml;base64,".concat(_toBase64.toBase64(sizerSvg))
}) : null) : null, _react.default.createElement("img", Object.assign({
}, rest, imgAttributes, {
decoding: "async",
"data-nimg": layout,
className: className,
ref: function(img1) {
setRef(img1), (function(img, src, layout, placeholder, onLoadingComplete) {
if (img) {
var handleLoad = function() {
"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" !== img.src && ("decode" in img ? img.decode() : Promise.resolve()).catch(function() {
}).then(function() {
if ("blur" === placeholder && (img.style.filter = "none", img.style.backgroundSize = "none", img.style.backgroundImage = "none"), loadedImageURLs.add(src), onLoadingComplete) {
var naturalWidth = img.naturalWidth, naturalHeight = img.naturalHeight;
onLoadingComplete({
naturalWidth: naturalWidth,
naturalHeight: naturalHeight
});
}
});
};
img.complete ? handleLoad() : img.onload = handleLoad;
}
})(img1, srcString, layout, placeholder1, onLoadingComplete1);
},
style: _objectSpread({
}, imgStyle, blurStyle)
})), _react.default.createElement("noscript", null, _react.default.createElement("img", Object.assign({
}, rest, generateImgAttrs({
src: src2,
unoptimized: unoptimized,
layout: layout,
width: widthInt,
quality: qualityInt,
sizes: sizes,
loader: loader
}), {
decoding: "async",
"data-nimg": layout,
style: imgStyle,
className: className,
loading: loading || "lazy"
}))), priority ? _react.default.createElement(_head.default, null, _react.default.createElement("link", {
key: "__nimg-" + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes,
rel: "preload",
as: "image",
href: imgAttributes.srcSet ? void 0 : imgAttributes.src,
imagesrcset: imgAttributes.srcSet,
imagesizes: imgAttributes.sizes
})) : null);
};
var _react = _interopRequireDefault(__webpack_require__(7294)), _head = _interopRequireDefault(__webpack_require__(5443)), _toBase64 = __webpack_require__(6978), _imageConfig = __webpack_require__(5809), _useIntersection = __webpack_require__(7190);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function _objectSpread(target) {
for(var _arguments = arguments, i = 1; i < arguments.length; i++)!function(i) {
var source = null != _arguments[i] ? _arguments[i] : {
}, ownKeys = Object.keys(source);
"function" == typeof Object.getOwnPropertySymbols && (ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}))), ownKeys.forEach(function(key) {
var obj, key1, value;
obj = target, key1 = key, value = source[key], key1 in obj ? Object.defineProperty(obj, key1, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key1] = value;
});
}(i);
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (null == source) return {
};
var key, i, target = {
}, sourceKeys = Object.keys(source);
for(i = 0; i < sourceKeys.length; i++)key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
return target;
}
var loadedImageURLs = new Set();
new Map();
var loaders = new Map([
[
"default",
function(param) {
var root = param.root, src = param.src, width = param.width, quality = param.quality;
return "".concat(root, "?url=").concat(encodeURIComponent(src), "&w=").concat(width, "&q=").concat(quality || 75);
}
],
[
"imgix",
function(param) {
var root = param.root, src = param.src, width = param.width, quality = param.quality, url = new URL("".concat(root).concat(normalizeSrc(src))), params = url.searchParams;
return params.set("auto", params.get("auto") || "format"), params.set("fit", params.get("fit") || "max"), params.set("w", params.get("w") || width.toString()), quality && params.set("q", quality.toString()), url.href;
}
],
[
"cloudinary",
function(param) {
var root = param.root, src = param.src, width = param.width, quality = param.quality, paramsString = [
"f_auto",
"c_limit",
"w_" + width,
"q_" + (quality || "auto")
].join(",") + "/";
return "".concat(root).concat(paramsString).concat(normalizeSrc(src));
}
],
[
"akamai",
function(param) {
var root = param.root, src = param.src, width = param.width;
return "".concat(root).concat(normalizeSrc(src), "?imwidth=").concat(width);
}
],
[
"custom",
function(param) {
var src = param.src;
throw new Error("Image with src \"".concat(src, "\" is missing \"loader\" prop.") + "\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader");
}
],
]);
function isStaticRequire(src) {
return void 0 !== src.default;
}
var ref1 = {
deviceSizes: [
640,
750,
828,
1080,
1200,
1920,
2048,
3840
],
imageSizes: [
16,
32,
48,
64,
96,
128,
256,
384
],
path: "/_next/image",
loader: "default"
}, configDeviceSizes = ref1.deviceSizes, configImageSizes = ref1.imageSizes, configLoader = ref1.loader, configPath = ref1.path;
ref1.domains;
var allSizes = _toConsumableArray(configDeviceSizes).concat(_toConsumableArray(configImageSizes));
function generateImgAttrs(param) {
var src = param.src, unoptimized = param.unoptimized, layout1 = param.layout, width1 = param.width, quality = param.quality, sizes1 = param.sizes, loader = param.loader;
if (unoptimized) return {
src: src,
srcSet: void 0,
sizes: void 0
};
var ref = function(width, layout, sizes) {
if (sizes && ("fill" === layout || "responsive" === layout)) {
for(var match, _Math, viewportWidthRe = /(^|\s)(1?\d?\d)vw/g, percentSizes = []; match = viewportWidthRe.exec(sizes); match)percentSizes.push(parseInt(match[2]));
if (percentSizes.length) {
var smallestRatio = 0.01 * (_Math = Math).min.apply(_Math, _toConsumableArray(percentSizes));
return {
widths: allSizes.filter(function(s) {
return s >= configDeviceSizes[0] * smallestRatio;
}),
kind: "w"
};
}
return {
widths: allSizes,
kind: "w"
};
}
return "number" != typeof width || "fill" === layout || "responsive" === layout ? {
widths: configDeviceSizes,
kind: "w"
} : {
widths: _toConsumableArray(new Set([
width,
2 * width
].map(function(w) {
return allSizes.find(function(p) {
return p >= w;
}) || allSizes[allSizes.length - 1];
}))),
kind: "x"
};
}(width1, layout1, sizes1), widths = ref.widths, kind = ref.kind, last = widths.length - 1;
return {
sizes: sizes1 || "w" !== kind ? sizes1 : "100vw",
srcSet: widths.map(function(w, i) {
return "".concat(loader({
src: src,
quality: quality,
width: w
}), " ").concat("w" === kind ? w : i + 1).concat(kind);
}).join(", "),
src: loader({
src: src,
quality: quality,
width: widths[last]
})
};
}
function getInt(x) {
return "number" == typeof x ? x : "string" == typeof x ? parseInt(x, 10) : void 0;
}
function defaultImageLoader(loaderProps) {
var load = loaders.get(configLoader);
if (load) return load(_objectSpread({
root: configPath
}, loaderProps));
throw new Error("Unknown \"loader\" found in \"next.config.js\". Expected: ".concat(_imageConfig.VALID_LOADERS.join(", "), ". Received: ").concat(configLoader));
}
function normalizeSrc(src) {
return "/" === src[0] ? src.slice(1) : src;
}
configDeviceSizes.sort(function(a, b) {
return a - b;
}), allSizes.sort(function(a, b) {
return a - b;
});
},
7190: function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.useIntersection = function(param) {
var arr3, rootMargin = param.rootMargin, isDisabled = param.disabled || !hasIntersectionObserver, unobserve = _react.useRef(), ref = function(arr) {
if (Array.isArray(arr)) return arr;
}(arr3 = _react.useState(!1)) || function(arr, i) {
var _arr = [], _n = !0, _d = !1, _e = void 0;
try {
for(var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !i || _arr.length !== i); _n = !0);
} catch (err) {
_d = !0, _e = err;
} finally{
try {
_n || null == _i.return || _i.return();
} finally{
if (_d) throw _e;
}
}
return _arr;
}(arr3, 2) || function() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}(), visible = ref[0], setVisible = ref[1], setRef = _react.useCallback(function(el) {
unobserve.current && (unobserve.current(), unobserve.current = void 0), !isDisabled && !visible && el && el.tagName && (unobserve.current = observe(el, function(isVisible) {
return isVisible && setVisible(isVisible);
}, {
rootMargin: rootMargin
}));
}, [
isDisabled,
rootMargin,
visible
]);
return _react.useEffect(function() {
if (!hasIntersectionObserver && !visible) {
var idleCallback = _requestIdleCallback.requestIdleCallback(function() {
return setVisible(!0);
});
return function() {
return _requestIdleCallback.cancelIdleCallback(idleCallback);
};
}
}, [
visible
]), [
setRef,
visible
];
};
var _react = __webpack_require__(7294), _requestIdleCallback = __webpack_require__(9311), hasIntersectionObserver = "undefined" != typeof IntersectionObserver;
function observe(element, callback, options) {
var ref = createObserver(options), id = ref.id, observer = ref.observer, elements = ref.elements;
return elements.set(element, callback), observer.observe(element), function() {
elements.delete(element), observer.unobserve(element), 0 === elements.size && (observer.disconnect(), observers.delete(id));
};
}
var observers = new Map();
function createObserver(options) {
var id = options.rootMargin || "", instance = observers.get(id);
if (instance) return instance;
var elements = new Map(), observer = new IntersectionObserver(function(entries) {
entries.forEach(function(entry) {
var callback = elements.get(entry.target), isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
callback && isVisible && callback(isVisible);
});
}, options);
return observers.set(id, instance = {
id: id,
observer: observer,
elements: elements
}), instance;
}
},
6978: function(__unused_webpack_module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.toBase64 = function(str) {
return window.btoa(str);
};
},
5809: function(__unused_webpack_module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.imageConfigDefault = exports.VALID_LOADERS = void 0, exports.VALID_LOADERS = [
"default",
"imgix",
"cloudinary",
"akamai",
"custom",
], exports.imageConfigDefault = {
deviceSizes: [
640,
750,
828,
1080,
1200,
1920,
2048,
3840
],
imageSizes: [
16,
32,
48,
64,
96,
128,
256,
384
],
path: "/_next/image",
loader: "default",
domains: [],
disableStaticImages: !1,
minimumCacheTTL: 60,
formats: [
"image/webp"
]
};
},
9008: function(module, __unused_webpack_exports, __webpack_require__) {
module.exports = __webpack_require__(5443);
},
5675: function(module, __unused_webpack_exports, __webpack_require__) {
module.exports = __webpack_require__(8045);
},
7857: function(__unused_webpack_module, exports, __webpack_require__) {
"use strict";
var e, React = __webpack_require__(7294), countup_js = __webpack_require__(8273), React__default = (e = React) && "object" == typeof e && "default" in e ? e : {
"default": e
};
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function(sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for(var i = 1; i < arguments.length; i++){
var source = null != arguments[i] ? arguments[i] : {
};
i % 2 ? ownKeys(Object(source), !0).forEach(function(key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
return key in obj ? Object.defineProperty(obj, key, {
value: value,
enumerable: !0,
configurable: !0,
writable: !0
}) : obj[key] = value, obj;
}
function _extends() {
return (_extends = Object.assign || function(target) {
for(var i = 1; i < arguments.length; i++){
var source = arguments[i];
for(var key in source)Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
}
return target;
}).apply(this, arguments);
}
function _objectWithoutProperties(source1, excluded1) {
if (null == source1) return {
};
var key2, i2, target1 = function(source, excluded) {
if (null == source) return {
};
var key, i, target = {
}, sourceKeys = Object.keys(source);
for(i = 0; i < sourceKeys.length; i++)key = sourceKeys[i], excluded.indexOf(key) >= 0 || (target[key] = source[key]);
return target;
}(source1, excluded1);
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source1);
for(i2 = 0; i2 < sourceSymbolKeys.length; i2++)key2 = sourceSymbolKeys[i2], excluded1.indexOf(key2) >= 0 || Object.prototype.propertyIsEnumerable.call(source1, key2) && (target1[key2] = source1[key2]);
}
return target1;
}
var useIsomorphicLayoutEffect = "undefined" != typeof window && void 0 !== window.document && void 0 !== window.document.createElement ? React.useLayoutEffect : React.useEffect;
function useEventCallback(fn) {
var ref = React.useRef(fn);
return useIsomorphicLayoutEffect(function() {
ref.current = fn;
}), React.useCallback(function() {
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
return ref.current.apply(void 0, args);
}, []);
}
var createCountUpInstance = function(el, props) {
var decimal = props.decimal, decimals = props.decimals, duration = props.duration, easingFn = props.easingFn, end = props.end, formattingFn = props.formattingFn, numerals = props.numerals, prefix = props.prefix, separator = props.separator, start = props.start, suffix = props.suffix, useEasing = props.useEasing;
return new countup_js.CountUp(el, end, {
startVal: start,
duration: duration,
decimal: decimal,
decimalPlaces: decimals,
easingFn: easingFn,
formattingFn: formattingFn,
numerals: numerals,
separator: separator,
prefix: prefix,
suffix: suffix,
useEasing: useEasing,
useGrouping: !!separator
});
}, _excluded$1 = [
"ref",
"startOnMount",
"enableReinitialize",
"delay",
"onEnd",
"onStart",
"onPauseResume",
"onReset",
"onUpdate"
], DEFAULTS = {
decimal: ".",
delay: null,
prefix: "",
suffix: "",
start: 0,
startOnMount: !0,
enableReinitialize: !0
}, useCountUp = function(props) {
var _useMemo = React.useMemo(function() {
return _objectSpread2(_objectSpread2({
}, DEFAULTS), props);
}, [
props
]), ref = _useMemo.ref, startOnMount = _useMemo.startOnMount, enableReinitialize = _useMemo.enableReinitialize, delay = _useMemo.delay, onEnd = _useMemo.onEnd, onStart = _useMemo.onStart, onPauseResume = _useMemo.onPauseResume, onReset = _useMemo.onReset, onUpdate = _useMemo.onUpdate, instanceProps = _objectWithoutProperties(_useMemo, _excluded$1), countUpRef = React.useRef(), timerRef = React.useRef(), isInitializedRef = React.useRef(!1), createInstance = useEventCallback(function() {
return createCountUpInstance("string" == typeof ref ? ref : ref.current, instanceProps);
}), getCountUp = useEventCallback(function(recreate) {
var countUp = countUpRef.current;
if (countUp && !recreate) return countUp;
var newCountUp = createInstance();
return countUpRef.current = newCountUp, newCountUp;
}), start = useEventCallback(function() {
var run = function() {
return getCountUp(!0).start(function() {
null == onEnd || onEnd({
pauseResume: pauseResume,
reset: reset,
start: restart,
update: update
});
});
};
delay && delay > 0 ? timerRef.current = setTimeout(run, 1000 * delay) : run(), null == onStart || onStart({
pauseResume: pauseResume,
reset: reset,
update: update
});
}), pauseResume = useEventCallback(function() {
getCountUp().pauseResume(), null == onPauseResume || onPauseResume({
reset: reset,
start: restart,
update: update
});
}), reset = useEventCallback(function() {
timerRef.current && clearTimeout(timerRef.current), getCountUp().reset(), null == onReset || onReset({
pauseResume: pauseResume,
start: restart,
update: update
});
}), update = useEventCallback(function(newEnd) {
getCountUp().update(newEnd), null == onUpdate || onUpdate({
pauseResume: pauseResume,
reset: reset,
start: restart
});
}), restart = useEventCallback(function() {
reset(), start();
}), maybeInitialize = useEventCallback(function(shouldReset) {
startOnMount && (shouldReset && reset(), start());
});
return React.useEffect(function() {
isInitializedRef.current ? enableReinitialize && maybeInitialize(!0) : (isInitializedRef.current = !0, maybeInitialize());
}, [
enableReinitialize,
isInitializedRef,
maybeInitialize,
delay,
props.start,
props.suffix,
props.prefix,
props.duration,
props.separator,
props.decimals,
props.decimal,
props.formattingFn
]), React.useEffect(function() {
return function() {
reset();
};
}, [
reset
]), {
start: restart,
pauseResume: pauseResume,
reset: reset,
update: update,
getCountUp: getCountUp
};
}, _excluded = [
"className",
"redraw",
"containerProps",
"children",
"style"
];
exports.ZP = function(props) {
var className = props.className, redraw = props.redraw, containerProps = props.containerProps, children = props.children, style = props.style, useCountUpProps = _objectWithoutProperties(props, _excluded), containerRef = React__default.default.useRef(null), isInitializedRef = React__default.default.useRef(!1), _useCountUp = useCountUp(_objectSpread2(_objectSpread2({
}, useCountUpProps), {
}, {
ref: containerRef,
startOnMount: "function" != typeof children || 0 === props.delay,
enableReinitialize: !1
})), start = _useCountUp.start, reset = _useCountUp.reset, updateCountUp = _useCountUp.update, pauseResume = _useCountUp.pauseResume, getCountUp = _useCountUp.getCountUp, restart = useEventCallback(function() {
start();
}), update = useEventCallback(function(end) {
props.preserveValue || reset(), updateCountUp(end);
}), initializeOnMount = useEventCallback(function() {
if ("function" == typeof props.children && !(containerRef.current instanceof Element)) {
console.error("Couldn't find attached element to hook the CountUp instance into! Try to attach \"containerRef\" from the render prop to a an Element, eg. <span ref={containerRef} />.");
return;
}
getCountUp();
});
return (React.useEffect(function() {
initializeOnMount();
}, [
initializeOnMount
]), React.useEffect(function() {
isInitializedRef.current && update(props.end);
}, [
props.end,
update
]), React.useEffect(function() {
redraw && isInitializedRef.current && restart();
}, [
restart,
redraw,
redraw && props
]), React.useEffect(function() {
!redraw && isInitializedRef.current && restart();
}, [
restart,
redraw,
props.start,
props.suffix,
props.prefix,
props.duration,
props.separator,
props.decimals,
props.decimal,
props.className,
props.formattingFn
]), React.useEffect(function() {
isInitializedRef.current = !0;
}, []), "function" == typeof children) ? children({
countUpRef: containerRef,
start: start,
reset: reset,
update: updateCountUp,
pauseResume: pauseResume,
getCountUp: getCountUp
}) : React__default.default.createElement("span", _extends({
className: className,
ref: containerRef,
style: style
}, containerProps));
};
}
}
]);

View File

@ -0,0 +1,15 @@
export function formatNumber(t) {
var i, a, n, e, r = t < 0 ? "-" : "";
i = Math.abs(t).toFixed(s.options.decimalPlaces);
var o = (i += "").split(".");
if (a = o[0], n = o.length > 1 ? s.options.decimal + o[1] : "", s.options.useGrouping) {
e = "";
for (var l = 0, h = a.length; l < h; ++l) 0 !== l && l % 3 == 0 && (e = s.options.separator + e), e = a[h - l - 1] + e;
a = e
}
return s.options.numerals && s.options.numerals.length && (a = a.replace(/[0-9]/g, function (t) {
return s.options.numerals[+t]
}), n = n.replace(/[0-9]/g, function (t) {
return s.options.numerals[+t]
})), r + s.options.prefix + a + n + s.options.suffix
}

View File

@ -0,0 +1,15 @@
export function formatNumber(t) {
var i, a, n, e;
i = Math.abs(t).toFixed(s.options.decimalPlaces);
var o = (i += "").split(".");
if (a = o[0], n = o.length > 1 ? s.options.decimal + o[1] : "", s.options.useGrouping) {
e = "";
for(var l = 0, h = a.length; l < h; ++l)0 !== l && l % 3 == 0 && (e = s.options.separator + e), e = a[h - l - 1] + e;
a = e;
}
return s.options.numerals && s.options.numerals.length && (a = a.replace(/[0-9]/g, function(t) {
return s.options.numerals[+t];
}), n = n.replace(/[0-9]/g, function(t) {
return s.options.numerals[+t];
})), (t < 0 ? "-" : "") + s.options.prefix + a + n + s.options.suffix;
}