'use strict';

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

var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var string_string = require('../string/string.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _toConsumableArray__default = /*#__PURE__*/_interopDefaultLegacy(_toConsumableArray);

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

exports.getPagesJsonCondition = getPagesJsonCondition;
