PHP 7.4.33
Preview: image-component.js Size: 13.95 KB
/var/www/wordpress-nextjs.wpress.dk/httpdocs/node_modules/next/dist/client/image-component.js
"use client";

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "Image", {
    enumerable: true,
    get: function() {
        return Image;
    }
});
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
const _jsxruntime = require("react/jsx-runtime");
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
const _reactdom = /*#__PURE__*/ _interop_require_default._(require("react-dom"));
const _head = /*#__PURE__*/ _interop_require_default._(require("../shared/lib/head"));
const _getimgprops = require("../shared/lib/get-img-props");
const _imageconfig = require("../shared/lib/image-config");
const _imageconfigcontextsharedruntime = require("../shared/lib/image-config-context.shared-runtime");
const _warnonce = require("../shared/lib/utils/warn-once");
const _routercontextsharedruntime = require("../shared/lib/router-context.shared-runtime");
const _imageloader = /*#__PURE__*/ _interop_require_default._(require("next/dist/shared/lib/image-loader"));
// This is replaced by webpack define plugin
const configEnv = process.env.__NEXT_IMAGE_OPTS;
if (typeof window === "undefined") {
    globalThis.__NEXT_IMAGE_IMPORTED = true;
}
// See https://stackoverflow.com/q/39777833/266535 for why we use this ref
// handler instead of the img's onLoad attribute.
function handleLoading(img, placeholder, onLoadRef, onLoadingCompleteRef, setBlurComplete, unoptimized, sizesInput) {
    const src = img == null ? void 0 : img.src;
    if (!img || 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.parentElement || !img.isConnected) {
            // Exit early in case of race condition:
            // - onload() is called
            // - decode() is called but incomplete
            // - unmount is called
            // - decode() completes
            return;
        }
        if (placeholder !== "empty") {
            setBlurComplete(true);
        }
        if (onLoadRef == null ? void 0 : onLoadRef.current) {
            // Since we don't have the SyntheticEvent here,
            // we must create one with the same shape.
            // See https://reactjs.org/docs/events.html
            const event = new Event("load");
            Object.defineProperty(event, "target", {
                writable: false,
                value: img
            });
            let prevented = false;
            let stopped = false;
            onLoadRef.current({
                ...event,
                nativeEvent: event,
                currentTarget: img,
                target: img,
                isDefaultPrevented: ()=>prevented,
                isPropagationStopped: ()=>stopped,
                persist: ()=>{},
                preventDefault: ()=>{
                    prevented = true;
                    event.preventDefault();
                },
                stopPropagation: ()=>{
                    stopped = true;
                    event.stopPropagation();
                }
            });
        }
        if (onLoadingCompleteRef == null ? void 0 : onLoadingCompleteRef.current) {
            onLoadingCompleteRef.current(img);
        }
        if (process.env.NODE_ENV !== "production") {
            const origSrc = new URL(src, "http://n").searchParams.get("url") || src;
            if (img.getAttribute("data-nimg") === "fill") {
                if (!unoptimized && (!sizesInput || sizesInput === "100vw")) {
                    let widthViewportRatio = img.getBoundingClientRect().width / window.innerWidth;
                    if (widthViewportRatio < 0.6) {
                        if (sizesInput === "100vw") {
                            (0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" prop and "sizes" prop of "100vw", but image is not rendered at full viewport width. Please adjust "sizes" to improve page performance. Read more: https://nextjs.org/docs/api-reference/next/image#sizes');
                        } else {
                            (0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" but is missing "sizes" prop. Please add it to improve page performance. Read more: https://nextjs.org/docs/api-reference/next/image#sizes');
                        }
                    }
                }
                if (img.parentElement) {
                    const { position } = window.getComputedStyle(img.parentElement);
                    const valid = [
                        "absolute",
                        "fixed",
                        "relative"
                    ];
                    if (!valid.includes(position)) {
                        (0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" and parent element with invalid "position". Provided "' + position + '" should be one of ' + valid.map(String).join(",") + ".");
                    }
                }
                if (img.height === 0) {
                    (0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has "fill" and a height value of 0. This is likely because the parent element of the image has not been styled to have a set height.');
                }
            }
            const heightModified = img.height.toString() !== img.getAttribute("height");
            const widthModified = img.width.toString() !== img.getAttribute("width");
            if (heightModified && !widthModified || !heightModified && widthModified) {
                (0, _warnonce.warnOnce)('Image with src "' + origSrc + '" has either width or height modified, but not the other. If you use CSS to change the size of your image, also include the styles \'width: "auto"\' or \'height: "auto"\' to maintain the aspect ratio.');
            }
        }
    });
}
function getDynamicProps(fetchPriority) {
    if (Boolean(_react.use)) {
        // In React 19.0.0 or newer, we must use camelCase
        // prop to avoid "Warning: Invalid DOM property".
        // See https://github.com/facebook/react/pull/25927
        return {
            fetchPriority
        };
    }
    // In React 18.2.0 or older, we must use lowercase prop
    // to avoid "Warning: Invalid DOM property".
    return {
        fetchpriority: fetchPriority
    };
}
const ImageElement = /*#__PURE__*/ (0, _react.forwardRef)((param, forwardedRef)=>{
    let { src, srcSet, sizes, height, width, decoding, className, style, fetchPriority, placeholder, loading, unoptimized, fill, onLoadRef, onLoadingCompleteRef, setBlurComplete, setShowAltText, sizesInput, onLoad, onError, ...rest } = param;
    return /*#__PURE__*/ (0, _jsxruntime.jsx)("img", {
        ...rest,
        ...getDynamicProps(fetchPriority),
        // It's intended to keep `loading` before `src` because React updates
        // props in order which causes Safari/Firefox to not lazy load properly.
        // See https://github.com/facebook/react/issues/25883
        loading: loading,
        width: width,
        height: height,
        decoding: decoding,
        "data-nimg": fill ? "fill" : "1",
        className: className,
        style: style,
        // 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.
        sizes: sizes,
        srcSet: srcSet,
        src: src,
        ref: (0, _react.useCallback)((img)=>{
            if (forwardedRef) {
                if (typeof forwardedRef === "function") forwardedRef(img);
                else if (typeof forwardedRef === "object") {
                    // @ts-ignore - .current is read only it's usually assigned by react internally
                    forwardedRef.current = img;
                }
            }
            if (!img) {
                return;
            }
            if (onError) {
                // If the image has an error before react hydrates, then the error is lost.
                // The workaround is to wait until the image is mounted which is after hydration,
                // then we set the src again to trigger the error handler (if there was an error).
                // eslint-disable-next-line no-self-assign
                img.src = img.src;
            }
            if (process.env.NODE_ENV !== "production") {
                if (!src) {
                    console.error('Image is missing required "src" property:', img);
                }
                if (img.getAttribute("alt") === null) {
                    console.error('Image is missing required "alt" property. Please add Alternative Text to describe the image for screen readers and search engines.');
                }
            }
            if (img.complete) {
                handleLoading(img, placeholder, onLoadRef, onLoadingCompleteRef, setBlurComplete, unoptimized, sizesInput);
            }
        }, [
            src,
            placeholder,
            onLoadRef,
            onLoadingCompleteRef,
            setBlurComplete,
            onError,
            unoptimized,
            sizesInput,
            forwardedRef
        ]),
        onLoad: (event)=>{
            const img = event.currentTarget;
            handleLoading(img, placeholder, onLoadRef, onLoadingCompleteRef, setBlurComplete, unoptimized, sizesInput);
        },
        onError: (event)=>{
            // if the real image fails to load, this will ensure "alt" is visible
            setShowAltText(true);
            if (placeholder !== "empty") {
                // If the real image fails to load, this will still remove the placeholder.
                setBlurComplete(true);
            }
            if (onError) {
                onError(event);
            }
        }
    });
});
function ImagePreload(param) {
    let { isAppRouter, imgAttributes } = param;
    const opts = {
        as: "image",
        imageSrcSet: imgAttributes.srcSet,
        imageSizes: imgAttributes.sizes,
        crossOrigin: imgAttributes.crossOrigin,
        referrerPolicy: imgAttributes.referrerPolicy,
        ...getDynamicProps(imgAttributes.fetchPriority)
    };
    if (isAppRouter && _reactdom.default.preload) {
        // See https://github.com/facebook/react/pull/26940
        _reactdom.default.preload(imgAttributes.src, // @ts-expect-error TODO: upgrade to `@types/react-dom@18.3.x`
        opts);
        return null;
    }
    return /*#__PURE__*/ (0, _jsxruntime.jsx)(_head.default, {
        children: /*#__PURE__*/ (0, _jsxruntime.jsx)("link", {
            rel: "preload",
            // Note how we omit the `href` attribute, as it would only be relevant
            // for browsers that do not support `imagesrcset`, and in those cases
            // it would cause the incorrect image to be preloaded.
            //
            // https://html.spec.whatwg.org/multipage/semantics.html#attr-link-imagesrcset
            href: imgAttributes.srcSet ? undefined : imgAttributes.src,
            ...opts
        }, "__nimg-" + imgAttributes.src + imgAttributes.srcSet + imgAttributes.sizes)
    });
}
const Image = /*#__PURE__*/ (0, _react.forwardRef)((props, forwardedRef)=>{
    const pagesRouter = (0, _react.useContext)(_routercontextsharedruntime.RouterContext);
    // We're in the app directory if there is no pages router.
    const isAppRouter = !pagesRouter;
    const configContext = (0, _react.useContext)(_imageconfigcontextsharedruntime.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 {
            ...c,
            allSizes,
            deviceSizes
        };
    }, [
        configContext
    ]);
    const { onLoad, onLoadingComplete } = props;
    const onLoadRef = (0, _react.useRef)(onLoad);
    (0, _react.useEffect)(()=>{
        onLoadRef.current = onLoad;
    }, [
        onLoad
    ]);
    const onLoadingCompleteRef = (0, _react.useRef)(onLoadingComplete);
    (0, _react.useEffect)(()=>{
        onLoadingCompleteRef.current = onLoadingComplete;
    }, [
        onLoadingComplete
    ]);
    const [blurComplete, setBlurComplete] = (0, _react.useState)(false);
    const [showAltText, setShowAltText] = (0, _react.useState)(false);
    const { props: imgAttributes, meta: imgMeta } = (0, _getimgprops.getImgProps)(props, {
        defaultLoader: _imageloader.default,
        imgConf: config,
        blurComplete,
        showAltText
    });
    return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
        children: [
            /*#__PURE__*/ (0, _jsxruntime.jsx)(ImageElement, {
                ...imgAttributes,
                unoptimized: imgMeta.unoptimized,
                placeholder: imgMeta.placeholder,
                fill: imgMeta.fill,
                onLoadRef: onLoadRef,
                onLoadingCompleteRef: onLoadingCompleteRef,
                setBlurComplete: setBlurComplete,
                setShowAltText: setShowAltText,
                sizesInput: props.sizes,
                ref: forwardedRef
            }),
            imgMeta.priority ? /*#__PURE__*/ (0, _jsxruntime.jsx)(ImagePreload, {
                isAppRouter: isAppRouter,
                imgAttributes: imgAttributes
            }) : null
        ]
    });
});

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-component.js.map

