"use strict";

exports.__esModule = true;
exports.default = void 0;
var _reactRedux = require("react-redux");
var _scopeRouteState = require("../selectors/scopeRouteState");
var _useLoader = _interopRequireDefault(require("./useLoader"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(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;
};
// look at scopeRouteState.js for documentation

var useScopeGuardLoader = function useScopeGuardLoader(actions, cutoutSelector) {
  var changeInProgress = (0, _reactRedux.useSelector)(_scopeRouteState.getScopeChangeInProgress);
  var cutoutSelectorGuard = function cutoutSelectorGuard() {
    if (changeInProgress) {
      return true;
    }
    if (cutoutSelector) {
      for (var _len = arguments.length, selArgs = new Array(_len), _key = 0; _key < _len; _key++) {
        selArgs[_key] = arguments[_key];
      }
      return cutoutSelector.apply(null, selArgs);
    }
    return true;
  };
  (0, _useLoader.default)(actions, cutoutSelectorGuard);
};
__signature__(useScopeGuardLoader, "useSelector{changeInProgress}\nuseLoader{}", function () {
  return [_reactRedux.useSelector, _useLoader.default];
});
__signature__(useScopeGuardLoader, "useSelector{changeInProgress}\nuseLoader{}", function () {
  return [_reactRedux.useSelector, _useLoader.default];
});
var _default = useScopeGuardLoader;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useScopeGuardLoader, "useScopeGuardLoader", "/home/vsts/work/1/s/src/hooks/useScopeGuardLoader.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/hooks/useScopeGuardLoader.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(useScopeGuardLoader, "useScopeGuardLoader", "/home/vsts/work/1/s/src/hooks/useScopeGuardLoader.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/hooks/useScopeGuardLoader.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();