"use client";
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useContext, useMemo } from "react";
/** @since 5.0.0 */ export const DEFAULT_MENU_CONFIGURATION = {
    horizontal: false,
    renderAsSheet: false,
    sheetHeader: null,
    sheetFooter: null,
    sheetPosition: "bottom",
    sheetVerticalSize: "touch"
};
/**
 * @internal
 * @since 5.0.0
 */ const context = /*#__PURE__*/ createContext({
    horizontal: false,
    renderAsSheet: false,
    sheetHeader: null,
    sheetFooter: null,
    sheetPosition: "bottom",
    sheetVerticalSize: "touch"
});
context.displayName = "MenuConfiguration";
/**
 * @internal
 * @since 5.0.0
 */ const { Provider } = context;
/**
 * This is probably just an internal only hook that allows you to get the
 * {@link MenuConfigurationContext} with optional overrides.
 *
 * @param overrides - An object of {@link MenuConfiguration} that would override
 * the inherited context values if they are not `undefined`.
 * @returns the {@link MenuConfigurationContext} with any overrides that were
 * provided.
 * @since 5.0.0
 */ export function useMenuConfiguration(overrides = {}) {
    const { horizontal, renderAsSheet, sheetHeader, sheetFooter, sheetPosition, sheetVerticalSize } = overrides;
    const inherited = useContext(context);
    return {
        horizontal: horizontal ?? inherited.horizontal,
        renderAsSheet: renderAsSheet ?? inherited.renderAsSheet,
        sheetHeader: sheetHeader === null ? null : sheetHeader ?? inherited.sheetHeader,
        sheetFooter: sheetFooter === null ? null : sheetFooter ?? inherited.sheetFooter,
        sheetPosition: sheetPosition ?? inherited.sheetPosition,
        sheetVerticalSize: sheetVerticalSize ?? inherited.sheetVerticalSize
    };
}
/**
 * **Client Component**
 *
 * Note: This will always merge values with any parent
 * `MenuConfigurationProvider`s.
 *
 * @since 5.0.0
 */ export function MenuConfigurationProvider(props) {
    const { children, ...configuration } = props;
    const { horizontal, renderAsSheet, sheetHeader, sheetFooter, sheetPosition, sheetVerticalSize } = useMenuConfiguration(configuration);
    const value = useMemo(()=>({
            horizontal,
            renderAsSheet,
            sheetHeader,
            sheetFooter,
            sheetPosition,
            sheetVerticalSize
        }), [
        horizontal,
        renderAsSheet,
        sheetFooter,
        sheetHeader,
        sheetPosition,
        sheetVerticalSize
    ]);
    return /*#__PURE__*/ _jsx(Provider, {
        value: value,
        children: children
    });
}

//# sourceMappingURL=MenuConfigurationProvider.js.map