import { jsx, Fragment } from 'react/jsx-runtime';
import { useEffect } from 'react';
import Icon from '../Icon/Icon.js';
import { useOnlineStatus } from '../../utils/OnlineStatus/useOnlineStatus.js';

const NetworkErrorBoundary = ({ children, offlineContent, hasError = false, onNetworkStatusChange, overlayClassName, overlayZIndex = 99998, iconWidth = 300, iconHeight = 300, }) => {
    const isOnline = useOnlineStatus();
    useEffect(() => {
        if (onNetworkStatusChange) {
            onNetworkStatusChange(isOnline);
        }
    }, [isOnline, onNetworkStatusChange]);
    if (hasError || !isOnline) {
        return (jsx("div", { className: `offlineOverlay ${overlayClassName ?? ''}`, style: { zIndex: overlayZIndex }, children: offlineContent || (jsx(Icon, { name: "offline_404_icon", height: iconHeight, width: iconWidth })) }));
    }
    return jsx(Fragment, { children: children });
};

export { NetworkErrorBoundary, NetworkErrorBoundary as default };
//# sourceMappingURL=NetworkErrorBoundary.js.map
