// Main app — hash router, tweaks integration, root mount. const { useState: useStateApp, useEffect: useEffectApp } = React; const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "palette": "rose", "type": "cormorant", "heroTreatment": "full", "ornaments": "restrained", "mode": "light", "locale": "EN" }/*EDITMODE-END*/; function parseRoute() { const hash = (window.location.hash || "#/").replace(/^#/, ""); // expected forms: /, /real-weddings, /real-weddings/slug, /services, /destinations, /about, /enquire if (hash === "/" || hash === "") return { name: "home" }; const parts = hash.split("/").filter(Boolean); if (parts[0] === "real-weddings") { if (parts[1]) return { name: "wedding", slug: parts[1] }; return { name: "real-weddings" }; } if (parts[0] === "services") return { name: "services" }; if (parts[0] === "destinations") return { name: "destinations" }; if (parts[0] === "about") return { name: "about" }; if (parts[0] === "enquire") return { name: "enquire" }; return { name: "home" }; } function App() { const [t, setTweak] = useTweaks(TWEAK_DEFAULTS); const [route, setRoute] = useStateApp(parseRoute()); useEffectApp(() => { const onHash = () => { setRoute(parseRoute()); window.scrollTo({ top: 0, behavior: "instant" }); }; window.addEventListener("hashchange", onHash); return () => window.removeEventListener("hashchange", onHash); }, []); // apply data attrs to html root useEffectApp(() => { const html = document.documentElement; html.setAttribute("data-mode", t.mode); html.setAttribute("data-palette", t.palette); html.setAttribute("data-type", t.type); html.setAttribute("data-ornaments", t.ornaments); html.setAttribute("lang", t.locale.toLowerCase()); html.setAttribute("dir", t.locale === "AR" ? "rtl" : "ltr"); }, [t.mode, t.palette, t.type, t.ornaments, t.locale]); const setLocale = (l) => setTweak("locale", l); // Map active nav id from route const navId = route.name === "home" ? "home" : route.name === "wedding" ? "real-weddings" : route.name; return (