'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../../_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(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, item), {}, {
      items: visibleInnerItems.length ? visibleInnerItems : undefined
    }));
    return acc;
  }, []);
};

exports.getVisibleItems = getVisibleItems;
