import { i as __toESM } from "../_runtime.mjs";
import { B as require_react, b as require_jsx_runtime } from "../_libs/@tanstack/react-router+[...].mjs";
import { a as FIRM, i as cn, r as PageIntro } from "./router-5YS9k2gO.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/contact-ByL43_0K.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
var SUBJECTS = [
	"Defence policy",
	"Defence industry",
	"Defence research",
	"Media & speaking",
	"Other"
];
function ContactPage() {
	const [sent, setSent] = (0, import_react.useState)(false);
	const [error, setError] = (0, import_react.useState)("");
	const [mailto, setMailto] = (0, import_react.useState)(`mailto:${FIRM.email}`);
	function onSubmit(event) {
		event.preventDefault();
		setError("");
		const data = new FormData(event.currentTarget);
		const name = String(data.get("name") ?? "").trim();
		const org = String(data.get("organisation") ?? "").trim();
		const email = String(data.get("email") ?? "").trim();
		const subject = String(data.get("subject") ?? "").trim();
		const message = String(data.get("message") ?? "").trim();
		if (!name || !org || !email || !subject || !message) {
			setError("Please complete every field.");
			return;
		}
		if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
			setError("Please enter a valid email address.");
			return;
		}
		const body = [
			`Name: ${name}`,
			`Organisation: ${org}`,
			`Email: ${email}`,
			`Subject: ${subject}`,
			"",
			message
		].join("\n");
		const href = `mailto:${FIRM.email}?subject=${encodeURIComponent(`Enquiry — ${subject}`)}&body=${encodeURIComponent(body)}`;
		setMailto(href);
		setSent(true);
	}
	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageIntro, {
		kicker: "Contact",
		title: "Write to a principal.",
		lede: "Enquiries are reviewed in Singapore. We reply to serious correspondence. Please do not send classified or restricted material."
	}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
		className: "bg-paper text-ink-fg",
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
			className: "site-wrap grid gap-14 py-16 md:grid-cols-12 md:py-24",
			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
				className: "md:col-span-5",
				children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
					src: "/images/colonnade.jpg",
					alt: "Evening colonnade in Singapore’s financial district.",
					className: "aspect-4/5 w-full object-cover"
				}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
					className: "mt-8 space-y-6",
					children: [
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
							className: "label-kicker !text-ink-muted",
							children: "Email"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
							href: `mailto:${FIRM.email}`,
							className: "mt-2 block font-display text-2xl text-ink-fg no-underline",
							children: FIRM.email
						})] }),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
							className: "label-kicker !text-ink-muted",
							children: "Telephone"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
							className: "mt-2 font-display text-2xl",
							children: FIRM.phone
						})] }),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
								className: "label-kicker !text-ink-muted",
								children: "Office"
							}),
							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("address", {
								className: "mt-2 not-italic font-display text-2xl leading-snug",
								children: FIRM.addressLines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
									className: "block",
									children: line
								}, line))
							}),
							/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
								className: "mt-3 text-sm text-ink-muted",
								children: FIRM.hours
							})
						] })
					]
				})]
			}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
				className: "md:col-span-7",
				children: sent ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
					className: "border border-rule bg-ivory p-8 md:p-10",
					children: [
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
							className: "label-kicker !text-ink-muted",
							children: "Received"
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
							className: "mt-4 font-display text-3xl font-medium",
							children: "Your message is ready to send."
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
							className: "mt-4 leading-relaxed text-ink-muted",
							children: [
								"Write to",
								" ",
								/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
									href: mailto,
									className: "text-ink-fg underline underline-offset-4",
									children: FIRM.email
								}),
								". A principal will reply on unclassified terms. Do not attach or describe classified or restricted material."
							]
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
							href: mailto,
							className: "mt-8 inline-flex min-h-12 items-center bg-ink px-6 text-[0.78rem] font-semibold tracking-[0.16em] text-fg uppercase no-underline transition-[background-color,scale] duration-150 ease-out hover:bg-ink-soft active:scale-[0.96]",
							children: "Open email draft"
						})
					]
				}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
					onSubmit,
					className: "space-y-6",
					noValidate: true,
					children: [
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
							label: "Name",
							name: "name",
							autoComplete: "name"
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
							label: "Organisation",
							name: "organisation",
							autoComplete: "organization"
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
							label: "Email",
							name: "email",
							type: "email",
							autoComplete: "email"
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
							htmlFor: "subject",
							className: "label-kicker !text-ink-muted",
							children: "Subject"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", {
							id: "subject",
							name: "subject",
							defaultValue: "",
							className: "mt-2 min-h-12 w-full border border-rule bg-ivory px-3 text-[1.02rem] text-ink-fg outline-none transition-[border-color] duration-150 focus:border-ink",
							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
								value: "",
								disabled: true,
								children: "Select a practice"
							}), SUBJECTS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
								value: item,
								children: item
							}, item))]
						})] }),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
							htmlFor: "message",
							className: "label-kicker !text-ink-muted",
							children: "Message"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", {
							id: "message",
							name: "message",
							rows: 7,
							className: "mt-2 w-full border border-rule bg-ivory px-3 py-3 text-[1.02rem] text-ink-fg outline-none transition-[border-color] duration-150 focus:border-ink"
						})] }),
						error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
							className: "text-sm text-ink-fg",
							role: "alert",
							children: error
						}) : null,
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
							className: "text-sm leading-relaxed text-ink-muted",
							children: "By sending an enquiry you confirm that the contents are unclassified. Daciora does not accept restricted or classified material by email."
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
							type: "submit",
							className: cn("inline-flex min-h-12 items-center bg-ink px-8", "text-[0.78rem] font-semibold tracking-[0.16em] text-fg uppercase", "transition-[background-color,scale] duration-150 ease-out", "hover:bg-ink-soft active:scale-[0.96]"),
							children: "Send enquiry"
						})
					]
				})
			})]
		})
	})] });
}
function Field({ label, name, type = "text", autoComplete }) {
	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
		htmlFor: name,
		className: "label-kicker !text-ink-muted",
		children: label
	}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
		id: name,
		name,
		type,
		autoComplete,
		className: "mt-2 min-h-12 w-full border border-rule bg-ivory px-3 text-[1.02rem] text-ink-fg outline-none transition-[border-color] duration-150 focus:border-ink"
	})] });
}
//#endregion
export { ContactPage as component };
