UNPKG

wcz-layout

Version:

2,531 lines 65.9 kB
import { b as withOfflineFallback, c as isTestEnv, h as userQueryOptions, m as loginProvidersQueryOptions, n as WISTRON_PRIMARY_COLOR, p as getUser, r as WISTRON_SECONDARY_COLOR, t as Platform, u as rootRouteHead, v as OFFLINE_PHOTO_KEY, y as clearSessionSnapshot } from "./utils-KaM5VMTJ.mjs";
import { t as getAccessToken } from "./tokens-D8CVIFTb.mjs";
import { n as RouterIconButton, t as RouterListItemButton } from "./RouterListItemButton-ULMlaQh6.mjs";
import { t as DialogsContext } from "./DialogsContext-DLqA8RJ_.mjs";
import { c } from "react/compiler-runtime";
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
import { AppBar, Avatar, Box, Collapse, CssBaseline, Grow, IconButton, InitColorSchemeScript, List, ListItem, ListItemButton, ListItemIcon, ListItemText, ListSubheader, Menu, Stack, ThemeProvider, Toolbar, Typography, useColorScheme } from "@mui/material";
import { useQuery } from "@tanstack/react-query";
import { LocalizationProvider } from "@mui/x-date-pickers";
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
import dayjs from "dayjs";
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import { Fragment, useEffect, useId, useRef, useState } from "react";
import { I18nextProvider, Trans, initReactI18next, useTranslation } from "react-i18next";
import { manifest, resources } from "virtual:wcz-layout";
import z from "zod";
import Menu$1 from "@mui/icons-material/Menu";
import MenuOpen from "@mui/icons-material/MenuOpen";
import { styled } from "@mui/material/styles";
import { rootRouteId, useLocation, useMatch, useRouter } from "@tanstack/react-router";
import { createServerFn } from "@tanstack/react-start";
import AccountCircle from "@mui/icons-material/AccountCircle";
import ArrowBack from "@mui/icons-material/ArrowBack";
import Brightness4 from "@mui/icons-material/Brightness4";
import ChevronRight from "@mui/icons-material/ChevronRight";
import DarkMode from "@mui/icons-material/DarkMode";
import Done from "@mui/icons-material/Done";
import LightMode from "@mui/icons-material/LightMode";
import Login from "@mui/icons-material/Login";
import Logout from "@mui/icons-material/Logout";
import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
import Translate from "@mui/icons-material/Translate";
import axios from "axios";
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
import Drawer from "@mui/material/Drawer";
import Box$1 from "@mui/material/Box";
import Divider$1 from "@mui/material/Divider";
import List$1 from "@mui/material/List";
import ListSubheader$1 from "@mui/material/ListSubheader";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Avatar$1 from "@mui/material/Avatar";
import ListItem$1 from "@mui/material/ListItem";
import ListItemButton$1 from "@mui/material/ListItemButton";
import ListItemIcon$1 from "@mui/material/ListItemIcon";
import ListItemText$1 from "@mui/material/ListItemText";
import Paper$1 from "@mui/material/Paper";
import Typography$1 from "@mui/material/Typography";
import Close from "@mui/icons-material/Close";
import useEventCallback$1 from "@mui/utils/useEventCallback";
//#region src/components/core/account/UserAvatar.tsx
const getProfilePhoto = createServerFn({ method: "GET" }).handler(async () => {
	const accessToken = await getAccessToken("graph");
	try {
		const response = await axios.get("https://graph.microsoft.com/v1.0/me/photos/240x240/$value", {
			responseType: "arraybuffer",
			headers: { Authorization: `Bearer ${accessToken}` }
		});
		return `data:image/jpeg;base64,${Buffer.from(response.data).toString("base64")}`;
	} catch (error) {
		if (axios.isAxiosError(error) && error.response?.status === 404) return "";
		throw new Error("Failed to fetch profile photo");
	}
});
const initials = (name) => {
	const words = name.trim().split(/\s+/).filter(Boolean);
	const last = words.length > 1 ? words.at(-1) ?? "" : "";
	return `${words[0]?.[0] ?? ""}${last[0] ?? ""}`.toUpperCase();
};
const UserAvatar = (t0) => {
	const $ = c(11);
	if ($[0] !== "a3c35311052264d80f09c9f7325c63fdc7f22b064802a470759fdbf3b24f1f87") {
		for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "a3c35311052264d80f09c9f7325c63fdc7f22b064802a470759fdbf3b24f1f87";
	}
	const { user } = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = [
			"graph",
			"me",
			"photo"
		];
		$[1] = t1;
	} else t1 = $[1];
	const t2 = user.provider === "entra";
	let t3;
	if ($[2] !== t2) {
		t3 = {
			queryKey: t1,
			queryFn: _temp2$4,
			enabled: t2,
			staleTime: Infinity,
			gcTime: Infinity,
			networkMode: "offlineFirst"
		};
		$[2] = t2;
		$[3] = t3;
	} else t3 = $[3];
	const { data: photoUrl } = useQuery(t3);
	const t4 = user.name;
	const t5 = photoUrl || void 0;
	let t6;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			width: {
				xs: 32,
				sm: 40
			},
			height: {
				xs: 32,
				sm: 40
			},
			fontSize: 16,
			fontWeight: 500,
			letterSpacing: "0.06em",
			pt: "2px",
			pl: "0.06em",
			backgroundColor: "primary.main",
			color: "primary.contrastText"
		};
		$[4] = t6;
	} else t6 = $[4];
	let t7;
	if ($[5] !== user.name) {
		t7 = initials(user.name);
		$[5] = user.name;
		$[6] = t7;
	} else t7 = $[6];
	let t8;
	if ($[7] !== t5 || $[8] !== t7 || $[9] !== user.name) {
		t8 = /* @__PURE__ */ jsx(Avatar, {
			alt: t4,
			src: t5,
			sx: t6,
			children: t7
		});
		$[7] = t5;
		$[8] = t7;
		$[9] = user.name;
		$[10] = t8;
	} else t8 = $[10];
	return t8;
};
function _temp$6() {
	return getProfilePhoto();
}
function _temp2$4() {
	return withOfflineFallback(OFFLINE_PHOTO_KEY, _temp$6);
}
//#endregion
//#region src/components/core/account/UserMenu.tsx
const capitalize = (value) => value && value.charAt(0).toUpperCase() + value.slice(1);
const ToolbarAccount = () => {
	const $ = c(111);
	if ($[0] !== "c2fc10f7eb55ea1e949412963e4aa468a33dc2d92f50c30d2db0533746bd634d") {
		for (let $i = 0; $i < 111; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "c2fc10f7eb55ea1e949412963e4aa468a33dc2d92f50c30d2db0533746bd634d";
	}
	const [anchorElement, setAnchorElement] = useState();
	const [tab, setTab] = useState("settings");
	const open = Boolean(anchorElement);
	const { t, i18n } = useTranslation();
	const { mode, setMode } = useColorScheme();
	let t0;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = { from: rootRouteId };
		$[1] = t0;
	} else t0 = $[1];
	const user = useMatch(t0).context.user;
	let T0;
	let closeMenu;
	let openMenu;
	let settings;
	let t1;
	let t2;
	let theme;
	if ($[2] !== i18n || $[3] !== mode || $[4] !== setMode || $[5] !== t) {
		const supportedLanguages = (Array.isArray(i18n.options.supportedLngs) ? i18n.options.supportedLngs : []).filter(_temp$5);
		const languageDisplayNames = new Intl.DisplayNames([i18n.language], { type: "language" });
		let t3;
		if ($[13] !== t) {
			t3 = t("Layout.Light");
			$[13] = t;
			$[14] = t3;
		} else t3 = $[14];
		let t4;
		if ($[15] !== t3) {
			t4 = {
				mode: "light",
				icon: LightMode,
				label: t3
			};
			$[15] = t3;
			$[16] = t4;
		} else t4 = $[16];
		let t5;
		if ($[17] !== t) {
			t5 = t("Layout.Dark");
			$[17] = t;
			$[18] = t5;
		} else t5 = $[18];
		let t6;
		if ($[19] !== t5) {
			t6 = {
				mode: "dark",
				icon: DarkMode,
				label: t5
			};
			$[19] = t5;
			$[20] = t6;
		} else t6 = $[20];
		let t7;
		if ($[21] !== t) {
			t7 = t("Layout.System");
			$[21] = t;
			$[22] = t7;
		} else t7 = $[22];
		let t8;
		if ($[23] !== t7) {
			t8 = {
				mode: "system",
				icon: SettingsBrightness,
				label: t7
			};
			$[23] = t7;
			$[24] = t8;
		} else t8 = $[24];
		let t9;
		if ($[25] !== t4 || $[26] !== t6 || $[27] !== t8) {
			t9 = [
				t4,
				t6,
				t8
			];
			$[25] = t4;
			$[26] = t6;
			$[27] = t8;
			$[28] = t9;
		} else t9 = $[28];
		const colorModes = t9;
		let t10;
		if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
			t10 = (event) => setAnchorElement(event.currentTarget);
			$[29] = t10;
		} else t10 = $[29];
		openMenu = t10;
		let t11;
		if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
			t11 = () => {
				setAnchorElement(void 0);
				setTimeout(() => setTab("settings"), 300);
			};
			$[30] = t11;
		} else t11 = $[30];
		closeMenu = t11;
		let t12;
		if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
			t12 = (newTab) => () => setTab(newTab);
			$[31] = t12;
		} else t12 = $[31];
		const changeTab = t12;
		let t13;
		if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
			t13 = { backgroundColor: "transparent" };
			$[32] = t13;
		} else t13 = $[32];
		let t14;
		if ($[33] !== t) {
			t14 = t("Layout.Settings");
			$[33] = t;
			$[34] = t14;
		} else t14 = $[34];
		let t15;
		if ($[35] !== t14) {
			t15 = /* @__PURE__ */ jsx(ListSubheader, {
				sx: t13,
				children: t14
			});
			$[35] = t14;
			$[36] = t15;
		} else t15 = $[36];
		let t16;
		let t17;
		if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
			t16 = changeTab("theme");
			t17 = { py: .3 };
			$[37] = t16;
			$[38] = t17;
		} else {
			t16 = $[37];
			t17 = $[38];
		}
		let t18;
		if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
			t18 = /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Brightness4, {}) });
			$[39] = t18;
		} else t18 = $[39];
		let t19;
		if ($[40] !== t) {
			t19 = t("Layout.Appearance");
			$[40] = t;
			$[41] = t19;
		} else t19 = $[41];
		let t20;
		if ($[42] !== colorModes || $[43] !== mode || $[44] !== t) {
			t20 = colorModes.find((m) => m.mode === mode)?.label ?? t("Layout.System");
			$[42] = colorModes;
			$[43] = mode;
			$[44] = t;
			$[45] = t20;
		} else t20 = $[45];
		let t21;
		if ($[46] !== t19 || $[47] !== t20) {
			t21 = /* @__PURE__ */ jsx(ListItemText, {
				primary: t19,
				secondary: t20
			});
			$[46] = t19;
			$[47] = t20;
			$[48] = t21;
		} else t21 = $[48];
		let t22;
		if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
			t22 = /* @__PURE__ */ jsx(ChevronRight, {});
			$[49] = t22;
		} else t22 = $[49];
		let t23;
		if ($[50] !== t21) {
			t23 = /* @__PURE__ */ jsxs(ListItemButton, {
				onClick: t16,
				sx: t17,
				children: [
					t18,
					t21,
					t22
				]
			});
			$[50] = t21;
			$[51] = t23;
		} else t23 = $[51];
		let t24;
		let t25;
		if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
			t24 = changeTab("language");
			t25 = { py: .3 };
			$[52] = t24;
			$[53] = t25;
		} else {
			t24 = $[52];
			t25 = $[53];
		}
		let t26;
		if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
			t26 = /* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Translate, {}) });
			$[54] = t26;
		} else t26 = $[54];
		let t27;
		if ($[55] !== t) {
			t27 = t("Layout.Language");
			$[55] = t;
			$[56] = t27;
		} else t27 = $[56];
		let t28;
		if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
			t28 = /* @__PURE__ */ jsx(ChevronRight, {});
			$[57] = t28;
		} else t28 = $[57];
		const t29 = /* @__PURE__ */ jsxs(ListItemButton, {
			onClick: t24,
			sx: t25,
			children: [
				t26,
				/* @__PURE__ */ jsx(ListItemText, {
					primary: t27,
					secondary: capitalize(languageDisplayNames.of(i18n.language))
				}),
				t28
			]
		});
		let t30;
		if ($[58] !== t15 || $[59] !== t23 || $[60] !== t29) {
			t30 = /* @__PURE__ */ jsxs(List, {
				component: "nav",
				subheader: t15,
				children: [t23, t29]
			});
			$[58] = t15;
			$[59] = t23;
			$[60] = t29;
			$[61] = t30;
		} else t30 = $[61];
		settings = t30;
		let t31;
		let t32;
		if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
			t31 = changeTab("settings");
			t32 = {
				backgroundColor: "transparent",
				display: "flex",
				alignItems: "center",
				px: 1,
				cursor: "pointer"
			};
			$[62] = t31;
			$[63] = t32;
		} else {
			t31 = $[62];
			t32 = $[63];
		}
		let t33;
		if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
			t33 = { mr: .5 };
			$[64] = t33;
		} else t33 = $[64];
		let t34;
		if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
			t34 = /* @__PURE__ */ jsx(IconButton, {
				size: "small",
				sx: t33,
				"aria-label": "Back",
				children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
			});
			$[65] = t34;
		} else t34 = $[65];
		let t35;
		if ($[66] !== t) {
			t35 = t("Layout.Appearance");
			$[66] = t;
			$[67] = t35;
		} else t35 = $[67];
		let t36;
		if ($[68] !== t35) {
			t36 = /* @__PURE__ */ jsxs(ListSubheader, {
				onClick: t31,
				sx: t32,
				children: [
					t34,
					" ",
					t35
				]
			});
			$[68] = t35;
			$[69] = t36;
		} else t36 = $[69];
		let t37;
		if ($[70] !== colorModes || $[71] !== mode || $[72] !== setMode) {
			t37 = colorModes.map((t38) => {
				const { mode: modeValue, icon: Icon, label } = t38;
				return /* @__PURE__ */ jsxs(ListItemButton, {
					onClick: () => {
						setMode(modeValue);
						closeMenu();
					},
					selected: mode === modeValue,
					children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Icon, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: label })]
				}, modeValue);
			});
			$[70] = colorModes;
			$[71] = mode;
			$[72] = setMode;
			$[73] = t37;
		} else t37 = $[73];
		let t38;
		if ($[74] !== t36 || $[75] !== t37) {
			t38 = /* @__PURE__ */ jsx(List, {
				subheader: t36,
				children: t37
			});
			$[74] = t36;
			$[75] = t37;
			$[76] = t38;
		} else t38 = $[76];
		theme = t38;
		T0 = List;
		let t39;
		let t40;
		if ($[77] === Symbol.for("react.memo_cache_sentinel")) {
			t39 = changeTab("settings");
			t40 = {
				backgroundColor: "transparent",
				display: "flex",
				alignItems: "center",
				px: 1,
				cursor: "pointer"
			};
			$[77] = t39;
			$[78] = t40;
		} else {
			t39 = $[77];
			t40 = $[78];
		}
		let t41;
		if ($[79] === Symbol.for("react.memo_cache_sentinel")) {
			t41 = { mr: .5 };
			$[79] = t41;
		} else t41 = $[79];
		let t42;
		if ($[80] === Symbol.for("react.memo_cache_sentinel")) {
			t42 = /* @__PURE__ */ jsx(IconButton, {
				size: "small",
				sx: t41,
				"aria-label": "Back",
				children: /* @__PURE__ */ jsx(ArrowBack, { fontSize: "small" })
			});
			$[80] = t42;
		} else t42 = $[80];
		let t43;
		if ($[81] !== t) {
			t43 = t("Layout.Language");
			$[81] = t;
			$[82] = t43;
		} else t43 = $[82];
		if ($[83] !== t43) {
			t1 = /* @__PURE__ */ jsxs(ListSubheader, {
				onClick: t39,
				sx: t40,
				children: [
					t42,
					" ",
					t43
				]
			});
			$[83] = t43;
			$[84] = t1;
		} else t1 = $[84];
		t2 = supportedLanguages.map((languageCode) => /* @__PURE__ */ jsxs(ListItemButton, {
			onClick: () => i18n.changeLanguage(languageCode).finally(() => closeMenu()),
			selected: i18n.resolvedLanguage === languageCode,
			children: [/* @__PURE__ */ jsx(ListItemIcon, { children: i18n.resolvedLanguage === languageCode && /* @__PURE__ */ jsx(Done, {}) }), /* @__PURE__ */ jsx(ListItemText, { primary: capitalize(languageDisplayNames.of(languageCode)) })]
		}, languageCode));
		$[2] = i18n;
		$[3] = mode;
		$[4] = setMode;
		$[5] = t;
		$[6] = T0;
		$[7] = closeMenu;
		$[8] = openMenu;
		$[9] = settings;
		$[10] = t1;
		$[11] = t2;
		$[12] = theme;
	} else {
		T0 = $[6];
		closeMenu = $[7];
		openMenu = $[8];
		settings = $[9];
		t1 = $[10];
		t2 = $[11];
		theme = $[12];
	}
	let t3;
	if ($[85] !== T0 || $[86] !== t1 || $[87] !== t2) {
		t3 = /* @__PURE__ */ jsx(T0, {
			subheader: t1,
			children: t2
		});
		$[85] = T0;
		$[86] = t1;
		$[87] = t2;
		$[88] = t3;
	} else t3 = $[88];
	const language = t3;
	let t4;
	if ($[89] !== user) {
		t4 = user ? /* @__PURE__ */ jsx(UserAvatar, { user }) : /* @__PURE__ */ jsx(AccountCircle, { sx: {
			width: {
				xs: 32,
				sm: 40
			},
			height: {
				xs: 32,
				sm: 40
			}
		} });
		$[89] = user;
		$[90] = t4;
	} else t4 = $[90];
	let t5;
	if ($[91] !== openMenu || $[92] !== t4) {
		t5 = /* @__PURE__ */ jsx(IconButton, {
			size: "small",
			edge: "end",
			onClick: openMenu,
			"aria-label": "Account",
			children: t4
		});
		$[91] = openMenu;
		$[92] = t4;
		$[93] = t5;
	} else t5 = $[93];
	let t6;
	if ($[94] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = { width: 240 };
		$[94] = t6;
	} else t6 = $[94];
	let t7;
	if ($[95] !== t || $[96] !== user) {
		t7 = /* @__PURE__ */ jsx(List, {
			disablePadding: true,
			children: user ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ListItem, { children: /* @__PURE__ */ jsx(ListItemText, {
				primary: user.name,
				secondary: /* @__PURE__ */ jsxs("span", { children: [
					user.employeeId && /* @__PURE__ */ jsx("span", { children: user.employeeId }),
					user.employeeId && /* @__PURE__ */ jsx("br", {}),
					user.department && /* @__PURE__ */ jsx("span", { children: user.department })
				] })
			}) }), /* @__PURE__ */ jsxs(ListItemButton, {
				onClick: _temp2$3,
				children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Logout, { color: "error" }) }), /* @__PURE__ */ jsx(ListItemText, { primary: t("Layout.Logout") })]
			})] }) : /* @__PURE__ */ jsxs(ListItemButton, {
				onClick: _temp3$2,
				children: [/* @__PURE__ */ jsx(ListItemIcon, { children: /* @__PURE__ */ jsx(Login, { color: "success" }) }), /* @__PURE__ */ jsx(ListItemText, { primary: t("Layout.LogIn") })]
			})
		});
		$[95] = t;
		$[96] = user;
		$[97] = t7;
	} else t7 = $[97];
	const t8 = tab === "settings" && settings;
	const t9 = tab === "theme" && theme;
	const t10 = tab === "language" && language;
	let t11;
	if ($[98] !== t10 || $[99] !== t7 || $[100] !== t8 || $[101] !== t9) {
		t11 = /* @__PURE__ */ jsxs(Box, {
			sx: t6,
			children: [
				t7,
				t8,
				t9,
				t10
			]
		});
		$[98] = t10;
		$[99] = t7;
		$[100] = t8;
		$[101] = t9;
		$[102] = t11;
	} else t11 = $[102];
	let t12;
	if ($[103] !== anchorElement || $[104] !== closeMenu || $[105] !== open || $[106] !== t11) {
		t12 = /* @__PURE__ */ jsx(Menu, {
			anchorEl: anchorElement,
			open,
			onClose: closeMenu,
			children: t11
		});
		$[103] = anchorElement;
		$[104] = closeMenu;
		$[105] = open;
		$[106] = t11;
		$[107] = t12;
	} else t12 = $[107];
	let t13;
	if ($[108] !== t12 || $[109] !== t5) {
		t13 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, t12] });
		$[108] = t12;
		$[109] = t5;
		$[110] = t13;
	} else t13 = $[110];
	return t13;
};
function _temp$5(lng) {
	return lng !== "cimode";
}
function _temp2$3() {
	clearSessionSnapshot();
	location.href = "/auth/logout";
}
function _temp3$2() {
	const returnTo = location.pathname + location.search;
	location.href = `/auth/login?returnTo=${encodeURIComponent(returnTo)}`;
}
//#endregion
//#region src/components/core/AppTitle.tsx
const AppTitle = () => {
	const $ = c(6);
	if ($[0] !== "ab03af767dd9ff816bebffe4e97b58599e51414413ee378222712a7efe3c5b86") {
		for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "ab03af767dd9ff816bebffe4e97b58599e51414413ee378222712a7efe3c5b86";
	}
	let t0;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = {
			alignItems: "center",
			flexGrow: 1
		};
		$[1] = t0;
	} else t0 = $[1];
	let t1;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = /* @__PURE__ */ jsx(RouterIconButton, {
			to: "/",
			size: "small",
			children: /* @__PURE__ */ jsx("img", {
				src: "/favicon-32x32.png",
				alt: manifest.name,
				loading: "lazy"
			})
		});
		$[2] = t1;
	} else t1 = $[2];
	let t2;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = { display: {
			xs: "inline",
			sm: "none"
		} };
		$[3] = t2;
	} else t2 = $[3];
	let t3;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ jsx(Box, {
			component: "span",
			sx: t2,
			children: manifest.short_name ?? manifest.name
		});
		$[4] = t3;
	} else t3 = $[4];
	let t4;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t4 = /* @__PURE__ */ jsxs(Stack, {
			direction: "row",
			spacing: 1,
			sx: t0,
			children: [t1, /* @__PURE__ */ jsxs(Typography, {
				variant: "h6",
				children: [t3, /* @__PURE__ */ jsx(Box, {
					component: "span",
					sx: { display: {
						xs: "none",
						sm: "inline"
					} },
					children: manifest.name
				})]
			})]
		});
		$[5] = t4;
	} else t4 = $[5];
	return t4;
};
//#endregion
//#region src/models/Navigation.ts
const isPageItem = (item) => item.kind === "item";
const isPageGroup = (item) => item.kind === "group";
const isDivider = (item) => item.kind === "divider";
const isHeader = (item) => item.kind === "header";
//#endregion
//#region src/components/core/navigation/NavigationListItem.tsx
const ICON_SIZE = 34;
const getSelectedColor = (theme) => theme.vars?.palette.primary.dark ?? theme.palette.primary.dark;
const getActionActiveColor = (theme) => theme.vars?.palette.action.active ?? theme.palette.action.active;
const StyledNavButton = styled(ListItemButton$1)(({ theme }) => ({
	borderRadius: Number(theme.shape.borderRadius) * 2,
	"&.Mui-selected": {
		"& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": { color: getSelectedColor(theme) },
		"& .MuiAvatar-root": { backgroundColor: getSelectedColor(theme) },
		"& .MuiTouchRipple-child": { backgroundColor: getSelectedColor(theme) }
	},
	"& .MuiSvgIcon-root": { color: getActionActiveColor(theme) },
	"& .MuiAvatar-root": { backgroundColor: getActionActiveColor(theme) }
}));
const routerButtonSx = (theme) => ({
	borderRadius: 2,
	"&.Mui-selected": {
		"& .MuiListItemIcon-root, & .MuiTypography-root, & .MuiSvgIcon-root": { color: getSelectedColor(theme) },
		"& .MuiAvatar-root": { backgroundColor: getSelectedColor(theme) },
		"& .MuiTouchRipple-child": { backgroundColor: getSelectedColor(theme) }
	},
	"& .MuiSvgIcon-root": { color: getActionActiveColor(theme) },
	"& .MuiAvatar-root": { backgroundColor: getActionActiveColor(theme) }
});
const IconOrAvatar = (t0) => {
	const $ = c(18);
	if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
		for (let $i = 0; $i < 18; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
	}
	const { item, collapsed } = t0;
	if (item.icon || collapsed) {
		let t1;
		if ($[1] !== collapsed) {
			t1 = collapsed ? {
				position: "absolute",
				left: "50%",
				top: "calc(50% - 6px)",
				transform: "translate(-50%, -50%)"
			} : {};
			$[1] = collapsed;
			$[2] = t1;
		} else t1 = $[2];
		let t2;
		if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
			t2 = {
				display: "flex",
				alignItems: "center",
				justifyContent: "center",
				minWidth: ICON_SIZE
			};
			$[3] = t2;
		} else t2 = $[3];
		const t3 = item.icon ?? null;
		let t4;
		if ($[4] !== collapsed || $[5] !== item.icon || $[6] !== item.title) {
			t4 = !item.icon && collapsed ? /* @__PURE__ */ jsx(Avatar$1, {
				sx: {
					width: 27,
					height: 27,
					fontSize: 12
				},
				children: item.title.split(" ").slice(0, 2).map(_temp$4).join("")
			}) : null;
			$[4] = collapsed;
			$[5] = item.icon;
			$[6] = item.title;
			$[7] = t4;
		} else t4 = $[7];
		let t5;
		if ($[8] !== t3 || $[9] !== t4) {
			t5 = /* @__PURE__ */ jsxs(ListItemIcon$1, {
				sx: t2,
				children: [t3, t4]
			});
			$[8] = t3;
			$[9] = t4;
			$[10] = t5;
		} else t5 = $[10];
		let t6;
		if ($[11] !== collapsed || $[12] !== item.title) {
			t6 = collapsed ? /* @__PURE__ */ jsx(Typography$1, {
				variant: "caption",
				sx: {
					position: "absolute",
					bottom: -18,
					left: "50%",
					transform: "translateX(-50%)",
					fontSize: 10,
					fontWeight: 500,
					textAlign: "center",
					whiteSpace: "nowrap",
					overflow: "hidden",
					textOverflow: "ellipsis",
					maxWidth: 56
				},
				children: item.title
			}) : null;
			$[11] = collapsed;
			$[12] = item.title;
			$[13] = t6;
		} else t6 = $[13];
		let t7;
		if ($[14] !== t1 || $[15] !== t5 || $[16] !== t6) {
			t7 = /* @__PURE__ */ jsxs(Box$1, {
				sx: t1,
				children: [t5, t6]
			});
			$[14] = t1;
			$[15] = t5;
			$[16] = t6;
			$[17] = t7;
		} else t7 = $[17];
		return t7;
	}
	return null;
};
const MiniPopover = (t0) => {
	const $ = c(8);
	if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
		for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
	}
	const { open, children } = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			position: "fixed",
			left: 84,
			pl: "2px",
			pb: "10px"
		};
		$[1] = t1;
	} else t1 = $[1];
	let t2;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			pt: .5,
			pb: .5,
			transform: "translateY(calc(50% - 30px))",
			maxHeight: "min(calc(100vh - 100px), 560px)",
			overflowY: "auto",
			overscrollBehavior: "contain"
		};
		$[2] = t2;
	} else t2 = $[2];
	let t3;
	if ($[3] !== children) {
		t3 = /* @__PURE__ */ jsx(Box$1, {
			sx: t1,
			children: /* @__PURE__ */ jsx(Paper$1, {
				sx: t2,
				children
			})
		});
		$[3] = children;
		$[4] = t3;
	} else t3 = $[4];
	let t4;
	if ($[5] !== open || $[6] !== t3) {
		t4 = /* @__PURE__ */ jsx(Grow, {
			in: open,
			children: t3
		});
		$[5] = open;
		$[6] = t3;
		$[7] = t4;
	} else t4 = $[7];
	return t4;
};
const NavigationListItem = (t0) => {
	const $ = c(62);
	if ($[0] !== "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9") {
		for (let $i = 0; $i < 62; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "a5a2437d20ca7e62fe542d3943ca8a6b2a0b22122396667ddebffe138510b1d9";
	}
	const { item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded: t1, isSidebarFullyCollapsed, onClick, renderNested, onClose } = t0;
	const isSidebarFullyExpanded = t1 === void 0 ? true : t1;
	const [hoveredMiniItemId, setHoveredMiniItemId] = useState(null);
	let t2;
	if ($[1] !== item) {
		t2 = isPageGroup(item);
		$[1] = item;
		$[2] = t2;
	} else t2 = $[2];
	const groupItem = t2;
	const itemId = groupItem ? `group-${item.title}` : `item-${item.to ?? item.href ?? item.title}`;
	let t3;
	if ($[3] !== collapsed || $[4] !== groupItem || $[5] !== isOpen || $[6] !== isSidebarFullyCollapsed || $[7] !== isSidebarFullyExpanded) {
		t3 = (theme) => {
			if (collapsed && isSidebarFullyCollapsed && groupItem) return {
				fontSize: 18,
				position: "absolute",
				top: "41.5%",
				right: "2px",
				transform: "translateY(-50%) rotate(-90deg)"
			};
			if (!collapsed && isSidebarFullyExpanded && groupItem) return {
				ml: .5,
				transform: `rotate(${isOpen ? 0 : -90}deg)`,
				transition: theme.transitions.create("transform", {
					easing: theme.transitions.easing.sharp,
					duration: 100
				})
			};
			return { display: "none" };
		};
		$[3] = collapsed;
		$[4] = groupItem;
		$[5] = isOpen;
		$[6] = isSidebarFullyCollapsed;
		$[7] = isSidebarFullyExpanded;
		$[8] = t3;
	} else t3 = $[8];
	const chevronSx = t3;
	const shouldJustExpand = groupItem && !collapsed;
	const t4 = collapsed ? 60 : 48;
	let t5;
	if ($[9] !== t4) {
		t5 = {
			px: 1.4,
			height: t4
		};
		$[9] = t4;
		$[10] = t5;
	} else t5 = $[10];
	let t6;
	if ($[11] !== disabled || $[12] !== selected || $[13] !== t5) {
		t6 = {
			selected,
			disabled,
			sx: t5
		};
		$[11] = disabled;
		$[12] = selected;
		$[13] = t5;
		$[14] = t6;
	} else t6 = $[14];
	const buttonProps = t6;
	let t7;
	if ($[15] !== collapsed || $[16] !== item) {
		t7 = /* @__PURE__ */ jsx(IconOrAvatar, {
			item,
			collapsed
		});
		$[15] = collapsed;
		$[16] = item;
		$[17] = t7;
	} else t7 = $[17];
	let t8;
	if ($[18] !== collapsed || $[19] !== item.title) {
		t8 = !collapsed && /* @__PURE__ */ jsx(ListItemText$1, {
			primary: item.title,
			slotProps: { primary: {
				noWrap: true,
				title: item.title
			} },
			sx: {
				ml: 1.2,
				flex: 1,
				minWidth: 0,
				"& .MuiTypography-root": {
					whiteSpace: "nowrap",
					overflow: "hidden",
					textOverflow: "ellipsis"
				}
			}
		});
		$[18] = collapsed;
		$[19] = item.title;
		$[20] = t8;
	} else t8 = $[20];
	let t9;
	if ($[21] !== chevronSx || $[22] !== groupItem) {
		t9 = groupItem ? /* @__PURE__ */ jsx(ExpandMoreIcon, { sx: chevronSx }) : null;
		$[21] = chevronSx;
		$[22] = groupItem;
		$[23] = t9;
	} else t9 = $[23];
	let t10;
	if ($[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
		t10 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
			t7,
			t8,
			t9
		] });
		$[24] = t7;
		$[25] = t8;
		$[26] = t9;
		$[27] = t10;
	} else t10 = $[27];
	const buttonContent = t10;
	let t11;
	if ($[28] !== collapsed || $[29] !== groupItem || $[30] !== itemId) {
		t11 = groupItem && collapsed ? {
			onMouseEnter: () => {
				setHoveredMiniItemId(itemId);
			},
			onMouseLeave: () => {
				setHoveredMiniItemId(null);
			}
		} : {};
		$[28] = collapsed;
		$[29] = groupItem;
		$[30] = itemId;
		$[31] = t11;
	} else t11 = $[31];
	let t12;
	if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
		t12 = {
			py: 0,
			px: 1,
			overflowX: "hidden"
		};
		$[32] = t12;
	} else t12 = $[32];
	let t13;
	if ($[33] !== buttonContent || $[34] !== buttonProps || $[35] !== groupItem || $[36] !== item || $[37] !== onClick || $[38] !== onClose || $[39] !== shouldJustExpand) {
		t13 = groupItem ? /* @__PURE__ */ jsx(StyledNavButton, {
			...buttonProps,
			onClick: shouldJustExpand ? () => onClick?.(item) : void 0,
			children: buttonContent
		}) : /* @__PURE__ */ jsx(RouterListItemButton, {
			...buttonProps,
			to: item.to,
			href: item.href,
			params: item.params,
			search: item.search,
			onClick: onClose,
			sx: [buttonProps.sx, routerButtonSx],
			children: buttonContent
		});
		$[33] = buttonContent;
		$[34] = buttonProps;
		$[35] = groupItem;
		$[36] = item;
		$[37] = onClick;
		$[38] = onClose;
		$[39] = shouldJustExpand;
		$[40] = t13;
	} else t13 = $[40];
	let t14;
	if ($[41] !== collapsed || $[42] !== groupItem || $[43] !== hoveredMiniItemId || $[44] !== item.children || $[45] !== itemId || $[46] !== renderNested) {
		t14 = groupItem && collapsed ? /* @__PURE__ */ jsx(MiniPopover, {
			open: itemId === hoveredMiniItemId,
			children: renderNested?.(item.children)
		}) : null;
		$[41] = collapsed;
		$[42] = groupItem;
		$[43] = hoveredMiniItemId;
		$[44] = item.children;
		$[45] = itemId;
		$[46] = renderNested;
		$[47] = t14;
	} else t14 = $[47];
	let t15;
	if ($[48] !== t11 || $[49] !== t13 || $[50] !== t14) {
		t15 = /* @__PURE__ */ jsxs(ListItem$1, {
			...t11,
			sx: t12,
			children: [t13, t14]
		});
		$[48] = t11;
		$[49] = t13;
		$[50] = t14;
		$[51] = t15;
	} else t15 = $[51];
	const listItem = t15;
	let t16;
	if ($[52] !== collapsed || $[53] !== groupItem || $[54] !== isOpen || $[55] !== item.children || $[56] !== renderNested) {
		t16 = groupItem && !collapsed ? /* @__PURE__ */ jsx(Collapse, {
			in: isOpen,
			timeout: "auto",
			unmountOnExit: true,
			children: renderNested?.(item.children)
		}) : null;
		$[52] = collapsed;
		$[53] = groupItem;
		$[54] = isOpen;
		$[55] = item.children;
		$[56] = renderNested;
		$[57] = t16;
	} else t16 = $[57];
	let t17;
	if ($[58] !== itemId || $[59] !== listItem || $[60] !== t16) {
		t17 = /* @__PURE__ */ jsxs(Fragment, { children: [listItem, t16] }, itemId);
		$[58] = itemId;
		$[59] = listItem;
		$[60] = t16;
		$[61] = t17;
	} else t17 = $[61];
	return t17;
};
function _temp$4(word) {
	return word.charAt(0).toUpperCase();
}
//#endregion
//#region src/components/core/navigation/NavigationList.tsx
const NavigationList = (t0) => {
	const $ = c(29);
	if ($[0] !== "4dbd114545118530db002b7c781f97683277f7b721a30074e8778a8e4ea56119") {
		for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "4dbd114545118530db002b7c781f97683277f7b721a30074e8778a8e4ea56119";
	}
	const { subNavigation, depth: t1, collapsed, isPopover, isSidebarFullyExpanded: t2, isSidebarFullyCollapsed, renderItem, activePath, onClose } = t0;
	const depth = t1 === void 0 ? 0 : t1;
	const isSidebarFullyExpanded = t2 === void 0 ? true : t2;
	let t3;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = [];
		$[1] = t3;
	} else t3 = $[1];
	const [openKeys, setOpenKeys] = useState(t3);
	let t4;
	let t5;
	if ($[2] !== collapsed) {
		t4 = () => {
			if (collapsed) setOpenKeys([]);
		};
		t5 = [collapsed];
		$[2] = collapsed;
		$[3] = t4;
		$[4] = t5;
	} else {
		t4 = $[3];
		t5 = $[4];
	}
	useEffect(t4, t5);
	let t6;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
		$[5] = t6;
	} else t6 = $[5];
	const toggleKey = t6;
	let t7;
	if ($[6] !== activePath || $[7] !== collapsed || $[8] !== depth || $[9] !== onClose) {
		t7 = (children) => /* @__PURE__ */ jsx(NavigationList, {
			subNavigation: children,
			depth: depth + 1,
			isPopover: collapsed,
			activePath,
			onClose
		});
		$[6] = activePath;
		$[7] = collapsed;
		$[8] = depth;
		$[9] = onClose;
		$[10] = t7;
	} else t7 = $[10];
	const renderNested = t7;
	let t8;
	if ($[11] !== activePath || $[12] !== collapsed || $[13] !== depth || $[14] !== isPopover || $[15] !== isSidebarFullyCollapsed || $[16] !== isSidebarFullyExpanded || $[17] !== onClose || $[18] !== openKeys || $[19] !== renderItem || $[20] !== renderNested || $[21] !== subNavigation) {
		const filteredNavigation = subNavigation.filter(_temp$3);
		const t9 = isPopover && depth === 1 ? .5 : 0;
		const t10 = depth === 0 && !isPopover ? 4 : .5;
		const t11 = (isPopover ? 1 : 2) * (isPopover ? depth - 1 : depth);
		const t12 = isPopover && depth === 1 ? 240 : "auto";
		const t13 = collapsed ? 84 : "auto";
		let t14;
		if ($[23] !== t10 || $[24] !== t11 || $[25] !== t12 || $[26] !== t13 || $[27] !== t9) {
			t14 = {
				padding: 0,
				mt: t9,
				mb: t10,
				pl: t11,
				minWidth: t12,
				width: t13
			};
			$[23] = t10;
			$[24] = t11;
			$[25] = t12;
			$[26] = t13;
			$[27] = t9;
			$[28] = t14;
		} else t14 = $[28];
		t8 = /* @__PURE__ */ jsx(List$1, {
			sx: t14,
			children: filteredNavigation.map((navItem, index) => {
				if (isHeader(navItem)) return /* @__PURE__ */ jsx(ListSubheader$1, {
					sx: {
						fontSize: 12,
						fontWeight: "700",
						height: collapsed ? 0 : 40,
						px: 2,
						overflow: "hidden",
						textOverflow: "ellipsis",
						whiteSpace: "nowrap",
						zIndex: 2,
						bgcolor: "transparent",
						position: "static"
					},
					children: navItem.title
				}, `subheader-${depth}-${index}`);
				if (isDivider(navItem)) {
					const nextItem = filteredNavigation[index + 1];
					return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Divider$1, { sx: {
						mx: 1,
						mt: 1,
						mb: nextItem && isHeader(nextItem) && !collapsed ? 0 : 1
					} }) }, `divider-${depth}-${index}`);
				}
				if (!isPageItem(navItem) && !isPageGroup(navItem)) return null;
				const key_0 = `item-${depth}-${index}`;
				const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
				const selected = isPageItem(navItem) && navItem.to === activePath;
				if (renderItem) return /* @__PURE__ */ jsx(Fragment, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key_0);
				return /* @__PURE__ */ jsx(NavigationListItem, {
					item: navItem,
					isOpen: openKeys.includes(uniqueItemKey),
					selected,
					collapsed,
					isSidebarFullyExpanded,
					isSidebarFullyCollapsed,
					onClick: isPageGroup(navItem) && !collapsed ? () => toggleKey(uniqueItemKey) : void 0,
					renderNested,
					onClose
				}, key_0);
			})
		});
		$[11] = activePath;
		$[12] = collapsed;
		$[13] = depth;
		$[14] = isPopover;
		$[15] = isSidebarFullyCollapsed;
		$[16] = isSidebarFullyExpanded;
		$[17] = onClose;
		$[18] = openKeys;
		$[19] = renderItem;
		$[20] = renderNested;
		$[21] = subNavigation;
		$[22] = t8;
	} else t8 = $[22];
	return t8;
};
function _temp$3(nav) {
	return !nav.hidden;
}
//#endregion
//#region src/components/core/navigation/NavigationContent.tsx
const NavigationContent = (t0) => {
	const $ = c(17);
	if ($[0] !== "8e18ca51999228f0bb12ab188e0dd8177eed75d44b84d25a0355fb537f5fdbd1") {
		for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "8e18ca51999228f0bb12ab188e0dd8177eed75d44b84d25a0355fb537f5fdbd1";
	}
	const { navigation, collapsed, expanded, setExpanded, showPermanent } = t0;
	const location = useLocation();
	const t1 = collapsed ? "stable" : "auto";
	const t2 = navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2;
	let t3;
	if ($[1] !== t1 || $[2] !== t2) {
		t3 = {
			height: "100%",
			display: "flex",
			flexDirection: "column",
			justifyContent: "space-between",
			overflow: "auto",
			scrollbarGutter: t1,
			overflowX: "hidden",
			pt: t2
		};
		$[1] = t1;
		$[2] = t2;
		$[3] = t3;
	} else t3 = $[3];
	const t4 = !expanded;
	let t5;
	if ($[4] !== setExpanded || $[5] !== showPermanent) {
		t5 = showPermanent ? void 0 : () => setExpanded(false);
		$[4] = setExpanded;
		$[5] = showPermanent;
		$[6] = t5;
	} else t5 = $[6];
	let t6;
	if ($[7] !== collapsed || $[8] !== expanded || $[9] !== location.pathname || $[10] !== navigation || $[11] !== t4 || $[12] !== t5) {
		t6 = /* @__PURE__ */ jsx(NavigationList, {
			subNavigation: navigation,
			collapsed,
			isSidebarFullyExpanded: expanded,
			isSidebarFullyCollapsed: t4,
			activePath: location.pathname,
			onClose: t5
		});
		$[7] = collapsed;
		$[8] = expanded;
		$[9] = location.pathname;
		$[10] = navigation;
		$[11] = t4;
		$[12] = t5;
		$[13] = t6;
	} else t6 = $[13];
	let t7;
	if ($[14] !== t3 || $[15] !== t6) {
		t7 = /* @__PURE__ */ jsx(Box$1, {
			component: "nav",
			sx: t3,
			children: t6
		});
		$[14] = t3;
		$[15] = t6;
		$[16] = t7;
	} else t7 = $[16];
	return t7;
};
const NavigationRail = (t0) => {
	const $ = c(29);
	if ($[0] !== "49d079c05318eb36fa341a571be66f2c7d983f06018386e081b42f162f58e4e6") {
		for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "49d079c05318eb36fa341a571be66f2c7d983f06018386e081b42f162f58e4e6";
	}
	const { navigation, expanded, setExpanded } = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			xs: "none",
			sm: "block"
		};
		$[1] = t1;
	} else t1 = $[1];
	const t2 = expanded ? 320 : 84;
	let t3;
	if ($[2] !== expanded) {
		t3 = (theme) => ({
			position: "absolute",
			top: `64px`,
			height: `calc(100% - 64px)`,
			width: expanded ? 320 : 84,
			background: "transparent",
			borderTop: "1px solid",
			borderColor: theme.vars?.palette.divider ?? theme.palette.divider,
			boxShadow: "none"
		});
		$[2] = expanded;
		$[3] = t3;
	} else t3 = $[3];
	let t4;
	if ($[4] !== t2 || $[5] !== t3) {
		t4 = {
			display: t1,
			width: t2,
			"& .MuiDrawer-paper": t3
		};
		$[4] = t2;
		$[5] = t3;
		$[6] = t4;
	} else t4 = $[6];
	const t5 = !expanded;
	let t6;
	if ($[7] !== expanded || $[8] !== navigation || $[9] !== setExpanded || $[10] !== t5) {
		t6 = /* @__PURE__ */ jsx(NavigationContent, {
			navigation,
			collapsed: t5,
			expanded,
			setExpanded,
			showPermanent: true
		});
		$[7] = expanded;
		$[8] = navigation;
		$[9] = setExpanded;
		$[10] = t5;
		$[11] = t6;
	} else t6 = $[11];
	let t7;
	if ($[12] !== t4 || $[13] !== t6) {
		t7 = /* @__PURE__ */ jsx(Drawer, {
			variant: "permanent",
			sx: t4,
			children: t6
		});
		$[12] = t4;
		$[13] = t6;
		$[14] = t7;
	} else t7 = $[14];
	let t8;
	if ($[15] !== setExpanded) {
		t8 = () => setExpanded(false);
		$[15] = setExpanded;
		$[16] = t8;
	} else t8 = $[16];
	let t9;
	if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
		t9 = {
			display: {
				xs: "block",
				sm: "none"
			},
			"& .MuiDrawer-paper": { width: "min(280px, calc(100vw - 56px))" }
		};
		$[17] = t9;
	} else t9 = $[17];
	let t10;
	if ($[18] !== expanded || $[19] !== navigation || $[20] !== setExpanded) {
		t10 = /* @__PURE__ */ jsx(NavigationContent, {
			navigation,
			collapsed: false,
			expanded,
			setExpanded,
			showPermanent: false
		});
		$[18] = expanded;
		$[19] = navigation;
		$[20] = setExpanded;
		$[21] = t10;
	} else t10 = $[21];
	let t11;
	if ($[22] !== expanded || $[23] !== t10 || $[24] !== t8) {
		t11 = /* @__PURE__ */ jsx(Drawer, {
			open: expanded,
			onClose: t8,
			sx: t9,
			children: t10
		});
		$[22] = expanded;
		$[23] = t10;
		$[24] = t8;
		$[25] = t11;
	} else t11 = $[25];
	let t12;
	if ($[26] !== t11 || $[27] !== t7) {
		t12 = /* @__PURE__ */ jsxs(Fragment, { children: [t7, t11] });
		$[26] = t11;
		$[27] = t7;
		$[28] = t12;
	} else t12 = $[28];
	return t12;
};
//#endregion
//#region src/components/core/TestMascot.tsx
const TEAL = "#1ec8d3";
const SKIN = "#fbe3d1";
const INK = "#17171a";
const EDGE = "#d3dde2";
/**
* Wisby, drawn inline rather than loaded from `public/`: this package ships as
* `dist` only, so a file asset would have to be copied into every consuming
* app. Approximated from the brand artwork — swap the whole <svg> when we have
* the official file, nothing outside this component reads its internals.
*
* White parts carry an explicit stroke: the AppBar is transparent over paper,
* so an unstroked white suit disappears in light mode.
*/
const Wisby = () => {
	const $ = c(24);
	if ($[0] !== "e5213aae92cf50ec48e63642048f00953109cbb2097e6b3e7ca6b310b4453c41") {
		for (let $i = 0; $i < 24; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "e5213aae92cf50ec48e63642048f00953109cbb2097e6b3e7ca6b310b4453c41";
	}
	let t0;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = {
			xs: 96,
			sm: 140
		};
		$[1] = t0;
	} else t0 = $[1];
	let t1;
	let t2;
	let t3;
	let t4;
	let t5;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = {
			"0%, 100%": { transform: "translateY(0)" },
			"50%": { transform: "translateY(-2.5px)" }
		};
		t2 = {
			"0%, 100%": { transform: "rotate(0deg)" },
			"50%": { transform: "rotate(-12deg)" }
		};
		t3 = {
			"0%, 92%, 100%": { transform: "scaleY(1)" },
			"95%": { transform: "scaleY(.1)" }
		};
		t4 = {
			transformBox: "view-box",
			transformOrigin: "42.5px 78px",
			animation: "wisbyWave 1.3s ease-in-out infinite"
		};
		t5 = {
			transformBox: "fill-box",
			transformOrigin: "50% 50%",
			animation: "wisbyBlink 5.5s ease-in-out infinite"
		};
		$[2] = t1;
		$[3] = t2;
		$[4] = t3;
		$[5] = t4;
		$[6] = t5;
	} else {
		t1 = $[2];
		t2 = $[3];
		t3 = $[4];
		t4 = $[5];
		t5 = $[6];
	}
	let t10;
	let t11;
	let t12;
	let t13;
	let t14;
	let t15;
	let t16;
	let t17;
	let t18;
	let t19;
	let t6;
	let t7;
	let t8;
	let t9;
	if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
		t6 = {
			height: t0,
			width: "auto",
			flexShrink: 0,
			display: "block",
			filter: "drop-shadow(0 4px 10px rgba(0,0,0,.22))",
			animation: "wisbyBob 3.2s ease-in-out infinite",
			"@keyframes wisbyBob": t1,
			"@keyframes wisbyWave": t2,
			"@keyframes wisbyBlink": t3,
			"& .wisby-wave-arm": t4,
			"& .wisby-eye": t5,
			"@media (prefers-reduced-motion: reduce)": {
				animation: "none",
				"& .wisby-wave-arm, & .wisby-eye": { animation: "none" }
			}
		};
		t7 = /* @__PURE__ */ jsx("ellipse", {
			cx: "50",
			cy: "109.6",
			rx: "15.5",
			ry: "2.4",
			fill: "#000",
			opacity: ".07"
		});
		t8 = /* @__PURE__ */ jsx("path", {
			d: "M62.5 16.6q6-11.8 16.8-9.6Q80.4 18.4 62.5 16.6z",
			fill: "#56a832"
		});
		t9 = /* @__PURE__ */ jsx("path", {
			d: "M64.8 15.4q6.8-3.4 12-6.8",
			stroke: "#3d7c22",
			strokeWidth: "1.1",
			strokeLinecap: "round",
			fill: "none"
		});
		t10 = /* @__PURE__ */ jsx("path", {
			d: "M37 108.6c0-9.8 12.4-9.8 12.4 0v.6a1.4 1.4 0 0 1-1.4 1.4H38.4a1.4 1.4 0 0 1-1.4-1.4z",
			fill: "#fff",
			stroke: EDGE,
			strokeWidth: ".8"
		});
		t11 = /* @__PURE__ */ jsx("path", {
			d: "M50.6 108.6c0-9.8 12.4-9.8 12.4 0v.6a1.4 1.4 0 0 1-1.4 1.4H52a1.4 1.4 0 0 1-1.4-1.4z",
			fill: "#fff",
			stroke: EDGE,
			strokeWidth: ".8"
		});
		t12 = /* @__PURE__ */ jsx("rect", {
			x: "37",
			y: "107.2",
			width: "12.4",
			height: "3.4",
			rx: "1.5",
			fill: TEAL
		});
		t13 = /* @__PURE__ */ jsx("rect", {
			x: "50.6",
			y: "107.2",
			width: "12.4",
			height: "3.4",
			rx: "1.5",
			fill: TEAL
		});
		t14 = /* @__PURE__ */ jsx("rect", {
			x: "40.4",
			y: "102.4",
			width: "5.4",
			height: "1.3",
			rx: ".65",
			fill: TEAL
		});
		t15 = /* @__PURE__ */ jsx("rect", {
			x: "40.4",
			y: "104.8",
			width: "5.4",
			height: "1.3",
			rx: ".65",
			fill: TEAL
		});
		t16 = /* @__PURE__ */ jsx("rect", {
			x: "54",
			y: "102.4",
			width: "5.4",
			height: "1.3",
			rx: ".65",
			fill: TEAL
		});
		t17 = /* @__PURE__ */ jsx("rect", {
			x: "54",
			y: "104.8",
			width: "5.4",
			height: "1.3",
			rx: ".65",
			fill: TEAL
		});
		t18 = /* @__PURE__ */ jsx("rect", {
			x: "43.4",
			y: "86",
			width: "3.8",
			height: "17",
			rx: "1.9",
			fill: TEAL
		});
		t19 = /* @__PURE__ */ jsx("rect", {
			x: "52.8",
			y: "86",
			width: "3.8",
			height: "17",
			rx: "1.9",
			fill: TEAL
		});
		$[7] = t10;
		$[8] = t11;
		$[9] = t12;
		$[10] = t13;
		$[11] = t14;
		$[12] = t15;
		$[13] = t16;
		$[14] = t17;
		$[15] = t18;
		$[16] = t19;
		$[17] = t6;
		$[18] = t7;
		$[19] = t8;
		$[20] = t9;
	} else {
		t10 = $[7];
		t11 = $[8];
		t12 = $[9];
		t13 = $[10];
		t14 = $[11];
		t15 = $[12];
		t16 = $[13];
		t17 = $[14];
		t18 = $[15];
		t19 = $[16];
		t6 = $[17];
		t7 = $[18];
		t8 = $[19];
		t9 = $[20];
	}
	let t20;
	let t21;
	if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
		t20 = /* @__PURE__ */ jsx("path", {
			d: "M42.5 78c-5 1-10-1-17-5",
			stroke: EDGE,
			strokeWidth: "7",
			strokeLinecap: "round",
			fill: "none"
		});
		t21 = /* @__PURE__ */ jsx("path", {
			d: "M42.5 78c-5 1-10-1-17-5",
			stroke: "#fff",
			strokeWidth: "5.4",
			strokeLinecap: "round",
			fill: "none"
		});
		$[21] = t20;
		$[22] = t21;
	} else {
		t20 = $[21];
		t21 = $[22];
	}
	let t22;
	if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
		t22 = /* @__PURE__ */ jsxs(Box, {
			component: "svg",
			viewBox: "0 0 100 116",
			"aria-hidden": true,
			sx: t6,
			children: [
				t7,
				t8,
				t9,
				t10,
				t11,
				t12,
				t13,
				t14,
				t15,
				t16,
				t17,
				t18,
				t19,
				/* @__PURE__ */ jsxs("g", {
					className: "wisby-wave-arm",
					children: [
						t20,
						t21,
						/* @__PURE__ */ jsxs("g", {
							transform: "translate(24.5 72) rotate(-20) scale(1.2)",
							children: [
								/* @__PURE__ */ jsx("rect", {
									x: "-4.05",
									y: "-8.6",
									width: "1.9",
									height: "6.2",
									rx: ".95",
									fill: TEAL
								}),
								/* @__PURE__ */ jsx("rect", {
									x: "-2",
									y: "-9.6",
									width: "1.9",
									height: "7.2",
									rx: ".95",
									fill: TEAL
								}),
								/* @__PURE__ */ jsx("rect", {
									x: ".05",
									y: "-9.2",
									width: "1.9",
									height: "6.8",
									rx: ".95",
									fill: TEAL
								}),
								/* @__PURE__ */ jsx("rect", {
									x: "2.1",
									y: "-8",
									width: "1.9",
									height: "5.6",
									rx: ".95",
									fill: TEAL
								}),
								/* @__PURE__ */ jsx("rect", {
									x: "-6.4",
									y: "-4.6",
									width: "1.9",
									height: "5.4",
									rx: ".95",
									fill: TEAL,
									transform: "rotate(-32 -5.45 -1.9)"
								}),
								/* @__PURE__ */ jsx("rect", {
									x: "-4.6",
									y: "-3.4",
									width: "9.2",
									height: "7.6",
									rx: "3.2",
									fill: TEAL
								}),
								/* @__PURE__ */ jsx("path", {
									d: "M0 2.5c-2.7-1.9-3.4-3.1-2.7-4.1a1.65 1.65 0 0 1 2.7.2 1.65 1.65 0 0 1 2.7-.2c.7 1 0 2.2-2.7 4.1z",
									fill: "#fff"
								})
							]
						})
					]
				}),
				/* @__PURE__ */ jsxs("g", { children: [
					/* @__PURE__ */ jsx("path", {
						d: "M57.5 78c4.5 2 8 5 10.5 12",
						stroke: EDGE,
						strokeWidth: "7",
						strokeLinecap: "round",
						fill: "none"
					}),
					/* @__PURE__ */ jsx("path", {
						d: "M57.5 78c4.5 2 8 5 10.5 12",
						stroke: "#fff",
						strokeWidth: "5.4",
						strokeLinecap: "round",
						fill: "none"
					}),
					/* @__PURE__ */ jsx("circle", {
						cx: "64.3",
						cy: "88",
						r: "1.9",
						fill: TEAL
					}),
					/* @__PURE__ */ jsx("rect", {
						x: "63.6",
						y: "84.7",
						width: "8.8",
						height: "11.6",
						rx: "4.4",
						fill: TEAL
					})
				] }),
				/* @__PURE__ */ jsx("rect", {
					x: "40.6",
					y: "72",
					width: "18.8",
					height: "20",
					rx: "7",
					fill: "#fff",
					stroke: EDGE,
					strokeWidth: ".9"
				}),
				/* @__PURE__ */ jsx("rect", {
					x: "46.4",
					y: "70",
					width: "7.2",
					height: "3",
					rx: "1.2",
					fill: "#7ea4ac"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "50",
					cy: "79.6",
					r: "5",
					fill: "#eaf7fa"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "50",
					cy: "79.6",
					r: "3.6",
					fill: "#7fdfe8"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "50",
					cy: "79.6",
					r: "2.4",
					fill: "#0ec6d4"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "50",
					cy: "42.4",
					r: "29.4",
					fill: "#e9f6fa",
					opacity: ".6"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "50",
					cy: "42.4",
					r: "27.6",
					fill: "#f8fcfd",
					stroke: "#e0eff4",
					strokeWidth: "1.4"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "50",
					cy: "46",
					r: "24",
					fill: SKIN
				}),
				/* @__PURE__ */ jsx("path", {
					d: "M27 39a24 24 0 0 1 46 0L68.4 33.5 63.8 39 59.2 33.5 54.6 39 50 33.5 45.4 39 40.8 33.5 36.2 39 31.6 33.5z",
					fill: TEAL
				}),
				/* @__PURE__ */ jsx("path", {
					d: "M36.4 41.6q3.6-3 7.6-.6",
					stroke: INK,
					strokeWidth: "2.6",
					strokeLinecap: "round",
					fill: "none"
				}),
				/* @__PURE__ */ jsx("path", {
					d: "M56 41q4-2.4 7.6.6",
					stroke: INK,
					strokeWidth: "2.6",
					strokeLinecap: "round",
					fill: "none"
				}),
				/* @__PURE__ */ jsx("ellipse", {
					className: "wisby-eye",
					cx: "40.4",
					cy: "48.4",
					rx: "3.8",
					ry: "4.7",
					fill: INK
				}),
				/* @__PURE__ */ jsx("ellipse", {
					className: "wisby-eye",
					cx: "59.6",
					cy: "48.4",
					rx: "3.8",
					ry: "4.7",
					fill: INK
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "41.6",
					cy: "46.6",
					r: "1.3",
					fill: "#fff"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "60.8",
					cy: "46.6",
					r: "1.3",
					fill: "#fff"
				}),
				/* @__PURE__ */ jsx("ellipse", {
					cx: "32.6",
					cy: "53",
					rx: "4.2",
					ry: "2.8",
					fill: "#f6b3a8",
					opacity: ".9"
				}),
				/* @__PURE__ */ jsx("ellipse", {
					cx: "67.4",
					cy: "53",
					rx: "4.2",
					ry: "2.8",
					fill: "#f6b3a8",
					opacity: ".9"
				}),
				/* @__PURE__ */ jsx("path", {
					d: "M44.8 57.4c3.4-1.6 7-1.6 10.4 0 0 4.8-2.4 6.6-5.2 6.6s-5.2-1.8-5.2-6.6z",
					fill: "#e0604c"
				}),
				/* @__PURE__ */ jsx("path", {
					d: "M26.4 36q5-16.4 18.4-21.4-11.4 8.2-14.6 22.6z",
					fill: "#fff",
					opacity: ".7"
				}),
				/* @__PURE__ */ jsx("path", {
					d: "M36.6 22.3 40.8 20M63.4 22.3 59.2 20",
					stroke: "#ffb020",
					strokeWidth: "2.6",
					strokeLinecap: "round"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "72",
					cy: "56",
					r: "1.2",
					fill: "#e53935"
				}),
				/* @__PURE__ */ jsx("circle", {
					cx: "70.2",
					cy: "59.4",
					r: "1.2",
					fill: "#29b6d6"
				})
			]
		});
		$[23] = t22;
	} else t22 = $[23];
	return t22;
};
/**
* Replaces the old TEST chip. Dismissal is component state on purpose: it lasts
* the session but a reload brings him back, so nobody permanently hides the
* fact that they are not on production.
*/
const TestMascot = () => {
	const $ = c(11);
	if ($[0] !== "e5213aae92cf50ec48e63642048f00953109cbb2097e6b3e7ca6b310b4453c41") {
		for (let $i = 0; $i < 11; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "e5213aae92cf50ec48e63642048f00953109cbb2097e6b3e7ca6b310b4453c41";
	}
	const router = useRouter();
	const { t } = useTranslation();
	const [dismissed, setDismissed] = useState(false);
	if (dismissed || !isTestEnv(router.origin)) return null;
	let t0;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = { env: /* @__PURE__ */ jsx(Box, {
			component: "span",
			sx: {
				color: "warning.main",
				fontWeight: 700
			}
		}) };
		$[1] = t0;
	} else t0 = $[1];
	let t1;
	if ($[2] !== t) {
		t1 = /* @__PURE__ */ jsx(Trans, {
			t,
			i18nKey: "Layout.TestEnvironment",
			components: t0
		});
		$[2] = t;
		$[3] = t1;
	} else t1 = $[3];
	let t2;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = () => setDismissed(true);
		$[4] = t2;
	} else t2 = $[4];
	let t3;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = /* @__PURE__ */ jsx(IconButton, {
			size: "small",
			onClick: t2,
			sx: _temp3$1,
			children: /* @__PURE__ */ jsx(Close, { sx: { fontSize: 14 } })
		});
		$[5] = t3;
	} else t3 = $[5];
	let t4;
	if ($[6] !== t1) {
		t4 = /* @__PURE__ */ jsxs(Box, {
			sx: _temp2$2,
			children: [t1, t3]
		});
		$[6] = t1;
		$[7] = t4;
	} else t4 = $[7];
	let t5;
	if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = /* @__PURE__ */ jsx(Wisby, {});
		$[8] = t5;
	} else t5 = $[8];
	let t6;
	if ($[9] !== t4) {
		t6 = /* @__PURE__ */ jsxs(Box, {
			sx: _temp$2,
			children: [t4, t5]
		});
		$[9] = t4;
		$[10] = t6;
	} else t6 = $[10];
	return t6;
};
function _temp$2(theme) {
	return {
		position: "fixed",
		right: {
			xs: 4,
			sm: 16
		},
		bottom: 0,
		display: "flex",
		alignItems: "flex-end",
		pointerEvents: "none",
		zIndex: theme.zIndex.tooltip
	};
}
function _temp2$2(theme_0) {
	return {
		position: "relative",
		mb: {
			xs: 5,
			sm: 8
		},
		mr: -1,
		px: 1.5,
		py: 1,
		maxWidth: 190,
		borderRadius: 2,
		border: "1px solid",
		borderColor: "divider",
		color: "text.primary",
		backgroundColor: theme_0.palette.common.white,
		fontSize: 13,
		fontWeight: 500,
		lineHeight: 1.35,
		boxShadow: theme_0.shadows[6],
		transformOrigin: "100% 50%",
		animation: "wisbyTalk 5s ease-in-out infinite",
		...theme_0.applyStyles("dark", { backgroundColor: theme_0.palette.grey[800] }),
		"@keyframes wisbyTalk": {
			"0%, 86%, 100%": { transform: "scale(1)" },
			"91%": { transform: "scale(1.05)" },
			"95%": { transform: "scale(.985)" }
		},
		"@media (prefers-reduced-motion: reduce)": { animation: "none" },
		"&::after": {
			content: "\"\"",
			position: "absolute",
			right: -5,
			bottom: 14,
			width: 9,
			height: 9,
			transform: "rotate(45deg)",
			borderRight: "1px solid",
			borderTop: "1px solid",
			borderColor: "inherit",
			backgroundColor: "inherit"
		}
	};
}
function _temp3$1(theme_1) {
	return {
		pointerEvents: "auto",
		position: "absolute",
		top: -12,
		right: -12,
		padding: .25,
		border: "1px solid",
		borderColor: "divider",
		color: "text.primary",
		backgroundColor: theme_1.palette.common.white,
		"&:hover": { backgroundColor: theme_1.palette.grey[100] },
		...theme_1.applyStyles("dark", {
			backgroundColor: theme_1.palette.grey[800],
			"&:hover": { backgroundColor: theme_1.palette.grey[700] }
		})
	};
}
//#endregion
//#region src/components/core/Layout.tsx
const NAVIGATION_STORAGE_KEY = "navigation-open";
const getInitialNavigationOpen = () => {
	if (Platform.isWindows || Platform.isMacOS) return localStorage.getItem(NAVIGATION_STORAGE_KEY) === "true";
	return false;
};
const saveNavigationState = (value) => {
	if (Platform.isWindows || Platform.isMacOS) localStorage.setItem(NAVIGATION_STORAGE_KEY, String(value));
};
const DrawerHeader = styled("div")(({ theme }) => ({
	display: "flex",
	alignItems: "center",
	justifyContent: "flex-end",
	padding: theme.spacing(0, 1),
	...theme.mixins.toolbar
}));
const Layout = (t0) => {
	const $ = c(33);
	if ($[0] !== "6efe35980a23b2f2e5f80ee032c72f4ccc19b5fb1be382d06a0535a50acfed85") {
		for (let $i = 0; $i < 33; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "6efe35980a23b2f2e5f80ee032c72f4ccc19b5fb1be382d06a0535a50acfed85";
	}
	const { navigation, options, children } = t0;
	const [navigationOpen, setNavigationOpen] = useState(false);
	let t1;
	if ($[1] !== navigation) {
		t1 = navigation?.some(_temp$1);
		$[1] = navigation;
		$[2] = t1;
	} else t1 = $[2];
	const showNavigation = t1;
	let t2;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = { select: _temp2$1 };
		$[3] = t2;
	} else t2 = $[3];
	const pathname = useLocation(t2);
	const showShell = options?.showShell ?? pathname !== "/login";
	let t3;
	let t4;
	if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = () => {
			if (getInitialNavigationOpen()) setNavigationOpen(true);
		};
		t4 = [];
		$[4] = t3;
		$[5] = t4;
	} else {
		t3 = $[4];
		t4 = $[5];
	}
	useEffect(t3, t4);
	let t5;
	let t6;
	let t7;
	if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
		t5 = /* @__PURE__ */ jsx(InitColorSchemeScript, {});
		t6 = /* @__PURE__ */ jsx(CssBaseline, {});
		t7 = /* @__PURE__ */ jsx(TestMascot, {});
		$[6] = t5;
		$[7] = t6;
		$[8] = t7;
	} else {
		t5 = $[6];
		t6 = $[7];
		t7 = $[8];
	}
	let t8;
	if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
		t8 = {
			display: "flex",
			height: "100dvh",
			maxHeight: "100dvh",
			overflow: "hidden",
			width: "100%"
		};
		$[9] = t8;
	} else t8 = $[9];
	let t9;
	if ($[10] !== navigationOpen || $[11] !== options || $[12] !== showNavigation || $[13] !== showShell) {
		t9 = showShell && /* @__PURE__ */ jsx(AppBar, {
			color: "transparent",
			position: "fixed",
			sx: {
				borderBottom: "1px solid",
				borderColor: "var(--mui-palette-divider)",
				boxShadow: "none"
			},
			children: /* @__PURE__ */ jsxs(Toolbar, { children: [
				showNavigation && /* @__PURE__ */ jsx(IconButton, {
					"aria-label": "Toggle navigation",
					onClick: () => {
						setNavigationOpen(_temp3);
					},
					sx: { marginRight: 2 },
					children: navigationOpen ? /* @__PURE__ */ jsx(MenuOpen, {}) : /* @__PURE__ */ jsx(Menu$1, {})
				}),
				/* @__PURE__ */ jsx(AppTitle, {}),
				options?.appBarActions && /* @__PURE__ */ jsx(Stack, {
					direction: "row",
					spacing: 1,
					sx: {
						alignItems: "center",
						mr: 1
					},
					children: options.appBarActions
				}),
				/* @__PURE__ */ jsx(ToolbarAccount, {})
			] })
		});
		$[10] = navigationOpen;
		$[11] = options;
		$[12] = showNavigation;
		$[13] = showShell;
		$[14] = t9;
	} else t9 = $[14];
	let t10;
	if ($[15] !== navigation || $[16] !== navigationOpen || $[17] !== showNavigation || $[18] !== showShell) {
		t10 = showNavigation && showShell && /* @__PURE__ */ jsx(NavigationRail, {
			navigation,
			expanded: navigationOpen,
			setExpanded: (newValue_0) => {
				setNavigationOpen(newValue_0);
				saveNavigationState(newValue_0);
			}
		});
		$[15] = navigation;
		$[16] = navigationOpen;
		$[17] = showNavigation;
		$[18] = showShell;
		$[19] = t10;
	} else t10 = $[19];
	let t11;
	if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
		t11 = {
			flexGrow: 1,
			display: "flex",
			flexDirection: "column",
			minWidth: 0,
			height: "100%",
			overflow: "hidden"
		};
		$[20] = t11;
	} else t11 = $[20];
	let t12;
	if ($[21] !== showShell) {
		t12 = showShell && /* @__PURE__ */ jsx(DrawerHeader, {});
		$[21] = showShell;
		$[22] = t12;
	} else t12 = $[22];
	let t13;
	if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
		t13 = {
			flex: 1,
			overflow: "auto",
			position: "relative"
		};
		$[23] = t13;
	} else t13 = $[23];
	let t14;
	if ($[24] !== children) {
		t14 = /* @__PURE__ */ jsx(Box, {
			sx: t13,
			children
		});
		$[24] = children;
		$[25] = t14;
	} else t14 = $[25];
	let t15;
	if ($[26] !== t12 || $[27] !== t14) {
		t15 = /* @__PURE__ */ jsxs(Box, {
			component: "main",
			sx: t11,
			children: [t12, t14]
		});
		$[26] = t12;
		$[27] = t14;
		$[28] = t15;
	} else t15 = $[28];
	let t16;
	if ($[29] !== t10 || $[30] !== t15 || $[31] !== t9) {
		t16 = /* @__PURE__ */ jsxs(Fragment, { children: [
			t5,
			t6,
			t7,
			/* @__PURE__ */ jsxs(Box, {
				sx: t8,
				children: [
					t9,
					t10,
					t15
				]
			})
		] });
		$[29] = t10;
		$[30] = t15;
		$[31] = t9;
		$[32] = t16;
	} else t16 = $[32];
	return t16;
};
function _temp$1(item) {
	return item.hidden !== true;
}
function _temp2$1(location) {
	return location.pathname;
}
function _temp3(previous) {
	const newValue = !previous;
	saveNavigationState(newValue);
	return newValue;
}
//#endregion
//#region src/providers/DialogsProvider.tsx
function DialogsProvider({ children }) {
	const [stack, setStack] = useState([]);
	const keyPrefix = useId();
	const nextId = useRef(0);
	const dialogMetadata = useRef(/* @__PURE__ */ new WeakMap());
	const requestDialog = useEventCallback$1(function open(Component, payload, options = {}) {
		const { onClose = async () => {} } = options;
		let resolve;
		const promise = new Promise((resolveImpl) => {
			resolve = resolveImpl;
		});
		const key = `${keyPrefix}-${nextId.current}`;
		nextId.current += 1;
		const newEntry = {
			key,
			open: true,
			promise,
			Component,
			payload,
			onClose,
			resolve
		};
		dialogMetadata.current.set(promise, newEntry);
		setStack((previousStack) => [...previousStack, newEntry]);
		return promise;
	});
	const removeDialogFromStack = (dialog) => {
		setStack((previousStack_0) => previousStack_0.filter((entry) => entry.promise !== dialog));
		dialogMetadata.current.delete(dialog);
	};
	const closeDialogUi = useEventCallback$1(function closeDialogUi(dialog_0) {
		setStack((previousStack_1) => previousStack_1.map((entry_0) => entry_0.promise === dialog_0 ? {
			...entry_0,
			open: false
		} : entry_0));
		setTimeout(() => removeDialogFromStack(dialog_0), 1e3);
	});
	const closeDialog = useEventCallback$1(async function closeDialog(dialog_1, result) {
		const entryToClose = dialogMetadata.current.get(dialog_1);
		if (!entryToClose) throw new Error("Dialog not found in stack");
		try {
			await entryToClose.onClose(result);
		} finally {
			entryToClose.resolve(result);
			closeDialogUi(dialog_1);
		}
		return dialog_1;
	});
	return /* @__PURE__ */ jsxs(DialogsContext.Provider, {
		value: {
			open: requestDialog,
			close: closeDialog
		},
		children: [children, stack.map(({ key: key_0, open, Component: Component_0, payload: payload_0, promise: promise_0 }) => /* @__PURE__ */ jsx(Component_0, {
			payload: payload_0,
			open,
			onClose: async (result_0) => {
				await closeDialog(promise_0, result_0);
			}
		}, key_0))]
	});
}
//#endregion
//#region src/providers/LayoutProvider.tsx
const YEAR_IN_SECONDS = 31536e3;
const LANGUAGE_COOKIE = "i18next";
const normalizeLocale = (locale) => locale.replace(/[^a-z]/gi, "").toLowerCase();
const zodLocales = new Map(Object.entries(z.core.locales).map(([locale, createLocale]) => [normalizeLocale(locale), createLocale]));
const setLocale = (language) => {
	const baseLanguage = language.split(/[-_]/)[0];
	const createLocale = zodLocales.get(normalizeLocale(language)) ?? zodLocales.get(normalizeLocale(baseLanguage)) ?? z.core.locales.en;
	z.config(createLocale());
	if (!dayjs.locale(language).startsWith(baseLanguage)) dayjs.locale("en");
};
i18n.use(LanguageDetector).use(initReactI18next).init({
	resources,
	lng: "en",
	fallbackLng: "en",
	supportedLngs: Object.keys(resources),
	detection: { caches: [] },
	interpolation: { escapeValue: false }
});
setLocale(i18n.resolvedLanguage ?? i18n.language);
i18n.on("languageChanged", (language) => {
	setLocale(language);
	if (typeof document !== "undefined") document.cookie = `${LANGUAGE_COOKIE}=${language};path=/;max-age=${YEAR_IN_SECONDS};SameSite=Lax`;
});
const LayoutProvider = (t0) => {
	const $ = c(17);
	if ($[0] !== "33252bda848063e03443e7fcfe6569c13fbfb8e1f5ff8ec8b0be39481aa3cb8d") {
		for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
		$[0] = "33252bda848063e03443e7fcfe6569c13fbfb8e1f5ff8ec8b0be39481aa3cb8d";
	}
	const { options, navigation, theme, children } = t0;
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = createCache({ key: "css" });
		$[1] = t1;
	} else t1 = $[1];
	const emotionCache = t1;
	const { i18n: activeI18n } = useTranslation();
	useQuery(userQueryOptions);
	let t2;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = [];
		$[2] = t2;
	} else t2 = $[2];
	useEffect(_temp, t2);
	let t3;
	if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
		t3 = [];
		$[3] = t3;
	} else t3 = $[3];
	useEffect(_temp2, t3);
	let t4;
	if ($[4] !== activeI18n.language || $[5] !== children) {
		t4 = /* @__PURE__ */ jsx(Fragment, { children }, activeI18n.language);
		$[4] = activeI18n.language;
		$[5] = children;
		$[6] = t4;
	} else t4 = $[6];
	let t5;
	if ($[7] !== navigation || $[8] !== options || $[9] !== t4) {
		t5 = /* @__PURE__ */ jsx(DialogsProvider, { children: /* @__PURE__ */ jsx(Layout, {
			navigation,
			options,
			children: t4
		}) });
		$[7] = navigation;
		$[8] = options;
		$[9] = t4;
		$[10] = t5;
	} else t5 = $[10];
	let t6;
	if ($[11] !== activeI18n.language || $[12] !== t5) {
		t6 = /* @__PURE__ */ jsx(LocalizationProvider, {
			dateAdapter: AdapterDayjs,
			adapterLocale: activeI18n.language,
			children: t5
		});
		$[11] = activeI18n.language;
		$[12] = t5;
		$[13] = t6;
	} else t6 = $[13];
	let t7;
	if ($[14] !== t6 || $[15] !== theme) {
		t7 = /* @__PURE__ */ jsx(CacheProvider, {
			value: emotionCache,
			children: /* @__PURE__ */ jsx(I18nextProvider, {
				i18n,
				children: /* @__PURE__ */ jsx(ThemeProvider, {
					theme,
					children: t6
				})
			})
		});
		$[14] = t6;
		$[15] = theme;
		$[16] = t7;
	} else t7 = $[16];
	return t7;
};
function _temp() {
	i18n.changeLanguage();
}
function _temp2() {
	if ("serviceWorker" in navigator) navigator.serviceWorker.register("/sw.js");
}
//#endregion
export { LayoutProvider, WISTRON_PRIMARY_COLOR, WISTRON_SECONDARY_COLOR, getUser, loginProvidersQueryOptions, rootRouteHead };

//# sourceMappingURL=index.mjs.map