import ExtendActions from "./ExtendActions.mjs";
import TimelineElement from "./TimelineElement.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import { Card, CardContent, Fade, makeStyles } from "@material-ui/core";
import TimeAgo from "timeago-react";
import Timeline from "@material-ui/lab/Timeline";
//#region src/UI/timeline/TimeLine.jsx
const useStyles = makeStyles((theme) => ({
	root: { position: "relative" },
	extended: { display: "none" },
	paper: {
		position: "absolute",
		bottom: -38,
		left: -16,
		width: "100%",
		height: 0,
		transition: theme.transitions.create("height", {
			easing: theme.transitions.easing.easeOut,
			duration: theme.transitions.duration.standard
		})
	},
	expanded: { height: 500 },
	extendedButton: {
		display: "flex",
		justifyContent: "flex-end"
	},
	actions: {
		display: "flex",
		justifyContent: "center",
		marginBottom: theme.spacing(3)
	},
	biasLeft: {
		display: "flex",
		width: "100%"
	}
}));
const TimeLine = (t0) => {
	const $ = c(32);
	const { timelineData, semantic, biasLeft } = t0;
	const [initial, setInitial] = useState(6);
	const [extendOne, setExtendOne] = useState(false);
	const classes = useStyles();
	let t1;
	if ($[0] !== extendOne) {
		t1 = () => {
			setExtendOne(!extendOne);
		};
		$[0] = extendOne;
		$[1] = t1;
	} else t1 = $[1];
	const extend = t1;
	let t2;
	let t3;
	if ($[2] !== initial) {
		t2 = () => setInitial(initial + 6);
		t3 = () => setInitial(initial - 6);
		$[2] = initial;
		$[3] = t2;
		$[4] = t3;
	} else {
		t2 = $[3];
		t3 = $[4];
	}
	const t4 = initial < timelineData.length;
	const t5 = initial >= 6;
	let t6;
	if ($[5] !== t2 || $[6] !== t3 || $[7] !== t4 || $[8] !== t5) {
		t6 = /* @__PURE__ */ React.createElement(ExtendActions, {
			more: t2,
			less: t3,
			showMore: t4,
			showLess: t5
		});
		$[5] = t2;
		$[6] = t3;
		$[7] = t4;
		$[8] = t5;
		$[9] = t6;
	} else t6 = $[9];
	const extendActions = t6;
	let t7;
	if ($[10] !== biasLeft || $[11] !== classes.extended || $[12] !== classes.extendedButton || $[13] !== extend || $[14] !== extendOne || $[15] !== initial || $[16] !== semantic || $[17] !== timelineData) {
		t7 = timelineData && timelineData.map((item, index) => {
			if (index <= initial) {
				console.log(item);
				return /* @__PURE__ */ React.createElement(TimelineElement, {
					biasLeft,
					key: index,
					time: semantic ? /* @__PURE__ */ React.createElement(TimeAgo, { datetime: item.time }) : item.time,
					entry: item.event,
					type: item.type,
					title: item.title,
					extendOne,
					extend,
					demoGraph: item.extendedData && /* @__PURE__ */ React.createElement(Fade, { in: extendOne }, /* @__PURE__ */ React.createElement(Card, {
						style: { backgroundColor: "white" },
						elevation: 0,
						className: !extendOne && classes.extended
					}, /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement("div", { className: classes.extendedButton }, item.moreInfo && item.moreInfo))))
				});
			}
		});
		$[10] = biasLeft;
		$[11] = classes.extended;
		$[12] = classes.extendedButton;
		$[13] = extend;
		$[14] = extendOne;
		$[15] = initial;
		$[16] = semantic;
		$[17] = timelineData;
		$[18] = t7;
	} else t7 = $[18];
	let t8;
	if ($[19] !== biasLeft || $[20] !== classes.biasLeft || $[21] !== extendActions) {
		t8 = biasLeft && /* @__PURE__ */ React.createElement("div", { className: classes.biasLeft }, /* @__PURE__ */ React.createElement("div", { style: { flex: 1 } }), /* @__PURE__ */ React.createElement("div", { style: {
			flex: 2,
			marginLeft: -22
		} }, extendActions));
		$[19] = biasLeft;
		$[20] = classes.biasLeft;
		$[21] = extendActions;
		$[22] = t8;
	} else t8 = $[22];
	let t9;
	if ($[23] !== biasLeft || $[24] !== classes.actions || $[25] !== extendActions) {
		t9 = !biasLeft && /* @__PURE__ */ React.createElement("div", { className: classes.actions }, extendActions);
		$[23] = biasLeft;
		$[24] = classes.actions;
		$[25] = extendActions;
		$[26] = t9;
	} else t9 = $[26];
	let t10;
	if ($[27] !== classes.root || $[28] !== t7 || $[29] !== t8 || $[30] !== t9) {
		t10 = /* @__PURE__ */ React.createElement(Timeline, { className: classes.root }, t7, t8, t9);
		$[27] = classes.root;
		$[28] = t7;
		$[29] = t8;
		$[30] = t9;
		$[31] = t10;
	} else t10 = $[31];
	return t10;
};
//#endregion
export { TimeLine as default };

//# sourceMappingURL=TimeLine.mjs.map