import { FluentIconButton } from "../../inputs/buttons/FluentIconButton.mjs";
import { StatusChip } from "../../dataDisplay/status/StatusChip.mjs";
import { Adornment } from "../../components/feedback/Adornment.mjs";
import { IconButtonWithTooltip } from "../../inputs/buttons/IconButtonWithToolTip.mjs";
import { CompactDataList } from "../../dataDisplay/CompactDataList.mjs";
import { CompactDataListItem } from "../../dataDisplay/CompactDataListItem.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import { Avatar, Card, CardContent, Collapse, Typography, makeStyles } from "@material-ui/core";
import clsx from "clsx";
import { ChevronDownIcon } from "@fluentui/react-icons";
//#region src/UI/mapLayout/ui/CompactCard.jsx
const useStyles = makeStyles((theme) => ({
	titleWrapper: {
		display: "flex",
		justifyContent: "space-between",
		gap: theme.spacing(1)
	},
	subtitleWrapper: {
		display: "flex",
		paddingBottom: 0,
		alignItems: "center",
		gap: theme.spacing(1)
	},
	title: {
		flex: 1,
		lineHeight: "125%"
	},
	expand: {
		transform: "rotate(0deg)",
		transition: theme.transitions.create("transform", { duration: theme.transitions.duration.shortest })
	},
	expandOpen: { transform: "rotate(180deg)" },
	expandButtonWrapper: {
		display: "flex",
		justifyContent: "space-between"
	},
	sectionWrapper: { marginTop: theme.spacing(1.5) },
	iconButtonWrapper: { borderRadius: 2 },
	avatar: {
		width: "80px",
		height: "80px"
	},
	contentWrapper: { flex: 2 },
	secondaryText: {
		color: "inherit",
		opacity: .6
	},
	cardContent: {
		flex: 1,
		paddingTop: 0,
		"&:last-child": { paddingBottom: theme.spacing(2) }
	}
}));
const CompactCard = (props) => {
	const $ = c(62);
	const { title, primaryText, secondaryText, noWrap: t0, extendedList: t1, status: t2, statusLabel, statusVariant, showAdornment: t3, avatar, imageAvatarSrc, overrideStatusError, overrideStatusInfo, overrideStatusSuccess, overrideStatusWarning, iconButtons: t4, children } = props;
	const noWrap = t0 === void 0 ? false : t0;
	let t5;
	if ($[0] !== t1) {
		t5 = t1 === void 0 ? [] : t1;
		$[0] = t1;
		$[1] = t5;
	} else t5 = $[1];
	const extendedList = t5;
	const status = t2 === void 0 ? "info" : t2;
	const showAdornment = t3 === void 0 ? true : t3;
	let t6;
	if ($[2] !== t4) {
		t6 = t4 === void 0 ? [] : t4;
		$[2] = t4;
		$[3] = t6;
	} else t6 = $[3];
	const iconButtons = t6;
	const [expanded, setExpanded] = useState(false);
	const classes = useStyles();
	let t7;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {
			display: "flex",
			height: "100%",
			width: "100%"
		};
		$[4] = t7;
	} else t7 = $[4];
	let t8;
	if ($[5] !== showAdornment || $[6] !== status) {
		t8 = showAdornment && status && /* @__PURE__ */ React.createElement("div", { style: { height: "100%" } }, /* @__PURE__ */ React.createElement(Adornment, { color: status }));
		$[5] = showAdornment;
		$[6] = status;
		$[7] = t8;
	} else t8 = $[7];
	let t9;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = { width: "100%" };
		$[8] = t9;
	} else t9 = $[8];
	let t10;
	if ($[9] !== classes.avatar || $[10] !== imageAvatarSrc) {
		t10 = imageAvatarSrc && /* @__PURE__ */ React.createElement(Avatar, {
			variant: "square",
			className: classes.avatar,
			src: imageAvatarSrc
		});
		$[9] = classes.avatar;
		$[10] = imageAvatarSrc;
		$[11] = t10;
	} else t10 = $[11];
	let t11;
	if ($[12] !== avatar || $[13] !== classes.avatar) {
		t11 = avatar && /* @__PURE__ */ React.createElement(Avatar, {
			variant: "square",
			className: classes.avatar
		}, avatar);
		$[12] = avatar;
		$[13] = classes.avatar;
		$[14] = t11;
	} else t11 = $[14];
	let t12;
	if ($[15] !== title) {
		t12 = /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle1" }, title);
		$[15] = title;
		$[16] = t12;
	} else t12 = $[16];
	let t13;
	if ($[17] !== overrideStatusError || $[18] !== overrideStatusInfo || $[19] !== overrideStatusSuccess || $[20] !== overrideStatusWarning || $[21] !== status || $[22] !== statusLabel || $[23] !== statusVariant) {
		t13 = status && statusLabel && /* @__PURE__ */ React.createElement(StatusChip, {
			status,
			label: statusLabel,
			success: overrideStatusSuccess,
			error: overrideStatusError,
			warning: overrideStatusWarning,
			info: overrideStatusInfo,
			variant: statusVariant
		});
		$[17] = overrideStatusError;
		$[18] = overrideStatusInfo;
		$[19] = overrideStatusSuccess;
		$[20] = overrideStatusWarning;
		$[21] = status;
		$[22] = statusLabel;
		$[23] = statusVariant;
		$[24] = t13;
	} else t13 = $[24];
	let t14;
	if ($[25] !== classes.titleWrapper || $[26] !== t12 || $[27] !== t13) {
		t14 = /* @__PURE__ */ React.createElement("div", { className: classes.titleWrapper }, t12, t13);
		$[25] = classes.titleWrapper;
		$[26] = t12;
		$[27] = t13;
		$[28] = t14;
	} else t14 = $[28];
	let t15;
	if ($[29] !== noWrap || $[30] !== primaryText) {
		t15 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "body2",
			noWrap
		}, primaryText);
		$[29] = noWrap;
		$[30] = primaryText;
		$[31] = t15;
	} else t15 = $[31];
	let t16;
	if ($[32] !== classes.secondaryText || $[33] !== secondaryText) {
		t16 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "body2",
			className: classes.secondaryText
		}, secondaryText);
		$[32] = classes.secondaryText;
		$[33] = secondaryText;
		$[34] = t16;
	} else t16 = $[34];
	let t17;
	if ($[35] !== classes.contentWrapper || $[36] !== t14 || $[37] !== t15 || $[38] !== t16) {
		t17 = /* @__PURE__ */ React.createElement("div", { className: classes.contentWrapper }, t14, t15, t16);
		$[35] = classes.contentWrapper;
		$[36] = t14;
		$[37] = t15;
		$[38] = t16;
		$[39] = t17;
	} else t17 = $[39];
	let t18;
	if ($[40] !== classes.subtitleWrapper || $[41] !== t10 || $[42] !== t11 || $[43] !== t17) {
		t18 = /* @__PURE__ */ React.createElement(CardContent, { className: classes.subtitleWrapper }, t10, t11, t17);
		$[40] = classes.subtitleWrapper;
		$[41] = t10;
		$[42] = t11;
		$[43] = t17;
		$[44] = t18;
	} else t18 = $[44];
	let t19;
	if ($[45] !== classes.cardContent || $[46] !== classes.expand || $[47] !== classes.expandButtonWrapper || $[48] !== classes.expandOpen || $[49] !== classes.iconButtonWrapper || $[50] !== classes.sectionWrapper || $[51] !== expanded || $[52] !== extendedList || $[53] !== iconButtons) {
		t19 = (extendedList?.length > 0 || iconButtons?.length > 0) && /* @__PURE__ */ React.createElement(CardContent, { className: classes.cardContent }, /* @__PURE__ */ React.createElement("div", { className: classes.sectionWrapper }, /* @__PURE__ */ React.createElement(Collapse, {
			in: expanded,
			timeout: "auto",
			unmountOnExit: true
		}, /* @__PURE__ */ React.createElement(CompactDataList, { disableSeparator: false }, extendedList?.map(_temp))), /* @__PURE__ */ React.createElement("div", { className: classes.expandButtonWrapper }, /* @__PURE__ */ React.createElement("div", null, extendedList?.length > 0 && /* @__PURE__ */ React.createElement(FluentIconButton, {
			className: clsx(classes.expand, { [classes.expandOpen]: expanded }, classes.iconButtonWrapper),
			onClick: () => setExpanded(!expanded),
			icon: ChevronDownIcon
		})), /* @__PURE__ */ React.createElement("div", null, iconButtons?.length > 0 && iconButtons?.map((iconButton) => /* @__PURE__ */ React.createElement(IconButtonWithTooltip, {
			className: classes.iconButtonWrapper,
			icon: iconButton?.icon,
			onClick: iconButton?.onclick,
			title: iconButton?.title,
			size: "small",
			...iconButton
		}))))));
		$[45] = classes.cardContent;
		$[46] = classes.expand;
		$[47] = classes.expandButtonWrapper;
		$[48] = classes.expandOpen;
		$[49] = classes.iconButtonWrapper;
		$[50] = classes.sectionWrapper;
		$[51] = expanded;
		$[52] = extendedList;
		$[53] = iconButtons;
		$[54] = t19;
	} else t19 = $[54];
	let t20;
	if ($[55] !== children || $[56] !== t18 || $[57] !== t19) {
		t20 = /* @__PURE__ */ React.createElement(Card, { style: t9 }, t18, children, t19);
		$[55] = children;
		$[56] = t18;
		$[57] = t19;
		$[58] = t20;
	} else t20 = $[58];
	let t21;
	if ($[59] !== t20 || $[60] !== t8) {
		t21 = /* @__PURE__ */ React.createElement("div", { style: t7 }, t8, t20);
		$[59] = t20;
		$[60] = t8;
		$[61] = t21;
	} else t21 = $[61];
	return t21;
};
function _temp(item) {
	return /* @__PURE__ */ React.createElement(CompactDataListItem, {
		label: item?.label,
		value: item?.value
	});
}
//#endregion
export { CompactCard };

//# sourceMappingURL=CompactCard.mjs.map