import { FluentButton } from "../../../UI/inputs/buttons/FluentButton.mjs";
import { ConfigService } from "../../../configService/index.mjs";
import { useUser } from "../../../utilities/auth/useUser.mjs";
import { FluentIcon } from "../../../utilities/iconLibrary/FluentIcon.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { AppBar, IconButton, Toolbar, Typography, makeStyles } from "@material-ui/core";
import { ForwardIcon, WaffleIcon } from "@fluentui/react-icons";
import { useTranslation } from "react-i18next";
//#region src/shell/ui/appSwitcher/FUIAppHeader.jsx
const useStyles = makeStyles((theme) => ({
	main: {
		flexGrow: 1,
		padding: "0 24px",
		display: "flex",
		justifyContent: "space-between",
		alignItems: "center"
	},
	secondary: {},
	appIcon: {
		width: 24,
		height: 24,
		color: theme.palette.text.primary
	},
	appLink: {
		display: "flex",
		flexDirection: "row"
	},
	arrow: {},
	arrowIcon: {
		width: 12,
		height: 12
	},
	linkTitle: { marginRight: theme.spacing(1) },
	toolbar: {
		padding: 0,
		minHeight: theme.spacing(6)
	}
}));
const FUIAppHeader = (props) => {
	const $ = c(24);
	const classes = useStyles();
	const { onClose, unityUrl } = props;
	const { t } = useTranslation();
	const user = useUser();
	let t0;
	if ($[0] !== user.currentTenantId) {
		t0 = (url) => {
			const newWindow = window.open(url + `?tenantId=${user.currentTenantId}`, "_blank", "noopener,noreferrer");
			if (newWindow) newWindow.opener = null;
		};
		$[0] = user.currentTenantId;
		$[1] = t0;
	} else t0 = $[1];
	const openInNewTab = t0;
	let t1;
	if ($[2] !== classes.appIcon) {
		t1 = /* @__PURE__ */ React.createElement(FluentIcon, {
			component: WaffleIcon,
			className: classes.appIcon
		});
		$[2] = classes.appIcon;
		$[3] = t1;
	} else t1 = $[3];
	let t2;
	if ($[4] !== classes.menuButton || $[5] !== onClose || $[6] !== t1) {
		t2 = /* @__PURE__ */ React.createElement(IconButton, {
			className: classes.menuButton,
			edge: "start",
			onClick: onClose
		}, t1);
		$[4] = classes.menuButton;
		$[5] = onClose;
		$[6] = t1;
		$[7] = t2;
	} else t2 = $[7];
	let t3;
	if ($[8] !== classes.appLink || $[9] !== classes.arrow || $[10] !== classes.arrowIcon || $[11] !== classes.linkTitle || $[12] !== classes.secondary || $[13] !== openInNewTab || $[14] !== t || $[15] !== unityUrl) {
		t3 = ConfigService.config.UNITY_PRODUCT_ID != 1 && /* @__PURE__ */ React.createElement(FluentButton, {
			className: classes.appLink,
			onClick: () => openInNewTab(unityUrl)
		}, /* @__PURE__ */ React.createElement("div", { className: classes.linkTitle }, /* @__PURE__ */ React.createElement(Typography, {
			className: classes.secondary,
			variant: "body1"
		}, t("Back to Unity"))), /* @__PURE__ */ React.createElement("div", { className: classes.arrow }, /* @__PURE__ */ React.createElement(FluentIcon, {
			component: ForwardIcon,
			className: classes.arrowIcon
		})));
		$[8] = classes.appLink;
		$[9] = classes.arrow;
		$[10] = classes.arrowIcon;
		$[11] = classes.linkTitle;
		$[12] = classes.secondary;
		$[13] = openInNewTab;
		$[14] = t;
		$[15] = unityUrl;
		$[16] = t3;
	} else t3 = $[16];
	let t4;
	if ($[17] !== classes.main || $[18] !== t2 || $[19] !== t3) {
		t4 = /* @__PURE__ */ React.createElement("div", { className: classes.main }, t2, t3);
		$[17] = classes.main;
		$[18] = t2;
		$[19] = t3;
		$[20] = t4;
	} else t4 = $[20];
	let t5;
	if ($[21] !== classes.toolbar || $[22] !== t4) {
		t5 = /* @__PURE__ */ React.createElement(AppBar, {
			elevation: 0,
			color: "transparent",
			position: "static"
		}, /* @__PURE__ */ React.createElement(Toolbar, { className: classes.toolbar }, t4));
		$[21] = classes.toolbar;
		$[22] = t4;
		$[23] = t5;
	} else t5 = $[23];
	return t5;
};
//#endregion
export { FUIAppHeader as default };

//# sourceMappingURL=FUIAppHeader.mjs.map