import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import { hyphenate } from '../string/string.mjs';

function getPagesJsonCondition(componentConfig) {
  var allList = Object.values(componentConfig).reduce(function (acc, item) {
    return [].concat(_toConsumableArray(acc), _toConsumableArray(item.list || []));
  }, []).filter(function (item) {
    return !item.demoRedirect;
  }).map(function (item) {
    return {
      name: item.name,
      path: ['pages', item.subPackage || 'press', hyphenate(item.name), hyphenate(item.name)].join('/')
    };
  });
  return {
    current: 0,
    list: allList
  };
}

export { getPagesJsonCondition };
