"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _path = _interopRequireDefault(require("path"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

let getEntries = (appSchemas, mode) => {
  let appPath = process.cwd();
  let {
    isReactMig,
    hasWidget,
    server,
    folder
  } = appSchemas.app;
  const {
    hasEFC: prevOptionForEnableEFC
  } = appSchemas.app;
  const {
    hasEFC: newOptionForEnableEFC
  } = appSchemas.efc;
  const hasEFC = newOptionForEnableEFC || prevOptionForEnableEFC;
  let mainJs = [];
  let entry = {
    main: mainJs
  };

  if (mode === 'dev' || mode === 'dev-no-warn') {
    mainJs.push(`${_path.default.join(__dirname, '..', 'templates', 'WMSTemplate')}?wmsPath=wss:${(0, _utils.getServerURL)(server)}`);
  }

  mainJs.push(_path.default.join(appPath, folder, isReactMig ? 'migration.js' : 'index.js'));

  if (hasWidget) {
    entry.widget = [_path.default.join(appPath, folder, 'widget.js')];
  }

  if (hasEFC) {
    entry.efc = [_path.default.join(appPath, folder, 'efc.js')];
  }

  return entry;
};

var _default = getEntries;
exports.default = _default;