import { SeverityTypeEnums } from "../../../../enums/unitySystemEnums.mjs";
import { c } from "react-compiler-runtime";
import React, { memo } from "react";
import { ButtonBase, makeStyles } from "@material-ui/core";
import { Alert } from "@material-ui/lab";
//#region src/UI/dataDisplay/entityHeader/ui/AlertPill.jsx
/**
* Styles for the AlertPill component
*/
const useStyles = makeStyles((theme) => {
	const endRadius = theme.spacing(3);
	return {
		root: {
			display: "flex",
			flexDirection: "row",
			overflow: "hidden",
			flexGrow: 0,
			alignSelf: "start"
		},
		alertRoot: {
			padding: theme.spacing(0, 1.5, 0, 1),
			borderRadius: 0,
			"&:first-of-type": {
				borderTopLeftRadius: endRadius,
				borderBottomLeftRadius: endRadius
			},
			"&:last-of-type": {
				borderTopRightRadius: endRadius,
				borderBottomRightRadius: endRadius
			}
		},
		alertIcon: { marginRight: theme.spacing(.5) },
		buttonBase: {
			borderRadius: endRadius,
			overflow: "hidden"
		},
		defaultSeverityAlert: { backgroundColor: theme.palette.grey[400] }
	};
});
/**
* Memoized version of the Alert component
*
* @param {object} props - Component props
* @param {number} props.count - The count to display in the Alert
* @param {boolean} props.hide - Whether the Alert should be hidden
* @param {string} props.severity - The severity of the Alert
* @param {object} props.alertProps - Additional props to pass to the Alert component
* @param {number} props.maxCount - Max count to show before displaying as "{maxCount}+"
* @returns {JSX.Element | null} - The Alert component, or null if the count is falsy or hide is true
*/
const MemoizedAlert = memo((props) => {
	const $ = c(8);
	const { count, hide, severity, alertProps, maxCount, label } = props;
	const classes = useStyles(props);
	if (count && !hide) {
		let displayCount = count;
		if (maxCount && count > maxCount) displayCount = `${maxCount}+`;
		if (severity === SeverityTypeEnums.Default) {
			let t0;
			if ($[0] !== alertProps || $[1] !== classes.defaultSeverityAlert || $[2] !== displayCount) {
				t0 = /* @__PURE__ */ React.createElement(Alert, {
					severity: SeverityTypeEnums.Info,
					...alertProps,
					className: classes.defaultSeverityAlert
				}, displayCount);
				$[0] = alertProps;
				$[1] = classes.defaultSeverityAlert;
				$[2] = displayCount;
				$[3] = t0;
			} else t0 = $[3];
			return t0;
		}
		const t0 = label ? label : displayCount;
		let t1;
		if ($[4] !== alertProps || $[5] !== severity || $[6] !== t0) {
			t1 = /* @__PURE__ */ React.createElement(Alert, {
				severity,
				...alertProps
			}, t0);
			$[4] = alertProps;
			$[5] = severity;
			$[6] = t0;
			$[7] = t1;
		} else t1 = $[7];
		return t1;
	}
	return null;
});
MemoizedAlert.displayName = "MemoizedAlert";
/**
* The AlertPill component displays a row of Alerts, each with a count and a severity level.
* Alerts can be hidden by setting the corresponding hide prop to true.
*
* @param {object} props - Component props
* @param {function} [props.handleClick] - The click event handler.
* @param {number} props.maxCount - Max count to show before displaying as "{maxCount}+"
* @param {number} props.errorCount - The count for the error Alert
* @param {number} props.warningCount - The count for the warning Alert
* @param {number} props.successCount - The count for the success Alert
* @param {number} props.infoCount - The count for the info Alert
* @param {number} props.defaultCount - The count for the default Alert
* @param {string} props.errorLabel - The label for the error Alert
* @param {string} props.warningLabel - The label for the warning Alert
* @param {string} props.successLabel - The label for the success Alert
* @param {string} props.infoLabel - The label for the info Alert
* @param {string} props.defaultLabel - The label for the default Alert
* @param {boolean} props.hideError - Whether the error Alert should be hidden
* @param {boolean} props.hideWarning - Whether the warning Alert should be hidden
* @param {boolean} props.hideSuccess - Whether the success Alert should be hidden
* @param {boolean} props.hideInfo - Whether the info Alert should be hidden
* @param {boolean} props.hideDefault - Whether the default Alert should be hidden
* @param {string} props.variant - The variant of the Alert
* @param {function} [props.handleClick] - The click event handler.
* @param {number} props.maxCount - Max count to show before displaying as "{maxCount}+"
* @returns {JSX.Element} - The AlertPill component
*/
const AlertPill = (props) => {
	const $ = c(48);
	const { variant: t0, handleClick, maxCount, errorCount, warningCount, successCount, infoCount, defaultCount, errorLabel, warningLabel, successLabel, infoLabel, defaultLabel, hideError: t1, hideWarning: t2, hideSuccess: t3, hideInfo: t4, hideDefault: t5 } = props;
	const variant = t0 === void 0 ? "filled" : t0;
	const hideError = t1 === void 0 ? false : t1;
	const hideWarning = t2 === void 0 ? false : t2;
	const hideSuccess = t3 === void 0 ? false : t3;
	const hideInfo = t4 === void 0 ? false : t4;
	const hideDefault = t5 === void 0 ? false : t5;
	const classes = useStyles(props);
	let t6;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			filled: "filled",
			standard: "hint",
			outlined: "outlined",
			text: ""
		};
		$[0] = t6;
	} else t6 = $[0];
	const t7 = t6[variant];
	let t8;
	if ($[1] !== classes.alertIcon || $[2] !== classes.alertRoot) {
		t8 = {
			root: classes.alertRoot,
			icon: classes.alertIcon
		};
		$[1] = classes.alertIcon;
		$[2] = classes.alertRoot;
		$[3] = t8;
	} else t8 = $[3];
	let t9;
	if ($[4] !== t7 || $[5] !== t8) {
		t9 = {
			variant: t7,
			classes: t8
		};
		$[4] = t7;
		$[5] = t8;
		$[6] = t9;
	} else t9 = $[6];
	const alertProps = t9;
	let t10;
	if ($[7] !== alertProps || $[8] !== errorCount || $[9] !== errorLabel || $[10] !== hideError || $[11] !== maxCount) {
		t10 = /* @__PURE__ */ React.createElement(MemoizedAlert, {
			count: errorCount,
			hide: hideError,
			severity: SeverityTypeEnums.Error,
			alertProps,
			maxCount,
			label: errorLabel
		});
		$[7] = alertProps;
		$[8] = errorCount;
		$[9] = errorLabel;
		$[10] = hideError;
		$[11] = maxCount;
		$[12] = t10;
	} else t10 = $[12];
	let t11;
	if ($[13] !== alertProps || $[14] !== hideWarning || $[15] !== maxCount || $[16] !== warningCount || $[17] !== warningLabel) {
		t11 = /* @__PURE__ */ React.createElement(MemoizedAlert, {
			count: warningCount,
			hide: hideWarning,
			severity: SeverityTypeEnums.Warning,
			alertProps,
			maxCount,
			label: warningLabel
		});
		$[13] = alertProps;
		$[14] = hideWarning;
		$[15] = maxCount;
		$[16] = warningCount;
		$[17] = warningLabel;
		$[18] = t11;
	} else t11 = $[18];
	let t12;
	if ($[19] !== alertProps || $[20] !== hideSuccess || $[21] !== maxCount || $[22] !== successCount || $[23] !== successLabel) {
		t12 = /* @__PURE__ */ React.createElement(MemoizedAlert, {
			count: successCount,
			hide: hideSuccess,
			severity: SeverityTypeEnums.Success,
			alertProps,
			maxCount,
			label: successLabel
		});
		$[19] = alertProps;
		$[20] = hideSuccess;
		$[21] = maxCount;
		$[22] = successCount;
		$[23] = successLabel;
		$[24] = t12;
	} else t12 = $[24];
	let t13;
	if ($[25] !== alertProps || $[26] !== hideInfo || $[27] !== infoCount || $[28] !== infoLabel || $[29] !== maxCount) {
		t13 = /* @__PURE__ */ React.createElement(MemoizedAlert, {
			count: infoCount,
			hide: hideInfo,
			severity: SeverityTypeEnums.Info,
			alertProps,
			maxCount,
			label: infoLabel
		});
		$[25] = alertProps;
		$[26] = hideInfo;
		$[27] = infoCount;
		$[28] = infoLabel;
		$[29] = maxCount;
		$[30] = t13;
	} else t13 = $[30];
	let t14;
	if ($[31] !== alertProps || $[32] !== defaultCount || $[33] !== defaultLabel || $[34] !== hideDefault || $[35] !== maxCount) {
		t14 = /* @__PURE__ */ React.createElement(MemoizedAlert, {
			count: defaultCount,
			hide: hideDefault,
			severity: SeverityTypeEnums.Default,
			alertProps,
			maxCount,
			label: defaultLabel
		});
		$[31] = alertProps;
		$[32] = defaultCount;
		$[33] = defaultLabel;
		$[34] = hideDefault;
		$[35] = maxCount;
		$[36] = t14;
	} else t14 = $[36];
	let t15;
	if ($[37] !== classes.buttonBase || $[38] !== handleClick || $[39] !== t10 || $[40] !== t11 || $[41] !== t12 || $[42] !== t13 || $[43] !== t14) {
		t15 = /* @__PURE__ */ React.createElement(ButtonBase, {
			onClick: handleClick,
			className: classes.buttonBase
		}, t10, t11, t12, t13, t14);
		$[37] = classes.buttonBase;
		$[38] = handleClick;
		$[39] = t10;
		$[40] = t11;
		$[41] = t12;
		$[42] = t13;
		$[43] = t14;
		$[44] = t15;
	} else t15 = $[44];
	let t16;
	if ($[45] !== classes.root || $[46] !== t15) {
		t16 = /* @__PURE__ */ React.createElement("div", { className: classes.root }, t15);
		$[45] = classes.root;
		$[46] = t15;
		$[47] = t16;
	} else t16 = $[47];
	return t16;
};
//#endregion
export { AlertPill };

//# sourceMappingURL=AlertPill.mjs.map