1import{cN as W,cO as X,cP as Z,c0 as J,n as K,B as C,c8 as P}from"#entry";import{_ as A}from"./DX_VXQC6.js";import{E as l,l as E,D as Y,m as I,v as y,at as j,$ as d,L as _,Z as x,ab as m,ad as N,X as v,C as o,aa as p,W as ee,aA as te,a8 as R,ac as F,aE as f,f as se}from"./BZS6mqMC.js";import{_ as ae}from"./BzNZ8Vbe.js";import{f as le}from"./B013ARcF.js";const re=[Z.STORE_CATEGORIES],oe={storeType:"store",categoryFilters:[],sortBy:"",per_page:100,slug:""};async function ie(g,n){const s=l(()=>Object.assign({},oe,E(n))),u=l(()=>E(g)),i=l(()=>({per_page:s.value.per_page,version:"published",sort_by:"sort_by_date:desc",starts_with:s.value.slug,filter_query:{component:{in:s.value.storeType},store_city:{like:s.value.sortBy?s.value.sortBy:null},services:{any_in_array:s.value.categoryFilters.join(",")||[]}}})),e=l(()=>{var c;return((c=b.value)==null?void 0:c.data.stories)??[]}),{data:b}=await W({key:`store-${i.value.starts_with}`,slug:u.value||"",fatal:!0,resolveRelations:re,additionalOptions:i,asyncDataOption:{watch:[s,u],immediate:!0,deep:!0}});return{articles:e}}async function ne(g){const n=await X(g);return{categories:n==null?void 0:n.datasource_entries}}const ue={key:0,class:"mb-xl"},ce={class:"flex flex-col gap-2xs md:flex-row md:items-center md:justify-between md:gap-0"},de={class:"flex items-center justify-between"},me={key:0,class:"mt-2xs flex flex-wrap gap-2xs"},ve=100,we=Y({__name:"StoresGrid",props:{slug:{},blogType:{},totalItems:{},filterOptions:{},hideHeader:{type:Boolean}},emits:["filterActive","update:articles"],async setup(g,{emit:n}){let s,u;const i=g,e=I({categories:[],sort_by:"all"}),b=J(),{t:c}=K(),w=I(!1),V=se("hideSortingField",!1);y(()=>o(V),t=>{t&&(e.value={...e.value,sort_by:"all"})});const h=()=>{w.value=!0},k=n,M=l(()=>c("pagination.result_label",{totalProductsCount:i.totalItems},i.totalItems??0)),D=l(()=>T.filter(t=>e.value.categories.includes(t.value))),L=()=>{b.replace({query:{page:void 0}})},$=t=>{e.value={...e.value,categories:e.value.categories.filter(a=>a!==t)}},S=()=>{e.value={sort_by:"all",categories:[]}},U=l(()=>e.value.sort_by==="all"?"":e.value.sort_by),q=l(()=>({per_page:ve,categoryFilters:e.value.categories,sortBy:U.value,slug:i.slug})),B=l(()=>e.value.categories.length||e.value.sort_by!=="all"&&e.value.sort_by.length),O=l(()=>{const t=H.flatMap(a=>{var r;return((r=a.articles)==null?void 0:r.value)||[]});return[...new Map(t.map(a=>[a.uuid,a])).values()]}),G=[...new Set(i.slug.split(","))].filter(Boolean),H=([s,u]=j(()=>Promise.all(G.map(t=>ie("",()=>({...q.value,slug:t}))))),s=await s,u(),s);y(()=>B.value,()=>{k("filterActive",B.value)}),y(()=>O.value,t=>{t&&k("update:articles",O.value)},{immediate:!0}),y(()=>i.slug,t=>{t&&S()});const{categories:T}=([s,u]=j(()=>ne("store-categories")),s=await s,u(),s),z=l(()=>le(T));return(t,a)=>(d(),_("div",null,[t.hideHeader?F("",!0):(d(),_("section",ue,[x("div",ce,[x("div",de,[x("span",null,m(M.value),1),N(t.$slots,"view-toggle")]),v(o(C),{variant:"ghost",class:"hidden w-auto md:flex",onClick:h},{default:p(()=>[v(o(P),{class:"text-neutral-medium"}),f(" "+m(o(c)("filter.label")),1)]),_:1})]),v(o(C),{variant:"ghost",class:"w-auto !px-0 md:hidden",onClick:h},{default:p(()=>[v(o(P),{class:"text-neutral-medium"}),f(" "+m(o(c)("filter.label")),1)]),_:1}),B.value?(d(),_("div",me,[(d(!0),_(ee,null,te(D.value,(r,Q)=>(d(),R(o(A),{key:Q,dismissible:"",color:"white",onDismissed:ge=>$(r.value)},{default:p(()=>[f(m(r.name),1)]),_:2},1032,["onDismissed"]))),128)),e.value.sort_by!=="all"&&e.value.sort_by?(d(),R(o(A),{key:0,color:"white",dismissible:"",onDismissed:a[0]||(a[0]=r=>e.value.sort_by="")},{default:p(()=>[f(m(e.value.sort_by),1)]),_:1})):F("",!0),v(o(C),{variant:"text",class:"w-auto",size:"sm",onClick:S},{default:p(()=>[f(m(t.$t("filter.reset_all")),1)]),_:1})])):F("",!0)])),N(t.$slots,"default",{openFilterSheet:h,filterTags:D.value,sortBy:e.value.sort_by,removeCategory:$,removeSortBy:()=>e.value.sort_by="",resetFilters:S}),v(ae,{show:w.value,"onUpdate:show":a[1]||(a[1]=r=>w.value=r),filters:e.value,"onUpdate:filters":[a[2]||(a[2]=r=>e.value=r),L],"header-alignment":"left",categories:z.value,"sort-options":t.filterOptions},null,8,["show","filters","categories","sort-options"])]))}});
1export{we as _};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.