var _createMergedDefaultS;
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); }
import { omit } from "lodash";

//./caretPosition.js

import createAction from "./utils/createMetaAction";
import createMergedDefaultStateReducer from "./utils/createMergedDefaultStateReducer";
export 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
// ------------------------------------
export var annotationVisibilityToggle = createAction("annotationVisibilityToggle");
//eg: annotationVisibilityToggle('features')
export var annotationVisibilityHide = createAction("annotationVisibilityHide");
export var annotationVisibilityShow = createAction("annotationVisibilityShow");
export var hideFeatureTypes = createAction("hideFeatureTypes");
export var showFeatureTypes = createAction("showFeatureTypes");
export var resetFeatureTypesToHide = createAction("resetFeatureTypesToHide");
export var hideFeatureIndividual = createAction("hideFeatureIndividual");
export var showFeatureIndividual = createAction("showFeatureIndividual");
export var resetFeatureIndividualToHide = createAction("resetFeatureIndividualToHide");
export var hidePrimerIndividual = createAction("hidePrimerIndividual");
export var showPrimerIndividual = createAction("showPrimerIndividual");
export var resetPrimerIndividualToHide = createAction("resetPrimerIndividualToHide");
export var hidePartIndividual = createAction("hidePartIndividual");
export var showPartIndividual = createAction("showPartIndividual");
export var resetPartIndividualToHide = createAction("resetPartIndividualToHide");

// ------------------------------------
// Reducer
// ------------------------------------
var annotationVisibility = createMergedDefaultStateReducer((_createMergedDefaultS = {}, _createMergedDefaultS[resetPartIndividualToHide] = function (state) {
  return _extends({}, state, {
    partIndividualToHide: {}
  });
}, _createMergedDefaultS[showPartIndividual] = function (state, payload) {
  return _extends({}, state, {
    parts: true,
    partIndividualToHide: 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: 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: 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: 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);
export default annotationVisibility;