import { FluentIcon } from "../../../utilities/iconLibrary/FluentIcon.mjs";
import { redirectToProductOnClick } from "../../../utilities/DemoJuly/redirectToProduct.mjs";
import { c } from "react-compiler-runtime";
import React, { useState } from "react";
import { ButtonBase, Typography, makeStyles } from "@material-ui/core";
import { Link as Link$1 } from "react-router-dom";
//#region src/shell/ui/appSwitcher/FUIAppListItem.jsx
const useStyles = makeStyles((theme) => ({
	root: {
		display: "flex",
		flexDirection: "row",
		marginTop: theme.spacing(3),
		marginRight: theme.spacing(6),
		width: 110,
		alignItems: "center"
	},
	iconStyle: {
		backgroundColor: (props) => props.verticalColor,
		color: theme.palette.getContrastText(theme.palette.secondary.dark),
		width: 40,
		height: 40,
		display: "flex",
		justifyContent: "center",
		alignItems: "center"
	},
	iconContainer: { marginRight: theme.spacing(1) },
	imageIcon: {
		width: 28,
		height: 28
	},
	label: { marginTop: theme.spacing(.5) },
	images: {
		width: theme.spacing(6),
		height: theme.spacing(6)
	}
}));
const FUIAppListItem = (props) => {
	const $ = c(26);
	const classes = useStyles();
	const { iconStyle } = useStyles(props);
	const { icon, label, color, redirectInfo, link, image, params, closeSwitcher, user } = props;
	const [open, setOpen] = useState(false);
	let t0;
	if ($[0] !== closeSwitcher || $[1] !== open || $[2] !== redirectInfo || $[3] !== user) {
		t0 = () => {
			if (redirectInfo) redirectToProductOnClick(redirectInfo, user.currentTenantId);
			else closeSwitcher();
			setOpen(!open);
		};
		$[0] = closeSwitcher;
		$[1] = open;
		$[2] = redirectInfo;
		$[3] = user;
		$[4] = t0;
	} else t0 = $[4];
	const handleClick = t0;
	let t1;
	if ($[5] !== classes.images || $[6] !== color || $[7] !== handleClick || $[8] !== icon || $[9] !== iconStyle || $[10] !== image || $[11] !== label || $[12] !== link || $[13] !== params || $[14] !== redirectInfo) {
		t1 = !!icon || !!image ? redirectInfo ? /* @__PURE__ */ React.createElement(ButtonBase, { onClick: handleClick }, image ? /* @__PURE__ */ React.createElement("img", {
			src: image,
			alt: label,
			className: classes.images
		}) : /* @__PURE__ */ React.createElement("div", { className: `${iconStyle}` }, /* @__PURE__ */ React.createElement(FluentIcon, {
			component: icon,
			style: { color: `${color ? color : ""}` }
		}))) : /* @__PURE__ */ React.createElement(ButtonBase, {
			component: Link$1,
			to: {
				pathname: link,
				state: params
			},
			onClick: handleClick
		}, image ? /* @__PURE__ */ React.createElement("img", {
			src: image,
			alt: label,
			className: classes.images
		}) : /* @__PURE__ */ React.createElement("div", { className: `${iconStyle}` }, /* @__PURE__ */ React.createElement(FluentIcon, {
			component: icon,
			style: { color: `${color ? color : ""}` }
		}))) : null;
		$[5] = classes.images;
		$[6] = color;
		$[7] = handleClick;
		$[8] = icon;
		$[9] = iconStyle;
		$[10] = image;
		$[11] = label;
		$[12] = link;
		$[13] = params;
		$[14] = redirectInfo;
		$[15] = t1;
	} else t1 = $[15];
	const iconButton = t1;
	let t2;
	if ($[16] !== classes.iconContainer || $[17] !== iconButton) {
		t2 = /* @__PURE__ */ React.createElement("div", { className: classes.iconContainer }, iconButton);
		$[16] = classes.iconContainer;
		$[17] = iconButton;
		$[18] = t2;
	} else t2 = $[18];
	let t3;
	if ($[19] !== classes.label || $[20] !== label) {
		t3 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Typography, {
			variant: "caption",
			className: classes.label
		}, label));
		$[19] = classes.label;
		$[20] = label;
		$[21] = t3;
	} else t3 = $[21];
	let t4;
	if ($[22] !== classes.root || $[23] !== t2 || $[24] !== t3) {
		t4 = /* @__PURE__ */ React.createElement("div", { className: classes.root }, t2, t3);
		$[22] = classes.root;
		$[23] = t2;
		$[24] = t3;
		$[25] = t4;
	} else t4 = $[25];
	return t4;
};
//#endregion
export { FUIAppListItem as default };

//# sourceMappingURL=FUIAppListItem.mjs.map