import{F as h,b8 as A,m as c,P as m,Q as i,R as l,T as f,X as p,a1 as k,a2 as N,a0 as b,a5 as P,a6 as T,_,e as E,Z as w}from"./vendor-CHzKNe_Q.js";import{i as B,_ as V}from"./index-D6o2tNli.js";import{P as C}from"./product-card-B_rso-kM.js";const F={class:"mx-auto w-full max-w-screen-xl px-5 md:px-12"},D={class:"mb-8 text-center lg:text-lg"},G=h({__name:"products-block",props:{id:{},background:{},title:{},subtitle:{},count:{default:4},query:{},filter:{},cardType:{default:"full"},columnsAmountDesktop:{default:"4"},columnsAmountTablet:{default:"3"},skus:{}},setup(e){const a=e,{products:d,fetchProducts:g}=B(),s=c(()=>{const t=Array.from(new Set(a.skus?.map(o=>o.sku)?.filter(Boolean)??[]));return t.length?t:[]}),y=c(()=>s.value.length?`"code":"${s.value.join('","')}"`:""),v=c(()=>[y.value,a.filter].filter(Boolean).join(" ")),x=c(()=>{if(!s.value.length)return d.value;const t=new Map(s.value.map((o,r)=>[o,r]));return[...d.value].sort((o,r)=>{const n=t.get(o.code)??Number.MAX_SAFE_INTEGER,u=t.get(r.code)??Number.MAX_SAFE_INTEGER;return n-u})});return A(async()=>{await g({itemsPerPage:s.value.length||a.count,keyword:a.query,filter:v.value||void 0})}),(t,o)=>{const r=m("VcTypography"),n=m("VcProductsGrid");return l(),i("div",{class:w(["products-block py-10 lg:py-24",e.background])},[f("div",F,[p(r,{tag:"h2",variant:"h1",class:"mb-2 text-center lg:mb-4"},{default:k(()=>[N(b(e.title),1)]),_:1}),f("div",D,b(e.subtitle),1),p(n,{columns:{default:1,xs:2,sm:2,md:Number(e.columnsAmountTablet),lg:Number(e.columnsAmountDesktop),xl:Number(e.columnsAmountDesktop),"2xl":Number(e.columnsAmountDesktop)}},{default:k(()=>[(l(!0),i(P,null,T(x.value,u=>(l(),_(E(C),{key:u.id,"card-type":e.cardType,product:u},null,8,["card-type","product"]))),128))]),_:1},8,["columns"])])],2)}}}),R=V(G,[["__scopeId","data-v-f6f7ce68"]]);export{R as default};
//# sourceMappingURL=products-block-Db_B9EyD.js.map
