import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { BrowserRouter } from 'react-router-dom'
import App from './App.tsx'
import './index.css'
import { debug, enableDebug } from './debug.ts'

// Enable debug via URL param: ?debug
if (typeof window !== 'undefined' && window.location.search.includes('debug')) {
  enableDebug()
}

debug('main', 'app starting')
const root = document.getElementById('root')
debug('main', 'root element:', root)

createRoot(root!).render(
  <StrictMode>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </StrictMode>,
)
