'use strict';

var jsxRuntime = require('../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
var reactIcons_esm = require('../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
var index = require('../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
var body = require('../body/body.cjs');
var flex = require('../flex/flex.cjs');
var headline = require('../headline/headline.cjs');
var errorstate_module = require('./errorstate.module.css.cjs');

const getIcon = (status = "") => {
    switch (status) {
        case "400":
            return jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.FileTextIcon, { width: 80, height: 80 });
        case "NOT_FOUND":
            return jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.FileIcon, { width: 80, height: 80 });
        case "UNDER_MAINTENANCE":
            return jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.ExclamationTriangleIcon, { width: 80, height: 80 });
        case "SOMETHING_WENT_WRONG":
            return jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.ExclamationTriangleIcon, { width: 80, height: 80 });
        default:
            return jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.ExclamationTriangleIcon, { width: 80, height: 80 });
    }
};
const getMessage = (status = "System is facing some issue with your request, please try again later") => {
    switch (status) {
        case "400":
            return "Sorry, the page you are looking for doesn’t exist or has been moved.";
        case "NOT_FOUND":
            return "Sorry, the resource you are looking for doesn’t exist or has been deleted.";
        case "UNDER_MAINTENANCE":
            return "The page you are looking for is under maintenance and will be back soon.";
        case "SOMETHING_WENT_WRONG":
            return "System is facing some issue with your request, please try again later";
        default:
            return status;
    }
};
const getHeadline = (status = "Something gone wrong") => {
    switch (status) {
        case "400":
            return "404 error";
        case "NOT_FOUND":
            return "Resource not found";
        case "UNDER_MAINTENANCE":
            return "Under maintenance";
        case "SOMETHING_WENT_WRONG":
            return "Something gone wrong";
        default:
            return status;
    }
};
const errorstate = index.cva(errorstate_module.default.errorstate);
function ErrorState({ children, className, status, icon, message, ...props }) {
    return (jsxRuntime.jsxRuntimeExports.jsx(flex.Flex, { justify: "center", style: { width: "100%", height: "100%" }, children: jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { direction: "column", gap: "large", align: "center", justify: "center", className: errorstate({ className }), style: { textAlign: "center", maxWidth: "400px" }, ...props, children: [icon ? icon : getIcon(status), jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { direction: "column", gap: "medium", children: [jsxRuntime.jsxRuntimeExports.jsx(headline.Headline, { size: "large", children: getHeadline(status) }), jsxRuntime.jsxRuntimeExports.jsx(body.Body, { size: "large", children: message ? message : getMessage(status) })] })] }) }));
}

exports.ErrorState = ErrorState;
//# sourceMappingURL=errorstate.cjs.map
