import { c } from "react-compiler-runtime";
import React from "react";
import { Breadcrumbs, Typography, makeStyles } from "@material-ui/core";
import { Link as Link$1, Route, useHistory } from "react-router-dom";
import { useTranslation } from "react-i18next";
//#region src/UI/inputs/link/BreadCrumbMenu.jsx
const useStyles = makeStyles((theme) => ({ link: {
	textDecoration: "none",
	color: (props) => props.color === "primary" ? theme?.palette?.getContrastText(theme.palette.primary.main) : theme?.palette?.getContrastText(theme.palette.secondary.main)
} }));
const SYSTEM_ROUTE_LABELS = [
	"inquiry",
	"page",
	"menupage",
	"reports",
	"virtual",
	"workflowtask"
];
const BreadCrumbMenu = (props) => {
	const $ = c(10);
	const classes = useStyles(props);
	const { root, breadCrumbAltLabelList: t0 } = props;
	let t1;
	if ($[0] !== t0) {
		t1 = t0 === void 0 ? [] : t0;
		$[0] = t0;
		$[1] = t1;
	} else t1 = $[1];
	const breadCrumbAltLabelList = t1;
	const { t } = useTranslation();
	const history = useHistory();
	breadCrumbAltLabelList.forEach(_temp);
	let t2;
	if ($[2] !== breadCrumbAltLabelList) {
		t2 = [...SYSTEM_ROUTE_LABELS, ...breadCrumbAltLabelList];
		$[2] = breadCrumbAltLabelList;
		$[3] = t2;
	} else t2 = $[3];
	const breadCrumbLabelList = t2;
	let t3;
	if ($[4] !== breadCrumbLabelList || $[5] !== classes.link || $[6] !== history || $[7] !== root || $[8] !== t) {
		t3 = /* @__PURE__ */ React.createElement(Route, null, (t4) => {
			const { location } = t4;
			const pathnames = location.pathname.split("/").filter(_temp2);
			pathnames.forEach(_temp3);
			const useLabel = breadCrumbLabelList.includes(pathnames[pathnames.length - 2]);
			if (useLabel && history?.location?.state?.label) pathnames[pathnames.length - 1] = history.location.state.label;
			return /* @__PURE__ */ React.createElement(Breadcrumbs, { "aria-label": "Breadcrumb" }, /* @__PURE__ */ React.createElement(Link$1, {
				color: "inherit",
				to: "/",
				className: classes.link
			}, t(root)), pathnames.map((value, index) => {
				if (!!useLabel && index === 0) return null;
				const last = index === pathnames.length - 1;
				const to = `/${pathnames.slice(0, index + 1).join("/")}`;
				const capitalValue = value[0].toUpperCase() + value.slice(1);
				return last ? /* @__PURE__ */ React.createElement(Typography, {
					className: classes.link,
					key: to
				}, t(capitalValue)) : /* @__PURE__ */ React.createElement(Link$1, {
					to,
					key: to,
					className: classes.link
				}, t(capitalValue));
			}));
		});
		$[4] = breadCrumbLabelList;
		$[5] = classes.link;
		$[6] = history;
		$[7] = root;
		$[8] = t;
		$[9] = t3;
	} else t3 = $[9];
	return t3;
};
function _temp(crumb) {
	return crumb.toLowerCase();
}
function _temp2(x) {
	return x;
}
function _temp3(name) {
	return name.toLowerCase();
}
//#endregion
export { BreadCrumbMenu };

//# sourceMappingURL=BreadCrumbMenu.mjs.map