1import{b as G,d as M,r as d,c,ax as Q,an as U,j as n,k as m,l as S,w as H,o as J,m as g,ay as K,N as W,a5 as X,q as l,F as Y,n as Z,s as ee,t as te,x as w,p as re}from"./B30BqIw0.js";import{u as se}from"./1V3UmDFY.js";import{a as oe}from"./Dy94r6Ln.js";import{_ as ae}from"./CBs2ZSYP.js";import{u as ie,a as ne}from"./CRmxdYcE.js";const le={class:"bg-uppababy-bodybg"},ce={key:0,class:"flex flex-wrap"},ue={key:0,class:"mx-auto mt-4 mb-2"},ye=G({__name:"SwProductListingFilters",props:{content:{},listingType:{}},setup(C,{expose:k}){const f=C;let y={listing:{filters:"Filters",sort:"Sort",resetFilters:"Reset filters"}};y=M(se(),y);const a=K(),O=X(),{selectedFilters:T,handleOptionSelectToggle:q}=ne(),{sidebarSelectedFilters:e,updateSidebarSelectedFilters:A}=ie(),{filtersToQuery:B,getCurrentFilters:P,getCurrentSortingOrder:h,getInitialFilters:u,search:j}=oe(),N=d(!1),_=d([]),R=c(()=>!!(F.value.length!==0||e["max-price"]||e["min-price"]||e.rating||e["shipping-free"])),p=c(()=>(h.value,{manufacturer:[...e.manufacturer].join("|"),properties:[...e.properties].join("|"),"min-price":e["min-price"],"max-price":e["max-price"],order:h.value,"shipping-free":e["shipping-free"],rating:e.rating,search:"",associations:{children:{associations:{options:{associations:{media:{}}}}}},limit:a.query.limit?Number(a.query.limit):10}));for(const t in a.query)e.hasOwnProperty(t)&&(e[t]&&typeof e[t]=="object"?a.query[t].split("|").forEach(r=>{e[t].add(r)}):e[t]=a.query[t]);const b=async({code:t,value:r,label:s})=>{await q({code:t,value:r,label:s}),A({code:t,value:r}),await v()},v=async()=>{e.category.size>0&&(p.value.filter[1]={type:"equalsAny",field:"categoryIds",value:[...e.category]}),await j(p.value);const t=B(p.value);delete t.limit,delete t.associations,delete t.filter,await O.push({query:t})},V=()=>{e.manufacturer.clear(),e.properties.clear(),e.category.clear(),e["min-price"]=void 0,e["max-price"]=void 0,e.rating=void 0,e["shipping-free"]=void 0,T.value=[]},F=c(()=>[...e.properties,...e.manufacturer,...e.category]);re("selectedOptionIds",F);async function E(){_.value.forEach(t=>{t?.closeFilter?.()}),V(),await v()}const I=f.content.type==="sidebar-filter"&&f.content.config?.boxLayout?.value==="standard",L=d(null);Q(L,()=>N.value=!1),U(()=>{e.manufacturer.clear(),e.properties.clear(),e.category.clear(),e["min-price"]=void 0,e["max-price"]=void 0,e.rating=void 0,e["shipping-free"]=void 0});const x=t=>t.filter(r=>!r?.translated?.customFields?.filter_group_1||r?.translated?.customFields.filter_group_1!=="shop-by-product").map(r=>({...r,options:r?.options?x(r?.options):[]})),D=t=>t.map(r=>r.name==="Styles"?{...r,label:"Fashion"}:r),$=c(()=>{const t=u?.value.filter(s=>s?.translated?.customFields.filter_group_1==="shop-by-product"&&s?.translated?.customFields.filter_group_2).reduce((s,o)=>{const i=o?.translated?.customFields.filter_group_2;return s[i]||(s[i]=[]),s[i].push({...o}),s},{});let r=x(u?.value);if(Object.keys(t).length!==0){const s={label:"Shop By Product",code:"shop_by_product",createdAt:"2024-11-11T13:08:52.917+00:00",updatedAt:"2024-11-21T12:13:57.479+00:00",name:"Shop By Product",displayType:"text",sortingType:"alphanumeric",description:"FamilyGroup",position:1,filterable:!0,visibleOnProductDetailPage:!0,options:t,id:"shopbyproduct",apiAlias:"property_group"};r.splice(1,0,s)}return r.push({label:"Shop by Category",code:"shop_by_Category",name:"shop_by_Category",position:2,apiAlias:"shop_by_Category"}),r.push({label:"price",code:"price",name:"price",min:0,max:1e4,avg:null,sum:null,apiAlias:"price_aggregation"}),r.push({label:"rating",code:"rating",name:"rating",max:0,apiAlias:"rating_aggregation"}),r=D(r),r});return k({onOptionSelectToggle:b}),(t,r)=>{const s=W;return l(),n("div",le,[m("div",{class:J(["w-full",{"px-5":g(I)}])},[S(s,null,{default:H(()=>[g(u).length?(l(),n("div",ce,[(l(!0),n(Y,null,Z($.value,(o,i)=>(l(),n("div",{key:`${o?.id||o?.code}`,class:"w-full"},[S(ae,{ref_for:!0,ref:z=>_.value[i]=z,"selected-filters":g(P),filter:o,class:"relative",onSelectFilterValue:b},null,8,["selected-filters","filter"])]))),128)),R.value?(l(),n("div",ue,[m("button",{class:"w-full justify-center py-2 px-6 border border-transparent shadow-sm text-md font-medium rounded-md text-white bg-black hover:bg-secondary-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-secondary-500",type:"button",onClick:E},[ee(te(t.$t("search.resetFilters"))+" ",1),r[0]||(r[0]=m("span",{class:"w-6 h-6 i-carbon-close-filled inline-block align-middle ml-2"},null,-1))])])):w("",!0)])):w("",!0)]),_:1})],2)])}}});
1export{ye 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.