import { useStyleConfig } from "../core/theme.js";
import "../core/index.js";
import { useSidemenuContext } from "./context.js";
import { useCallback, useMemo } from "react";

//#region src/sidemenuV2/useSidemenuItem.ts
const useSidemenuItem = (itemId) => {
	const sidemenuContext = useSidemenuContext();
	const styles = useStyleConfig("SidemenuV2", sidemenuContext);
	const isSubmenuOpen = useMemo(() => {
		return itemId ? sidemenuContext?.submenuStates?.[itemId] ?? false : false;
	}, [itemId, sidemenuContext?.submenuStates]);
	const handleToggleSubmenu = useCallback(() => {
		if (itemId && sidemenuContext?.toggleSubmenu) sidemenuContext.toggleSubmenu(itemId);
	}, [itemId, sidemenuContext?.toggleSubmenu]);
	const isDark = sidemenuContext?.variant === "dark";
	const size = sidemenuContext?.size ?? "lg";
	const isMenuExpanded = sidemenuContext?.isMenuExpanded ?? true;
	return useMemo(() => ({
		isDark,
		size,
		styles,
		isMenuExpanded,
		isSubmenuOpen,
		toggleSubmenu: handleToggleSubmenu
	}), [
		isDark,
		size,
		styles,
		isMenuExpanded,
		isSubmenuOpen,
		handleToggleSubmenu
	]);
};
var useSidemenuItem_default = useSidemenuItem;

//#endregion
export { useSidemenuItem_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=useSidemenuItem.js.map