(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,54084,e=>{"use strict";var a=e.i(43476),s=e.i(71645),l=e.i(40141);function n(e){return(0,l.GenIcon)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M10.25 2a8.25 8.25 0 0 1 6.34 13.53l5.69 5.69a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-5.69-5.69A8.25 8.25 0 1 1 10.25 2ZM3.5 10.25a6.75 6.75 0 1 0 13.5 0 6.75 6.75 0 0 0-13.5 0Z"},child:[]}]})(e)}var t=e.i(15760),i=e.i(54616),r=e.i(66027);let o=({id:e,label:s,onChange:l,disabled:n=!1,children:t})=>(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("label",{htmlFor:e,className:"text-xs font-semibold uppercase tracking-widest text-gray-500",children:s}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("select",{id:e,disabled:n,onChange:e=>l(e.target.value),className:"w-full appearance-none rounded-lg border border-gray-200 bg-gray-50 px-3.5 py-2.5 pr-9 text-sm text-gray-800 transition-colors duration-150 focus:border-gray-900 focus:bg-white focus:outline-none focus:ring-2 focus:ring-gray-900/10 disabled:cursor-not-allowed disabled:opacity-40",children:t}),(0,a.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-3 flex items-center text-gray-400",children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]})]});e.s(["default",0,()=>{let[e,l]=(0,s.useState)(""),[c,d]=(0,s.useState)(),[u,h]=(0,s.useState)(""),[x,m]=(0,s.useState)(""),{data:g}=(0,r.useQuery)({queryKey:["searchData"],queryFn:()=>t.apiClient.get("client/search").then(e=>e)}),{data:p}=(0,r.useQuery)({queryKey:["brands"],queryFn:()=>t.apiClient.get("client/brands").then(e=>e.brands)}),{data:y,mutate:j}=(0,i.useMutation)({mutationKey:["getmodels"],mutationFn:e=>t.apiClient.patch("client/search",{make_id:e}).then(e=>e.models)});return(0,a.jsxs)("div",{className:"w-full max-w-xl rounded-2xl bg-white p-6 shadow-xl shadow-gray-200/80 md:p-8",children:[(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("p",{className:"text-2xl font-bold tracking-tight text-gray-900",children:"Search for a car"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Filter by make, model, and year to find your match."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,a.jsx)("div",{className:"col-span-2 sm:col-span-1",children:(0,a.jsxs)(o,{id:"make",label:"Make",onChange:e=>{if(l(e),d(void 0),e){let a=p?.find(a=>a.slug===e);a&&j(String(a.id))}},children:[(0,a.jsx)("option",{value:"",children:"Any Make"}),g?.makes.map((e,s)=>(0,a.jsx)("option",{value:e.slug,children:e.name},s))]})}),(0,a.jsx)("div",{className:"col-span-2 sm:col-span-1",children:(0,a.jsxs)(o,{id:"model",label:"Model",onChange:d,disabled:!e,children:[(0,a.jsx)("option",{value:"",children:"Any Model"}),y?.map((e,s)=>(0,a.jsx)("option",{value:e.slug,children:e.name},s))]})}),(0,a.jsx)("div",{className:"col-span-1",children:(0,a.jsxs)(o,{id:"min-year",label:"Min Year",onChange:h,children:[(0,a.jsx)("option",{value:"",children:"Min Year"}),g?.years.map((e,s)=>(0,a.jsx)("option",{value:e.value,children:e.name},s))]})}),(0,a.jsx)("div",{className:"col-span-1",children:(0,a.jsxs)(o,{id:"max-year",label:"Max Year",onChange:m,children:[(0,a.jsx)("option",{value:"",children:"Max Year"}),g?.years.map((e,s)=>(0,a.jsx)("option",{value:e.value,children:e.name},s))]})})]}),(0,a.jsx)("div",{className:"my-6 h-px w-full bg-gray-100"}),(0,a.jsxs)("button",{onClick:()=>{let a={};e&&(a.make=e),c&&(a.model=c),u&&(a.minYear=u),x&&(a.year=x);let s=new URLSearchParams(a).toString();window.location.href=`/vehicles${s?`?${s}`:""}`},className:"flex w-full items-center justify-center gap-2 rounded-xl bg-gray-900 px-6 py-3 text-sm font-semibold text-white transition-all duration-150 hover:bg-gray-700 active:scale-[0.98] focus:outline-none focus:ring-2 focus:ring-gray-900 focus:ring-offset-2",children:[(0,a.jsx)(n,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:"Search Vehicles"})]})]})}],54084)}]);