import { UnityFluentIcon } from "../../../../utilities/iconLibrary/UnityFluentIcon.mjs";
import { getIconFromName } from "../../../../utilities/tree/TreeUtilities.mjs";
import { getUnityIconFromName } from "../../../../utilities/iconLibrary/UnityIconLibrary.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { darken, makeStyles, useTheme } from "@material-ui/core";
import clsx from "clsx";
//#region src/UI/templates/ui/renderers/IconRenderer.jsx
const useStyles = makeStyles((theme) => ({
	iconContainer: {
		display: "flex",
		alignItems: "center",
		justifyContent: "center",
		borderRadius: 50,
		marginTop: theme.spacing(.5),
		marginBottom: theme.spacing(.5),
		marginRight: (props) => !props?.removeMargin && theme.spacing(1),
		width: theme.spacing(4),
		height: theme.spacing(4),
		backgroundColor: "#ffffff"
	},
	border: { border: (props) => props?.color?.hex ? `1px solid ${darken(props?.color?.hex, .1)}` : `1px solid ${theme.palette.secondary.main}` }
}));
/**
* IconRenderer
*/
const IconRenderer = (props) => {
	const $ = c(19);
	const { value, noBorder, removeContainer } = props;
	const { color, name, type } = value;
	const classes = useStyles(value);
	const theme = useTheme(props);
	const t0 = !removeContainer && classes.iconContainer;
	const t1 = !noBorder && classes.border;
	let t2;
	if ($[0] !== t0 || $[1] !== t1) {
		t2 = clsx(t0, t1);
		$[0] = t0;
		$[1] = t1;
		$[2] = t2;
	} else t2 = $[2];
	const t3 = color?.hex || theme.palette.secondary.main;
	let t4;
	if ($[3] !== name || $[4] !== type) {
		t4 = type === "unity" ? getUnityIconFromName(name) : getIconFromName(name);
		$[3] = name;
		$[4] = type;
		$[5] = t4;
	} else t4 = $[5];
	let t5;
	if ($[6] !== color?.hex || $[7] !== theme) {
		t5 = color?.hex ? darken(color?.hex, .1) : theme.palette.secondary.main;
		$[6] = color?.hex;
		$[7] = theme;
		$[8] = t5;
	} else t5 = $[8];
	let t6;
	if ($[9] !== t5) {
		t6 = { color: t5 };
		$[9] = t5;
		$[10] = t6;
	} else t6 = $[10];
	let t7;
	if ($[11] !== t3 || $[12] !== t4 || $[13] !== t6 || $[14] !== type) {
		t7 = /* @__PURE__ */ React.createElement(UnityFluentIcon, {
			size: "medium",
			color: t3,
			type,
			icon: t4,
			style: t6
		});
		$[11] = t3;
		$[12] = t4;
		$[13] = t6;
		$[14] = type;
		$[15] = t7;
	} else t7 = $[15];
	let t8;
	if ($[16] !== t2 || $[17] !== t7) {
		t8 = /* @__PURE__ */ React.createElement("div", { className: t2 }, t7);
		$[16] = t2;
		$[17] = t7;
		$[18] = t8;
	} else t8 = $[18];
	return t8;
};
//#endregion
export { IconRenderer };

//# sourceMappingURL=IconRenderer.mjs.map