import { UnityFluentIcon } from "../../../../utilities/iconLibrary/UnityFluentIcon.mjs";
import { getIconFromName } from "../../../../utilities/tree/TreeUtilities.mjs";
import { StatusChip } from "../../status/StatusChip.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { Box, TableCell, Tooltip, makeStyles, useTheme } from "@material-ui/core";
import { DateTime } from "luxon";
import clsx from "clsx";
//#region src/UI/dataDisplay/FluentDataTable/FluentCell/index.tsx
const useStyles = makeStyles((theme) => ({
	labelText: {
		color: theme.palette.text.primary,
		fontSize: "12px"
	},
	tableCell: {
		fontSize: "12px",
		letterSpacing: "0.4px",
		fontWeight: (props) => props?.bold ? 500 : 400
	},
	unityIconWrapper: { gap: theme.spacing(1) }
}));
const CellUnityIcon = (props) => {
	const theme = useTheme();
	const { icon = "", size = "large", color = theme.palette.primary.main, children } = props;
	const classes = useStyles(props);
	return /* @__PURE__ */ React.createElement(FluentCell, props, /* @__PURE__ */ React.createElement(Box, {
		display: "flex",
		alignItems: "center",
		className: classes.unityIconWrapper
	}, /* @__PURE__ */ React.createElement(UnityFluentIcon, {
		size,
		color,
		icon: getIconFromName(icon)
	}), children && children));
};
const CellImage = (props) => {
	const $ = c(8);
	const t0 = props?.src;
	const t1 = props?.alt;
	const t2 = props?.style;
	let t3;
	if ($[0] !== t0 || $[1] !== t1 || $[2] !== t2) {
		t3 = /* @__PURE__ */ React.createElement("img", {
			src: t0,
			alt: t1,
			style: t2
		});
		$[0] = t0;
		$[1] = t1;
		$[2] = t2;
		$[3] = t3;
	} else t3 = $[3];
	const t4 = props?.title;
	let t5;
	if ($[4] !== props || $[5] !== t3 || $[6] !== t4) {
		t5 = /* @__PURE__ */ React.createElement(FluentCell, props, t3, t4);
		$[4] = props;
		$[5] = t3;
		$[6] = t4;
		$[7] = t5;
	} else t5 = $[7];
	return t5;
};
const CellIcon = (props) => {
	const $ = c(9);
	let t0;
	if ($[0] !== props.icon || $[1] !== props.label) {
		t0 = props?.label ? /* @__PURE__ */ React.createElement(Box, {
			display: "flex",
			alignItems: "center",
			style: { gap: "8px" }
		}, /* @__PURE__ */ React.createElement(Box, null, props?.icon), props?.label) : props?.icon;
		$[0] = props.icon;
		$[1] = props.label;
		$[2] = t0;
	} else t0 = $[2];
	const t1 = props?.children;
	let t2;
	if ($[3] !== t0 || $[4] !== t1) {
		t2 = /* @__PURE__ */ React.createElement(React.Fragment, null, t0, t1);
		$[3] = t0;
		$[4] = t1;
		$[5] = t2;
	} else t2 = $[5];
	let t3;
	if ($[6] !== props || $[7] !== t2) {
		t3 = /* @__PURE__ */ React.createElement(FluentCell, props, t2);
		$[6] = props;
		$[7] = t2;
		$[8] = t3;
	} else t3 = $[8];
	return t3;
};
const CellNumber = (props) => {
	const $ = c(6);
	const t0 = Number(props?.children);
	let t1;
	if ($[0] !== props.decimals || $[1] !== t0) {
		t1 = t0.toFixed(Number(props?.decimals ?? 2));
		$[0] = props.decimals;
		$[1] = t0;
		$[2] = t1;
	} else t1 = $[2];
	let t2;
	if ($[3] !== props || $[4] !== t1) {
		t2 = /* @__PURE__ */ React.createElement(FluentCell, props, t1);
		$[3] = props;
		$[4] = t1;
		$[5] = t2;
	} else t2 = $[5];
	return t2;
};
const CellDate = (props) => {
	const $ = c(6);
	let t0;
	if ($[0] !== props.children || $[1] !== props.format) {
		t0 = DateTime.fromJSDate(new Date(props?.children)).toFormat(props?.format || "MM/dd/yyyy");
		$[0] = props.children;
		$[1] = props.format;
		$[2] = t0;
	} else t0 = $[2];
	let t1;
	if ($[3] !== props || $[4] !== t0) {
		t1 = /* @__PURE__ */ React.createElement(FluentCell, props, t0);
		$[3] = props;
		$[4] = t0;
		$[5] = t1;
	} else t1 = $[5];
	return t1;
};
const CellCurrency = (props) => {
	const $ = c(4);
	const t0 = props?.currencySymbol || "$";
	const t1 = props?.children;
	let t2;
	if ($[0] !== props || $[1] !== t0 || $[2] !== t1) {
		t2 = /* @__PURE__ */ React.createElement(FluentCell, props, t0, t1);
		$[0] = props;
		$[1] = t0;
		$[2] = t1;
		$[3] = t2;
	} else t2 = $[3];
	return t2;
};
const CellText = (props) => {
	const $ = c(2);
	let t0;
	if ($[0] !== props) {
		t0 = /* @__PURE__ */ React.createElement(FluentCell, props, props.children);
		$[0] = props;
		$[1] = t0;
	} else t0 = $[1];
	return t0;
};
const CellChip = (props) => {
	const $ = c(6);
	const t0 = props?.status || "success";
	const t1 = props?.children;
	let t2;
	if ($[0] !== t0 || $[1] !== t1) {
		t2 = /* @__PURE__ */ React.createElement(StatusChip, {
			status: t0,
			label: t1
		});
		$[0] = t0;
		$[1] = t1;
		$[2] = t2;
	} else t2 = $[2];
	let t3;
	if ($[3] !== props || $[4] !== t2) {
		t3 = /* @__PURE__ */ React.createElement(FluentCell, props, t2);
		$[3] = props;
		$[4] = t2;
		$[5] = t3;
	} else t3 = $[5];
	return t3;
};
const FluentCell = (props) => {
	const $ = c(13);
	const classes = useStyles(props);
	const { scope: t0, style, align, colSpan, className, tooltip, children } = props;
	const scope = t0 === void 0 ? "row" : t0;
	const cellContent = children;
	let t1;
	if ($[0] !== className || $[1] !== classes.tableCell) {
		t1 = clsx(classes.tableCell, className);
		$[0] = className;
		$[1] = classes.tableCell;
		$[2] = t1;
	} else t1 = $[2];
	let t2;
	if ($[3] !== cellContent || $[4] !== tooltip) {
		t2 = tooltip ? /* @__PURE__ */ React.createElement(Tooltip, {
			title: tooltip || "",
			children: /* @__PURE__ */ React.createElement("span", null, cellContent || "")
		}) : cellContent;
		$[3] = cellContent;
		$[4] = tooltip;
		$[5] = t2;
	} else t2 = $[5];
	let t3;
	if ($[6] !== align || $[7] !== colSpan || $[8] !== scope || $[9] !== style || $[10] !== t1 || $[11] !== t2) {
		t3 = /* @__PURE__ */ React.createElement(TableCell, {
			scope,
			className: t1,
			style,
			align,
			colSpan
		}, t2);
		$[6] = align;
		$[7] = colSpan;
		$[8] = scope;
		$[9] = style;
		$[10] = t1;
		$[11] = t2;
		$[12] = t3;
	} else t3 = $[12];
	return t3;
};
FluentCell.UnityIcon = CellUnityIcon;
FluentCell.Icon = CellIcon;
FluentCell.Number = CellNumber;
FluentCell.Text = CellText;
FluentCell.Currency = CellCurrency;
FluentCell.Date = CellDate;
FluentCell.Chip = CellChip;
FluentCell.Image = CellImage;
//#endregion
export { FluentCell as default };

//# sourceMappingURL=index.mjs.map