import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import "@/lib/runtime";
import "./index.css";

// IMPORTANT: this must be set to true before/at mount time. `lib/runtime.ts`'s
// global `window.onerror`/`onunhandledrejection` handlers only show a
// dismissible toast once the app is bootstrapped; if this flag is never set,
// ANY runtime error anywhere in the app (e.g. an event handler exception, a
// rejected promise in a modal) is treated as a boot failure and wipes the
// entire mounted app, replacing #root with the plain-HTML fatal fallback
// screen. Mirrors the previous CDN bootstrap()'s
// `window.__HIRA_BOOTSTRAPPED__ = true` set immediately before render.
(window as any).__HIRA_BOOTSTRAPPED__ = true;

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <App />
  </StrictMode>
);
