export function filterMenuItems(items, _permissions = []) {
    return items.reduce((acc, item) => {
        if (item.permissions) {
            if (item.permissions.some((permission) => _permissions.includes(permission))) {
                acc.push(item);
            }
        } else if (item.hasSubitems) {
            const filteredSubItems = filterMenuItems(item.Subitems, _permissions);
            if (filteredSubItems.length > 0) {
                acc.push({ ...item, Subitems: filteredSubItems });
            }
        } else {
            acc.push(item);
        }
        return acc;
    }, []);
}
