import{r as s,j as e}from"./index-Br0JHFBh.js";import{B as o}from"./button-CbQ7DCWa.js";import{i as a}from"./AlertTriangle-D_RCNZgn.js";class u extends s.Component{state={hasError:!1,error:null};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,t){console.error("Uncaught error:",r,t)}resetError=()=>{this.setState({hasError:!1,error:null})};render(){if(this.state.hasError){const{fallback:r}=this.props;return typeof r=="function"?r({error:this.state.error,resetError:this.resetError}):r!==void 0?r:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[e.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:e.jsx(a,{className:"h-6 w-6 text-destructive"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:this.state.error?.message||"An unexpected error occurred"})]}),e.jsx(o,{variant:"outline",onClick:this.resetError,children:"Try again"})]})}return this.props.children}}export{u as E};
