PageSourceSearch

https://aidealer360.com/assets/InventorySearch-BKBhUZEL.js

js aidealer360.com collected 2026-10-01 15:55:41 UTC 12,067 bytes, 1 lines download raw bytes

1import{j as e}from"./ui-vendor-B12AOeKi.js";import{k as ee,u as se,r as c,L as te}from"./react-vendor-DZt7wVAJ.js";import{f as le,a as ae,b as re,m as ie,P as ne,S as oe}from"./Seo-CYs8c8XG.js";import{L as H,V as ce}from"./LeadForm-CV0mPG9M.js";import{S as de,a as me,b as xe,c as he}from"./sheet-DqGMXykp.js";import{S as pe}from"./sliders-horizontal-Cw0ETVoK.js";import"./index-BZo64Z7H.js";import"./charts-vendor-B6q1L48j.js";import"./supabase-vendor-dOy44Gxq.js";import"./animation-vendor-BAVy02gd.js";import"./share-2-CpjmIOL2.js";import"./facebook-DRz6IjqJ.js";import"./message-circle-BMVorY3S.js";import"./link-2-DFuIiLFx.js";import"./TradeForm-SdAQ082d.js";const K=i=>i.split("-").map(d=>d.charAt(0).toUpperCase()+d.slice(1)).join(" ");function _e({variant:i="all",condition:d}){var q,D,U,R,Y;const{make:_,model:E}=ee(),[o,I]=se(),r=o.get("dealer"),[S,A]=c.useState(null),[l,M]=c.useState(null),[a,G]=c.useState(null),[g,F]=c.useState(null),[V,B]=c.useState(!0),[J,$]=c.useState(!1),C=_?K(_):"",f=E?K(E):"",j=o.get("q")??"",x=o.get("make")??(i==="make"?C:""),w=o.get("model")??(i==="make"?f:""),y=o.get("trim")??"",N=o.get("year")??"",u=i==="condition"?d:o.get("condition")??"all",P=o.get("sort")??"newest",m=Number(o.get("page")??1),v=[j,x,w,y,N,i!=="condition"&&u!=="all"?u:""].filter(Boolean).length,n=(s,p)=>{const k=new URLSearchParams(o);p?k.set(s,p):k.delete(s),s!=="page"&&k.delete("page"),I(k,{replace:!0})};c.useEffect(()=>{le().then(s=>A(s.stores)).catch(()=>A([]))},[]),c.useEffect(()=>{ae(r??void 0).then(M).catch(()=>M(null))},[r]),c.useEffect(()=>{B(!0),F(null),re({store:r??void 0,q:j,make:x,model:w,trim:y,year:N,condition:u,sort:P,page:m,page_size:24}).then(G).catch(s=>F(s instanceof Error?s.message:String(s))).finally(()=>B(!1))},[r,j,x,w,y,N,u,P,m]);const t=(a==null?void 0:a.store)??(l==null?void 0:l.store)??null,b=(a==null?void 0:a.total)??0,L=Math.max(1,Math.ceil(b/((a==null?void 0:a.page_size)??24))),O=c.useMemo(()=>i==="condition"?`${d==="certified"?"Certified Pre-Owned":d==="new"?"New":"Used"} Vehicles for Sale${t!=null&&t.city?` in ${t.city}, ${t.state??""}`:""}`:i==="make"?`${C}${f?` ${f}`:""} Inventory${t!=null&&t.city?` in ${t.city}, ${t.state??""}`:""}`:(t==null?void 0:t.hero_headline)||`Shop ${(t==null?void 0:t.name)??"Our"} Inventory${t!=null&&t.city?` in ${t.city}, ${t.state??""}`:""}`,[i,d,C,f,t]),z=(q=a==null?void 0:a.vehicles)==null?void 0:q.map(s=>s.price??0).filter(s=>s>0).sort((s,p)=>s-p)[0],Q=i==="all"?`${(t==null?void 0:t.name)??"Inventory"} — Cars for Sale`:`${O}`,W=`Browse ${b} available ${i==="condition"?`${d} `:""}vehicles at ${(t==null?void 0:t.name)??"our dealership"}${t!=null&&t.city?` in ${t.city}, ${t.state??""}`:""}.${z?` Starting at ${ie(z)}.`:""} Search by year, make, model, trim, VIN or stock number.`,X=window.location.pathname,Z=t?[{"@context":"https://schema.org","@type":"AutoDealer",name:t.name,telephone:t.phone??void 0,address:{"@type":"PostalAddress",streetAddress:t.address??void 0,addressLocality:t.city??void 0,addressRegion:t.state??void 0,postalCode:t.zip??void 0}},{"@context":"https://schema.org","@type":"ItemList",numberOfItems:b,itemListElement:((a==null?void 0:a.vehicles)??[]).slice(0,20).map((s,p)=>({"@type":"ListItem",position:p+1,url:`${window.location.origin}/inventory/v/${s.slug}`,name:[s.year,s.make,s.model,s.trim].filter(Boolean).join(" ")}))}]:void 0,h="w-full rounded-lg border border-slate-300 bg-white px-3 py-2.5 text-base text-slate-900 focus:border-sky-500 focus:outline-none sm:text-sm",T=e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Search"}),e.jsx("input",{className:h,defaultValue:j,placeholder:"Year, make, model, VIN, stock #",onKeyDown:s=>{s.key==="Enter"&&n("q",s.target.value.trim())},onBlur:s=>n("q",s.target.value.trim())})]}),e.jsxs("div",{className:"mt-4 space-y-3",children:[i!=="condition"&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Condition"}),e.jsxs("select",{className:h,value:u,onChange:s=>n("condition",s.target.value),children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"new",children:"New"}),e.jsx("option",{value:"used",children:"Used"}),e.jsx("option",{value:"certified",children:"Certified"})]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Year"}),e.jsxs("select",{className:h,value:N,onChange:s=>n("year",s.target.value),children:[e.jsx("option",{value:"",children:"Any year"}),((l==null?void 0:l.years)??[]).map(s=>e.jsx("option",{value:s,children:s},s))]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Make"}),e.jsxs("select",{className:h,value:x,onChange:s=>{n("model",""),n("make",s.target.value)},children:[e.jsx("option",{value:"",children:"Any make"}
1),((l==null?void 0:l.makes)??[]).map(s=>e.jsxs("option",{value:s.make,children:[s.make," (",s.count,")"]},s.make))]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Model"}),e.jsxs("select",{className:h,value:w,onChange:s=>n("model",s.target.value),disabled:!x,children:[e.jsx("option",{value:"",children:"Any model"}),(((D=l==null?void 0:l.models)==null?void 0:D[x])??[]).map(s=>e.jsx("option",{value:s,children:s},s))]})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1 block text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Trim"}),e.jsx("input",{className:h,defaultValue:y,placeholder:"Any trim",onBlur:s=>n("trim",s.target.value.trim())})]}),e.jsx("button",{onClick:()=>{I(r?{dealer:r}:{}),$(!1)},className:"min-h-11 w-full rounded-lg border border-slate-300 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",children:"Clear filters"})]})]});return e.jsxs(ne,{store:t,storeParam:r,children:[e.jsx(oe,{title:Q,description:W,path:X,image:(Y=(R=(U=a==null?void 0:a.vehicles)==null?void 0:U[0])==null?void 0:R.photos)==null?void 0:Y[0],jsonLd:Z}),e.jsx("section",{className:"w-full min-w-0 max-w-full border-b border-slate-200 bg-gradient-to-br from-slate-900 via-slate-800 to-sky-900 px-4 py-10 text-white sm:px-6",children:e.jsxs("div",{className:"mx-auto w-full min-w-0 max-w-7xl",children:[e.jsx("h1",{className:"break-words text-2xl font-bold tracking-tight sm:text-3xl",children:O}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm text-slate-200",children:(t==null?void 0:t.hero_subhead)||"Search our live inventory by year, make, model, trim, VIN or stock number. Every vehicle updated daily."}),l&&e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2 text-xs",children:[e.jsxs("span",{className:"rounded-full bg-white/10 px-3 py-1",children:[l.total," available"]}),l.counts.new>0&&e.jsxs("span",{className:"rounded-full bg-white/10 px-3 py-1",children:[l.counts.new," new"]}),l.counts.used>0&&e.jsxs("span",{className:"rounded-full bg-white/10 px-3 py-1",children:[l.counts.used," used"]}),l.counts.certified>0&&e.jsxs("span",{className:"rounded-full bg-white/10 px-3 py-1",children:[l.counts.certified," certified"]})]}),S&&S.length>1&&e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-slate-300",children:"Store:"}),S.map(s=>e.jsx("button",{onClick:()=>n("dealer",s.slug||s.dealership_id),className:`rounded-full px-3 py-1 ${(r??"")===(s.slug||s.dealership_id)||!r&&s.dealership_id===(t==null?void 0:t.dealership_id)?"bg-white text-slate-900":"bg-white/10 text-white hover:bg-white/20"}`,children:s.name},s.dealership_id))]})]})}),e.jsx("div",{"data-public-inventory":!0,className:"mx-auto w-full min-w-0 max-w-7xl px-4 py-8 sm:px-6",children:e.jsxs("div",{className:"lg:grid lg:grid-cols-[280px_1fr] lg:gap-8",children:[e.jsxs("aside",{className:"hidden space-y-4 lg:block",children:[e.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-4",children:T}),e.jsx("div",{className:"rounded-2xl border border-slate-200 bg-white p-4",children:e.jsx(H,{store:r||(t==null?void 0:t.dealership_id)||"",compact:!0})})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-4 grid min-w-0 grid-cols-2 items-center gap-3 sm:flex sm:flex-wrap sm:justify-between",children:[e.jsxs("button",{onClick:()=>$(!0),className:"flex min-h-11 items-center gap-2 rounded-lg border border-slate-300 bg-white px-4 py-2 text-sm font-semibold text-slate-800 hover:bg-slate-50 lg:hidden",children:[e.jsx(pe,{className:"h-4 w-4"}),"Filters",v>0&&e.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-sky-600 px-1 text-[11px] font-bold text-white",children:v})]}),e.jsx("p",{className:"text-right text-sm text-slate-600 sm:text-left",children:V?"Loading inventory…":`${b} vehicles found`}),e.jsxs("label",{className:"col-span-2 flex min-w-0 flex-wrap items-center gap-2 text-sm sm:col-span-1",children:[e.jsx("span",{className:"text-slate-500",children:"Sort"}),e.jsxs("select",{className:"min-h-11 min-w-0 max-w-full rounded-lg border border-slate-300 bg-white px-2 py-1.5 text-sm",value:P,onChange:s=>n("sort",s.target.value),children:[e.jsx("option",{value:"newest",children:"Newest arrivals"}),e.jsx("option",{value:"price_asc",children:"Price: low to high"}),e.jsx("option",{value:"price_desc",children:"Price: high to low"}),e.jsx("option",{value:"miles_asc",children:"Lowest mileage"}),e.jsx("option",{value:"year_desc",children:"Newest model year"})]})]})]}),g&&e.jsx("div",{className:"rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700",children:g}),!g&&e.jsx("div",{className:"grid gap-5 sm:grid-cols-2 xl:grid-cols-3",children:((a==null?void 0:a.vehicles)??[]).map(s=>e.jsx(ce,{vehicle:s,storeParam:r},s.id))}),!V&&!g&&b===0&&e.jsxs("div",{className:"rounded-xl border border-slate-200 bg-white p-8 text-center",children:[e.jsx("h2",{className:"text-base font-semibold text-slate-900",children:"No matches right now"}),e.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"Try clearing a filter, or send us a note and we'll find it for you."})]}),L>1&&e.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-2",children:[e.jsx("button",{disabled:m<=1,onClick:()=>n("page",String(m-1)),className:"min-h-11 rounded-lg border border-slate-300 px-3 py-1.5 text-sm disabled:opacity-40",children:"Previous"}),e.jsxs("span",{className:"text-sm text-slate-600",children:["Page ",m," of ",L]}),e.jsx("button",{disabled:m>=L,onClick:()=>n("page",String(m+1)),className:"min-h-11 rounded-lg border border-slate-300 px-3 py-1.5 text-sm disabled:opacity-40",children:"Next"})]}),e.jsx("div",{className:"mt-8 rounded-2xl border border-slate-200 bg-white p-4 lg:hidden",children:e.jsx(H,{store:r||(t==null?void 0:t.dealership_id)||"",compact:!0})}),l&&l.makes.length>0&&e.jsxs("nav",{className:"mt-12 border-t border-slate-200 pt-6",children:[e.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-slate-500",children:"Browse by make"}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:l.makes.map(s=>e.jsxs(te,{to:`/inventory/make/${s.make.toLowerCase().replace(/[^a-z0-9]+/g,"-")}${r?`?dealer=${r}`:""}`,className:"flex min-h-11 items-center rounded-full border border-slate-300 bg-white px-3 py-1.5 text-xs font-medium text-slate-700 hover:border-sky-400 hover:text-sky-700",children:[s.make," (",s.count,")"]},s.make))})]})]})]})}),e.jsx(de,{open:J,onOpenChange:$,children:e.jsxs(me,{side:"left",className:"w-full overflow-y-auto p-4 sm:max-w-sm",children:[e.jsx(xe,{className:"mb-4",children:e.jsxs(he,{children:["Filters",v>0&&e.jsx("span",{className:"ml-2 inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-sky-600 px-1 text-[11px] font-bold text-white",children:v})]})}),T]})})]})}export{_e as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.