/* global React, Logo */
const { useState: useStateNav, useEffect: useEffectNav } = React;
// ============ NAVIGATION with mega-menu ============
function Nav({ variant = "light", activeItem }) {
const [openMenu, setOpenMenu] = useStateNav(null);
const [mobileOpen, setMobileOpen] = useStateNav(false);
const [mobileSection, setMobileSection] = useStateNav(null);
const [scrolled, setScrolled] = useStateNav(false);
useEffectNav(() => {
const onScroll = () => setScrolled(window.scrollY > 8);
window.addEventListener("scroll", onScroll);
return () => window.removeEventListener("scroll", onScroll);
}, []);
useEffectNav(() => {
document.body.style.overflow = mobileOpen ? "hidden" : "";
return () => { document.body.style.overflow = ""; };
}, [mobileOpen]);
const dark = variant === "dark";
let prefix = "";
const path = window.location.pathname;
if (path.includes("/products/")) {
const sub = path.substring(path.indexOf("/products/") + "/products/".length);
const depth = sub.split("/").length - 1;
prefix = "../".repeat(depth + 1);
} else if (path.includes("/industries/")) {
const sub = path.substring(path.indexOf("/industries/") + "/industries/".length);
const depth = sub.split("/").length - 1;
prefix = "../".repeat(depth + 1);
}
let currentActive = activeItem;
if (!currentActive) {
if (path.endsWith("eff-pro.html")) currentActive = "Effervescent Processing System (EFF-PRO)";
else if (path.endsWith("eff-pack.html")) currentActive = "Tube Filling Machine (EFF-PACK)";
else if (path.endsWith("vtd.html")) currentActive = "Vacuum Tray Dryer (VTD)";
else if (path.endsWith("rapid-mixing-granulator.html")) currentActive = "Rapid Mixer Granulator (RMG)";
else if (path.endsWith("fbd.html")) currentActive = "Fluid Bed Dryer (FBD)";
else if (path.endsWith("fbp.html")) currentActive = "Fluid Bed Processor (FBP)";
else if (path.endsWith("fbc.html")) currentActive = "Fluid Bed Coater (FBC)";
else if (path.endsWith("auto-coater.html")) currentActive = "Auto Tablet Coater (AC)";
else if (path.endsWith("extruder.html")) currentActive = "Extruder";
else if (path.endsWith("cpb.html")) currentActive = "Conta Pillar Blender (CPB)";
else if (path.endsWith("ocb.html")) currentActive = "Octagonal Blender (OCB)";
else if (path.endsWith("dcb.html")) currentActive = "Double Cone Blender (DCB)";
else if (path.endsWith("v-blender.html")) currentActive = "V Cone Blender (V-Blender)";
else if (path.endsWith("bin-blender.html")) currentActive = "Multi Attached Blender";
else if (path.endsWith("vsft.html")) currentActive = "Vibro Sifter (VSFT)";
else if (path.endsWith("mml.html")) currentActive = "Multi Mill (MML)";
else if (path.endsWith("dcm.html")) currentActive = "Dry Co Mill (DCM)";
else if (path.endsWith("ppv.html")) currentActive = "Paste Preparation Vessel (PPV)";
else if (path.endsWith("lpd.html")) currentActive = "Lifting & Positioning Device (LPD)";
else if (path.endsWith("atd.html")) currentActive = "Air Tray Dryer (ATD)";
else if (path.endsWith("spheronizer.html")) currentActive = "Spheronizer";
else if (path.endsWith("powder-transfer-system.html")) currentActive = "Powder Transfer Systems (PTS)";
else if (path.endsWith("ipc-bin.html")) currentActive = "IPC Bin Container";
else if (path.endsWith("ltd.html")) currentActive = "Lifting & Tilting Device (LTD)";
}
const solutionsItems = [
{ label: "Formulation", href: `${prefix}formulation.html` },
{ label: "Effervescent Packaging", href: `${prefix}packaging.html` },
{ label: "Containment", href: `${prefix}containment.html` },
{ label: "Transfer Systems", href: `${prefix}transfer-systems.html` },
];
const industriesItems = [
{ label: "Pharmaceuticals", href: `${prefix}industries/pharmaceuticals.html` },
{ label: "Nutraceuticals", href: `${prefix}industries/nutraceuticals.html` },
{ label: "Cosmetics", href: `${prefix}industries/cosmetics.html` },
{ label: "Chemicals", href: `${prefix}industries/chemicals.html` },
{ label: "Food & Dairy", href: `${prefix}industries/food.html` },
];
const navItems = [
{ label: "Products", key: "products", href: `${prefix}products.html` },
{ label: "Solutions", key: "solutions", href: "#" },
{ label: "Industries", key: "industries", href: `${prefix}index.html#industries` },
{ label: "Projects", key: "projects", href: "#" },
{ label: "Blog", key: "blog", href: "#" },
{ label: "Company", key: "company", href: `${prefix}company.html` },
{ label: "Careers", key: "careers", href: `${prefix}careers.html` },
{ label: "Contact", key: "contact", href: `${prefix}contact.html` },
];
const isKeyActive = (key) => {
const p = path.toLowerCase();
if (key === "products" && (p.includes("/products/") || p.includes("products.html"))) return true;
if (key === "solutions" && (p.includes("formulation.html") || p.includes("packaging.html") || p.includes("containment.html") || p.includes("transfer-systems.html") || p.includes("/solutions/"))) return true;
if (key === "industries" && p.includes("/industries/")) return true;
if (key === "company" && p.includes("company.html")) return true;
if (key === "careers" && p.includes("careers.html")) return true;
if (key === "contact" && p.includes("contact.html")) return true;
return false;
};
return (