"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.InitialLoadingConditional = void 0;
var _react = _interopRequireDefault(require("react"));
var _mobxReactLite = require("mobx-react-lite");
function _InitialLoadingConditional({
  children = null,
  loadingElement = null,
  hideLoadingElement,
  state
}) {
  const {
    initTask
  } = state;
  const {
    status
  } = initTask;
  const {
    isLoading,
    isIdle
  } = status;
  if (initTask.status.isError) {
    return null;
  }
  if (hideLoadingElement) {
    return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
  }
  if (isIdle || isLoading) {
    return loadingElement;
  }
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
}
const InitialLoadingConditional = exports.InitialLoadingConditional = (0, _mobxReactLite.observer)(_InitialLoadingConditional);
//# sourceMappingURL=InitialLoadingConditional.js.map