"use strict";

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

var _nameTemplates = require("../common/nameTemplates");

var _EFCTemplatePlugin = require("../custom_plugins/EFCTemplatePlugin");

function configEFCTemplatePlugin(options) {
  const {
    publicPath
  } = options;
  const {
    chunkSplitEnable
  } = options.i18nChunkSplit;
  const {
    enableRTLSplit
  } = options.css.plugins.rtlSplit;
  const {
    createSDkFile,
    hasEFC,
    entryPointName,
    outputFile,
    version,
    templateFilePath
  } = options.efc;

  if (!hasEFC || !createSDkFile) {
    return false;
  }

  const i18nFileNameTemplate = (0, _nameTemplates.nameTemplates)('i18njs', options);
  return new _EFCTemplatePlugin.EFCTemplatePlugin({
    entryPointName,
    templateFilePath,
    outputFile,
    i18nFileNameTemplate,
    version,
    publicPath,
    chunkSplitEnable,
    enableRTLSplit
  });
}