import React from 'react'; import ReactDOM from 'react-dom/client'; import { Chart, registerables } from 'chart.js'; import App from './App'; import './index.css'; // Register Chart.js components Chart.register(...registerables); // Error boundary component class ErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error) { return { hasError: true, error }; } componentDidCatch(error, errorInfo) { console.error('Application error:', error, errorInfo); } render() { if (this.state.hasError) { return (

Something went wrong

Please try refreshing the page. If the problem persists, contact support.

            {this.state.error?.message}
          
); } return this.props.children; } } const root = document.getElementById('root'); if (!root) { console.error('Root element not found'); document.body.innerHTML = `

Error Initializing Application

Unable to find root element. Please refresh the page.

`; } else { try { ReactDOM.createRoot(root).render( ); console.log('Application rendered successfully'); } catch (error) { console.error('Error rendering application:', error); root.innerHTML = `

Error Loading Application

Please try refreshing the page. If the problem persists, contact support.

          ${error.message}
        
`; } }