import React from 'react' import ReactDOM from 'react-dom/client' import App from './App' import './index.css' // Restore persisted theme try { const saved = localStorage.getItem('theme') as 'dark' | 'light' | null if (saved) document.documentElement.setAttribute('data-theme', saved) else document.documentElement.setAttribute('data-theme', 'dark') } catch { document.documentElement.setAttribute('data-theme', 'dark') } class ErrorBoundary extends React.Component< { children: React.ReactNode }, { error: Error | null } > { constructor(props: { children: React.ReactNode }) { super(props) this.state = { error: null } } static getDerivedStateFromError(error: Error) { return { error } } render() { if (this.state.error) { return (
Runtime error
            {this.state.error.message}
          
) } return this.props.children } } ReactDOM.createRoot(document.getElementById('root')!).render( )