import { createRoot } from 'react-dom/client'
import './index.css'
import EmbedPlayer from './components/EmbedPlayer'

const root = document.getElementById('root')
if (root) {
  const puzzleId = root.dataset.puzzleId || ''
  const theme = root.dataset.theme || ''
  const showTimer = root.dataset.timer !== 'false'
  const showHints = root.dataset.hints !== 'false'

  if (theme === 'dark') document.documentElement.setAttribute('data-theme', 'dark')
  else if (theme === 'light') document.documentElement.setAttribute('data-theme', 'light')

  createRoot(root).render(
    <EmbedPlayer puzzleId={puzzleId} showTimer={showTimer} showHints={showHints} />
  )
}
