mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 06:36:08 +03:00
fix(es/minifier): Mark delete
as a property mutation (#6063)
**Related issue:** - Closes https://github.com/swc-project/swc/issues/6004.
This commit is contained in:
parent
d02ec8beef
commit
38df5978c1
@ -47,6 +47,8 @@ pub(crate) struct Ctx {
|
||||
|
||||
pub(super) in_await_arg: bool,
|
||||
|
||||
pub(super) is_delete_arg: bool,
|
||||
|
||||
pub(super) in_left_of_for_loop: bool,
|
||||
|
||||
pub(super) executed_multiple_time: bool,
|
||||
|
@ -409,6 +409,7 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
in_pat_of_param: true,
|
||||
is_delete_arg: false,
|
||||
..child.ctx
|
||||
};
|
||||
n.params.visit_with(&mut *child.with_ctx(ctx));
|
||||
@ -431,6 +432,7 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
in_pat_of_param: true,
|
||||
is_delete_arg: false,
|
||||
..child.ctx
|
||||
};
|
||||
n.params.visit_with(&mut *child.with_ctx(ctx));
|
||||
@ -449,6 +451,7 @@ where
|
||||
in_assign_lhs: true,
|
||||
is_exact_reassignment: true,
|
||||
is_op_assign: n.op != op!("="),
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.left.visit_with(&mut *self.with_ctx(ctx));
|
||||
@ -456,6 +459,7 @@ where
|
||||
let ctx = Ctx {
|
||||
in_assign_lhs: false,
|
||||
is_exact_reassignment: false,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.right.visit_with(&mut *self.with_ctx(ctx));
|
||||
@ -493,6 +497,7 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
in_pat_of_param: false,
|
||||
is_delete_arg: false,
|
||||
var_decl_kind_of_pat: None,
|
||||
..self.ctx
|
||||
};
|
||||
@ -504,6 +509,7 @@ where
|
||||
fn visit_await_expr(&mut self, n: &AwaitExpr) {
|
||||
let ctx = Ctx {
|
||||
in_await_arg: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.visit_children_with(&mut *self.with_ctx(ctx));
|
||||
@ -585,6 +591,7 @@ where
|
||||
let ctx = Ctx {
|
||||
inline_prevented,
|
||||
in_call_arg: true,
|
||||
is_delete_arg: false,
|
||||
is_exact_arg: true,
|
||||
is_exact_reassignment: false,
|
||||
is_callee: false,
|
||||
@ -614,6 +621,7 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
in_catch_param: true,
|
||||
..self.ctx
|
||||
};
|
||||
@ -623,6 +631,7 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
self.with_ctx(ctx).visit_in_cond(&n.body);
|
||||
@ -636,6 +645,7 @@ where
|
||||
{
|
||||
let ctx = Ctx {
|
||||
inline_prevented: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.super_class.visit_with(&mut *self.with_ctx(ctx));
|
||||
@ -695,10 +705,12 @@ where
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip(self, n)))]
|
||||
fn visit_do_while_stmt(&mut self, n: &DoWhileStmt) {
|
||||
n.body.visit_with(&mut *self.with_ctx(Ctx {
|
||||
is_delete_arg: false,
|
||||
executed_multiple_time: true,
|
||||
..self.ctx
|
||||
}));
|
||||
n.test.visit_with(&mut *self.with_ctx(Ctx {
|
||||
is_delete_arg: false,
|
||||
executed_multiple_time: true,
|
||||
..self.ctx
|
||||
}));
|
||||
@ -799,6 +811,7 @@ where
|
||||
e.left.visit_with(self);
|
||||
let ctx = Ctx {
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
self.with_ctx(ctx).visit_in_cond(&e.right);
|
||||
@ -827,6 +840,7 @@ where
|
||||
fn visit_fn_decl(&mut self, n: &FnDecl) {
|
||||
let ctx = Ctx {
|
||||
in_decl_with_no_side_effect_for_member_access: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
self.with_ctx(ctx).declare_decl(&n.ident, true, None, true);
|
||||
@ -893,8 +907,9 @@ where
|
||||
|
||||
self.with_child(n.span.ctxt, ScopeKind::Block, |child| {
|
||||
let ctx = Ctx {
|
||||
in_left_of_for_loop: true,
|
||||
is_exact_reassignment: true,
|
||||
is_delete_arg: false,
|
||||
in_left_of_for_loop: true,
|
||||
..child.ctx
|
||||
};
|
||||
n.left.visit_with(&mut *child.with_ctx(ctx));
|
||||
@ -902,6 +917,7 @@ where
|
||||
n.right.visit_with(child);
|
||||
|
||||
let ctx = Ctx {
|
||||
is_delete_arg: false,
|
||||
executed_multiple_time: true,
|
||||
in_cond: true,
|
||||
..child.ctx
|
||||
@ -919,6 +935,7 @@ where
|
||||
let ctx = Ctx {
|
||||
in_left_of_for_loop: true,
|
||||
is_exact_reassignment: true,
|
||||
is_delete_arg: false,
|
||||
..child.ctx
|
||||
};
|
||||
n.left.visit_with(&mut *child.with_ctx(ctx));
|
||||
@ -926,6 +943,7 @@ where
|
||||
let ctx = Ctx {
|
||||
executed_multiple_time: true,
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..child.ctx
|
||||
};
|
||||
child.with_ctx(ctx).visit_in_cond(&n.body);
|
||||
@ -939,6 +957,7 @@ where
|
||||
let ctx = Ctx {
|
||||
executed_multiple_time: true,
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
@ -987,6 +1006,7 @@ where
|
||||
fn visit_if_stmt(&mut self, n: &IfStmt) {
|
||||
let ctx = Ctx {
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.test.visit_with(self);
|
||||
@ -1024,6 +1044,7 @@ where
|
||||
is_exact_arg: false,
|
||||
is_exact_reassignment: false,
|
||||
is_callee: false,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
c.visit_with(&mut *self.with_ctx(ctx));
|
||||
@ -1040,7 +1061,7 @@ where
|
||||
v.mark_indexed_with_dynamic_key();
|
||||
}
|
||||
|
||||
if self.ctx.in_assign_lhs {
|
||||
if self.ctx.in_assign_lhs || self.ctx.is_delete_arg {
|
||||
v.mark_has_property_mutation();
|
||||
}
|
||||
|
||||
@ -1240,6 +1261,7 @@ where
|
||||
in_call_arg: false,
|
||||
in_assign_lhs: false,
|
||||
in_await_arg: false,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.visit_children_with(&mut *self.with_ctx(ctx));
|
||||
@ -1251,6 +1273,7 @@ where
|
||||
for stmt in stmts {
|
||||
let ctx = Ctx {
|
||||
in_cond: self.ctx.in_cond || had_cond,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
@ -1266,6 +1289,7 @@ where
|
||||
let ctx = Ctx {
|
||||
is_exact_arg: false,
|
||||
is_exact_reassignment: false,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
c.visit_with(&mut *self.with_ctx(ctx));
|
||||
@ -1280,6 +1304,7 @@ where
|
||||
|
||||
for case in n.cases.iter() {
|
||||
let ctx = Ctx {
|
||||
is_delete_arg: false,
|
||||
in_cond: true,
|
||||
..self.ctx
|
||||
};
|
||||
@ -1297,6 +1322,7 @@ where
|
||||
fn visit_try_stmt(&mut self, n: &TryStmt) {
|
||||
let ctx = Ctx {
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
@ -1308,6 +1334,18 @@ where
|
||||
let ctx = Ctx {
|
||||
in_update_arg: true,
|
||||
is_exact_reassignment: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.visit_children_with(&mut *self.with_ctx(ctx));
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "debug", tracing::instrument(skip(self, n)))]
|
||||
fn visit_unary_expr(&mut self, n: &UnaryExpr) {
|
||||
let ctx = Ctx {
|
||||
in_update_arg: false,
|
||||
is_exact_reassignment: false,
|
||||
is_delete_arg: n.op == op!("delete"),
|
||||
..self.ctx
|
||||
};
|
||||
n.visit_children_with(&mut *self.with_ctx(ctx));
|
||||
@ -1321,6 +1359,7 @@ where
|
||||
in_call_arg: false,
|
||||
in_assign_lhs: false,
|
||||
in_await_arg: false,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
n.visit_children_with(&mut *self.with_ctx(ctx));
|
||||
@ -1365,6 +1404,7 @@ where
|
||||
.as_deref()
|
||||
.map(is_safe_to_access_prop)
|
||||
.unwrap_or(false),
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
e.name.visit_with(&mut *self.with_ctx(ctx));
|
||||
@ -1407,11 +1447,13 @@ where
|
||||
fn visit_while_stmt(&mut self, n: &WhileStmt) {
|
||||
n.test.visit_with(&mut *self.with_ctx(Ctx {
|
||||
executed_multiple_time: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
}));
|
||||
let ctx = Ctx {
|
||||
executed_multiple_time: true,
|
||||
in_cond: true,
|
||||
is_delete_arg: false,
|
||||
..self.ctx
|
||||
};
|
||||
|
||||
|
@ -2102,7 +2102,7 @@
|
||||
},
|
||||
prefilters: [
|
||||
function(elem, props, opts) {
|
||||
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow");
|
||||
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow");
|
||||
for(prop in opts.queue || (null == (hooks = jQuery._queueHooks(elem, "fx")).unqueued && (hooks.unqueued = 0, oldfire = hooks.empty.fire, hooks.empty.fire = function() {
|
||||
hooks.unqueued || oldfire();
|
||||
}), hooks.unqueued++, anim.always(function() {
|
||||
@ -2116,7 +2116,7 @@
|
||||
}
|
||||
orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
|
||||
}
|
||||
if (!(!(propTween = !jQuery.isEmptyObject(props)) && jQuery.isEmptyObject(orig))) for(prop in ("width" in props || "height" in props) && 1 === elem.nodeType && (opts.overflow = [
|
||||
if (!(!(propTween = !jQuery.isEmptyObject(props)) && jQuery.isEmptyObject(orig))) for(prop in isBox && 1 === elem.nodeType && (opts.overflow = [
|
||||
style.overflow,
|
||||
style.overflowX,
|
||||
style.overflowY
|
||||
|
@ -18116,7 +18116,7 @@
|
||||
target: target
|
||||
}, "state"), mutatedProps = eventReturn.mutation(lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()({}, mutationTargetProps, mutationTargetState), baseProps), childState = baseState[childName] || {}, updateState = function(state) {
|
||||
var state1, state2;
|
||||
return mutatedProps ? "parent" === target ? lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state, _defineProperty({}, key, lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state[key], mutatedProps))) : lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state, _defineProperty({}, key, lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state[key], _defineProperty({}, target, mutatedProps)))) : (state[key] && state[key][target] && delete state[key][target], state[key] && !lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(state[key]).length && delete state[key], state);
|
||||
return mutatedProps ? "parent" === target ? lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state, _defineProperty({}, key, lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state[key], mutatedProps))) : lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state, _defineProperty({}, key, lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(state[key], _defineProperty({}, target, mutatedProps)))) : ((state2 = state)[key] && state2[key][target] && delete state2[key][target], state2[key] && !lodash_keys__WEBPACK_IMPORTED_MODULE_0___default()(state2[key]).length && delete state2[key], state2);
|
||||
};
|
||||
return null != childName ? lodash_assign__WEBPACK_IMPORTED_MODULE_8___default()(baseState, _defineProperty({}, childName, updateState(childState))) : updateState(baseState);
|
||||
}, getReturnByChild = function(childName) {
|
||||
|
@ -10131,6 +10131,20 @@ fn feedback_regex_range() {
|
||||
run_default_exec_test(src);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_6004() {
|
||||
run_default_exec_test(
|
||||
r###"
|
||||
const props = {'a': 1, 'b': 2};
|
||||
const isBox = 'a' in props || 'b' in props;
|
||||
for (const p in props) {
|
||||
delete props[p];
|
||||
}
|
||||
console.log(isBox);
|
||||
"###,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_6047_1() {
|
||||
run_default_exec_test(
|
||||
|
@ -1704,7 +1704,7 @@
|
||||
}();
|
||||
}
|
||||
exports.default = function(_param) {
|
||||
var src, arr, sizerSvg, src1 = _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, className = _param.className, quality = _param.quality, width = _param.width, height = _param.height, objectFit = _param.objectFit, objectPosition = _param.objectPosition, onLoadingComplete = _param.onLoadingComplete, _loader = _param.loader, loader = void 0 === _loader ? defaultImageLoader : _loader, _placeholder = _param.placeholder, placeholder = void 0 === _placeholder ? "empty" : _placeholder, blurDataURL = _param.blurDataURL, all = function(source, excluded) {
|
||||
var src, arr, sizerSvg, src1 = _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, className = _param.className, quality = _param.quality, width = _param.width, height = _param.height, objectFit = _param.objectFit, objectPosition = _param.objectPosition, onLoadingComplete = _param.onLoadingComplete, _loader = _param.loader, loader = void 0 === _loader ? defaultImageLoader : _loader, _placeholder = _param.placeholder, placeholder = void 0 === _placeholder ? "empty" : _placeholder, blurDataURL = _param.blurDataURL, rest = function(source, excluded) {
|
||||
if (null == source) return {};
|
||||
var key, i, target = function(source, excluded) {
|
||||
if (null == source) return {};
|
||||
@ -1735,7 +1735,7 @@
|
||||
"placeholder",
|
||||
"blurDataURL"
|
||||
]), layout = sizes ? "responsive" : "intrinsic";
|
||||
"layout" in all && (all.layout && (layout = all.layout), delete all.layout);
|
||||
"layout" in rest && (rest.layout && (layout = rest.layout), delete rest.layout);
|
||||
var staticSrc = "";
|
||||
if ("object" == typeof (src = src1) && (isStaticRequire(src) || void 0 !== src.src)) {
|
||||
var staticImageData = isStaticRequire(src1) ? src1.default : src1;
|
||||
@ -1851,7 +1851,7 @@
|
||||
alt: "",
|
||||
"aria-hidden": !0,
|
||||
src: "data:image/svg+xml;base64,".concat(_toBase64.toBase64(sizerSvg))
|
||||
}) : null) : null, _react.default.createElement("img", Object.assign({}, all, imgAttributes, {
|
||||
}) : null) : null, _react.default.createElement("img", Object.assign({}, rest, imgAttributes, {
|
||||
decoding: "async",
|
||||
"data-nimg": layout,
|
||||
className: className,
|
||||
@ -1874,7 +1874,7 @@
|
||||
}(img, srcString, layout, placeholder, onLoadingComplete);
|
||||
},
|
||||
style: _objectSpread({}, imgStyle, blurStyle)
|
||||
})), _react.default.createElement("noscript", null, _react.default.createElement("img", Object.assign({}, all, generateImgAttrs({
|
||||
})), _react.default.createElement("noscript", null, _react.default.createElement("img", Object.assign({}, rest, generateImgAttrs({
|
||||
src: src1,
|
||||
unoptimized: unoptimized,
|
||||
layout: layout,
|
||||
|
@ -95,7 +95,7 @@
|
||||
}();
|
||||
}
|
||||
exports.default = function(_param) {
|
||||
var src, arr, sizerSvg, src1 = _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, className = _param.className, quality = _param.quality, width = _param.width, height = _param.height, objectFit = _param.objectFit, objectPosition = _param.objectPosition, onLoadingComplete = _param.onLoadingComplete, _loader = _param.loader, loader = void 0 === _loader ? defaultImageLoader : _loader, _placeholder = _param.placeholder, placeholder = void 0 === _placeholder ? "empty" : _placeholder, blurDataURL = _param.blurDataURL, all = function(source, excluded) {
|
||||
var src, arr, sizerSvg, src1 = _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, className = _param.className, quality = _param.quality, width = _param.width, height = _param.height, objectFit = _param.objectFit, objectPosition = _param.objectPosition, onLoadingComplete = _param.onLoadingComplete, _loader = _param.loader, loader = void 0 === _loader ? defaultImageLoader : _loader, _placeholder = _param.placeholder, placeholder = void 0 === _placeholder ? "empty" : _placeholder, blurDataURL = _param.blurDataURL, rest = function(source, excluded) {
|
||||
if (null == source) return {};
|
||||
var key, i, target = function(source, excluded) {
|
||||
if (null == source) return {};
|
||||
@ -126,7 +126,7 @@
|
||||
"placeholder",
|
||||
"blurDataURL"
|
||||
]), layout = sizes ? "responsive" : "intrinsic";
|
||||
"layout" in all && (all.layout && (layout = all.layout), delete all.layout);
|
||||
"layout" in rest && (rest.layout && (layout = rest.layout), delete rest.layout);
|
||||
var staticSrc = "";
|
||||
if ("object" == typeof (src = src1) && (isStaticRequire(src) || void 0 !== src.src)) {
|
||||
var staticImageData = isStaticRequire(src1) ? src1.default : src1;
|
||||
@ -242,7 +242,7 @@
|
||||
alt: "",
|
||||
"aria-hidden": !0,
|
||||
src: "data:image/svg+xml;base64,".concat(_toBase64.toBase64(sizerSvg))
|
||||
}) : null) : null, _react.default.createElement("img", Object.assign({}, all, imgAttributes, {
|
||||
}) : null) : null, _react.default.createElement("img", Object.assign({}, rest, imgAttributes, {
|
||||
decoding: "async",
|
||||
"data-nimg": layout,
|
||||
className: className,
|
||||
@ -265,7 +265,7 @@
|
||||
}(img, srcString, layout, placeholder, onLoadingComplete);
|
||||
},
|
||||
style: _objectSpread({}, imgStyle, blurStyle)
|
||||
})), _react.default.createElement("noscript", null, _react.default.createElement("img", Object.assign({}, all, generateImgAttrs({
|
||||
})), _react.default.createElement("noscript", null, _react.default.createElement("img", Object.assign({}, rest, generateImgAttrs({
|
||||
src: src1,
|
||||
unoptimized: unoptimized,
|
||||
layout: layout,
|
||||
|
@ -61,12 +61,12 @@
|
||||
});
|
||||
}, [
|
||||
configContext
|
||||
]), layout = sizes ? "responsive" : "intrinsic";
|
||||
"layout" in all && (all.layout && (layout = all.layout), delete all.layout);
|
||||
]), rest = all, layout = sizes ? "responsive" : "intrinsic";
|
||||
"layout" in rest && (rest.layout && (layout = rest.layout), delete rest.layout);
|
||||
var loader = defaultImageLoader;
|
||||
if ("loader" in all) {
|
||||
if (all.loader) {
|
||||
var customImageLoader = all.loader;
|
||||
if ("loader" in rest) {
|
||||
if (rest.loader) {
|
||||
var customImageLoader = rest.loader;
|
||||
loader = function(obj) {
|
||||
obj.config;
|
||||
var opts = _object_without_properties_loose(obj, [
|
||||
@ -75,7 +75,7 @@
|
||||
return customImageLoader(opts);
|
||||
};
|
||||
}
|
||||
delete all.loader;
|
||||
delete rest.loader;
|
||||
}
|
||||
var staticSrc = "";
|
||||
if ("object" == typeof (src = src1) && (isStaticRequire(src) || void 0 !== src.src)) {
|
||||
@ -190,7 +190,7 @@
|
||||
setIntersection: setIntersection,
|
||||
isVisible: isVisible,
|
||||
noscriptSizes: sizes
|
||||
}, all);
|
||||
}, rest);
|
||||
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement("span", {
|
||||
style: wrapperStyle
|
||||
}, hasSizer ? _react.default.createElement("span", {
|
||||
|
@ -14863,36 +14863,36 @@
|
||||
});
|
||||
}, [
|
||||
G
|
||||
]), V = l ? "responsive" : "intrinsic";
|
||||
"layout" in W && (W.layout && (V = W.layout), delete W.layout);
|
||||
var H = x;
|
||||
if ("loader" in W) {
|
||||
if (W.loader) {
|
||||
var Z = W.loader;
|
||||
H = function(e) {
|
||||
]), V = W, H = l ? "responsive" : "intrinsic";
|
||||
"layout" in V && (V.layout && (H = V.layout), delete V.layout);
|
||||
var Z = x;
|
||||
if ("loader" in V) {
|
||||
if (V.loader) {
|
||||
var X = V.loader;
|
||||
Z = function(e) {
|
||||
e.config;
|
||||
var t = g(e, [
|
||||
"config"
|
||||
]);
|
||||
return Z(t);
|
||||
return X(t);
|
||||
};
|
||||
}
|
||||
delete W.loader;
|
||||
delete V.loader;
|
||||
}
|
||||
var X = "";
|
||||
var J = "";
|
||||
if ("object" == typeof (t = u) && (w(t) || void 0 !== t.src)) {
|
||||
var J = w(u) ? u.default : u;
|
||||
if (!J.src) throw 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(J)));
|
||||
if (z = z || J.blurDataURL, X = J.src, (!V || "fill" !== V) && (I = I || J.height, R = R || J.width, !J.height || !J.width)) throw 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(J)));
|
||||
var Y = w(u) ? u.default : u;
|
||||
if (!Y.src) throw 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(Y)));
|
||||
if (z = z || Y.blurDataURL, J = Y.src, (!H || "fill" !== H) && (I = I || Y.height, R = R || Y.width, !Y.height || !Y.width)) throw 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(Y)));
|
||||
}
|
||||
u = "string" == typeof u ? u : X;
|
||||
var Y = _(R), K = _(I), Q = _(F), $ = !k && ("lazy" === T || void 0 === T);
|
||||
(u.startsWith("data:") || u.startsWith("blob:")) && (D = !0, $ = !1), b.has(u) && ($ = !1);
|
||||
var ee = o(s.useState(!1), 2), et = ee[0], er = ee[1], en = o(d.useIntersection({
|
||||
u = "string" == typeof u ? u : J;
|
||||
var K = _(R), Q = _(I), $ = _(F), ee = !k && ("lazy" === T || void 0 === T);
|
||||
(u.startsWith("data:") || u.startsWith("blob:")) && (D = !0, ee = !1), b.has(u) && (ee = !1);
|
||||
var et = o(s.useState(!1), 2), er = et[0], en = et[1], ei = o(d.useIntersection({
|
||||
rootRef: void 0 === O ? null : O,
|
||||
rootMargin: void 0 === C ? "200px" : C,
|
||||
disabled: !$
|
||||
}), 3), ei = en[0], eo = en[1], ea = en[2], eu = !$ || eo, el = {
|
||||
disabled: !ee
|
||||
}), 3), eo = ei[0], ea = ei[1], eu = ei[2], el = !ee || ea, es = {
|
||||
boxSizing: "border-box",
|
||||
display: "block",
|
||||
overflow: "hidden",
|
||||
@ -14903,7 +14903,7 @@
|
||||
border: 0,
|
||||
margin: 0,
|
||||
padding: 0
|
||||
}, es = {
|
||||
}, ec = {
|
||||
boxSizing: "border-box",
|
||||
display: "block",
|
||||
width: "initial",
|
||||
@ -14913,7 +14913,7 @@
|
||||
border: 0,
|
||||
margin: 0,
|
||||
padding: 0
|
||||
}, ec = !1, ef = Object.assign({}, j, "raw" === V ? {} : {
|
||||
}, ef = !1, ed = Object.assign({}, j, "raw" === H ? {} : {
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
@ -14932,70 +14932,70 @@
|
||||
maxHeight: "100%",
|
||||
objectFit: B,
|
||||
objectPosition: M
|
||||
}), ed = "blur" !== U || et ? {} : {
|
||||
}), ep = "blur" !== U || er ? {} : {
|
||||
filter: "blur(20px)",
|
||||
backgroundSize: B || "cover",
|
||||
backgroundImage: 'url("'.concat(z, '")'),
|
||||
backgroundPosition: M || "0% 0%"
|
||||
};
|
||||
if ("fill" === V) el.display = "block", el.position = "absolute", el.top = 0, el.left = 0, el.bottom = 0, el.right = 0;
|
||||
else if (void 0 !== Y && void 0 !== K) {
|
||||
var ep = K / Y, eh = isNaN(ep) ? "100%" : "".concat(100 * ep, "%");
|
||||
"responsive" === V ? (el.display = "block", el.position = "relative", ec = !0, es.paddingTop = eh) : "intrinsic" === V ? (el.display = "inline-block", el.position = "relative", el.maxWidth = "100%", ec = !0, es.maxWidth = "100%", r = "data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27".concat(Y, "%27%20height=%27").concat(K, "%27/%3e")) : "fixed" === V && (el.display = "inline-block", el.position = "relative", el.width = Y, el.height = K);
|
||||
if ("fill" === H) es.display = "block", es.position = "absolute", es.top = 0, es.left = 0, es.bottom = 0, es.right = 0;
|
||||
else if (void 0 !== K && void 0 !== Q) {
|
||||
var eh = Q / K, ey = isNaN(eh) ? "100%" : "".concat(100 * eh, "%");
|
||||
"responsive" === H ? (es.display = "block", es.position = "relative", ef = !0, ec.paddingTop = ey) : "intrinsic" === H ? (es.display = "inline-block", es.position = "relative", es.maxWidth = "100%", ef = !0, ec.maxWidth = "100%", r = "data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27".concat(K, "%27%20height=%27").concat(Q, "%27/%3e")) : "fixed" === H && (es.display = "inline-block", es.position = "relative", es.width = K, es.height = Q);
|
||||
}
|
||||
var ey = {
|
||||
var eg = {
|
||||
src: m,
|
||||
srcSet: void 0,
|
||||
sizes: void 0
|
||||
};
|
||||
eu && (ey = E({
|
||||
el && (eg = E({
|
||||
config: q,
|
||||
src: u,
|
||||
unoptimized: D,
|
||||
layout: V,
|
||||
width: Y,
|
||||
quality: Q,
|
||||
layout: H,
|
||||
width: K,
|
||||
quality: $,
|
||||
sizes: l,
|
||||
loader: H
|
||||
loader: Z
|
||||
}));
|
||||
var eg = u, ev = "imagesizes";
|
||||
ev = "imageSizes";
|
||||
var eb = (i(n = {}, "imageSrcSet", ey.srcSet), i(n, ev, ey.sizes), n), em = s.default.useLayoutEffect, eD = s.useRef(N), ew = s.useRef(u);
|
||||
var ev = u, eb = "imagesizes";
|
||||
eb = "imageSizes";
|
||||
var em = (i(n = {}, "imageSrcSet", eg.srcSet), i(n, eb, eg.sizes), n), eD = s.default.useLayoutEffect, ew = s.useRef(N), eE = s.useRef(u);
|
||||
s.useEffect(function() {
|
||||
eD.current = N;
|
||||
ew.current = N;
|
||||
}, [
|
||||
N
|
||||
]), em(function() {
|
||||
ew.current !== u && (ea(), ew.current = u);
|
||||
]), eD(function() {
|
||||
eE.current !== u && (eu(), eE.current = u);
|
||||
}, [
|
||||
ea,
|
||||
eu,
|
||||
u
|
||||
]);
|
||||
var eE = y({
|
||||
isLazy: $,
|
||||
imgAttributes: ey,
|
||||
heightInt: K,
|
||||
widthInt: Y,
|
||||
qualityInt: Q,
|
||||
layout: V,
|
||||
var e_ = y({
|
||||
isLazy: ee,
|
||||
imgAttributes: eg,
|
||||
heightInt: Q,
|
||||
widthInt: K,
|
||||
qualityInt: $,
|
||||
layout: H,
|
||||
className: P,
|
||||
imgStyle: ef,
|
||||
blurStyle: ed,
|
||||
imgStyle: ed,
|
||||
blurStyle: ep,
|
||||
loading: T,
|
||||
config: q,
|
||||
unoptimized: D,
|
||||
placeholder: U,
|
||||
loader: H,
|
||||
srcString: eg,
|
||||
onLoadingCompleteRef: eD,
|
||||
setBlurComplete: er,
|
||||
setIntersection: ei,
|
||||
isVisible: eu
|
||||
}, W);
|
||||
return s.default.createElement(s.default.Fragment, null, "raw" === V ? s.default.createElement(A, Object.assign({}, eE)) : s.default.createElement("span", {
|
||||
style: el
|
||||
}, ec ? s.default.createElement("span", {
|
||||
loader: Z,
|
||||
srcString: ev,
|
||||
onLoadingCompleteRef: ew,
|
||||
setBlurComplete: en,
|
||||
setIntersection: eo,
|
||||
isVisible: el
|
||||
}, V);
|
||||
return s.default.createElement(s.default.Fragment, null, "raw" === H ? s.default.createElement(A, Object.assign({}, e_)) : s.default.createElement("span", {
|
||||
style: es
|
||||
}, ef ? s.default.createElement("span", {
|
||||
style: ec
|
||||
}, r ? s.default.createElement("img", {
|
||||
style: {
|
||||
display: "block",
|
||||
@ -15011,12 +15011,12 @@
|
||||
alt: "",
|
||||
"aria-hidden": !0,
|
||||
src: r
|
||||
}) : null) : null, s.default.createElement(A, Object.assign({}, eE))), k ? s.default.createElement(c.default, null, s.default.createElement("link", Object.assign({
|
||||
key: "__nimg-" + ey.src + ey.srcSet + ey.sizes,
|
||||
}) : null) : null, s.default.createElement(A, Object.assign({}, e_))), k ? s.default.createElement(c.default, null, s.default.createElement("link", Object.assign({
|
||||
key: "__nimg-" + eg.src + eg.srcSet + eg.sizes,
|
||||
rel: "preload",
|
||||
as: "image",
|
||||
href: ey.srcSet ? void 0 : ey.src
|
||||
}, eb))) : null);
|
||||
href: eg.srcSet ? void 0 : eg.src
|
||||
}, em))) : null);
|
||||
};
|
||||
var l, s = function(e) {
|
||||
if (e && e.__esModule) return e;
|
||||
|
Loading…
Reference in New Issue
Block a user