import { Typography } from "../UI/dataDisplay/typography/Typography.mjs";
import { Adornment } from "../UI/components/feedback/Adornment.mjs";
import { Sticky } from "../UI/components/dataDisplay/Sticky.mjs";
import React, { Component } from "react";
//#region src/errorBoundary/ErrorBoundary.jsx
var ErrorBoundary = class extends Component {
	constructor(props) {
		super(props);
		this.state = { hasError: false };
		if (import.meta.env && import.meta.env.DEV && import.meta.hot) import.meta.hot.on("vite:beforeUpdate", () => {
			if (this.state.hasError) this.setState({ hasError: false });
		});
	}
	static getDerivedStateFromError(error) {
		return { hasError: true };
	}
	componentDidCatch(error, info) {
		console.log(error);
		console.log(info);
	}
	render() {
		const { hasError } = this.state;
		const { children } = this.props;
		if (hasError) return /* @__PURE__ */ React.createElement("div", { style: {
			height: "100%",
			display: "flex"
		} }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Adornment, { color: "error" })), /* @__PURE__ */ React.createElement("div", { style: { marginLeft: 32 } }, /* @__PURE__ */ React.createElement("div", { style: { marginTop: 64 } }, /* @__PURE__ */ React.createElement(Typography, {
			style: { margin: 8 },
			variant: "h3"
		}, "A fatal error has occurred."), /* @__PURE__ */ React.createElement(Typography, {
			style: { margin: 8 },
			variant: "body2"
		}, "We are sorry this happened. A log of this error has been recorded and sent to support.")), /* @__PURE__ */ React.createElement("div", { style: {
			marginTop: 118,
			display: "flex",
			flexDirection: "column",
			alignItems: "flex-start"
		} }, /* @__PURE__ */ React.createElement(Sticky, {
			text: "Create a support ticket",
			size: "small",
			color: "success"
		}), /* @__PURE__ */ React.createElement(Sticky, {
			text: "Report this bug",
			size: "small",
			color: "warning"
		}), /* @__PURE__ */ React.createElement(Sticky, {
			text: "View Documents",
			size: "small",
			color: "info"
		}))));
		return children;
	}
};
//#endregion
export { ErrorBoundary as default };

//# sourceMappingURL=ErrorBoundary.mjs.map