import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Children, Component } from 'react';
import { styled } from '../../styled-components.js';
const ErrorWrapper = styled.div `
  padding: 20px;
  color: red;
`;
export class ErrorBoundary extends Component {
    constructor(props) {
        super(props);
        this.state = { error: undefined };
    }
    componentDidCatch(error) {
        this.setState({ error });
        return false;
    }
    render() {
        if (this.state.error) {
            return (_jsxs(ErrorWrapper, { children: [_jsx("h1", { children: "Something went wrong..." }), _jsxs("small", { children: [" ", this.state.error.message, " "] }), _jsx("p", { children: _jsxs("details", { children: [_jsx("summary", { children: "Stack trace" }), _jsx("pre", { children: this.state.error.stack })] }) }), typeof __REDOC_VERSION__ !== 'undefined' ? (_jsxs(_Fragment, { children: [_jsxs("small", { children: [" References docs version: ", __REDOC_VERSION__] }), " ", _jsx("br", {})] })) : null, typeof __REDOC_REVISION__ !== 'undefined' ? (_jsxs("small", { children: [" Commit: ", __REDOC_REVISION__] })) : null] }));
        }
        return _jsx(_Fragment, { children: Children.only(this.props.children) });
    }
}
//# sourceMappingURL=ErrorBoundary.js.map