function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import { createStore } from '@looker/redux';
import map from 'lodash/map';
import { defaultSettingsState, settingsSlice } from './settings';
import { lodesSlice, defaultLodesState } from './lodes';
import { defaultSpecsState, specsSlice } from './specs';

var isInitSuccessAction = action => {
  var _action$payload;

  return !!((_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.specs);
};

var actionSanitizer = (action, _id) => {
  if (isInitSuccessAction(action)) {
    action = _objectSpread(_objectSpread({}, action), {}, {
      payload: _objectSpread(_objectSpread({}, action.payload), {}, {
        specs: sanitizeSpecs(action.payload.specs)
      })
    });
  }

  return action;
};

var stateSanitizer = (state, _index) => {
  if (state.specs) {
    return _objectSpread(_objectSpread({}, state), {}, {
      specs: _objectSpread(_objectSpread({}, state.specs), {}, {
        specs: sanitizeSpecs(state.specs.specs)
      })
    });
  }

  return state;
};

var sanitizeSpecs = specList => map(specList, spec => _objectSpread(_objectSpread({}, spec), {}, {
  api: spec.api ? '<api>' : undefined,
  specContent: spec.specContent ? '<specContent>' : undefined
}));

var devTools = process.env.NODE_ENV !== 'production' ? {
  actionSanitizer,
  stateSanitizer
} : false;
export var store = createStore({
  devTools,
  preloadedState: {
    settings: defaultSettingsState,
    lodes: defaultLodesState,
    specs: defaultSpecsState
  },
  reducer: {
    settings: settingsSlice.reducer,
    lodes: lodesSlice.reducer,
    specs: specsSlice.reducer
  }
});
//# sourceMappingURL=store.js.map