import R from"./Dzn_TAHJ.js";import{b as $,s as i,u as L,H as U,x as j,y as F,I as G,e as H,f as I,r as M,m as T,i as E,A as K,p as n,j as h,P as N}from"./BCLrUOBx.js";import{u as V}from"./DRQhQ4ga.js";import{u as z}from"./VJGZwNiG.js";import{u as J}from"./CCot8u0_.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 Dt={__name:"index",async setup(O){var d,_,f,v;let r,m;const u=$(),{customScripts:Q}=i(u),{unAuthGet:b}=u,p=V(),{brands:q,shippingRules:w,collections:x,categoryData:W}=i(p),{emptyProducts:D,setProducts:l}=p,S=L(),{langCode:k}=i(S),t=U(),A=`category-${t.params.category}}`,g=async()=>{var a,c,o;return await b({api:"all",params:`?${N({category:(a=t==null?void 0:t.params)==null?void 0:a.category,sortby:t.query.sortby||"",shipping:t.query.shipping||"",brand:t.query.brand||"",collection:t.query.collection||"",rating:t.query.rating||0,max:((c=t==null?void 0:t.query)==null?void 0:c.max)||0,min:((o=t==null?void 0:t.query)==null?void 0:o.min)||0,page:t.query.page||"",sidebar_data:!q.value||!w.value||!x.value})}`,lang:k.value})},{data:e,pending:X,error:Y}=([r,m]=j(async()=>z(A,async()=>{const a=await g();return l(a),a.data.category},"$vrvFBjAx8i")),r=await r,m(),r),{pageMeta:C}=J(),{getImageURL:B}=F();G(()=>t.query,()=>{y()}),H(C({meta_title:(d=e.value)==null?void 0:d.meta_title,meta_description:(_=e.value)==null?void 0:_.meta_description,meta_keywords:(f=e.value)==null?void 0:f.meta_keywords,image_url:B((v=e.value)==null?void 0:v.image)}));const P=I(()=>e.value.title),s=M(!1),y=async()=>{if(s.value=!0,t.params.category!==e.value.slug)return!1;D();const a=await g();l(a),s.value=!1};return(a,c)=>{const o=R;return h(),T("div",null,[n(e)?(h(),E(o,{key:0,"result-title":P.value,"has-breadcrumb":!0,categories:[n(e)],"fetching-product-data":n(s),onFetchData:y},null,8,["result-title","categories","fetching-product-data"])):K("",!0)])}}};export{Dt as default};
