// (C) 2025 GoodData Corporation
import { createContextStore } from "@gooddata/sdk-ui";
import { getItemInteractiveParent } from "./itemUtils.js";
/**
 * @internal
 */
export const UiMenuContextStore = createContextStore("UiMenu");
/**
 * @internal
 */
export const typedUiMenuContextStore = () => UiMenuContextStore;
/**
 * @internal
 */
export const getSelectedMenuId = (context) => {
    const { focusedItem, shownCustomContentItemId, items } = context;
    return (shownCustomContentItemId ||
        (focusedItem ? getItemInteractiveParent(items, focusedItem.id)?.id : undefined));
};
