/**
 * @license MIT
 * author: Cube Dev Team
 * @cube-dev/ui-kit v0.0.0-canary-127afd4
 * Released under the MIT license.
 */

import { Item } from 'react-stately';
import { ItemAction } from './actions/ItemAction/index.js';
import { ItemBadge } from './content/ItemBadge/index.js';
/**
 * Service props that are used by react-stately or parent components
 * and should not be passed to the Item component.
 */
const SERVICE_PROPS = new Set([
    // React Stately props
    'textValue',
    'hasChildItems',
    'childItems',
    'title',
    // Custom service props
    'onAction',
    'wrapper',
    'keywords', // CommandMenu-specific
    'forceMount', // CommandMenu-specific
]);
/**
 * Filters out service props from collection item props, returning only
 * props that should be passed to the Item component.
 *
 * This eliminates the need to manually extract and pass Item props
 * in components like MenuItem, ListBox Option, and Select Option.
 *
 * @param itemProps - The props from a collection item (node.props)
 * @returns Filtered props safe to spread onto Item component
 *
 * @example
 * ```tsx
 * const itemProps = filterCollectionItemProps(item.props);
 * return <Item {...itemProps} />;
 * ```
 */
export function filterCollectionItemProps(itemProps) {
    if (!itemProps) {
        return {};
    }
    const filtered = {};
    for (const key in itemProps) {
        if (Object.prototype.hasOwnProperty.call(itemProps, key) &&
            !SERVICE_PROPS.has(key)) {
            filtered[key] = itemProps[key];
        }
    }
    return filtered;
}
const _CollectionItem = Object.assign(Item, {
    Action: ItemAction,
    Badge: ItemBadge,
});
export { _CollectionItem as CollectionItem };

        