module.exports=[24510,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(42343);function e(a){return(0,d.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:[]}]})(a)}var f=a.i(62477),g=a.i(70025),h=a.i(33217);let i=({id:a,label:c,onChange:d,disabled:e=!1,children:f})=>(0,b.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,b.jsx)("label",{htmlFor:a,className:"text-xs font-semibold uppercase tracking-widest text-gray-500",children:c}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("select",{id:a,disabled:e,onChange:a=>d(a.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:f}),(0,b.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-3 flex items-center text-gray-400",children:(0,b.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",strokeWidth:2,viewBox:"0 0 24 24",children:(0,b.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]})]});a.s(["default",0,()=>{let[a,d]=(0,c.useState)(""),[j,k]=(0,c.useState)(),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),{data:p}=(0,h.useQuery)({queryKey:["searchData"],queryFn:()=>f.apiClient.get("client/search").then(a=>a)}),{data:q}=(0,h.useQuery)({queryKey:["brands"],queryFn:()=>f.apiClient.get("client/brands").then(a=>a.brands)}),{data:r,mutate:s}=(0,g.useMutation)({mutationKey:["getmodels"],mutationFn:a=>f.apiClient.patch("client/search",{make_id:a}).then(a=>a.models)});return(0,b.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,b.jsxs)("div",{className:"mb-6",children:[(0,b.jsx)("p",{className:"text-2xl font-bold tracking-tight text-gray-900",children:"Search for a car"}),(0,b.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Filter by make, model, and year to find your match."})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsx)("div",{className:"col-span-2 sm:col-span-1",children:(0,b.jsxs)(i,{id:"make",label:"Make",onChange:a=>{if(d(a),k(void 0),a){let b=q?.find(b=>b.slug===a);b&&s(String(b.id))}},children:[(0,b.jsx)("option",{value:"",children:"Any Make"}),p?.makes.map((a,c)=>(0,b.jsx)("option",{value:a.slug,children:a.name},c))]})}),(0,b.jsx)("div",{className:"col-span-2 sm:col-span-1",children:(0,b.jsxs)(i,{id:"model",label:"Model",onChange:k,disabled:!a,children:[(0,b.jsx)("option",{value:"",children:"Any Model"}),r?.map((a,c)=>(0,b.jsx)("option",{value:a.slug,children:a.name},c))]})}),(0,b.jsx)("div",{className:"col-span-1",children:(0,b.jsxs)(i,{id:"min-year",label:"Min Year",onChange:m,children:[(0,b.jsx)("option",{value:"",children:"Min Year"}),p?.years.map((a,c)=>(0,b.jsx)("option",{value:a.value,children:a.name},c))]})}),(0,b.jsx)("div",{className:"col-span-1",children:(0,b.jsxs)(i,{id:"max-year",label:"Max Year",onChange:o,children:[(0,b.jsx)("option",{value:"",children:"Max Year"}),p?.years.map((a,c)=>(0,b.jsx)("option",{value:a.value,children:a.name},c))]})})]}),(0,b.jsx)("div",{className:"my-6 h-px w-full bg-gray-100"}),(0,b.jsxs)("button",{onClick:()=>{let b={};a&&(b.make=a),j&&(b.model=j),l&&(b.minYear=l),n&&(b.year=n);let c=new URLSearchParams(b).toString();window.location.href=`/vehicles${c?`?${c}`:""}`},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,b.jsx)(e,{className:"h-4 w-4"}),(0,b.jsx)("span",{children:"Search Vehicles"})]})]})}],24510)}];

//# sourceMappingURL=components_common_SearchBar_tsx_0ijdti6._.js.map