import { r as reactExports, U as jsxRuntimeExports } from "./worker-entry-Xz__m-MI.js";
import { c as useQuery, d as categoriesQueryOptions, p as productsQueryOptions } from "./router-CHpUX3w1.js";
import { u as useSuspenseQuery } from "./useSuspenseQuery-CUxLKZvE.js";
import { C as ChevronRight, S as SiteHeader, P as ProductCard, a as SiteFooter } from "./site-footer-Ck1IemTj.js";
import { c as createLucideIcon } from "./createLucideIcon-4cZKQB6y.js";
import { S as ShoppingBag } from "./shopping-bag-CbDsBdXX.js";
import { c as cn } from "./utils-Bz4m9VPB.js";
import { T as Truck } from "./truck-z30CqIo1.js";
import "node:events";
import "node:async_hooks";
import "node:stream/web";
import "node:stream";
import "./button-DpKP5ewx.js";
import "./index-P9m2NEcT.js";
import "./index-BGCFm29u.js";
import "./Combination-DLYpVfee.js";
import "./index-MHtqZ26n.js";
import "./index-C7lwDevP.js";
const __iconNode = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
const ChevronLeft = createLucideIcon("chevron-left", __iconNode);
const dressPink = "/assets/dress-pink-Cq31EkVw.jpg";
const dressRose = "/assets/dress-rose-CYpFnOVO.jpg";
const dressMauve = "/assets/dress-mauve-qNt4MEYR.jpg";
const dressCoral = "/assets/dress-coral-CQFGDb3W.jpg";
const slides = [
  { src: dressPink, alt: "Pink dress collection" },
  { src: dressRose, alt: "Rose dress collection" },
  { src: dressMauve, alt: "Mauve dress collection" },
  { src: dressCoral, alt: "Coral dress collection" }
];
const INTERVAL_MS = 4e3;
function HeroCarousel() {
  const [index, setIndex] = reactExports.useState(0);
  reactExports.useEffect(() => {
    const t = setInterval(() => {
      setIndex((i) => (i + 1) % slides.length);
    }, INTERVAL_MS);
    return () => clearInterval(t);
  }, []);
  const go = (next) => {
    setIndex((next % slides.length + slides.length) % slides.length);
  };
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative aspect-[4/5] overflow-hidden rounded-[2rem] shadow-elegant bg-muted", children: [
    slides.map((slide, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      "img",
      {
        src: slide.src,
        alt: slide.alt,
        width: 1200,
        height: 1500,
        loading: i === 0 ? "eager" : "lazy",
        className: `absolute inset-0 h-full w-full object-cover transition-all duration-[1200ms] ease-out ${i === index ? "opacity-100 scale-100" : "opacity-0 scale-110"}`
      },
      slide.src
    )),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-primary/15 via-transparent to-transparent pointer-events-none" }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "button",
      {
        type: "button",
        "aria-label": "পূর্বের ছবি",
        onClick: () => go(index - 1),
        className: "absolute left-3 top-1/2 -translate-y-1/2 h-9 w-9 rounded-full bg-background/70 backdrop-blur hover:bg-background flex items-center justify-center shadow-soft transition",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronLeft, { className: "h-4 w-4" })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      "button",
      {
        type: "button",
        "aria-label": "পরের ছবি",
        onClick: () => go(index + 1),
        className: "absolute right-3 top-1/2 -translate-y-1/2 h-9 w-9 rounded-full bg-background/70 backdrop-blur hover:bg-background flex items-center justify-center shadow-soft transition",
        children: /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-4 w-4" })
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2", children: slides.map((_, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
      "button",
      {
        type: "button",
        "aria-label": `স্লাইড ${i + 1}`,
        onClick: () => setIndex(i),
        className: `h-1.5 rounded-full transition-all ${i === index ? "w-6 bg-primary" : "w-1.5 bg-background/70"}`
      },
      i
    )) })
  ] });
}
function CategoryGrid() {
  const { data: categories = [] } = useQuery(categoriesQueryOptions());
  if (categories.length === 0) return null;
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "mx-auto max-w-7xl px-3 md:px-6 py-6 md:py-8", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-4", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-base md:text-lg font-semibold text-foreground", children: "ক্যাটাগরি" }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "#collection", className: "text-xs text-primary hover:underline", children: "সব দেখুন →" })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex gap-3 md:gap-5 overflow-x-auto pb-2 -mx-1 px-1 scrollbar-thin", children: categories.map((cat) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
      "a",
      {
        href: `#cat-${cat.slug}`,
        className: "group flex flex-col items-center gap-1.5 shrink-0 w-16 md:w-20",
        children: [
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-14 w-14 md:h-16 md:w-16 rounded-full overflow-hidden border-2 border-border group-hover:border-primary transition-all bg-muted flex items-center justify-center", children: cat.image_url ? /* @__PURE__ */ jsxRuntimeExports.jsx(
            "img",
            {
              src: cat.image_url,
              alt: cat.name,
              loading: "lazy",
              className: "h-full w-full object-cover"
            }
          ) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShoppingBag, { className: "h-6 w-6 text-muted-foreground" }) }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[11px] md:text-xs text-center text-foreground/80 group-hover:text-primary leading-tight line-clamp-2", children: cat.name })
        ]
      },
      cat.id
    )) })
  ] });
}
function HomePage() {
  const {
    data: products
  } = useSuspenseQuery(productsQueryOptions());
  const {
    data: categories = []
  } = useQuery(categoriesQueryOptions());
  const [tab, setTab] = reactExports.useState("featured");
  const featured = reactExports.useMemo(() => products.filter((p) => p.isBestseller || p.isNew).slice(0, 8), [products]);
  const best = reactExports.useMemo(() => products.filter((p) => p.isBestseller).slice(0, 8), [products]);
  const latest = reactExports.useMemo(() => products.filter((p) => p.isNew).slice(0, 8), [products]);
  const tabProducts = tab === "featured" ? featured : tab === "best" ? best : latest;
  const byCategory = reactExports.useMemo(() => {
    const map = /* @__PURE__ */ new Map();
    products.forEach((p) => {
      const arr = map.get(p.category) ?? [];
      arr.push(p);
      map.set(p.category, arr);
    });
    return map;
  }, [products]);
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-h-screen bg-muted/30", children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(SiteHeader, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: "mx-auto max-w-7xl px-3 md:px-6 pt-4 md:pt-6", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-background rounded-lg border border-border/60 p-3 md:p-5", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-3 md:gap-5 md:grid-cols-[200px_1fr] lg:grid-cols-[220px_1fr_280px]", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsxs("aside", { className: "hidden md:flex flex-col gap-1", children: [
          categories.slice(0, 6).map((c) => /* @__PURE__ */ jsxRuntimeExports.jsxs("a", { href: `#cat-${c.slug}`, className: "group flex items-center justify-between text-sm py-2 px-2 rounded hover:bg-muted text-foreground/80 hover:text-primary transition-colors", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: c.name }),
            /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "h-3.5 w-3.5 opacity-0 group-hover:opacity-100" })
          ] }, c.id)),
          /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "#collection", className: "text-xs text-primary font-semibold mt-2 px-2 hover:underline", children: "View all" })
        ] }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative aspect-[16/9] md:aspect-auto md:h-full min-h-[260px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeroCarousel, {}) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "hidden lg:block", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative h-full min-h-[260px] rounded-lg overflow-hidden bg-gradient-to-br from-primary/15 to-secondary border border-border", children: [
          products[0]?.colors[0]?.imageUrl && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: products[0].colors[0].imageUrl, alt: "Featured", className: "absolute inset-0 h-full w-full object-cover opacity-90" }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-foreground/70 via-transparent" }),
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute bottom-0 left-0 right-0 p-4 text-background", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs uppercase tracking-wider opacity-80", children: "নতুন কালেকশন" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "font-display text-2xl mt-1 leading-tight", children: "এই সপ্তাহের সেরা" }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "#new", className: "inline-flex items-center gap-1 mt-2 text-xs font-semibold border-b border-background/70 pb-0.5", children: "এখনই দেখুন →" })
          ] })
        ] }) })
      ] }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid gap-3 md:gap-5 md:grid-cols-3 mt-3 md:mt-5", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(PromoCard, { eyebrow: "ফ্রি ডেলিভারি", title: "ঢাকার ভিতরে দ্রুত পৌঁছাবে", tone: "from-pink-100 to-rose-50", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(Truck, { className: "h-5 w-5" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(PromoCard, { eyebrow: "২০% ছাড়", title: "বেস্টসেলার পোশাকে", tone: "from-amber-100 to-orange-50" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(PromoCard, { eyebrow: "নতুন কালেকশন", title: "স্প্রিং ২০২৬", tone: "from-violet-100 to-pink-50" })
      ] })
    ] }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(CategoryGrid, {}),
    /* @__PURE__ */ jsxRuntimeExports.jsx("section", { id: "new", className: "mx-auto max-w-7xl px-3 md:px-6 pb-10", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "bg-background rounded-lg border border-border/60 p-4 md:p-6", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-center mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xl md:text-2xl font-bold text-foreground", children: "Recommended For You" }) }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-6 border-b border-border mb-5", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx(TabBtn, { active: tab === "featured", onClick: () => setTab("featured"), children: "Featured Products" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(TabBtn, { active: tab === "best", onClick: () => setTab("best"), children: "Best Selling" }),
        /* @__PURE__ */ jsxRuntimeExports.jsx(TabBtn, { active: tab === "latest", onClick: () => setTab("latest"), children: "Latest Products" })
      ] }),
      tabProducts.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-sm text-muted-foreground py-10", children: "এই সেকশনে কোন প্রোডাক্ট নেই।" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 md:gap-5 lg:grid-cols-4", children: tabProducts.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { product: p }, p.id)) })
    ] }) }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { id: "collection", className: "mx-auto max-w-7xl px-3 md:px-6 pb-10 space-y-6", children: [
      categories.map((cat) => {
        const items = byCategory.get(cat.name) ?? [];
        if (items.length === 0) return null;
        return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: `cat-${cat.slug}`, className: "bg-background rounded-lg border border-border/60 p-4 md:p-6 scroll-mt-24", children: [
          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-4", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg md:text-xl font-bold text-foreground", children: cat.name }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: "#collection", className: "text-xs text-primary hover:underline", children: "View All →" })
          ] }),
          /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 md:gap-5 lg:grid-cols-4", children: items.slice(0, 8).map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { product: p }, p.id)) })
        ] }, cat.id);
      }),
      /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { id: "bestsellers", className: "bg-background rounded-lg border border-border/60 p-4 md:p-6", children: [
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-between mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg md:text-xl font-bold text-foreground", children: "সম্পূর্ণ কালেকশন" }) }),
        /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-2 gap-3 md:gap-5 lg:grid-cols-4", children: products.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(ProductCard, { product: p }, p.id)) })
      ] })
    ] }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(SiteFooter, {})
  ] });
}
function TabBtn({
  active,
  onClick,
  children
}) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick, className: cn("pb-2 -mb-px text-sm font-medium transition-colors border-b-2", active ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"), children });
}
function PromoCard({
  eyebrow,
  title,
  tone,
  icon
}) {
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("rounded-lg border border-border/60 p-4 bg-gradient-to-br", tone), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start gap-3", children: [
    icon && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-9 w-9 rounded-full bg-background/70 flex items-center justify-center text-foreground shrink-0", children: icon }),
    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[11px] uppercase tracking-wider text-foreground/70 font-semibold", children: eyebrow }),
      /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-semibold text-foreground mt-0.5 leading-snug", children: title })
    ] })
  ] }) });
}
export {
  HomePage as component
};
