import { LayoutUnit } from "../../../layout/LayoutUnit.mjs";
import { PrimaryActionHeader } from "../../utilityDisplay/utilityHeader/PrimaryActionHeader.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Card, makeStyles } from "@material-ui/core";
import { CancelIcon } from "@fluentui/react-icons";
import { useTranslation } from "react-i18next";
import ReactHtmlParser from "react-html-parser";
//#region src/UI/components/dataDisplay/EmailDisplay.jsx
const useStyles = makeStyles((theme) => ({ htmlContainer: {
	display: "flex",
	justifyContent: "center"
} }));
const EmailDisplay = (props) => {
	const $ = c(23);
	const { html: t0, to, from, title, handleClose } = props;
	const html = t0 === void 0 ? "" : t0;
	const classes = useStyles();
	const { t } = useTranslation();
	let buttons;
	if ($[0] !== handleClose || $[1] !== t) {
		buttons = [];
		if (handleClose) {
			let t1;
			if ($[3] !== t) {
				t1 = t("Close");
				$[3] = t;
				$[4] = t1;
			} else t1 = $[4];
			let t2;
			if ($[5] !== handleClose) {
				t2 = () => handleClose();
				$[5] = handleClose;
				$[6] = t2;
			} else t2 = $[6];
			let t3;
			if ($[7] !== t1 || $[8] !== t2) {
				t3 = {
					label: t1,
					component: CancelIcon,
					click: t2
				};
				$[7] = t1;
				$[8] = t2;
				$[9] = t3;
			} else t3 = $[9];
			buttons.push(t3);
		}
		$[0] = handleClose;
		$[1] = t;
		$[2] = buttons;
	} else buttons = $[2];
	const secondaryButtons = buttons;
	const t1 = `To: ${to} . From: ${from}`;
	let t2;
	if ($[10] !== secondaryButtons || $[11] !== t1 || $[12] !== title) {
		t2 = /* @__PURE__ */ React.createElement(Card, { square: true }, /* @__PURE__ */ React.createElement(PrimaryActionHeader, {
			hidePAB: true,
			title,
			subheader: t1,
			secondaryButtons
		}));
		$[10] = secondaryButtons;
		$[11] = t1;
		$[12] = title;
		$[13] = t2;
	} else t2 = $[13];
	let t3;
	if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "sm" });
		$[14] = t3;
	} else t3 = $[14];
	const t4 = classes.htmlContainer;
	let t5;
	if ($[15] !== html) {
		t5 = ReactHtmlParser(html);
		$[15] = html;
		$[16] = t5;
	} else t5 = $[16];
	let t6;
	if ($[17] !== classes.htmlContainer || $[18] !== t5) {
		t6 = /* @__PURE__ */ React.createElement("div", { className: t4 }, t5);
		$[17] = classes.htmlContainer;
		$[18] = t5;
		$[19] = t6;
	} else t6 = $[19];
	let t7;
	if ($[20] !== t2 || $[21] !== t6) {
		t7 = /* @__PURE__ */ React.createElement(React.Fragment, null, t2, t3, t6);
		$[20] = t2;
		$[21] = t6;
		$[22] = t7;
	} else t7 = $[22];
	return t7;
};
//#endregion
export { EmailDisplay };

//# sourceMappingURL=EmailDisplay.mjs.map