import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { HashRouter } from "react-router-dom";
import App from "./App";
import { ThemeProvider } from "./state/theme";
import "./index.css";

const container = document.getElementById("root");
if (!container) {
  throw new Error("Root container '#root' not found in index.html");
}

createRoot(container).render(
  <StrictMode>
    {/*
      Hash routing (`#/explore/...`) rather than path-based routing: this app
      is copied as static files into the host site at a nested path
      (public/tools/ontology-explorer/) and will later move to its own host
      entirely. Hash routes need zero server rewrite-rule configuration on
      any static host to survive a hard refresh on a deep link.
    */}
    <HashRouter>
      <ThemeProvider>
        <App />
      </ThemeProvider>
    </HashRouter>
  </StrictMode>,
);
