"use strict";

exports.__esModule = true;
exports.visibilityDefaultValues = exports.showPrimerIndividual = exports.showPartIndividual = exports.showFeatureTypes = exports.showFeatureIndividual = exports.resetPrimerIndividualToHide = exports.resetPartIndividualToHide = exports.resetFeatureTypesToHide = exports.resetFeatureIndividualToHide = exports.hidePrimerIndividual = exports.hidePartIndividual = exports.hideFeatureTypes = exports.hideFeatureIndividual = exports["default"] = exports.annotationVisibilityToggle = exports.annotationVisibilityShow = exports.annotationVisibilityHide = void 0;
var _lodash = require("lodash");
var _createMetaAction = _interopRequireDefault(require("./utils/createMetaAction"));
var _createMergedDefaultStateReducer = _interopRequireDefault(require("./utils/createMergedDefaultStateReducer"));
var _createMergedDefaultS;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var visibilityDefaultValues = {
  featureTypesToHide: {},
  featureIndividualToHide: {},
  partIndividualToHide: {},
  primerIndividualToHide: {},
  features: true,
  warnings: true,
  assemblyPieces: true,
  chromatogram: true,
  lineageAnnotations: true,
  translations: true,
  parts: true,
  orfs: false,
  orfTranslations: false,
  cdsFeatureTranslations: true,
  axis: true,
  cutsites: true,
  // cutsites: true,
  cutsitesInSequence: true,
  primers: true,
  dnaColors: false,
  sequence: true,
  reverseSequence: true,
  fivePrimeThreePrimeHints: true,
  axisNumbers: true
};

// ------------------------------------
// Actions
// ------------------------------------
exports.visibilityDefaultValues = visibilityDefaultValues;
var annotationVisibilityToggle = (0, _createMetaAction["default"])("annotationVisibilityToggle");
//eg: annotationVisibilityToggle('features')
exports.annotationVisibilityToggle = annotationVisibilityToggle;
var annotationVisibilityHide = (0, _createMetaAction["default"])("annotationVisibilityHide");
exports.annotationVisibilityHide = annotationVisibilityHide;
var annotationVisibilityShow = (0, _createMetaAction["default"])("annotationVisibilityShow");
exports.annotationVisibilityShow = annotationVisibilityShow;
var hideFeatureTypes = (0, _createMetaAction["default"])("hideFeatureTypes");
exports.hideFeatureTypes = hideFeatureTypes;
var showFeatureTypes = (0, _createMetaAction["default"])("showFeatureTypes");
exports.showFeatureTypes = showFeatureTypes;
var resetFeatureTypesToHide = (0, _createMetaAction["default"])("resetFeatureTypesToHide");
exports.resetFeatureTypesToHide = resetFeatureTypesToHide;
var hideFeatureIndividual = (0, _createMetaAction["default"])("hideFeatureIndividual");
exports.hideFeatureIndividual = hideFeatureIndividual;
var showFeatureIndividual = (0, _createMetaAction["default"])("showFeatureIndividual");
exports.showFeatureIndividual = showFeatureIndividual;
var resetFeatureIndividualToHide = (0, _createMetaAction["default"])("resetFeatureIndividualToHide");
exports.resetFeatureIndividualToHide = resetFeatureIndividualToHide;
var hidePrimerIndividual = (0, _createMetaAction["default"])("hidePrimerIndividual");
exports.hidePrimerIndividual = hidePrimerIndividual;
var showPrimerIndividual = (0, _createMetaAction["default"])("showPrimerIndividual");
exports.showPrimerIndividual = showPrimerIndividual;
var resetPrimerIndividualToHide = (0, _createMetaAction["default"])("resetPrimerIndividualToHide");
exports.resetPrimerIndividualToHide = resetPrimerIndividualToHide;
var hidePartIndividual = (0, _createMetaAction["default"])("hidePartIndividual");
exports.hidePartIndividual = hidePartIndividual;
var showPartIndividual = (0, _createMetaAction["default"])("showPartIndividual");
exports.showPartIndividual = showPartIndividual;
var resetPartIndividualToHide = (0, _createMetaAction["default"])("resetPartIndividualToHide");

