import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import omit from "lodash/omit.js";
import { BlockIdContext } from "../../../../context/blockIdContext/index.js";
import { NavigationItemType, NavigationItemTypes } from "../../../../models/index.js";
import { block } from "../../../../utils/index.js";
import { useNavigationItemMap } from "./hooks/useNavigationItemMap.js";
import './NavigationItem.css';
const b = block('navigation-item');
const ANALYTICS_ID = 'navigation';
const nonComplexNavigationItemTypes = NavigationItemTypes.filter((type) => type !== NavigationItemType.Dropdown);
export const NavigationItem = ({ data, className, menuLayout, ...props }) => {
    const { type = NavigationItemType.Link } = data;
    const navItemMap = useNavigationItemMap();
    const Component = navItemMap[type];
    const componentProps = React.useMemo(() => {
        const componentProperties = {
            ...data,
            ...props,
        };
        if (nonComplexNavigationItemTypes.includes(type)) {
            return omit(componentProperties, 'hidePopup', 'isActive');
        }
        return NavigationItemTypes.includes(type)
            ? componentProperties
            : { ...componentProperties, menuLayout };
    }, [data, props, type, menuLayout]);
    return (
    // TODO: fix any
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    _jsx(BlockIdContext.Provider, { value: ANALYTICS_ID, children: _jsx("li", { className: b({ 'menu-layout': menuLayout }, className), children: _jsx(Component, { ...componentProps, className: b('content', { type }) }) }) }));
};
export default NavigationItem;
//# sourceMappingURL=NavigationItem.js.map
