import { jsxs, jsx } from "react/jsx-runtime";
import { R as Route, b as q, w as whatsappHref } from "./router-Dahr8H-r.js";
import { useSuspenseQuery } from "@tanstack/react-query";
import { L as LeadForm } from "./lead-form-Bx9NEbTG.js";
import { p as projectImage } from "./project-images-BkjwhtiA.js";
import "@tanstack/react-router";
import "react";
import "sonner";
import "lucide-react";
import "./client-P40JY-SL.js";
import "@supabase/supabase-js";
import "./server-CWcU6oWp.js";
import "node:async_hooks";
import "h3-v2";
import "@tanstack/router-core";
import "seroval";
import "@tanstack/history";
import "@tanstack/router-core/ssr/client";
import "@tanstack/router-core/ssr/server";
import "@tanstack/react-router/ssr/server";
import "zod";
function ProjectDetail() {
  const {
    slug
  } = Route.useParams();
  const {
    data: p
  } = useSuspenseQuery(q(slug));
  return /* @__PURE__ */ jsxs("article", { children: [
    /* @__PURE__ */ jsx("div", { className: "relative aspect-[21/9] w-full overflow-hidden bg-navy/5", children: /* @__PURE__ */ jsx("img", { src: projectImage(p.slug, p.cover_image), alt: p.name, width: 1920, height: 820, className: "size-full object-cover" }) }),
    /* @__PURE__ */ jsxs("div", { className: "mx-auto grid max-w-7xl gap-12 px-6 py-16 lg:grid-cols-[1fr_400px]", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("span", { className: "eyebrow", children: p.property_type }),
        /* @__PURE__ */ jsx("h1", { className: "mt-3 font-display text-4xl font-bold tracking-tight md:text-5xl", children: p.name }),
        /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm uppercase tracking-wider text-navy/50", children: p.location }),
        /* @__PURE__ */ jsxs("div", { className: "mt-8 grid grid-cols-2 gap-y-4 border-y border-navy/10 py-6 text-sm md:grid-cols-4", children: [
          /* @__PURE__ */ jsx(Field, { label: "Starting Price", value: p.starting_price }),
          /* @__PURE__ */ jsx(Field, { label: "Bedrooms", value: p.bedrooms }),
          /* @__PURE__ */ jsx(Field, { label: "Payment Plan", value: p.payment_plan }),
          /* @__PURE__ */ jsx(Field, { label: "Handover", value: p.handover_status })
        ] }),
        /* @__PURE__ */ jsxs("section", { className: "mt-12", children: [
          /* @__PURE__ */ jsx("h2", { className: "mb-4 font-display text-2xl font-bold", children: "Overview" }),
          /* @__PURE__ */ jsx("p", { className: "text-navy/80", children: p.overview || p.short_description })
        ] }),
        p.amenities?.length ? /* @__PURE__ */ jsxs("section", { className: "mt-12", children: [
          /* @__PURE__ */ jsx("h2", { className: "mb-4 font-display text-2xl font-bold", children: "Amenities" }),
          /* @__PURE__ */ jsx("ul", { className: "grid grid-cols-2 gap-3 text-sm sm:grid-cols-3", children: p.amenities.map((a) => /* @__PURE__ */ jsx("li", { className: "border-l-2 border-gold pl-3 text-navy/80", children: a }, a)) })
        ] }) : null,
        /* @__PURE__ */ jsxs("section", { className: "mt-12", children: [
          /* @__PURE__ */ jsx("h2", { className: "mb-4 font-display text-2xl font-bold", children: "Frequently Asked" }),
          /* @__PURE__ */ jsx("div", { className: "space-y-4", children: [["Can foreigners buy in this community?", "Yes — Dubai allows foreign ownership in designated freehold areas including this project."], ["Is a payment plan available?", `Yes. This project offers a ${p.payment_plan}.`], ["When is the expected handover?", `Handover is expected ${p.handover_status}.`]].map(([q2, a]) => /* @__PURE__ */ jsxs("details", { className: "border-b border-navy/10 pb-4", children: [
            /* @__PURE__ */ jsx("summary", { className: "cursor-pointer font-medium", children: q2 }),
            /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-navy/70", children: a })
          ] }, q2)) })
        ] }),
        /* @__PURE__ */ jsx("a", { href: whatsappHref(`Hi, I'd like more information about ${p.name} (${p.location}).`), target: "_blank", rel: "noopener noreferrer", className: "mt-10 inline-block bg-[#25D366] px-6 py-3 text-[10px] font-bold uppercase tracking-widest text-white", children: "WhatsApp Advisor" })
      ] }),
      /* @__PURE__ */ jsx("aside", { className: "lg:sticky lg:top-24 lg:h-fit", children: /* @__PURE__ */ jsxs("div", { className: "bg-white p-6 shadow-[var(--shadow-card)] ring-1 ring-navy/5", children: [
        /* @__PURE__ */ jsxs("p", { className: "mb-4 font-display text-lg font-bold", children: [
          "Download ",
          p.name,
          " Brochure"
        ] }),
        /* @__PURE__ */ jsx("p", { className: "mb-4 text-sm text-navy/70", children: "Brochure, floor plans & payment plan sent instantly to your WhatsApp." }),
        /* @__PURE__ */ jsx(LeadForm, { sourcePage: `/projects/${p.slug}`, prefilledInterest: p.property_type, projectName: p.name, variant: "full", ctaLabel: "Download Brochure" })
      ] }) })
    ] })
  ] });
}
function Field({
  label,
  value
}) {
  return /* @__PURE__ */ jsxs("div", { children: [
    /* @__PURE__ */ jsx("div", { className: "text-[10px] uppercase tracking-widest text-navy/40", children: label }),
    /* @__PURE__ */ jsx("div", { className: "mt-1 font-medium", children: value })
  ] });
}
export {
  ProjectDetail as component
};