Directory Contents

Dirs: 6 × Files: 123
Name Size Perms Modified Actions
compat DIR
- drwxr-xr-x 2024-10-14 10:19:00
Edit Download
- drwxr-xr-x 2024-10-14 10:19:00
Edit Download
dev DIR
- drwxr-xr-x 2024-10-14 10:19:00
Edit Download
legacy DIR
- drwxr-xr-x 2024-10-14 10:19:00
Edit Download
portal DIR
- drwxr-xr-x 2024-10-14 10:19:00
Edit Download
tracing DIR
- drwxr-xr-x 2024-10-14 10:19:00
Edit Download
79 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1010 B lrw-r--r-- 2024-10-14 10:18:53
Edit Download
477 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
121 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.03 KB lrw-r--r-- 2024-10-14 10:18:53
Edit Download
375 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
286 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
2.08 KB lrw-r--r-- 2024-10-14 10:18:54
Edit Download
1.37 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
91 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.01 KB lrw-r--r-- 2024-10-14 10:18:54
Edit Download
443 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
86 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
9.61 KB lrw-r--r-- 2024-10-14 10:18:54
Edit Download
5.62 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
40 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
4.44 KB lrw-r--r-- 2024-10-14 10:18:54
Edit Download
1.87 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
24 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
688 B lrw-r--r-- 2024-10-14 10:18:54
Edit Download
232 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
11 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
729 B lrw-r--r-- 2024-10-14 10:18:54
Edit Download
342 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
24 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
914 B lrw-r--r-- 2024-10-14 10:18:54
Edit Download
264 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
11 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
2.99 KB lrw-r--r-- 2024-10-14 10:18:54
Edit Download
1.01 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
141 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
922 B lrw-r--r-- 2024-10-14 10:18:54
Edit Download
310 B lrw-r--r-- 2024-10-14 10:18:58
Edit Download
202 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.52 KB lrw-r--r-- 2024-10-14 10:18:55
Edit Download
1017 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
60 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
807 B lrw-r--r-- 2024-10-14 10:18:55
Edit Download
318 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.08 KB lrw-r--r-- 2024-10-14 10:19:00
Edit Download
7.89 KB lrw-r--r-- 2024-10-14 10:18:55
Edit Download
5.59 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.49 KB lrw-r--r-- 2024-10-14 10:19:00
Edit Download
13.95 KB lrw-r--r-- 2024-10-14 10:18:55
Edit Download
7.44 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
736 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
31.81 KB lrw-r--r-- 2024-10-14 10:18:55
Edit Download
18.93 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
4.53 KB lrw-r--r-- 2024-10-14 10:19:00
Edit Download
19.51 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
10.65 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
36 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.88 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
1.24 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
56 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.24 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
586 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
87 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
737 B lrw-r--r-- 2024-10-14 10:18:56
Edit Download
393 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
144 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
883 B lrw-r--r-- 2024-10-14 10:18:56
Edit Download
395 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
190 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.42 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
821 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
64 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.23 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
458 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
73 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
6.52 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
3.26 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.34 KB lrw-r--r-- 2024-10-14 10:19:00
Edit Download
5.87 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
3.94 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
158 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
3.95 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
2.29 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
158 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
3.80 KB lrw-r--r-- 2024-10-14 10:18:56
Edit Download
2.23 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
62 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.05 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
610 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
77 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.12 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
688 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
277 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.42 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
740 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
396 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
3.64 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
2.13 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
115 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
3.23 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
1.41 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.66 KB lrw-r--r-- 2024-10-14 10:19:00
Edit Download
12.58 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
8.18 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
1.05 KB lrw-r--r-- 2024-10-14 10:19:00
Edit Download
6.20 KB lrw-r--r-- 2024-10-14 10:18:57
Edit Download
3.11 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
909 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
13.82 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
6.57 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
105 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.16 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
562 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
584 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.49 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
616 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
437 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
3.75 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
2.80 KB lrw-r--r-- 2024-10-14 10:18:59
Edit Download
156 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.08 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
439 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
11 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
2.23 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
919 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
505 B lrw-r--r-- 2024-10-14 10:19:00
Edit Download
1.42 KB lrw-r--r-- 2024-10-14 10:18:58
Edit Download
656 B lrw-r--r-- 2024-10-14 10:18:59
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).