import WidgetCard from "../../WidgetCard.mjs";
import { convertISODate } from "../../utils/ConvertISODate.mjs";
import FluentPrimaryStatNumber from "../../FluentComponents/molecules/FluentPrimaryStatNumber.mjs";
import FluentSecondaryStatNumber from "../../FluentComponents/molecules/FluentSecondaryStatNumber.mjs";
import { c } from "react-compiler-runtime";
import React, { Fragment, forwardRef } from "react";
import { Divider, LinearProgress, Typography, makeStyles } from "@material-ui/core";
//#region src/UI/widgets/library/ProgressBarWidget/ProgressBarWidget.jsx
const layout = {
	w: {
		default: 2,
		min: 0,
		max: 4
	},
	h: {
		default: 2,
		min: 0,
		max: 4
	}
};
const useStyles = makeStyles((theme) => ({
	root: {},
	displayItems: {
		display: "flex",
		flexDirection: "row",
		justifyContent: "space-around",
		color: "white"
	},
	divider: {
		marginTop: theme.spacing(4),
		marginBottom: theme.spacing(2)
	}
}));
const ProgressBarWidget = (props, ref) => {
	const $ = c(15);
	let children;
	let other;
	let params;
	if ($[0] !== props) {
		const { children: t0, params: t1, setParam, ...t2 } = props;
		children = t0;
		params = t1;
		other = t2;
		$[0] = props;
		$[1] = children;
		$[2] = other;
		$[3] = params;
	} else {
		children = $[1];
		other = $[2];
		params = $[3];
	}
	const { mockData, theme, dateRange } = params;
	const classes = useStyles();
	const t0 = mockData?.title;
	let t1;
	if ($[4] !== children || $[5] !== classes || $[6] !== dateRange || $[7] !== mockData) {
		t1 = mockData ? /* @__PURE__ */ React.createElement(Fragment, null, dateRange && /* @__PURE__ */ React.createElement(Typography, {
			gutterBottom: true,
			variant: "caption",
			component: "h3"
		}, "Starting: ", convertISODate(dateRange.from)), /* @__PURE__ */ React.createElement(FluentPrimaryStatNumber, {
			mainStat: mockData?.value,
			mainLabel: mockData?.label
		}), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(LinearProgress, {
			variant: "determinate",
			color: "secondary",
			value: mockData?.progress
		}), mockData?.progress, "%"), mockData?.data && /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement("div", { className: classes.divider }, /* @__PURE__ */ React.createElement(Divider, { style: {
			background: "white",
			opacity: .5
		} })), /* @__PURE__ */ React.createElement("div", { className: classes.displayItems }, mockData?.data.map(_temp))), children) : /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2" }, "Could not retrieve widget data. Please contact support.");
		$[4] = children;
		$[5] = classes;
		$[6] = dateRange;
		$[7] = mockData;
		$[8] = t1;
	} else t1 = $[8];
	let t2;
	if ($[9] !== other || $[10] !== ref || $[11] !== t0 || $[12] !== t1 || $[13] !== theme) {
		t2 = /* @__PURE__ */ React.createElement(WidgetCard, {
			theme,
			ref,
			...other,
			title: t0,
			widgetType: "ProgressBarWidget"
		}, t1);
		$[9] = other;
		$[10] = ref;
		$[11] = t0;
		$[12] = t1;
		$[13] = theme;
		$[14] = t2;
	} else t2 = $[14];
	return t2;
};
var ProgressBarWidget_default = forwardRef(ProgressBarWidget);
function _temp(item, index) {
	return /* @__PURE__ */ React.createElement(FluentSecondaryStatNumber, {
		secondaryStat: item.value,
		secondaryLabel: item.label,
		trend: item.trend
	});
}
//#endregion
export { ProgressBarWidget_default as default, layout };

//# sourceMappingURL=ProgressBarWidget.mjs.map