import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import { ErrorBoundary } from './components/ErrorBoundary';
import './index.css';

const rootEl = document.getElementById('root');
if (rootEl) {
  // Clear the static HTML loader and mark mounted
  if (typeof window !== 'undefined') {
    (window as unknown as { __diwaliMounted: boolean }).__diwaliMounted = true;
  }
  const root = createRoot(rootEl);
  root.render(
    <ErrorBoundary>
      <App />
    </ErrorBoundary>
  );
} else {
  console.error('Fatal: #root element missing from index.html');
}

