import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { App } from "./App.js";
import { productionAdapters } from "./adapters/production-adapters.js";
import { AdapterProvider } from "./contexts/adapter-context.js";
import {
	BestiaryProvider,
	BulkImportProvider,
	EncounterProvider,
	InitiativeRollsProvider,
	PlayerCharactersProvider,
	RulesEditionProvider,
	SidePanelProvider,
	ThemeProvider,
} from "./contexts/index.js";
import "./index.css";

const root = document.getElementById("root");
if (root) {
	createRoot(root).render(
		<StrictMode>
			<AdapterProvider adapters={productionAdapters}>
				<ThemeProvider>
					<RulesEditionProvider>
						<EncounterProvider>
							<BestiaryProvider>
								<PlayerCharactersProvider>
									<BulkImportProvider>
										<SidePanelProvider>
											<InitiativeRollsProvider>
												<App />
											</InitiativeRollsProvider>
										</SidePanelProvider>
									</BulkImportProvider>
								</PlayerCharactersProvider>
							</BestiaryProvider>
						</EncounterProvider>
					</RulesEditionProvider>
				</ThemeProvider>
			</AdapterProvider>
		</StrictMode>,
	);
}
