// src/shared/ErrorBoundary.tsx
import * as React from "react";
var ErrorBoundary = class extends React.Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }
  componentDidCatch(error) {
    var _a, _b;
    (_b = (_a = this.props).onError) == null ? void 0 : _b.call(_a, error);
    this.setState({ hasError: true });
  }
  static getDerivedStateFromError() {
    return { hasError: true };
  }
  render() {
    var _a;
    if (this.state.hasError) {
      return (_a = this.props.fallback) != null ? _a : /* @__PURE__ */ React.createElement("div", null, "Error!");
    }
    return this.props.children;
  }
};
export {
  ErrorBoundary
};
