import { objectSpread2 as _objectSpread2 } from '../../../_virtual/_rollupPluginBabelHelpers.js';

var getVisibleItems = function getVisibleItems(items) {
  return items.reduce(function (acc, item) {
    if (item.hidden) {
      return acc;
    }
    if (!item.items) {
      acc.push(item);
      return acc;
    }
    var visibleInnerItems = getVisibleItems(item.items);
    acc.push(_objectSpread2(_objectSpread2({}, item), {}, {
      items: visibleInnerItems.length ? visibleInnerItems : undefined
    }));
    return acc;
  }, []);
};

export { getVisibleItems };
