"use strict";

exports.__esModule = true;
exports.default = void 0;

var _immutable = _interopRequireDefault(require("immutable"));

var _normalizr = require("normalizr");

var _scopes = _interopRequireDefault(require("../schemas/scopes"));

var _scopes2 = require("../actions/scopes");

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

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var initialState = _immutable.default.fromJS({});

var scopeReducer = function scopeReducer(state, action) {
  if (state === void 0) {
    state = initialState;
  }

  switch (action.type) {
    case _scopes2.GET_SCOPES_SUCCESS:
      {
        var normalizedScopes = (0, _normalizr.normalize)(action.payload, _scopes.default);
        return state.merge(_immutable.default.fromJS(normalizedScopes.entities.scopes));
      }

    default:
      return state;
  }
};

var _default = scopeReducer;
var _default2 = _default;
var _default3 = _default2;
exports.default = _default3;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(initialState, "initialState", "/home/vsts/work/1/s/src/reducers/scopes.js");
  reactHotLoader.register(scopeReducer, "scopeReducer", "/home/vsts/work/1/s/src/reducers/scopes.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/reducers/scopes.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(initialState, "initialState", "/home/vsts/work/1/s/src/reducers/scopes.js");
  reactHotLoader.register(scopeReducer, "scopeReducer", "/home/vsts/work/1/s/src/reducers/scopes.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/reducers/scopes.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();