import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";

console.log("[orphic-ui statu : 🔍 ]\n Search Bar Builder - Initializing...");

document.addEventListener("DOMContentLoaded", function () {
	const wrapper = document.querySelector(".wrap");

	if (wrapper) {
		console.log(
			"[orphic-ui statu : ✅ ]\n Wrap element found, initializing app",
		);
		// Clear the wrapper
		wrapper.innerHTML = "";

		wrapper.style.display = "block";

		// Create root
		const root = createRoot(wrapper);

		console.log("[orphic-ui statu : ✅ ]\n Rendering Application");

		// Render app
		root.render(<App />);

		console.log(
			"[orphic-ui statu : ✅ ]\n Application successfully on screen!",
		);
	} else {
		console.error(
			"[orphic-ui statu : ❌ ]\n Wrap element not found! Cannot mount application.",
		);
	}
});
