import { jsx, jsxs } from "react/jsx-runtime";
import "react";
import { Button, Result, Typography } from "antd";
import { useErrorBoundary } from "react-error-boundary";
import { Trans, useTranslation } from "react-i18next";
const { Paragraph, Text, Link } = Typography;
const ErrorFallback = (param)=>{
    let { error } = param;
    const { resetBoundary } = useErrorBoundary();
    const { t } = useTranslation();
    const subTitle = /*#__PURE__*/ jsxs(Trans, {
        children: [
            'This is likely a Tachybase internals bug. Please open an issue at ',
            /*#__PURE__*/ jsx(Link, {
                href: "https://github.com/tegojs/tego-standard/issues",
                target: "_blank",
                children: "here"
            })
        ]
    });
    return /*#__PURE__*/ jsx("div", {
        style: {
            backgroundColor: 'white'
        },
        children: /*#__PURE__*/ jsx(Result, {
            style: {
                maxWidth: '60vw',
                margin: 'auto'
            },
            status: "error",
            title: t('Render Failed'),
            subTitle: subTitle,
            extra: [
                /*#__PURE__*/ jsx(Button, {
                    type: "primary",
                    href: "https://github.com/tegojs/tego-standard/issues",
                    target: "_blank",
                    children: t('Feedback')
                }, "feedback"),
                /*#__PURE__*/ jsx(Button, {
                    onClick: resetBoundary,
                    children: t('Try again')
                }, "try")
            ],
            children: /*#__PURE__*/ jsx(Paragraph, {
                copyable: true,
                children: /*#__PURE__*/ jsx(Text, {
                    type: "danger",
                    style: {
                        whiteSpace: 'pre-line',
                        textAlign: 'center'
                    },
                    children: error.stack
                })
            })
        })
    });
};
export { ErrorFallback };
