123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- exports.id = 7477;
- exports.ids = [7477];
- exports.modules = {
- /***/ 7477:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- module.exports = __webpack_require__(82003)
- /***/ }),
- /***/ 82003:
- /***/ ((module, exports, __webpack_require__) => {
- "use strict";
- "client";
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports["default"] = Image;
- var _extends = (__webpack_require__(25550)/* ["default"] */ .Z);
- var _interop_require_default = (__webpack_require__(40213)/* ["default"] */ .Z);
- var _interop_require_wildcard = (__webpack_require__(95928)/* ["default"] */ .Z);
- var _object_without_properties_loose = (__webpack_require__(36969)/* ["default"] */ .Z);
- var _react = _interop_require_wildcard(__webpack_require__(16689));
- var _head = _interop_require_default(__webpack_require__(94957));
- var _imageConfig = __webpack_require__(35843);
- var _useIntersection = __webpack_require__(99879);
- var _imageConfigContext = __webpack_require__(50744);
- var _utils = __webpack_require__(59232);
- var _normalizeTrailingSlash = __webpack_require__(68641);
- function Image(_param) {
- var { src , sizes , unoptimized =false , priority =false , loading , lazyRoot =null , lazyBoundary , className , quality , width , height , style , objectFit , objectPosition , onLoadingComplete , placeholder ="empty" , blurDataURL } = _param, all = _object_without_properties_loose(_param, [
- "src",
- "sizes",
- "unoptimized",
- "priority",
- "loading",
- "lazyRoot",
- "lazyBoundary",
- "className",
- "quality",
- "width",
- "height",
- "style",
- "objectFit",
- "objectPosition",
- "onLoadingComplete",
- "placeholder",
- "blurDataURL"
- ]);
- const configContext = (0, _react).useContext(_imageConfigContext.ImageConfigContext);
- const config = (0, _react).useMemo(()=>{
- const c = configEnv || configContext || _imageConfig.imageConfigDefault;
- const allSizes = [
- ...c.deviceSizes,
- ...c.imageSizes
- ].sort((a, b)=>a - b);
- const deviceSizes = c.deviceSizes.sort((a, b)=>a - b);
- return _extends({}, c, {
- allSizes,
- deviceSizes
- });
- }, [
- configContext
- ]);
- let rest = all;
- let layout = sizes ? "responsive" : "intrinsic";
- if ("layout" in rest) {
- // Override default layout if the user specified one:
- if (rest.layout) layout = rest.layout;
- // Remove property so it's not spread on <img>:
- delete rest.layout;
- }
- let loader = defaultImageLoader;
- if ("loader" in rest) {
- if (rest.loader) {
- const customImageLoader = rest.loader;
- var _tmp;
- _tmp = (obj)=>{
- const { config: _ } = obj, opts = _object_without_properties_loose(obj, [
- "config"
- ]);
- // The config object is internal only so we must
- // not pass it to the user-defined loader()
- return customImageLoader(opts);
- }, loader = _tmp, _tmp;
- }
- // Remove property so it's not spread on <img>
- delete rest.loader;
- }
- let staticSrc = "";
- if (isStaticImport(src)) {
- const staticImageData = isStaticRequire(src) ? src.default : src;
- 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 ${JSON.stringify(staticImageData)}`);
- }
- blurDataURL = blurDataURL || staticImageData.blurDataURL;
- staticSrc = staticImageData.src;
- if (!layout || layout !== "fill") {
- height = height || staticImageData.height;
- width = width || staticImageData.width;
- if (!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 ${JSON.stringify(staticImageData)}`);
- }
- }
- }
- src = typeof src === "string" ? src : staticSrc;
- let isLazy = !priority && (loading === "lazy" || typeof loading === "undefined");
- if (src.startsWith("data:") || src.startsWith("blob:")) {
- // https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs
- unoptimized = true;
- isLazy = false;
- }
- if (false) {}
- if (config.unoptimized) {
- unoptimized = true;
- }
- const [blurComplete, setBlurComplete] = (0, _react).useState(false);
- const [setIntersection, isIntersected, resetIntersected] = (0, _useIntersection).useIntersection({
- rootRef: lazyRoot,
- rootMargin: lazyBoundary || "200px",
- disabled: !isLazy
- });
- const isVisible = !isLazy || isIntersected;
- const wrapperStyle = {
- boxSizing: "border-box",
- display: "block",
- overflow: "hidden",
- width: "initial",
- height: "initial",
- background: "none",
- opacity: 1,
- border: 0,
- margin: 0,
- padding: 0
- };
- const sizerStyle = {
- boxSizing: "border-box",
- display: "block",
- width: "initial",
- height: "initial",
- background: "none",
- opacity: 1,
- border: 0,
- margin: 0,
- padding: 0
- };
- let hasSizer = false;
- let sizerSvgUrl;
- const layoutStyle = {
- 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,
- objectPosition
- };
- let widthInt = getInt(width);
- let heightInt = getInt(height);
- const qualityInt = getInt(quality);
- if (false) {}
- const imgStyle = Object.assign({}, style, layoutStyle);
- const blurStyle = placeholder === "blur" && !blurComplete ? {
- backgroundSize: objectFit || "cover",
- backgroundPosition: objectPosition || "0% 0%",
- filter: "blur(20px)",
- backgroundImage: `url("${blurDataURL}")`
- } : {};
- if (layout === "fill") {
- // <Image src="i.png" layout="fill" />
- wrapperStyle.display = "block";
- wrapperStyle.position = "absolute";
- wrapperStyle.top = 0;
- wrapperStyle.left = 0;
- wrapperStyle.bottom = 0;
- wrapperStyle.right = 0;
- } else if (typeof widthInt !== "undefined" && typeof heightInt !== "undefined") {
- // <Image src="i.png" width="100" height="100" />
- const quotient = heightInt / widthInt;
- const paddingTop = isNaN(quotient) ? "100%" : `${quotient * 100}%`;
- if (layout === "responsive") {
- // <Image src="i.png" width="100" height="100" layout="responsive" />
- wrapperStyle.display = "block";
- wrapperStyle.position = "relative";
- hasSizer = true;
- sizerStyle.paddingTop = paddingTop;
- } else if (layout === "intrinsic") {
- // <Image src="i.png" width="100" height="100" layout="intrinsic" />
- wrapperStyle.display = "inline-block";
- wrapperStyle.position = "relative";
- wrapperStyle.maxWidth = "100%";
- hasSizer = true;
- sizerStyle.maxWidth = "100%";
- sizerSvgUrl = `data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27${widthInt}%27%20height=%27${heightInt}%27/%3e`;
- } else if (layout === "fixed") {
- // <Image src="i.png" width="100" height="100" layout="fixed" />
- wrapperStyle.display = "inline-block";
- wrapperStyle.position = "relative";
- wrapperStyle.width = widthInt;
- wrapperStyle.height = heightInt;
- }
- } else {
- // <Image src="i.png" />
- if (false) {}
- }
- let imgAttributes = {
- src: emptyDataURL,
- srcSet: undefined,
- sizes: undefined
- };
- if (isVisible) {
- imgAttributes = generateImgAttrs({
- config,
- src,
- unoptimized,
- layout,
- width: widthInt,
- quality: qualityInt,
- sizes,
- loader
- });
- }
- let srcString = src;
- if (false) {}
- let imageSrcSetPropName = "imagesrcset";
- let imageSizesPropName = "imagesizes";
- if (false) {}
- const linkProps = {
- // Note: imagesrcset and imagesizes are not in the link element type with react 17.
- [imageSrcSetPropName]: imgAttributes.srcSet,
- [imageSizesPropName]: imgAttributes.sizes,
- crossOrigin: rest.crossOrigin
- };
- const useLayoutEffect = true ? _react.default.useEffect : 0;
- const onLoadingCompleteRef = (0, _react).useRef(onLoadingComplete);
- const previousImageSrc = (0, _react).useRef(src);
- (0, _react).useEffect(()=>{
- onLoadingCompleteRef.current = onLoadingComplete;
- }, [
- onLoadingComplete
- ]);
- useLayoutEffect(()=>{
- if (previousImageSrc.current !== src) {
- resetIntersected();
- previousImageSrc.current = src;
- }
- }, [
- resetIntersected,
- src
- ]);
- const imgElementArgs = _extends({
- isLazy,
- imgAttributes,
- heightInt,
- widthInt,
- qualityInt,
- layout,
- className,
- imgStyle,
- blurStyle,
- loading,
- config,
- unoptimized,
- placeholder,
- loader,
- srcString,
- onLoadingCompleteRef,
- setBlurComplete,
- setIntersection,
- isVisible,
- noscriptSizes: sizes
- }, rest);
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement("span", {
- style: wrapperStyle
- }, hasSizer ? /*#__PURE__*/ _react.default.createElement("span", {
- style: sizerStyle
- }, sizerSvgUrl ? /*#__PURE__*/ _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": true,
- src: sizerSvgUrl
- }) : null) : null, /*#__PURE__*/ _react.default.createElement(ImageElement, Object.assign({}, imgElementArgs))), priority ? // for browsers that do not support `imagesrcset`, and in those cases
- // it would likely cause the incorrect image to be preloaded.
- //
- // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset
- /*#__PURE__*/ _react.default.createElement(_head.default, null, /*#__PURE__*/ _react.default.createElement("link", Object.assign({
- key: "__nimg-" + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes,
- rel: "preload",
- as: "image",
- href: imgAttributes.srcSet ? undefined : imgAttributes.src
- }, linkProps))) : null);
- }
- "client";
- function normalizeSrc(src) {
- return src[0] === "/" ? src.slice(1) : src;
- }
- const configEnv = {"deviceSizes":[640,750,828,1080,1200,1920,2048,3840],"imageSizes":[16,32,48,64,96,128,256,384],"path":"/_next/image","loader":"default","dangerouslyAllowSVG":false,"unoptimized":false};
- const loadedImageURLs = new Set();
- const allImgs = new Map();
- let perfObserver;
- const emptyDataURL = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
- if (true) {
- global.__NEXT_IMAGE_IMPORTED = true;
- }
- const VALID_LOADING_VALUES = (/* unused pure expression or super */ null && ([
- "lazy",
- "eager",
- undefined
- ]));
- function imgixLoader({ config , src , width , quality }) {
- // Demo: https://static.imgix.net/daisy.png?auto=format&fit=max&w=300
- const url = new URL(`${config.path}${normalizeSrc(src)}`);
- const params = url.searchParams;
- // auto params can be combined with comma separation, or reiteration
- params.set("auto", params.getAll("auto").join(",") || "format");
- params.set("fit", params.get("fit") || "max");
- params.set("w", params.get("w") || width.toString());
- if (quality) {
- params.set("q", quality.toString());
- }
- return url.href;
- }
- function akamaiLoader({ config , src , width }) {
- return `${config.path}${normalizeSrc(src)}?imwidth=${width}`;
- }
- function cloudinaryLoader({ config , src , width , quality }) {
- // Demo: https://res.cloudinary.com/demo/image/upload/w_300,c_limit,q_auto/turtles.jpg
- const params = [
- "f_auto",
- "c_limit",
- "w_" + width,
- "q_" + (quality || "auto")
- ];
- const paramsString = params.join(",") + "/";
- return `${config.path}${paramsString}${normalizeSrc(src)}`;
- }
- function customLoader({ src }) {
- throw new Error(`Image with src "${src}" is missing "loader" prop.` + `\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader`);
- }
- function defaultLoader({ config , src , width , quality }) {
- if (false) {}
- if (src.endsWith(".svg") && !config.dangerouslyAllowSVG) {
- // Special case to make svg serve as-is to avoid proxying
- // through the built-in Image Optimization API.
- return src;
- }
- return `${(0, _normalizeTrailingSlash).normalizePathTrailingSlash(config.path)}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`;
- }
- const loaders = new Map([
- [
- "default",
- defaultLoader
- ],
- [
- "imgix",
- imgixLoader
- ],
- [
- "cloudinary",
- cloudinaryLoader
- ],
- [
- "akamai",
- akamaiLoader
- ],
- [
- "custom",
- customLoader
- ],
- ]);
- const VALID_LAYOUT_VALUES = (/* unused pure expression or super */ null && ([
- "fill",
- "fixed",
- "intrinsic",
- "responsive",
- undefined,
- ]));
- function isStaticRequire(src) {
- return src.default !== undefined;
- }
- function isStaticImageData(src) {
- return src.src !== undefined;
- }
- function isStaticImport(src) {
- return typeof src === "object" && (isStaticRequire(src) || isStaticImageData(src));
- }
- function getWidths({ deviceSizes , allSizes }, width, layout, sizes) {
- if (sizes && (layout === "fill" || layout === "responsive")) {
- // Find all the "vw" percent sizes used in the sizes prop
- const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g;
- const percentSizes = [];
- for(let match; match = viewportWidthRe.exec(sizes); match){
- percentSizes.push(parseInt(match[2]));
- }
- if (percentSizes.length) {
- const smallestRatio = Math.min(...percentSizes) * 0.01;
- return {
- widths: allSizes.filter((s)=>s >= deviceSizes[0] * smallestRatio),
- kind: "w"
- };
- }
- return {
- widths: allSizes,
- kind: "w"
- };
- }
- if (typeof width !== "number" || layout === "fill" || layout === "responsive") {
- return {
- widths: deviceSizes,
- kind: "w"
- };
- }
- const widths = [
- ...new Set(// > are actually 3x in the green color, but only 1.5x in the red and
- // > blue colors. Showing a 3x resolution image in the app vs a 2x
- // > resolution image will be visually the same, though the 3x image
- // > takes significantly more data. Even true 3x resolution screens are
- // > wasteful as the human eye cannot see that level of detail without
- // > something like a magnifying glass.
- // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
- [
- width,
- width * 2 /*, width * 3*/
- ].map((w)=>allSizes.find((p)=>p >= w) || allSizes[allSizes.length - 1])),
- ];
- return {
- widths,
- kind: "x"
- };
- }
- function generateImgAttrs({ config , src , unoptimized , layout , width , quality , sizes , loader }) {
- if (unoptimized) {
- return {
- src,
- srcSet: undefined,
- sizes: undefined
- };
- }
- const { widths , kind } = getWidths(config, width, layout, sizes);
- const last = widths.length - 1;
- return {
- sizes: !sizes && kind === "w" ? "100vw" : sizes,
- srcSet: widths.map((w, i)=>`${loader({
- config,
- src,
- quality,
- width: w
- })} ${kind === "w" ? w : i + 1}${kind}`).join(", "),
- // It's intended to keep `src` the last attribute because React updates
- // attributes in order. If we keep `src` the first one, Safari will
- // immediately start to fetch `src`, before `sizes` and `srcSet` are even
- // updated by React. That causes multiple unnecessary requests if `srcSet`
- // and `sizes` are defined.
- // This bug cannot be reproduced in Chrome or Firefox.
- src: loader({
- config,
- src,
- quality,
- width: widths[last]
- })
- };
- }
- function getInt(x) {
- if (typeof x === "number") {
- return x;
- }
- if (typeof x === "string") {
- return parseInt(x, 10);
- }
- return undefined;
- }
- function defaultImageLoader(loaderProps) {
- var ref;
- const loaderKey = ((ref = loaderProps.config) == null ? void 0 : ref.loader) || "default";
- const load = loaders.get(loaderKey);
- if (load) {
- return load(loaderProps);
- }
- throw new Error(`Unknown "loader" found in "next.config.js". Expected: ${_imageConfig.VALID_LOADERS.join(", ")}. Received: ${loaderKey}`);
- }
- // See https://stackoverflow.com/q/39777833/266535 for why we use this ref
- // handler instead of the img's onLoad attribute.
- function handleLoading(img, src, layout, placeholder, onLoadingCompleteRef, setBlurComplete) {
- if (!img || img.src === emptyDataURL || img["data-loaded-src"] === src) {
- return;
- }
- img["data-loaded-src"] = src;
- const p = "decode" in img ? img.decode() : Promise.resolve();
- p.catch(()=>{}).then(()=>{
- if (!img.parentNode) {
- // Exit early in case of race condition:
- // - onload() is called
- // - decode() is called but incomplete
- // - unmount is called
- // - decode() completes
- return;
- }
- loadedImageURLs.add(src);
- if (placeholder === "blur") {
- setBlurComplete(true);
- }
- if (onLoadingCompleteRef == null ? void 0 : onLoadingCompleteRef.current) {
- const { naturalWidth , naturalHeight } = img;
- // Pass back read-only primitive values but not the
- // underlying DOM element because it could be misused.
- onLoadingCompleteRef.current({
- naturalWidth,
- naturalHeight
- });
- }
- if (false) { var ref; }
- });
- }
- const ImageElement = (_param)=>{
- var { imgAttributes , heightInt , widthInt , qualityInt , layout , className , imgStyle , blurStyle , isLazy , placeholder , loading , srcString , config , unoptimized , loader , onLoadingCompleteRef , setBlurComplete , setIntersection , onLoad , onError , isVisible , noscriptSizes } = _param, rest = _object_without_properties_loose(_param, [
- "imgAttributes",
- "heightInt",
- "widthInt",
- "qualityInt",
- "layout",
- "className",
- "imgStyle",
- "blurStyle",
- "isLazy",
- "placeholder",
- "loading",
- "srcString",
- "config",
- "unoptimized",
- "loader",
- "onLoadingCompleteRef",
- "setBlurComplete",
- "setIntersection",
- "onLoad",
- "onError",
- "isVisible",
- "noscriptSizes"
- ]);
- loading = isLazy ? "lazy" : loading;
- return /*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement("img", Object.assign({}, rest, imgAttributes, {
- decoding: "async",
- "data-nimg": layout,
- className: className,
- style: _extends({}, imgStyle, blurStyle),
- ref: (0, _react).useCallback((img)=>{
- if (false) {}
- setIntersection(img);
- if (img == null ? void 0 : img.complete) {
- handleLoading(img, srcString, layout, placeholder, onLoadingCompleteRef, setBlurComplete);
- }
- }, [
- setIntersection,
- srcString,
- layout,
- placeholder,
- onLoadingCompleteRef,
- setBlurComplete,
- ]),
- onLoad: (event)=>{
- const img = event.currentTarget;
- handleLoading(img, srcString, layout, placeholder, onLoadingCompleteRef, setBlurComplete);
- if (onLoad) {
- onLoad(event);
- }
- },
- onError: (event)=>{
- if (placeholder === "blur") {
- // If the real image fails to load, this will still remove the placeholder.
- setBlurComplete(true);
- }
- if (onError) {
- onError(event);
- }
- }
- })), (isLazy || placeholder === "blur") && /*#__PURE__*/ _react.default.createElement("noscript", null, /*#__PURE__*/ _react.default.createElement("img", Object.assign({}, rest, generateImgAttrs({
- config,
- src: srcString,
- unoptimized,
- layout,
- width: widthInt,
- quality: qualityInt,
- sizes: noscriptSizes,
- loader
- }), {
- decoding: "async",
- "data-nimg": layout,
- style: imgStyle,
- className: className,
- // @ts-ignore - TODO: upgrade to `@types/react@17`
- loading: loading
- }))));
- };
- if ((typeof exports.default === "function" || typeof exports.default === "object" && exports.default !== null) && typeof exports.default.__esModule === "undefined") {
- Object.defineProperty(exports.default, "__esModule", {
- value: true
- });
- Object.assign(exports.default, exports);
- module.exports = exports.default;
- } //# sourceMappingURL=image.js.map
- /***/ })
- };
- ;
- //# sourceMappingURL=7477.js.map
|