import { FluentIcon } from "../../utilities/iconLibrary/FluentIcon.mjs";
import { getEllipseColor } from "../../utilities/style/colorConverter.mjs";
import { useSplitDecimal } from "../../hooks/useSplitDecimal.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Box, Typography, makeStyles, useTheme } from "@material-ui/core";
import clsx from "clsx";
import { PropTypes as PropTypes$1 } from "prop-types";
import { grey } from "@material-ui/core/colors";
//#region src/UI/dataDisplay/SummaryBlock.jsx
const useStyles = makeStyles((theme) => ({
	rootContainer: {
		backgroundColor: (props) => props?.backgroundColor || theme.palette.background.paper,
		borderLeft: (props) => props?.noLeftBorder ? "0px" : "solid 1px",
		borderRight: (props) => props?.noRightBorder ? "0px" : "solid 1px",
		height: (props) => props?.height,
		width: (props) => props?.width
	},
	labelOverflow: {
		whiteSpace: "nowrap",
		overflow: "hidden",
		textOverflow: "ellipsis",
		fontWeight: "400"
	},
	labelValue: {
		fontWeight: "400",
		fontSize: "16px"
	},
	labelText: {
		display: "flex",
		flexDirection: "column",
		alignItems: "flex-start",
		padding: "0px 10px",
		color: grey[500],
		fontSize: (props) => props?.labelVariant === "caption" && "12px",
		fontWeight: (props) => props?.labelVariant === "caption" ? "400" : "500"
	},
	iconWrapper: { marginLeft: theme.spacing(1) }
}));
/**
* `SummaryBlock` component
*/
const SummaryBlock = (props) => {
	const $ = c(30);
	const { value, startLabel, label, icon, style, primary, secondary, textVariant, labelVariant: t0, children, valueIsDecimal: t1, iconColor } = props;
	const labelVariant = t0 === void 0 ? "caption" : t0;
	const valueIsDecimal = t1 === void 0 ? true : t1;
	const { textValue } = useSplitDecimal(value);
	const theme = useTheme();
	const classes = useStyles(props);
	let t2;
	if ($[0] !== style) {
		t2 = {
			gap: "2px",
			...style
		};
		$[0] = style;
		$[1] = t2;
	} else t2 = $[1];
	let t3;
	if ($[2] !== classes.iconWrapper || $[3] !== classes.labelOverflow || $[4] !== classes.labelValue || $[5] !== icon || $[6] !== iconColor || $[7] !== primary || $[8] !== startLabel || $[9] !== style?.mainLabel || $[10] !== textValue || $[11] !== textVariant || $[12] !== theme || $[13] !== valueIsDecimal) {
		t3 = primary ? primary : /* @__PURE__ */ React.createElement(React.Fragment, null, startLabel && /* @__PURE__ */ React.createElement(Typography, {
			variant: "caption",
			className: clsx(classes.labelOverflow)
		}, startLabel), /* @__PURE__ */ React.createElement(Typography, {
			variant: textVariant,
			className: clsx(textVariant ? {} : classes.labelValue, classes.labelOverflow),
			style: style?.mainLabel
		}, textValue.mainLabel), valueIsDecimal && textValue.decimalLabel && /* @__PURE__ */ React.createElement(Typography, {
			variant: "caption",
			className: clsx(classes.labelOverflow)
		}, ".", textValue.decimalLabel), icon && /* @__PURE__ */ React.createElement("div", { className: classes.iconWrapper }, /* @__PURE__ */ React.createElement(FluentIcon, {
			component: icon,
			color: iconColor ? getEllipseColor(theme, iconColor) : null
		})));
		$[2] = classes.iconWrapper;
		$[3] = classes.labelOverflow;
		$[4] = classes.labelValue;
		$[5] = icon;
		$[6] = iconColor;
		$[7] = primary;
		$[8] = startLabel;
		$[9] = style?.mainLabel;
		$[10] = textValue;
		$[11] = textVariant;
		$[12] = theme;
		$[13] = valueIsDecimal;
		$[14] = t3;
	} else t3 = $[14];
	let t4;
	if ($[15] !== t3) {
		t4 = /* @__PURE__ */ React.createElement(Box, {
			display: "flex",
			justifyContent: "center",
			alignItems: "center",
			alignSelf: "stretch"
		}, t3);
		$[15] = t3;
		$[16] = t4;
	} else t4 = $[16];
	let t5;
	if ($[17] !== classes.labelOverflow || $[18] !== classes.labelText || $[19] !== label || $[20] !== labelVariant || $[21] !== secondary || $[22] !== style?.label) {
		t5 = secondary ? secondary : /* @__PURE__ */ React.createElement(Typography, {
			variant: labelVariant,
			className: clsx(classes.labelText, classes.labelOverflow),
			style: style?.label
		}, label);
		$[17] = classes.labelOverflow;
		$[18] = classes.labelText;
		$[19] = label;
		$[20] = labelVariant;
		$[21] = secondary;
		$[22] = style?.label;
		$[23] = t5;
	} else t5 = $[23];
	let t6;
	if ($[24] !== children || $[25] !== classes.rootContainer || $[26] !== t2 || $[27] !== t4 || $[28] !== t5) {
		t6 = /* @__PURE__ */ React.createElement(Box, {
			display: "flex",
			flexDirection: "column",
			justifyContent: "center",
			alignItems: "center",
			className: classes.rootContainer,
			style: t2
		}, t4, t5, children);
		$[24] = children;
		$[25] = classes.rootContainer;
		$[26] = t2;
		$[27] = t4;
		$[28] = t5;
		$[29] = t6;
	} else t6 = $[29];
	return t6;
};
SummaryBlock.propTypes = {
	value: PropTypes$1.string.isRequired,
	label: PropTypes$1.string,
	startLabel: PropTypes$1.string,
	icon: PropTypes$1.elementType,
	style: PropTypes$1.object,
	primary: PropTypes$1.elementType,
	secondary: PropTypes$1.elementType,
	textVariant: PropTypes$1.string,
	labelVariant: PropTypes$1.string,
	backgroundColor: PropTypes$1.string,
	children: PropTypes$1.elementType
};
//#endregion
export { SummaryBlock };

//# sourceMappingURL=SummaryBlock.mjs.map