"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _excluded = ["boundary"];
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);
})();
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
function _inheritsLoose(t, o) { t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); }
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
// Class components are as yet the only way to create error boundaries
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
  function ErrorBoundary(props) {
    var _this;
    _this = _React$Component.call(this, props) || this;
    var boundary = props.boundary;
    _this.boundary = boundary;
    _this.state = {};
    return _this;
  }
  _inheritsLoose(ErrorBoundary, _React$Component);
  var _proto = ErrorBoundary.prototype;
  _proto.componentDidCatch = function componentDidCatch(error, info) {
    console.error("Caught an error: " + error.message + ", at boundary " + this.boundary.name);
    console.error(info.componentStack);
    this.setState({
      error: error
    });
    this.boundary.handler(error, info);
  };
  _proto.render = function render() {
    var _this$props = this.props,
      boundary = _this$props.boundary,
      props = _objectWithoutProperties(_this$props, _excluded);
    return /*#__PURE__*/_react.default.createElement(boundary.component, _extends({}, props, this.state));
  };
  // @ts-ignore
  _proto.__reactstandin__regenerateByEval = function __reactstandin__regenerateByEval(key, code) {
    // @ts-ignore
    this[key] = eval(code);
  };
  return ErrorBoundary;
}(_react.default.Component);
var withErrorBoundary = function withErrorBoundary(name, handler) {
  if (handler === void 0) {
    handler = function handler() {};
  }
  return function (component) {
    return function (props) {
      return /*#__PURE__*/_react.default.createElement(ErrorBoundary, _extends({
        boundary: {
          name: name,
          handler: handler,
          component: component
        }
      }, props));
    };
  };
};
var _default = withErrorBoundary;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(ErrorBoundary, "ErrorBoundary", "/home/vsts/work/1/s/src/hocs/withErrorBoundary.js");
  reactHotLoader.register(withErrorBoundary, "withErrorBoundary", "/home/vsts/work/1/s/src/hocs/withErrorBoundary.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/hocs/withErrorBoundary.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(ErrorBoundary, "ErrorBoundary", "/home/vsts/work/1/s/src/hocs/withErrorBoundary.js");
  reactHotLoader.register(withErrorBoundary, "withErrorBoundary", "/home/vsts/work/1/s/src/hocs/withErrorBoundary.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/hocs/withErrorBoundary.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();