const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B1HO5Dud.js","./pvhYMo2c.js","./swiper-vue.DJHdZmOr.css"])))=>i.map(i=>d[i]);
import{f as I,g as $,b as E,h as F}from"./9wDxnFtt.js";import{b as t}from"./pvhYMo2c.js";const R=I("car",()=>{const{$axios:i}=$(),h=t({}),{locale:k,t:l}=E(),c=t(),d=t(),o=t([]),f=t([]),r=t(!0),p=t(!0),u=t(!1),n=t(!0),w=t(!1);let _=t(),C=t(1),m=t(),v=t();async function x(e){const a=await i.get(`car/${e}`);a.status>=200&&(c.value=a.data.data,r.value=!1),setTimeout(()=>{r.value=!0},500)}async function A(e){const a=await i.get(`car/${e}`);a.status>=200&&(c.value=a.data.data,r.value=!1),setTimeout(()=>{r.value=!0},500)}async function L(e,a){u.value=!0;const s=await i.get("car/search",{params:{page:e,model_id:typeof a.model_id=="object"?[...a.model_id]:[a.model_id],brand_id:typeof a.model_id=="object"?[...a.brand_id]:[a.brand_id],car_id:typeof a.model_id=="object"?[...a.car_id]:[a.car_id],min_price:a.min_price,max_price:a.max_price}});s.status>=200&&(s.data.data.length==0?o.value=[]:o.value=[...o.value,...s.data.data],p.value=!1,u.value=!1,_.value=s.data.meta.total,m.value=s.data.meta.per_page,v.value=s.data.meta.to)}async function P(e,a,s=!1,y=""){if((await i.post("add-favorite-withoutauth",{car_id:e,device_ip:y})).status>=200){const T=await F(()=>import("./B1HO5Dud.js"),__vite__mapDeps([0,1,2]),import.meta.url),{createToast:B}=T;B(l(a?"wishlist1":"wishlist2"),{toastBackgroundColor:"#00A0B4",position:"top-right",type:"success",transition:"bounce",showIcon:"true",timeout:3e3}),s&&g(y)}}async function g(e){const a=await i.get("user/car",{params:{device_ip:e}});a.status>=200&&(n.value=!1,f.value=a.data.data)}async function S(){const e=await i.get("prices");e.status>=200&&(n.value=!1,d.value=e.data)}return{errors:h,getCar:x,getCarBySlug:A,getSearchCars:L,filteredCar:o,isLoading:r,pendingState:w,isLoading2:p,isLoading3:u,gePrices:S,prices:d,itemsPerPage:v,isLoading4:n,AddFav:P,page:C,per_page:m,total:_,car:c,getFav:g,favsArr:f}});export{R as u};
