import T from"./Dzn_TAHJ.js";import{Y as C,s as f,b as j,u as B,H as D,r as a,I as G,h as $,i as A,j as H,p as e,P as I}from"./BCLrUOBx.js";import{u as M}from"./DRQhQ4ga.js";import"./CE6lP_wf.js";import"./CglRsQQc.js";import"./BhmSsx3W.js";import"./DNLyc9CF.js";import"./Bxmfm8sn.js";import"./CLdHT7wQ.js";import"./D6RK4iz0.js";import"./B2sEaWda.js";import"./CqOZUTmN.js";import"./az_OgR72.js";import"./DpRwRHtQ.js";import"./C-Tw4iS-.js";import"./CE4It_C4.js";import"./Dyp1qGEf.js";import"./CTAcmMAz.js";import"./a5umXhxZ.js";import"./BnLnKt_p.js";import"./Di7fl9dA.js";import"./Ce8lFovl.js";import"./GQCWnG0A.js";const ct={__name:"ListingLayout",props:{productParams:{type:Object,default(){return{}}},resultTitle:{type:String,default:""}},setup(y){const _=y,{productParams:u,resultTitle:q}=C(_),n=M(),{brands:h,shippingRules:b,collections:v,allCategories:c}=f(n),{emptyProducts:p,setProducts:S}=n,L=j(),{unAuthGet:P}=L,R=B(),{langCode:k}=f(R),t=D(),l=a(""),w=a(null),s=a(!1),x=a(null),m=async()=>{var i,o,d,g;s.value=!0;const r=await P({params:`?${I({...u.value,sortby:t.query.sortby||"",shipping:t.query.shipping||"",brand:t.query.brand||"",collection:t.query.collection||"",rating:t.query.rating||0,max:((i=t.query)==null?void 0:i.max)||0,min:((o=t.query)==null?void 0:o.min)||0,q:t.query.q||"",page:t.query.page||"",all_categories:!c.value,sidebar_data:!h.value||!b.value||!v.value})}`,lang:k.value,api:"products"});l.value=(g=(d=r.data)==null?void 0:d.source)==null?void 0:g.title,S(r),w.value=r.data.result,s.value=!1};return G(()=>t.query,async()=>{p(),await m()}),$(async()=>{p(),await m()}),(r,i)=>{const o=T;return H(),A(o,{ref_key:"productListRef",ref:x,categories:e(c),"result-title":e(l)||e(q),"product-params":e(u),"back-btn":!1,"fetching-product-data":e(s)},null,8,["categories","result-title","product-params","fetching-product-data"])}}};export{ct as default};