// ------------------------------------
// Reducer
// ------------------------------------
exports.resetPartIndividualToHide = resetPartIndividualToHide;
var annotationVisibility = (0, _createMergedDefaultStateReducer["default"])((_createMergedDefaultS = {}, _createMergedDefaultS[resetPartIndividualToHide] = function (state) {
  return _extends({}, state, {
    partIndividualToHide: {}
  });
}, _createMergedDefaultS[showPartIndividual] = function (state, payload) {
  return _extends({}, state, {
    parts: true,
    partIndividualToHide: (0, _lodash.omit)(state.partIndividualToHide, payload)
  });
}, _createMergedDefaultS[hidePartIndividual] = function (state, payload) {
  return _extends({}, state, {
    partIndividualToHide: _extends({}, state.partIndividualToHide, payload.reduce(function (acc, key) {
      acc[key] = true;
      return acc;
    }, {}))
  });
}, _createMergedDefaultS[resetFeatureIndividualToHide] = function (state) {
  return _extends({}, state, {
    featureIndividualToHide: {}
  });
}, _createMergedDefaultS[showFeatureIndividual] = function (state, payload) {
  return _extends({}, state, {
    features: true,
    featureIndividualToHide: (0, _lodash.omit)(state.featureIndividualToHide, payload)
  });
}, _createMergedDefaultS[hideFeatureIndividual] = function (state, payload) {
  return _extends({}, state, {
    featureIndividualToHide: _extends({}, state.featureIndividualToHide, payload.reduce(function (acc, key) {
      acc[key] = true;
      return acc;
    }, {}))
  });
}, _createMergedDefaultS[resetPrimerIndividualToHide] = function (state) {
  return _extends({}, state, {
    primerIndividualToHide: {}
  });
}, _createMergedDefaultS[showPrimerIndividual] = function (state, payload) {
  return _extends({}, state, {
    primers: true,
    primerIndividualToHide: (0, _lodash.omit)(state.primerIndividualToHide, payload)
  });
}, _createMergedDefaultS[hidePrimerIndividual] = function (state, payload) {
  return _extends({}, state, {
    primerIndividualToHide: _extends({}, state.primerIndividualToHide, payload.reduce(function (acc, key) {
      acc[key] = true;
      return acc;
    }, {}))
  });
}, _createMergedDefaultS[resetFeatureTypesToHide] = function (state) {
  return _extends({}, state, {
    featureTypesToHide: {}
  });
}, _createMergedDefaultS[showFeatureTypes] = function (state, payload) {
  return _extends({}, state, {
    featureTypesToHide: (0, _lodash.omit)(state.featureTypesToHide, payload)
  });
}, _createMergedDefaultS[hideFeatureTypes] = function (state, payload) {
  return _extends({}, state, {
    featureTypesToHide: _extends({}, state.featureTypesToHide, payload.reduce(function (acc, key) {
      acc[key] = true;
      return acc;
    }, {}))
  });
}, _createMergedDefaultS[annotationVisibilityToggle] = function (state, payload) {
  var _extends2;
  return _extends({}, state, (_extends2 = {}, _extends2[payload] = !state[payload], _extends2), payload === "orfs" && state.orfs === state.orfTranslations ? {
    orfTranslations: !state.orfTranslations
  } : null);
}, _createMergedDefaultS[annotationVisibilityHide] = function (state, payload) {
  var _extends3;
  return _extends({}, state, (_extends3 = {}, _extends3[payload] = false, _extends3));
}, _createMergedDefaultS[annotationVisibilityShow] = function (state, payload) {
  var _extends4;
  return _extends({}, state, (_extends4 = {}, _extends4[payload] = true, _extends4));
}, _createMergedDefaultS), visibilityDefaultValues);
var _default = annotationVisibility;
exports["default"] = _default;