import{i as x,be as l,bc as i,_ as T}from"./index-C3Ufbmof.js";import{F as B,b8 as A,m as c,P as h,Q as v,R as n,T as g,_ as P,W as p,a1 as y,a2 as F,a0 as k,X as M,e as W,Z as I}from"./vendor-D8NNcBCx.js";import{P as R}from"./product-card-FYw2J9H0.js";const O={class:"products-carousel__wrapper"},X={key:1,class:"products-carousel__subtitle"},j={class:"products-carousel__slide"},q=B({__name:"products-carousel",props:{id:{},background:{},title:{},subtitle:{},count:{default:8},query:{},filter:{},cardType:{default:"full"},slidesPerView:{default:4},skus:{default:()=>[]}},setup(e){const t=e,{products:m,fetchProducts:f}=x(),w=l(i.xs),V=l(i.sm),b=l(i.md),C=l(i.lg),r=c(()=>{const s=Array.from(new Set(t.skus?.map(a=>a.sku)?.filter(Boolean)??[]));return s.length?s:[]}),E=c(()=>r.value.length?`"code":"${r.value.join('","')}"`:""),N=c(()=>[E.value,t.filter].filter(Boolean).join(" ")),_=c(()=>{if(!r.value.length)return m.value;const s=new Map(r.value.map((a,o)=>[a,o]));return[...m.value].sort((a,o)=>{const u=s.get(a.code)??Number.MAX_SAFE_INTEGER,d=s.get(o.code)??Number.MAX_SAFE_INTEGER;return u-d})}),S=c(()=>({slidesPerView:1.5,breakpoints:{[w]:{slidesPerView:2},[V]:{slidesPerView:3},[b]:{slidesPerView:Math.min(t.slidesPerView,3)},[C]:{slidesPerView:t.slidesPerView}}}));return A(async()=>{r.value.length>0?await f({itemsPerPage:r.value.length,filter:N.value}):await f({itemsPerPage:t.count,keyword:t.query,filter:t.filter})}),(s,a)=>{const o=h("VcTypography"),u=h("VcCarousel");return n(),v("div",{class:I(["products-carousel",e.background])},[g("div",O,[e.title?(n(),P(o,{key:0,tag:"h2",variant:"h1",class:"products-carousel__title"},{default:y(()=>[F(k(e.title),1)]),_:1})):p("",!0),e.subtitle?(n(),v("div",X,k(e.subtitle),1)):p("",!0),_.value.length?(n(),P(u,{key:2,slides:_.value,options:S.value,navigation:""},{slide:y(({slide:d})=>[g("div",j,[M(W(R),{class:"products-carousel__card","card-type":e.cardType,product:d},null,8,["card-type","product"])])]),_:1},8,["slides","options"])):p("",!0)])],2)}}}),K=T(q,[["__scopeId","data-v-98856add"]]);export{K as default};
//# sourceMappingURL=products-carousel-BplhbCkB.js.map
