import{p as b,u as P,r as u,i as V,b as $,c as s,o as t,d as C,a as c,k as h,t as a,F as _,g as f,f as p}from"./app-q0jdcHwC.js";import{S as w}from"./SkeletonLoader-DoyP93ZN.js";import{_ as S}from"./ProductCardToggler-Cod_9bXB.js";import"./ProductCard-CB6dtTQd.js";import"./useTruncateText-CroACzlR.js";import"./ri-star-fill-DTNr-wIb.js";import"./EyeIcon-VDtOleu5.js";const B={class:"main-container pt-8 pb-12"},L={key:0,class:"text-slate-800 text-lg lg:text-3xl font-bold"},M={class:"grid grid-cols-1 xs:grid-cols-2 sm:grid-cols-3 md:grid-cols-4 xl:grid-cols-5 gap-3 sm:gap-6 items-start mt-6"},N={key:2,class:"text-slate-950 text-xl font-medium leading-7"},A={key:2,class:"flex justify-between items-center w-full mt-8 gap-4 flex-wrap"},D={class:"text-slate-800 text-base font-normal leading-normal"},G={__name:"MostPopular",setup(F){const k=b(),m=P(),l=u(1),d=u(12),n=u([]),i=u(0),o=u(!0);V(()=>{v(),window.scrollTo(0,0)});const y=async e=>{l.value=e,v()},v=async()=>{window.scrollTo({top:0,behavior:"smooth"}),o.value=!0,axios.get("/products",{params:{page:l.value,per_page:d.value,sort_type:"popular_product"},headers:{"Accept-Language":m.locale||"en",Authorization:k.token,currency_id:m.selectedCurrency.id}}).then(e=>{i.value=e.data.data.total,n.value=e.data.data.products,setTimeout(()=>{o.value=!1},300)}).catch(e=>{o.value=!1})};return(e,g)=>{const x=$("vue-awesome-paginate");return t(),s("div",B,[o.value?(t(),C(w,{key:1,class:"w-48 sm:w-60 md:w-72 lg:w-96 h-12 rounded-lg"})):(t(),s("div",L,a(e.$t("Most Popular")),1)),c("div",M,[o.value?(t(),s(_,{key:1},f(12,r=>c("div",{key:r},[p(w,{class:"w-full h-[220px] sm:h-[330px] rounded-lg"})])),64)):(t(!0),s(_,{key:0},f(n.value,r=>(t(),s("div",{key:r.id,class:"w-full"},[p(S,{productData:r},null,8,["productData"])]))),128)),n.value.length==0&&!o.value?(t(),s("div",N,a(e.$t("No Products Found")),1)):h("",!0)]),n.value.length>0&&!o.value?(t(),s("div",A,[c("div",D,a(e.$t("Showing"))+" "+a(d.value*(l.value-1)+1)+" to "+a(d.value*(l.value-1)+n.value.length)+" "+a(e.$t("of"))+" "+a(i.value)+" "+a(e.$t("results")),1),c("div",null,[p(x,{"total-items":i.value,"items-per-page":d.value,type:"button","max-pages-shown":5,modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=r=>l.value=r),"hide-prev-next-when-ends":!0,onClick:y},null,8,["total-items","items-per-page","modelValue"])])])):h("",!0)])}}};export{G as default};
