import { FluentIcon } from "../../../utilities/iconLibrary/FluentIcon.mjs";
import { FluentIconButton } from "../../inputs/buttons/FluentIconButton.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import { MenuItem, Popover, Typography, makeStyles } from "@material-ui/core";
import { MoreVerticalIcon } from "@fluentui/react-icons";
//#region src/UI/timeline/fluentTimeline/FluentTimelineContent.jsx
const useStyles = makeStyles((theme) => ({
	flexCol: {
		flexGrow: 1,
		fontSize: "0.875rem",
		marginLeft: theme.spacing(1)
	},
	customTimelineContent: {
		display: "flex",
		borderLeft: "1px solid " + theme.palette.grey[300],
		paddingLeft: theme.spacing(3),
		paddingTop: theme.spacing(.5),
		paddingBottom: theme.spacing(.5),
		marginLeft: theme.spacing(2.5),
		alignItems: "center"
	},
	customTimelineContentDate: {
		marginLeft: theme.spacing(3),
		marginRight: theme.spacing(2),
		minWidth: theme.spacing(5),
		fontWeight: 400,
		textAlign: "right",
		fontSize: "12px"
	},
	customTimelineDot: {
		marginLeft: theme.spacing(-3.55),
		width: theme.spacing(1),
		height: theme.spacing(1),
		backgroundColor: theme.palette.grey[400],
		borderRadius: "100%"
	},
	flexDescription: { fontSize: "0.875rem" }
}));
const FluentTimelineContent = (props) => {
	const $ = c(34);
	const { data, title, description, date, actions, category } = props;
	const classes = useStyles();
	const [openMenu, setOpenMenu] = useState(false);
	const [anchorEl, setAnchorEl] = useState(null);
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = (event) => {
			setOpenMenu(true);
			setAnchorEl(event.currentTarget);
		};
		$[0] = t0;
	} else t0 = $[0];
	const handlePopoverClick = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = (event_0) => {
			setOpenMenu(false);
			setAnchorEl(null);
		};
		$[1] = t1;
	} else t1 = $[1];
	const handlePopoverClose = t1;
	let t2;
	if ($[2] !== classes.customTimelineDot) {
		t2 = /* @__PURE__ */ React.createElement("div", { className: classes.customTimelineDot });
		$[2] = classes.customTimelineDot;
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] !== classes.flexCol || $[5] !== title) {
		t3 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "body2",
			noWrap: true,
			className: classes.flexCol
		}, title);
		$[4] = classes.flexCol;
		$[5] = title;
		$[6] = t3;
	} else t3 = $[6];
	let t4;
	if ($[7] !== classes.flexDescription || $[8] !== description) {
		t4 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "body2",
			noWrap: true,
			className: classes.flexDescription
		}, description);
		$[7] = classes.flexDescription;
		$[8] = description;
		$[9] = t4;
	} else t4 = $[9];
	let t5;
	if ($[10] !== classes.customTimelineContentDate || $[11] !== date) {
		t5 = /* @__PURE__ */ React.createElement(Typography, {
			variant: "caption",
			color: "textSecondary",
			className: classes.customTimelineContentDate
		}, date);
		$[10] = classes.customTimelineContentDate;
		$[11] = date;
		$[12] = t5;
	} else t5 = $[12];
	let t6;
	if ($[13] !== actions?.length || $[14] !== category || $[15] !== title) {
		t6 = actions?.length > 0 && /* @__PURE__ */ React.createElement(FluentIconButton, {
			icon: MoreVerticalIcon,
			size: "small",
			onClick: handlePopoverClick,
			id: "udpRecord-FluentTimelineContent-MoreAction-" + category + "-" + typeof title === "string" && title.replace(/\s+/g, ""),
			udprecordid: "udpRecord-FluentTimelineContent-MoreAction-" + category + "-" + typeof title === "string" && title.replace(/\s+/g, "")
		});
		$[13] = actions?.length;
		$[14] = category;
		$[15] = title;
		$[16] = t6;
	} else t6 = $[16];
	let t7;
	let t8;
	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
		t7 = {
			vertical: "bottom",
			horizontal: "right"
		};
		t8 = {
			vertical: "top",
			horizontal: "right"
		};
		$[17] = t7;
		$[18] = t8;
	} else {
		t7 = $[17];
		t8 = $[18];
	}
	let t9;
	if ($[19] !== actions || $[20] !== data) {
		t9 = actions?.map((action) => /* @__PURE__ */ React.createElement(MenuItem, {
			id: "udpRecord-FluentTimelineContent-MenuItem-" + action?.label?.replace(/ /g, "-"),
			udprecordid: "udpRecord-FluentTimelineContent-MenuItem-" + action?.label?.replace(/ /g, "-"),
			onClick: () => {
				if (action.onClick) action.onClick(data);
			},
			style: {
				display: "flex",
				justifyContent: "space-between"
			}
		}, /* @__PURE__ */ React.createElement(Typography, null, action?.label), action?.icon && /* @__PURE__ */ React.createElement(FluentIcon, {
			component: action?.icon,
			style: { marginLeft: 7 }
		})));
		$[19] = actions;
		$[20] = data;
		$[21] = t9;
	} else t9 = $[21];
	let t10;
	if ($[22] !== anchorEl || $[23] !== openMenu || $[24] !== t9) {
		t10 = /* @__PURE__ */ React.createElement(Popover, {
			id: "fluentTimelineContentPopover",
			open: openMenu,
			anchorEl,
			onClose: handlePopoverClose,
			anchorOrigin: t7,
			transformOrigin: t8
		}, t9);
		$[22] = anchorEl;
		$[23] = openMenu;
		$[24] = t9;
		$[25] = t10;
	} else t10 = $[25];
	let t11;
	if ($[26] !== classes.customTimelineContent || $[27] !== t10 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5 || $[32] !== t6) {
		t11 = /* @__PURE__ */ React.createElement("div", { className: classes.customTimelineContent }, t2, t3, t4, t5, t6, t10);
		$[26] = classes.customTimelineContent;
		$[27] = t10;
		$[28] = t2;
		$[29] = t3;
		$[30] = t4;
		$[31] = t5;
		$[32] = t6;
		$[33] = t11;
	} else t11 = $[33];
	return t11;
};
//#endregion
export { FluentTimelineContent };

//# sourceMappingURL=FluentTimelineContent.mjs.map