"use client"; import "photoswipe/style.css"; import { zodResolver } from "@hookform/resolvers/zod"; import { ChevronLeft, ChevronRight, Minus, Plus, RotateCcw, Store, Truck, ZoomIn, } from "lucide-react"; import type { PhotoSwipe } from "photoswipe/lightbox"; import PhotoSwipeLightbox from "photoswipe/lightbox"; import { useEffect, useMemo, useRef, useState } from "react"; import type { ControllerRenderProps, SubmitHandler, UseFormReturn, } from "react-hook-form"; import { Controller, useForm } from "react-hook-form"; import { z } from "zod"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, } from "@/components/ui/accordion"; import { AspectRatio } from "@/components/ui/aspect-ratio"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import type { CarouselApi } from "@/components/ui/carousel"; import { Carousel, CarouselContent, CarouselItem, } from "@/components/ui/carousel"; import { Field, FieldLabel } from "@/components/ui/field"; import { Input } from "@/components/ui/input"; import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { cn } from "@/lib/utils"; type StockStatusCode = "IN_STOCK" | "OUT_OF_STOCK"; interface StockInfo { stockStatusCode?: StockStatusCode; stockQuantity?: number; } interface ProductImagesProps { images: Array<{ alt: string; width: number; height: number; srcset: string; src: string; sizes: string; }>; galleryID: string; } interface Option { id: string; value: string; label: string; stockInfo: StockInfo; price?: price; } interface Hinges { label: string; id: string; name: FieldName; options?: Option[]; min?: number; max?: number; } interface ProductFormProps { hinges: Record; onSubmit: SubmitHandler; stockInfo?: StockInfo; form: UseFormReturn>; selectedSize?: string; productInfo: { name: string; thumbnail: { src: string; alt: string; }; price?: price; }; } type price = { regular?: number; sale?: number; currency?: string; }; interface PriceProps extends price { size?: "default" | "sm"; } type FormType = z.infer; type FieldName = keyof FormType; interface SizeRadioGroupProps { options?: Array