import { n as __toESM } from "../_runtime.mjs";
import { u as require_react } from "../_libs/@floating-ui/react-dom+[...].mjs";
import { p as require_jsx_runtime } from "../_libs/@radix-ui/react-checkbox+[...].mjs";
import { f as useStore, r as Input, s as fmt, t as Button } from "./categories-MJJjwt1u.mjs";
import { _ as useParams, h as Link } from "../_libs/@tanstack/react-router+[...].mjs";
import { n as toast } from "../_libs/sonner.mjs";
import { A as MapPin, B as CreditCard, E as Package, M as LoaderCircle, et as Camera, f as Star, h as Sparkles, i as Video, p as Square, q as CircleCheck, s as Upload } from "../_libs/lucide-react.mjs";
import { a as DialogDescription, c as DialogTitle, i as DialogContent, l as Header, n as CheckoutFlow, r as Dialog, s as DialogHeader, t as CartDrawer, u as SignInModal } from "./Modals-PUPoXlMv.mjs";
import { t as LiveMapTracker } from "./LiveMapTracker-CGaH0qfR.mjs";
//#region node_modules/.nitro/vite/services/ssr/assets/orders._id-BIVLL6TB.js
var import_react = /* @__PURE__ */ __toESM(require_react());
var import_jsx_runtime = require_jsx_runtime();
function VideoReviewModal({ open, onOpenChange, productId, productName, orderId, onSuccess }) {
	const { user } = useStore();
	const [rating, setRating] = (0, import_react.useState)(5);
	const [title, setTitle] = (0, import_react.useState)("");
	const [comment, setComment] = (0, import_react.useState)("");
	const [videoUrl, setVideoUrl] = (0, import_react.useState)("");
	const [isRecording, setIsRecording] = (0, import_react.useState)(false);
	const [recordingTime, setRecordingTime] = (0, import_react.useState)(0);
	const [uploading, setUploading] = (0, import_react.useState)(false);
	const [submitting, setSubmitting] = (0, import_react.useState)(false);
	const videoPreviewRef = (0, import_react.useRef)(null);
	const mediaRecorderRef = (0, import_react.useRef)(null);
	const recordedChunksRef = (0, import_react.useRef)([]);
	const timerRef = (0, import_react.useRef)(null);
	const startRecording = async () => {
		try {
			const stream = await navigator.mediaDevices.getUserMedia({
				video: true,
				audio: true
			});
			if (videoPreviewRef.current) {
				videoPreviewRef.current.srcObject = stream;
				videoPreviewRef.current.play();
			}
			recordedChunksRef.current = [];
			const recorder = new MediaRecorder(stream);
			mediaRecorderRef.current = recorder;
			recorder.ondataavailable = (e) => {
				if (e.data.size > 0) recordedChunksRef.current.push(e.data);
			};
			recorder.onstop = async () => {
				const blob = new Blob(recordedChunksRef.current, { type: "video/webm" });
				if (blob.size > 20 * 1024 * 1024) {
					const mbSize = (blob.size / (1024 * 1024)).toFixed(1);
					toast.error(`Recorded video is ${mbSize}MB, exceeding the 20MB maximum limit. Please record a shorter video.`);
					setVideoUrl("");
					return;
				}
				const uploadedUrl = await uploadVideoFile(blob, `webcam_review_${Date.now()}.webm`);
				if (uploadedUrl) setVideoUrl(uploadedUrl);
				stream.getTracks().forEach((track) => track.stop());
				if (videoPreviewRef.current) videoPreviewRef.current.srcObject = null;
			};
			recorder.start();
			setIsRecording(true);
			setRecordingTime(0);
			timerRef.current = setInterval(() => {
				setRecordingTime((t) => t + 1);
			}, 1e3);
		} catch (err) {
			toast.error("Camera permission denied or camera unavailable.");
		}
	};
	const stopRecording = () => {
		if (mediaRecorderRef.current && isRecording) {
			mediaRecorderRef.current.stop();
			setIsRecording(false);
			if (timerRef.current) clearInterval(timerRef.current);
		}
	};
	const uploadVideoFile = async (fileOrBlob, filename) => {
		setUploading(true);
		try {
			const formData = new FormData();
			formData.append("file", fileOrBlob, filename);
			const data = await (await fetch("/api/upload.php", {
				method: "POST",
				body: formData
			})).json();
			if (data.success && data.url) {
				toast.success("Video uploaded to server successfully!");
				return data.url;
			} else {
				toast.error(data.error || "Failed to upload video to server.");
				return null;
			}
		} catch {
			toast.error("Network error while uploading video.");
			return null;
		} finally {
			setUploading(false);
		}
	};
	const handleFileUpload = async (e) => {
		const file = e.target.files?.[0];
		if (!file) return;
		if (!file.type.startsWith("video/")) {
			toast.error("Please upload a valid video file.");
			return;
		}
		if (file.size > 20 * 1024 * 1024) {
			const mbSize = (file.size / (1024 * 1024)).toFixed(1);
			toast.error(`Video file is ${mbSize}MB, exceeding the 20MB maximum limit.`);
			e.target.value = "";
			return;
		}
		const uploadedUrl = await uploadVideoFile(file, file.name);
		if (uploadedUrl) setVideoUrl(uploadedUrl);
	};
	const handleSubmit = async (e) => {
		e.preventDefault();
		if (!title.trim() || !comment.trim()) {
			toast.error("Please fill out the review title and comment.");
			return;
		}
		setSubmitting(true);
		try {
			if ((await (await fetch("/api/reviews.php", {
				method: "POST",
				headers: { "Content-Type": "application/json" },
				body: JSON.stringify({
					product_id: productId,
					order_id: orderId,
					user_email: user?.email || "customer@example.com",
					user_name: user?.name || "Verified Buyer",
					rating,
					title,
					comment,
					video_url: videoUrl || "https://assets.mixkit.co/videos/preview/mixkit-unboxing-a-new-smartphone-41484-large.mp4"
				})
			})).json()).success) {
				toast.success("Thank you! Your video review has been submitted and is pending admin approval before appearing in the store.");
				onOpenChange(false);
				if (onSuccess) onSuccess();
			} else toast.error("Failed to post review. Please try again.");
		} catch (err) {
			toast.error("Error submitting review.");
		} finally {
			setSubmitting(false);
		}
	};
	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
		open,
		onOpenChange,
		children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogContent, {
			className: "sm:max-w-[540px] p-6 max-h-[90vh] overflow-y-auto",
			children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogHeader, { children: [
				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
					className: "flex items-center gap-2 text-orange-500 text-xs font-bold uppercase tracking-wider",
					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sparkles, { className: "w-4 h-4" }), " Verified Customer Review"]
				}),
				/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, {
					className: "text-xl font-bold",
					children: "Create Video Review"
				}),
				/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogDescription, {
					className: "text-xs text-neutral-500",
					children: [
						"Share your unboxing and product experience for ",
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
							className: "font-semibold text-neutral-800",
							children: productName
						}),
						"."
					]
				})
			] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
				onSubmit: handleSubmit,
				className: "space-y-4 pt-2",
				children: [
					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
						className: "text-xs font-semibold text-neutral-700 block mb-1.5",
						children: "Rating"
					}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
						className: "flex items-center gap-1.5",
						children: [[
							1,
							2,
							3,
							4,
							5
						].map((star) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
							type: "button",
							onClick: () => setRating(star),
							className: "p-1 hover:scale-110 transition-transform",
							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Star, { className: `w-7 h-7 ${star <= rating ? "text-amber-400 fill-amber-400" : "text-neutral-300"}` })
						}, star)), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
							className: "ml-2 text-xs font-bold text-neutral-600",
							children: [rating, " out of 5 Stars"]
						})]
					})] }),
					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
						className: "text-xs font-semibold text-neutral-700 flex items-center justify-between mb-1.5",
						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
							className: "flex items-center gap-1",
							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Video, { className: "w-4 h-4 text-orange-500" }), " Video Recording or Upload"]
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
							className: "text-[11px] text-orange-600 font-semibold bg-orange-50 px-1.5 py-0.5 rounded border border-orange-200",
							children: "Max size: 20MB"
						})]
					}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
						className: "border-2 border-dashed border-neutral-300 rounded-xl p-4 bg-neutral-50 flex flex-col items-center justify-center min-h-[200px] relative overflow-hidden",
						children: isRecording ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
							className: "w-full text-center space-y-3",
							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("video", {
								ref: videoPreviewRef,
								className: "w-full h-44 object-cover rounded-lg bg-black",
								muted: true
							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
								className: "flex items-center justify-center gap-3",
								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
									className: "inline-flex items-center gap-1.5 text-xs text-red-600 font-bold animate-pulse",
									children: [
										/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "w-2.5 h-2.5 bg-red-600 rounded-full" }),
										" Recording... 00:0",
										recordingTime,
										"s"
									]
								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
									type: "button",
									variant: "destructive",
									size: "sm",
									onClick: stopRecording,
									className: "gap-1",
									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Square, { className: "w-3.5 h-3.5" }), " Stop Recording"]
								})]
							})]
						}) : videoUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
							className: "w-full space-y-2",
							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("video", {
								src: videoUrl,
								controls: true,
								className: "w-full h-48 object-cover rounded-lg bg-black"
							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
								className: "flex justify-between items-center text-xs",
								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
									className: "text-emerald-600 font-medium flex items-center gap-1",
									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleCheck, { className: "w-4 h-4" }), " Video Attached"]
								}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
									type: "button",
									onClick: () => setVideoUrl(""),
									className: "text-red-500 hover:underline",
									children: "Remove video"
								})]
							})]
						}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
							className: "text-center space-y-3 py-2",
							children: [
								/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
									className: "w-12 h-12 rounded-full bg-orange-100 flex items-center justify-center mx-auto text-orange-500",
									children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Camera, { className: "w-6 h-6" })
								}),
								/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
									className: "text-xs font-semibold text-neutral-800",
									children: "Record video or select file"
								}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
									className: "text-[11px] text-neutral-500 mt-0.5",
									children: "Show how your package looks after delivery!"
								})] }),
								/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "flex items-center justify-center gap-2 pt-1",
									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
										type: "button",
										variant: "outline",
										size: "sm",
										onClick: startRecording,
										className: "gap-1.5 border-orange-400 text-orange-600 hover:bg-orange-50 text-xs",
										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Camera, { className: "w-3.5 h-3.5" }), " Record Webcam"]
									}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
										className: "cursor-pointer inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md bg-white border border-neutral-300 hover:bg-neutral-100 text-xs font-medium text-neutral-700 shadow-sm",
										children: [
											/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Upload, { className: "w-3.5 h-3.5" }),
											" Upload File",
											/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
												type: "file",
												accept: "video/*",
												onChange: handleFileUpload,
												className: "hidden"
											})
										]
									})]
								})
							]
						})
					})] }),
					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
						className: "space-y-1",
						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
							className: "text-xs font-semibold text-neutral-700",
							children: "Headline"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
							value: title,
							onChange: (e) => setTitle(e.target.value),
							placeholder: "e.g. Excellent delivery quality & authentic product!",
							required: true,
							className: "text-xs"
						})]
					}),
					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
						className: "space-y-1",
						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
							className: "text-xs font-semibold text-neutral-700",
							children: "Detailed Review"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", {
							value: comment,
							onChange: (e) => setComment(e.target.value),
							placeholder: "Write your review here. Did it meet your expectations?",
							rows: 3,
							required: true,
							className: "w-full p-2.5 text-xs rounded-md border border-neutral-300 focus:outline-none focus:ring-2 focus:ring-orange-500"
						})]
					}),
					/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
						className: "flex gap-2 pt-2",
						children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
							type: "button",
							variant: "outline",
							onClick: () => onOpenChange(false),
							className: "flex-1 text-xs",
							children: "Cancel"
						}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
							type: "submit",
							disabled: submitting,
							className: "flex-1 text-xs bg-orange-500 hover:bg-orange-600 font-semibold",
							children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoaderCircle, { className: "w-4 h-4 animate-spin" }) : "Post Video Review"
						})]
					})
				]
			})]
		})
	});
}
function OrderTracking() {
	const { id } = useParams({ from: "/orders/$id" });
	const [signInOpen, setSignInOpen] = (0, import_react.useState)(false);
	const [cartOpen, setCartOpen] = (0, import_react.useState)(false);
	const [checkoutOpen, setCheckoutOpen] = (0, import_react.useState)(false);
	const [selectedReviewItem, setSelectedReviewItem] = (0, import_react.useState)(null);
	const { orders, hydrated } = useStore();
	const order = orders.find((o) => o.id === id);
	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
		className: "min-h-screen bg-neutral-50 pb-16",
		children: [
			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignInModal, {
				open: signInOpen,
				onOpenChange: setSignInOpen
			}),
			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CartDrawer, {
				open: cartOpen,
				onOpenChange: setCartOpen,
				onCheckout: () => {
					setCartOpen(false);
					setCheckoutOpen(true);
				}
			}),
			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckoutFlow, {
				open: checkoutOpen,
				onOpenChange: setCheckoutOpen
			}),
			selectedReviewItem && order && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VideoReviewModal, {
				open: !!selectedReviewItem,
				onOpenChange: (o) => {
					if (!o) setSelectedReviewItem(null);
				},
				productId: selectedReviewItem.id,
				productName: selectedReviewItem.name,
				orderId: order.id
			}),
			/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Header, {
				onOpenCart: () => setCartOpen(true),
				onOpenSignIn: () => setSignInOpen(true)
			}),
			/* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
				className: "max-w-[960px] mx-auto px-4 py-6",
				children: !hydrated ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
					className: "text-center py-16 text-sm text-neutral-500",
					children: "Loading order telemetry…"
				}) : !order ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
					className: "bg-white rounded-lg border p-10 text-center",
					children: [
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Package, { className: "w-12 h-12 text-neutral-300 mx-auto mb-3" }),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
							className: "text-xl font-bold",
							children: "Order not found"
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
							className: "text-sm text-neutral-500 mt-2",
							children: [
								"We couldn't find order ",
								id,
								"."
							]
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
							to: "/profile",
							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
								className: "mt-5 bg-orange-500 hover:bg-orange-600",
								children: "Back to my account"
							})
						})
					]
				}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
					className: "space-y-6",
					children: [
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
							className: "bg-white rounded-xl border p-6 flex flex-wrap items-center justify-between gap-4",
							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
								/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
									className: "text-xs text-neutral-500 font-semibold uppercase tracking-wider",
									children: "Order Details"
								}),
								/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
									className: "text-2xl font-black text-neutral-900",
									children: order.id
								}),
								/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "text-xs text-neutral-500 mt-1",
									children: ["Placed ", new Date(order.createdAt).toLocaleString()]
								})
							] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
								className: "text-right",
								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
									className: "text-xs text-neutral-500",
									children: "Total Paid"
								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "text-2xl font-bold text-orange-600",
									children: ["₦ ", fmt(order.total)]
								})]
							})]
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveMapTracker, {
							orderId: order.id,
							status: order.status,
							destinationAddress: order.address,
							driverPhone: order.driverPhone
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
							className: "grid grid-cols-1 md:grid-cols-2 gap-6",
							children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
								className: "bg-white rounded-xl border p-5",
								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "font-bold mb-3 flex items-center gap-2 text-neutral-900",
									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MapPin, { className: "w-4 h-4 text-orange-500" }), " Delivery Address"]
								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "text-sm space-y-1",
									children: [
										/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
											className: "font-semibold text-neutral-800",
											children: order.address.name
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
											className: "text-neutral-600 text-xs",
											children: order.address.phone
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "text-neutral-600 text-xs",
											children: [
												order.address.street,
												", ",
												order.address.city,
												", ",
												order.address.state
											]
										})
									]
								})]
							}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
								className: "bg-white rounded-xl border p-5",
								children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "font-bold mb-3 flex items-center gap-2 text-neutral-900",
									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CreditCard, { className: "w-4 h-4 text-orange-500" }), " Payment Telemetry"]
								}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "text-xs space-y-2",
									children: [
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
												className: "text-neutral-500",
												children: "Method"
											}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
												className: "font-semibold",
												children: order.paymentMethod
											})]
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
												className: "text-neutral-500",
												children: "Reference"
											}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
												className: "font-mono",
												children: order.paymentRef
											})]
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
												className: "text-neutral-500",
												children: "Status"
											}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
												className: "text-emerald-600 font-bold",
												children: "Verified Paid"
											})]
										})
									]
								})]
							})]
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
							className: "bg-white rounded-xl border overflow-hidden",
							children: [
								/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "px-5 py-4 border-b font-bold flex items-center justify-between",
									children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
										className: "flex items-center gap-2 text-neutral-900",
										children: [
											/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Package, { className: "w-4 h-4 text-orange-500" }),
											" Items in Package (",
											order.items.length,
											")"
										]
									}), order.status === "delivered" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
										className: "text-xs font-semibold text-emerald-600 flex items-center gap-1 bg-emerald-50 px-2.5 py-1 rounded-full border border-emerald-200",
										children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sparkles, { className: "w-3.5 h-3.5" }), " Eligible for Video Review"]
									})]
								}),
								/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
									className: "divide-y divide-neutral-100",
									children: order.items.map((it) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
										className: "flex flex-wrap items-center gap-4 p-4 hover:bg-neutral-50/50 transition",
										children: [
											/* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
												src: it.images?.[0] || `https://picsum.photos/seed/${it.seed}/80/80`,
												alt: it.name,
												className: "w-16 h-16 rounded-lg object-cover border"
											}),
											/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
												className: "flex-1 min-w-[200px]",
												children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
													className: "text-sm font-semibold text-neutral-900 line-clamp-1",
													children: it.name
												}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
													className: "text-xs text-neutral-500 mt-0.5",
													children: ["Quantity: ", it.qty]
												})]
											}),
											/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
												className: "text-right",
												children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
													className: "text-sm font-bold text-neutral-900",
													children: ["₦ ", fmt(it.price * it.qty)]
												}), order.status === "delivered" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
													size: "sm",
													onClick: () => setSelectedReviewItem({
														id: it.id,
														name: it.name
													}),
													className: "mt-2 bg-gradient-to-r from-orange-500 to-amber-500 hover:from-orange-600 hover:to-amber-600 text-white text-xs gap-1.5 shadow-sm",
													children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Video, { className: "w-3.5 h-3.5" }), " Create Video Review"]
												}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
													className: "text-[11px] text-neutral-400 mt-1",
													children: "Video review unlocks upon delivery"
												})]
											})
										]
									}, it.id))
								}),
								/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
									className: "p-4 space-y-1.5 text-xs bg-neutral-50 border-t",
									children: [
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between text-neutral-600",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Subtotal" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["₦ ", fmt(order.subtotal)] })]
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between text-neutral-600",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Shipping" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: order.shipping === 0 ? "Free" : `₦ ${fmt(order.shipping)}` })]
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between text-neutral-600",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "VAT (1%)" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["₦ ", fmt(order.subtotal * .01)] })]
										}),
										/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
											className: "flex justify-between font-bold text-sm text-neutral-900 pt-1.5 border-t",
											children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Total" }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: ["₦ ", fmt(order.total)] })]
										})
									]
								})
							]
						}),
						/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
							className: "pt-2",
							children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
								to: "/profile",
								className: "text-sm font-medium text-orange-600 hover:underline",
								children: "← Back to account orders"
							})
						})
					]
				})
			})
		]
	});
}
//#endregion
export { OrderTracking as component };
