import{C as Ge,z as Mt,K as j,aP as Qe,B as w,S as g,P as d,a7 as _,M as a,T as s,L as C,O as G,U as S,N as L,aR as Ce,V as f,W as k,b as e,X as B,r as He,D as ce,E as Ft,R as je,Q as At,c4 as Lt,bk as Ee,bl as Ne,aq as Z,aX as he,aA as Pe,Z as We,az as ae,a$ as Dt,ao as we,aI as Xe,aZ as Rt,aE as Oe,Y as Et,bC as Nt,av as ze,c1 as Ot,bH as zt}from"./vendor-bSWkQivH.js";import{g as pe,be as Ut,v as qt,bf as Kt,bg as Gt,bh as Qt,L as Ht,aF as jt,l as Ye,bi as Wt,bj as Xt,ay as _e,az as Yt,aE as Zt,aL as ue,m as Jt,P as xt,n as eo,o as to,bk as oo,bl as ao,aG as ro,aH as so,aI as no,ap as lo,bm as io,a7 as Ze,bn as de,a8 as Je,bo as H,bp as xe,an as et,q as uo,O as co,j as po,aQ as go,bq as mo,br as ke,bs as Ue,bt as qe,M as Ke,bu as yo,bv as vo,bw as fo,bx as bo}from"./index-Dqv5IkpS.js";import{u as ho}from"./useBreadcrumbs-Bvh8-Tkx.js";import{b as _o}from"./index-C20fDzNq.js";import{P as tt,_ as ko,g as Po}from"./filters-popup-sidebar.vue_vue_type_style_index_0_lang-BdkpK2YN.js";import{u as ot}from"./useSlugInfo-cU0FszRY.js";import{P as wo}from"./product-skeleton-grid-CTjvbIpH.js";import{P as Co}from"./product-skeleton-list-MUr-_M1I.js";function Vo(y,u=0){const b=Kt(u),c=y?`
    category(
        storeId: $storeId
        userId: $userId
        cultureName: $cultureName
        currencyCode: $currencyCode
        previousOutline: $previousOutline
        id: "${y}",
    ) {
        id
        name
        slug
        outline
        seoInfo {
            pageTitle
            metaKeywords
            metaDescription
        }
        breadcrumbs {
            title
            seoPath
        }
        parent {
            id
            name
            slug
        }
        images {
            url
        }
    }`:"";return Mt`
    query GetCategory(
      $storeId: String!
      $userId: String
      $cultureName: String
      $currencyCode: String
      $maxLevel: Int
      $onlyActive: Boolean
      $productFilter: String
      $previousOutline: String
    ) {
      ${c}

      childCategories(
        storeId: $storeId
        userId: $userId
        cultureName: $cultureName
        currencyCode: $currencyCode
        maxLevel: $maxLevel
        onlyActive: $onlyActive
        productFilter: $productFilter
        previousOutline: $previousOutline
        ${y?`categoryId: "${y}"`:""}
      ) {
        __typename
        ${b}
      }
    }
  `}async function $o(y){var r;const{storeId:u,userId:b,cultureName:c,currencyCode:n}=pe,i=Ge(Ut,""),h=Vo(y.categoryId??"",y.maxLevel),{data:v}=await qt.query({query:h,variables:{storeId:u,userId:b,cultureName:c,currencyCode:n,previousOutline:i.value,...y}});return(r=v==null?void 0:v.category)!=null&&r.outline&&(i.value=v.category.outline),v}const So={class:"font-bold"},Bo={class:"-mt-1 mb-0.5 py-0.5 text-xs font-black uppercase text-neutral-900"},Io={class:"flex flex-col pl-4"},To=j({__name:"category-selector",props:{category:{},loading:{type:Boolean}},setup(y){const u=y,b=Qe(),{objectType:c,seoInfo:n}=ot(b.path.slice(1)),i=w(()=>{var r;return(r=u.category)==null?void 0:r.parent}),h=w(()=>{var r;return((r=u.category)==null?void 0:r.childCategories)||[]}),v=Gt(h);return(r,p)=>{var V,F,T,q;const t=g("VcWidgetSkeleton"),m=g("VcIcon"),I=g("router-link"),D=g("VcWidget");return r.loading?(a(),d(t,{key:0,size:"xs"},{default:s(()=>[(a(),C(L,null,G(6,l=>S("div",{key:l})),64))]),_:1})):i.value||(F=(V=r.category)==null?void 0:V.childCategories)!=null&&F.length?(a(),d(D,{key:1,size:"xs"},Ce({_:2},[i.value?{name:"header",fn:s(()=>[f(I,{to:e(Qt)(i.value),class:"-mx-2 flex grow items-center gap-1.5 rounded-sm px-2 py-1 text-sm hover:bg-neutral-50"},{default:s(()=>[f(m,{class:"fill-primary",name:"chevron-left",size:"xs"}),S("span",So,k(i.value.name),1)]),_:1},8,["to"])]),key:"0"}:void 0,(q=(T=r.category)==null?void 0:T.childCategories)!=null&&q.length?{name:"default",fn:s(()=>{var l;return[S("div",Bo,[e(c)==="Category"?(a(),C(L,{key:0},[B(k(r.category.name),1)],64)):e(c)==="Catalog"?(a(),C(L,{key:1},[B(k((l=e(n))==null?void 0:l.pageTitle),1)],64)):_("",!0)]),S("div",Io,[(a(!0),C(L,null,G(h.value,(A,R)=>(a(),d(I,{key:R,to:e(v)[A.id],class:"-mx-2 mt-0.5 truncate rounded-sm px-2 py-0.5 text-sm transition-colors hover:bg-neutral-50"},{default:s(()=>[B(k(A.name),1)]),_:2},1032,["to"]))),128))])]}),key:"1"}:void 0]),1024)):_("",!0)}}});function at(){const y=He(!1),u=ce(),{catalogId:b}=pe;async function c(n){var i,h;y.value=!0;try{const v=await $o(n);u.value={...v.category,childCategories:v.childCategories.childCategories??[],name:(i=v.category)==null?void 0:i.name,id:((h=v.category)==null?void 0:h.id)||b}}catch(v){throw Ht.error(`${at.name}.${c.name}`,v),v}finally{y.value=!1}}return{fetchCategory:c,loading:Ft(y),category:w(()=>u.value)}}const Mo=j({__name:"product-card",props:{loading:{type:Boolean},product:{},viewMode:{},browserTarget:{},cardType:{},lazy:{type:Boolean}},emits:["linkClick"],setup(y){const u=y,{isComponentRegistered:b,getComponent:c,shouldRenderComponent:n,getComponentProps:i}=jt(),{isEnabled:h}=Ye(Wt),v=h(Xt),r=w(()=>_e(u.product.id,u.product.slug)),p=w(()=>Object.values(Yt(u.product.properties??[],Zt.Product)).slice(0,3));return(t,m)=>{const I=g("VcProductImage"),D=g("VcProductActions"),V=g("VcProductTitle"),F=g("VcProductVendor"),T=g("VcProperty"),q=g("VcRating"),l=g("VcProductProperties"),A=g("VcProductPrice"),R=g("VcProductButton"),O=g("VcProductCard");return a(),d(O,{"view-mode":t.viewMode,border:""},{media:s(()=>[f(I,{images:t.viewMode==="grid"?t.product.images:[],"img-src":t.product.imgSrc,alt:t.product.name,lazy:t.lazy,to:r.value},{default:s(()=>[f(oo,null,{default:s(()=>[t.product.isPurchased?(a(),d(ao,{key:0})):_("",!0),t.product.price?(a(),d(ro,{key:1,static:"",price:t.product.price},null,8,["price"])):_("",!0)]),_:1})]),_:1},8,["images","img-src","alt","lazy","to"]),f(D,{direction:t.viewMode==="grid"?"vertical":"horizontal","with-background":t.viewMode==="grid"},{default:s(()=>[f(e(so),{product:t.product},null,8,["product"]),t.$cfg.product_compare_enabled?(a(),d(e(no),{key:0,product:t.product},null,8,["product"])):_("",!0)]),_:1},8,["direction","with-background"])]),default:s(()=>{var E,Q,N;return[f(V,{title:t.product.name,to:r.value,"lines-number":"2","fix-height":""},null,8,["title","to"]),t.$cfg.vendor_enabled?(a(),d(F,{key:0},{default:s(()=>{var $;return[B(k(($=t.product.vendor)==null?void 0:$.name),1)]}),_:1})):_("",!0),t.cardType!=="short"?(a(),d(l,{key:1},{default:s(()=>[(a(!0),C(L,null,G(p.value,($,z)=>(a(),d(T,{key:z,label:$.label},{default:s(()=>[B(k($.value),1)]),_:2},1032,["label"]))),128)),e(v)&&t.product.rating?(a(),d(T,{key:0,label:t.$t("shared.catalog.product_card.product_rating")},{default:s(()=>[f(q,{size:"xs",value:t.product.rating.value,"review-count":t.product.rating.reviewCount},null,8,["value","review-count"])]),_:1},8,["label"])):_("",!0)]),_:1})):_("",!0),f(A,{"actual-price":((E=t.product.minVariationPrice)==null?void 0:E.actual)??t.product.price.actual,"list-price":((Q=t.product.minVariationPrice)==null?void 0:Q.list)??t.product.price.list,"with-from-label":t.product.hasVariations,"single-line":t.viewMode==="grid"},null,8,["actual-price","list-price","with-from-label","single-line"]),e(b)(e(ue).CARD_BUTTON)&&e(n)(e(ue).CARD_BUTTON,t.product)?(a(),d(je(e(c)(e(ue).CARD_BUTTON)),At({key:2,product:t.product},e(i)(e(ue).CARD_BUTTON)),null,16,["product"])):t.product.isConfigurable?(a(),d(R,{key:3,to:e(_e)(t.product.id,t.product.slug),"link-text":t.$t("pages.catalog.customize_button"),"link-to":e(_e)(t.product.id,t.product.slug),"button-text":t.$t("pages.catalog.customize_button"),icon:"cube-transparent",target:t.browserTarget||t.$cfg.details_browser_target||"_blank",onLinkClick:m[0]||(m[0]=$=>t.$emit("linkClick",t.product,$))},null,8,["to","link-text","link-to","button-text","target"])):t.product.hasVariations?(a(),d(R,{key:4,to:r.value,"link-text":t.$t("pages.catalog.show_on_a_separate_page"),"link-to":r.value,"button-text":t.$t("pages.catalog.variations_button",[(((N=t.product.variations)==null?void 0:N.length)||0)+1]),target:t.browserTarget||t.$cfg.details_browser_target||"_blank",onLinkClick:m[1]||(m[1]=$=>t.$emit("linkClick",t.product,$))},null,8,["to","link-text","link-to","button-text","target"])):(a(),d(e(Jt),{key:5,product:t.product,"reserved-space":t.viewMode==="grid"},{default:s(()=>{var $,z;return[f(eo,{"is-in-stock":($=t.product.availabilityData)==null?void 0:$.isInStock,"is-digital":t.product.productType===e(xt).Digital,quantity:(z=t.product.availabilityData)==null?void 0:z.availableQuantity},null,8,["is-in-stock","is-digital","quantity"]),f(to,{"product-id":t.product.id},null,8,["product-id"])]}),_:1},8,["product","reserved-space"]))]}),_:1},8,["view-mode"])}}}),Fo={class:"view-mode",role:"group"},Ao={class:"view-mode__text"},Lo={class:"view-mode__text"},Do=j({__name:"view-mode",props:{mode:{default:"grid"}},emits:["update:mode"],setup(y){const u=y,b=w(()=>u.mode);return(c,n)=>{const i=g("VcTabSwitch");return a(),C("div",Fo,[f(i,{modelValue:b.value,"onUpdate:modelValue":n[0]||(n[0]=h=>b.value=h),value:"grid",icon:"grid",onChange:n[1]||(n[1]=h=>c.$emit("update:mode",h))},{default:s(()=>[S("span",Ao,k(c.$t("shared.catalog.view_mode.grid_label")),1)]),_:1},8,["modelValue"]),f(i,{modelValue:b.value,"onUpdate:modelValue":n[2]||(n[2]=h=>b.value=h),value:"list",icon:"list",onChange:n[3]||(n[3]=h=>c.$emit("update:mode",h))},{default:s(()=>[S("span",Lo,k(c.$t("shared.catalog.view_mode.list_label")),1)]),_:1},8,["modelValue"])])}}}),{i18n:Ro}=pe;function Eo({category:y,allowSetMeta:u,categoryComponentAnchorIsVisible:b}){const c=w(()=>{var t,m,I;return((m=(t=y.value)==null?void 0:t.seoInfo)==null?void 0:m.pageTitle)??((I=y.value)==null?void 0:I.name)??(y.value?"":Ro.global.t("pages.catalog.title"))}),n=w(()=>{var t,m;return(m=(t=y.value)==null?void 0:t.seoInfo)==null?void 0:m.metaDescription}),i=w(()=>{var t,m;return(m=(t=y.value)==null?void 0:t.seoInfo)==null?void 0:m.metaKeywords}),h=w(()=>{var t,m,I;return(I=(m=(t=y.value)==null?void 0:t.images)==null?void 0:m[0])==null?void 0:I.url}),v=w(()=>{var t,m;return(m=(t=y.value)==null?void 0:t.seoInfo)!=null&&m.semanticUrl?`${window.location.host}\${currentCategory.value?.seoInfo?.semanticUrl`:window.location.toString()}),r=w(()=>u.value&&b.value),{title:p}=lo(c);Lt({title:()=>r.value?p.value:void 0,keywords:()=>r.value?i.value:void 0,description:()=>r.value?n.value:void 0,ogUrl:()=>r.value?v.value:void 0,ogTitle:()=>r.value?p.value:void 0,ogDescription:()=>r.value?n.value:void 0,ogImage:()=>r.value?h.value:void 0,ogType:()=>r.value?"website":void 0})}const No={class:"category-controls"},Oo=j({__name:"category-controls",props:Ee({savedBranches:{},loading:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{},"purchased-before":{type:Boolean},"purchased-beforeModifiers":{}}),emits:Ee(["openBranchesModal","applyInStock","applyPurchasedBefore"],["update:modelValue","update:purchased-before"]),setup(y){const{isPurchasedBeforeEnabled:u}=io(),b=Ne(y,"modelValue"),c=Ne(y,"purchased-before");return(n,i)=>{const h=g("VcCheckbox"),v=g("VcTooltip"),r=g("i18n-t");return a(),C("div",No,[e(u)?(a(),d(v,{key:0,placement:"bottom-start",width:"12rem"},{trigger:s(()=>[f(h,{modelValue:c.value,"onUpdate:modelValue":i[0]||(i[0]=p=>c.value=p),disabled:n.loading,"data-test-id":"purchased-before-checkbox-filter",onClick:i[1]||(i[1]=p=>n.$emit("applyPurchasedBefore")),onKeyup:i[2]||(i[2]=he(p=>n.$emit("applyPurchasedBefore"),["enter"]))},{default:s(()=>[S("span",{class:Z(["whitespace-nowrap text-sm",{"text-neutral":!c.value}])},k(n.$t("pages.catalog.purchased_before_filter_card.checkbox_label")),3)]),_:1},8,["modelValue","disabled"])]),content:s(()=>[B(k(n.$t("pages.catalog.purchased_before_filter_card.tooltip_text")),1)]),_:1})):_("",!0),f(v,{placement:"bottom-start",width:"12rem"},{trigger:s(()=>[f(h,{modelValue:b.value,"onUpdate:modelValue":i[3]||(i[3]=p=>b.value=p),disabled:n.loading,onClick:i[4]||(i[4]=p=>n.$emit("applyInStock")),onKeyup:i[5]||(i[5]=he(p=>n.$emit("applyInStock"),["enter"]))},{default:s(()=>[S("span",{class:Z(["whitespace-nowrap text-sm",{"text-neutral":!b.value}])},k(n.$t("pages.catalog.instock_filter_card.checkbox_label")),3)]),_:1},8,["modelValue","disabled"])]),content:s(()=>[B(k(n.$t("pages.catalog.instock_filter_card.tooltip_text")),1)]),_:1}),f(v,{placement:"bottom-start",width:"13rem"},{trigger:s(()=>[f(h,{"model-value":!!n.savedBranches.length,disabled:n.loading,onClick:i[6]||(i[6]=Pe(p=>n.$emit("openBranchesModal",!1),["prevent"])),onKeyup:i[7]||(i[7]=he(Pe(p=>n.$emit("openBranchesModal",!1),["prevent"]),["enter"]))},{default:s(()=>[f(r,{keypath:"pages.catalog.branch_availability_filter_card.available_in",tag:"div",class:Z(["text-sm",{"text-neutral":!n.savedBranches.length}]),scope:"global"},{default:s(()=>[S("span",{class:Z({"font-bold text-[--link-color]":n.savedBranches.length})},k(n.$t("pages.catalog.branch_availability_filter_card.branches",{n:n.savedBranches.length})),3)]),_:1},8,["class"])]),_:1},8,["model-value","disabled"])]),content:s(()=>[B(k(n.$t("pages.catalog.branch_availability_filter_card.select_branch_text")),1)]),_:1})])}}}),zo=j({__name:"category-horizontal-filters",props:{loading:{type:Boolean},keywordQueryParam:{},filters:{},hideSorting:{type:Boolean,default:!1},hideAllFilters:{type:Boolean,default:!1}},emits:["applyFilters","applySort","showPopupSidebar"],setup(y,{emit:u}){const b=u,c=Ze(Je.Sort,{defaultValue:de[0].id,validator:r=>de.some(p=>p.id===r)});function n(r,p){c.value=r,p()}const{t:i}=We();function h(){return de.map(r=>({...r,name:i(r.name)}))}const v=w(()=>h());return(r,p)=>{const t=g("VcButton"),m=g("VcRadioButton"),I=g("VcMenuItem"),D=g("VcDropdownMenu");return a(),d(tt,{class:"category-horizontal-filters",orientation:"horizontal",keyword:r.keywordQueryParam,filters:r.filters,loading:r.loading,onChange:p[3]||(p[3]=V=>r.$emit("applyFilters",V))},{prepend:s(()=>[r.hideAllFilters?_("",!0):(a(),d(t,{key:0,size:"sm",variant:"outline",class:"category-horizontal-filters__show-all","prepend-icon":"filter",onClick:p[0]||(p[0]=V=>r.$emit("showPopupSidebar"))},{default:s(()=>[B(k(r.$t("common.buttons.all_filters")),1)]),_:1})),r.hideSorting?_("",!0):(a(),d(D,{key:1,"offset-options":4,class:"category-horizontal-filters__sorting","max-height":"20rem",width:"15rem","z-index":"3"},{trigger:s(()=>[f(t,{size:"sm",variant:"outline","prepend-icon":"switch-vertical",class:"category-horizontal-filters__sorting-trigger"},{default:s(()=>[B(k(r.$t("common.buttons.sort_by")),1)]),_:1})]),content:s(({close:V})=>[(a(!0),C(L,null,G(v.value,F=>(a(),d(I,{key:F.id,class:"category-horizontal-filters__sorting-input",color:"secondary",size:"sm",onClick:T=>n(F.id,V)},{default:s(()=>[f(m,{modelValue:e(c),"onUpdate:modelValue":p[1]||(p[1]=T=>ae(c)?c.value=T:null),size:"sm",value:F.id,label:F.name,class:"category-horizontal-filters__sorting-input",onChange:()=>{b("applySort"),V()},onClick:p[2]||(p[2]=Pe(()=>{},["stop"]))},null,8,["modelValue","value","label","onChange"])]),_:2},1032,["onClick"]))),128))]),_:1}))]),_:1},8,["keyword","filters","loading"])}}}),Uo={class:"category-products"},qo={key:0,class:"-mt-2 mb-6 flex justify-center"},Ko={key:2,class:"mt-6 flex justify-center"},Go=j({__name:"category-products",props:{cardType:{},columnsAmountDesktop:{default:"4"},columnsAmountTablet:{default:"3"},fetchingMoreProducts:{type:Boolean},fetchingProducts:{type:Boolean},fixedProductsCount:{},hasActiveFilters:{type:Boolean},hasSelectedFacets:{type:Boolean},itemsPerPage:{default:xe},pagesCount:{},pageHistory:{},pageNumber:{},products:{},savedViewMode:{},mode:{default:H.infiniteScroll}},emits:["resetFacetFilters","changePage","selectProduct","resetFilterKeyword"],setup(y,{emit:u}){Dt(l=>({"02dd8f6e":c.columnsAmountTablet,12336014:c.columnsAmountDesktop}));const b=u,c=y,n=Ze(Je.Keyword,{defaultValue:""});function i(){b("changePage",p.value-1)}function h(){b("changePage",t.value+1)}const v=we(c,"pageNumber"),r=we(c,"pageHistory"),p=w(()=>Math.min(...r.value)),t=w(()=>Math.max(...r.value)),m=Xe(et),I=w(()=>c.savedViewMode==="list"?Co:wo),D=w(()=>({null:1,xs:2,md:Number(c.columnsAmountTablet),xl:Number(c.columnsAmountDesktop)})),V=w(()=>c.savedViewMode==="grid"?F():c.savedViewMode=="list"?T():0);function F(){return m.isSmaller("xs")?D.value.null:m.isInBetween("xs","md")?D.value.xs*2:m.isInBetween("md","xl")?D.value.md*2:m.isGreaterOrEqual("xl")?D.value.xl*2:0}function T(){return m.isSmaller("xs")?2:m.isInBetween("xs","sm")?4:m.isInBetween("sm","lg")?6:m.isInBetween("lg","2xl")?4:m.isGreaterOrEqual("2xl")?5:0}function q(l){b("selectProduct",l)}return(l,A)=>{const R=g("VcButton"),O=g("VcInfinityScrollLoader"),E=g("VcScrollTopButton"),Q=g("VcEmptyView");return a(),C("div",Uo,[l.products.length||l.fetchingProducts?(a(),C(L,{key:0},[l.mode===e(H).loadMore&&p.value>1?(a(),C("div",qo,[l.products.length?(a(),d(R,{key:0,class:"mt-4",size:"sm",loading:l.fetchingMoreProducts&&v.value<p.value,"prepend-icon":"arrow-left",onClick:i},{default:s(()=>[B(k(l.$t("pages.catalog.load_previous_page")),1)]),_:1},8,["loading"])):_("",!0)])):_("",!0),S("div",{class:Z(["category-products__list",{"category-products__list--list":l.savedViewMode==="list","category-products__list--grid":l.savedViewMode==="grid"}])},[l.fetchingProducts?(a(!0),C(L,{key:0},G(l.itemsPerPage,N=>(a(),d(je(I.value),{key:N}))),128)):(a(!0),C(L,{key:1},G(l.products,(N,$)=>(a(),d(e(Mo),{key:$,loading:l.fetchingProducts,"view-mode":l.savedViewMode,lazy:$>=V.value,product:N,"browser-target":l.$cfg.details_browser_target,"card-type":l.cardType,onLinkClick:q},null,8,["loading","view-mode","lazy","product","browser-target","card-type"]))),128))],2),l.mode===e(H).infiniteScroll&&!Number(l.fixedProductsCount)?(a(),d(O,{key:1,loading:l.fetchingProducts||l.fetchingMoreProducts,"is-page-limit-reached":v.value>=e(uo),"page-number":v.value,"pages-count":l.pagesCount,distance:"400",class:"category-products__infinity",onVisible:A[0]||(A[0]=N=>l.$emit("changePage",v.value+1))},null,8,["loading","is-page-limit-reached","page-number","pages-count"])):_("",!0),l.mode===e(H).loadMore&&t.value<l.pagesCount?(a(),C("div",Ko,[f(R,{loading:l.fetchingMoreProducts&&v.value>t.value,"append-icon":"arrow-right",size:"sm",onClick:h},{default:s(()=>[B(k(l.$t("pages.catalog.load_next_page")),1)]),_:1},8,["loading"])])):_("",!0),f(E)],64)):(a(),d(Q,{key:1,text:l.hasActiveFilters||e(n)?l.$t("pages.catalog.no_products_filtered_message"):l.$t("pages.catalog.no_products_message"),icon:"outline-stock"},Ce({_:2},[l.hasSelectedFacets||e(n)?{name:"button",fn:s(()=>[f(R,{"prepend-icon":"reset",onClick:A[1]||(A[1]=N=>l.$emit("resetFilterKeyword"))},{default:s(()=>[B(k(l.$t("pages.catalog.no_products_button")),1)]),_:1})]),key:"0"}:void 0]),1032,["text"]))])}}}),Qo={key:1,class:"category__title-skeleton"},Ho={key:2},jo={key:3},Wo={key:4,class:"category__products-count"},Xo={key:1,class:"category__sort"},Yo={key:1,class:"category__chips"},Zo={class:"category__products-bottom"},la=j({__name:"category",props:{isRoot:{type:Boolean},categoryId:{},title:{},hideTotal:{type:Boolean},hideBreadcrumbs:{type:Boolean},hideSidebar:{type:Boolean},hideControls:{type:Boolean},hideSorting:{type:Boolean},viewMode:{},filtersOrientation:{},cardType:{},columnsAmountDesktop:{},columnsAmountTablet:{},keyword:{},filter:{},fixedProductsCount:{},allowSetMeta:{type:Boolean},showButtonToDefaultView:{type:Boolean},filtersDisplayOrder:{}},setup(y){const u=y,b=["grid","list"],{allowSetMeta:c}=Rt(u),n=we(u,"filtersDisplayOrder"),{catalogId:i,currencyCode:h}=pe,r=Xe(et).smaller("md"),p=w(()=>{var o,P;return((P=(o=t.value)==null?void 0:o.settings)==null?void 0:P.catalog_pagination_mode)??H.infiniteScroll}),{themeContext:t}=co(),{getFacets:m,facetsQueryParam:I,fetchingMoreProducts:D,fetchingProducts:V,fetchingFacets:F,hasSelectedFacets:T,isFiltersDirty:q,isFiltersSidebarVisible:l,keywordQueryParam:A,localStorageBranches:R,localStorageInStock:O,localStoragePurchasedBefore:E,pagesCount:Q,pageHistory:N,products:$,productsFilters:z,searchQueryParam:re,sortQueryParam:W,totalProductsCount:ge,applyFilters:rt,fetchProducts:st,fetchMoreProducts:nt,hideFiltersSidebar:Ve,openBranchesModal:$e,removeFacetFilter:lt,resetFacetFilters:se,resetFilterKeyword:it,showFiltersSidebar:Se,updateProductsFilters:ut,currentPage:J,updateCurrentPage:ct,resetCurrentPage:x}=po({filtersDisplayOrder:n,useQueryParams:!0,withFacets:!0,catalogPaginationMode:p.value}),{loading:Be,category:U,fetchCategory:dt}=at(),{analytics:ne}=go(),{selectedAddress:me}=mo(),ee=Ge("viewMode","grid"),Ie=He(xe),Te=ce(null),pt=Oe(Te),gt=w(()=>!pt.value&&r.value),te=w(()=>!r.value&&u.filtersOrientation==="horizontal"),mt=w(()=>u.viewMode&&b.includes(u.viewMode)),ye=w(()=>{var o,P,K;return{item_list_id:`category_${(o=U.value)==null?void 0:o.slug}_page_${J.value}`,item_list_name:`Category "${(P=U.value)==null?void 0:P.name}" (page ${J.value})`,related_id:(K=U.value)==null?void 0:K.id,related_type:"category"}}),Me=ce(null),yt=Oe(Me),vt=Qe(),{objectType:Fe,slugInfo:oe}=ot(vt.path.slice(1));Eo({category:U,allowSetMeta:c,categoryComponentAnchorIsVisible:yt});const ft=ho(()=>{var o,P;return _o(Fe.value==="Catalog"&&((o=oe.value)!=null&&o.entityInfo)?[{itemId:oe.value.entityInfo.id,semanticUrl:oe.value.entityInfo.semanticUrl,title:oe.value.entityInfo.pageTitle??oe.value.entityInfo.semanticUrl,typeName:Fe.value}]:(P=U.value)==null?void 0:P.breadcrumbs)}),ve=ce(null),{t:bt}=We();function ht(){return de.map(o=>({...o,name:bt(o.name)}))}const _t=w(()=>ht());function kt(){var K,Y,le;const o=(Y=(K=me.value)==null?void 0:K.id)!=null&&Y.startsWith(yo)||(le=me.value)==null?void 0:le.id,P=o?void 0:JSON.stringify(zt(me.value,["id","isDefault","isFavorite"]));return{selectedAddressId:o,selectedAddress:P}}const X=Et(()=>({...kt(),categoryId:u.categoryId,itemsPerPage:u.fixedProductsCount||Ie.value,sort:W.value,keyword:u.keyword||(!u.categoryId&&!u.isRoot?re.value:A.value),filter:[u.filter,I.value,ke(O.value),Ue(E.value),qe(R.value)].filter(Boolean).join(" ")})),{getSettingValue:Pt}=Ye(Ke.MODULE_ID);function fe(o){rt(o)}async function wt(o){const P={...X.value,filter:[u.filter,vo(o.facets),ke(o.inStock),Ue(o.purchasedBefore),qe(o.branches)].filter(Boolean).join(" ")};ut({branches:o.branches,inStock:o.inStock,purchasedBefore:o.purchasedBefore,facets:await m(P)})}async function Ct(o){o>Q.value||(ct(o),await nt({...X.value,page:J.value}),ne("viewItemList",$.value,ye.value),re.value&&Le())}async function Ae(){await st(X.value),ne("viewItemList",$.value,ye.value),re.value&&Le()}function Le(){ne("viewSearchResults",re.value,{visible_items:$.value.map(o=>({code:o.code})),results_count:ge.value,results_page:J.value})}function Vt(o){ne("selectItem",o,ye.value)}function $t(){x(),Ae()}return Nt(()=>!r.value,Ve),ze(()=>u.categoryId,o=>{if(o||u.isRoot){const{zero_price_product_enabled:P}=t.value.settings,Y=Pt(Ke.CATALOG_EMPTY_CATEGORIES_ENABLED)?void 0:Po([fo({catalogId:i,categoryId:o}),bo(!!P,h),ke(!0)]);dt({categoryId:o,maxLevel:1,onlyActive:!0,productFilter:Y})}},{immediate:!0}),ze(u,({viewMode:o})=>{o&&b.includes(o)&&(ee.value=o)}),Ot(w(()=>JSON.stringify(X.value)),()=>{ve.value&&ve.value.scrollIntoView({block:"center"}),Ae()},{debounce:20,flush:"post",immediate:!0}),(o,P)=>{const K=g("VcBreadcrumbs"),Y=g("i18n-t"),le=g("VcTypography"),De=g("VcButton"),St=g("VcLabel"),Bt=g("VcSelect"),be=g("VcChip"),Re=g("VcIcon"),It=g("VcLayout"),Tt=g("VcContainer");return a(),d(Tt,{ref_key:"categoryComponentAnchor",ref:Me,class:"category",style:{"overflow-anchor":"none"}},{default:s(()=>[o.hideBreadcrumbs?_("",!0):(a(),d(K,{key:0,class:"category__breadcrumbs",items:e(ft)},null,8,["items"])),!o.hideSidebar&&(e(r)||te.value)?(a(),d(ko,{key:1,"is-exist-selected-facets":e(T),"is-popup-sidebar-filter-dirty":e(q),"popup-sidebar-filters":e(z),"facets-loading":e(F),"is-mobile":e(r),"is-visible":e(l),"keyword-query-param":e(A),"sort-query-param":e(W),loading:e(V),"hide-controls":o.hideControls,onHidePopupSidebar:e(Ve),onResetFacetFilters:e(se),onOpenBranchesModal:e($e),onUpdatePopupSidebarFilters:wt,onApplyFilters:fe},null,8,["is-exist-selected-facets","is-popup-sidebar-filter-dirty","popup-sidebar-filters","facets-loading","is-mobile","is-visible","keyword-query-param","sort-query-param","loading","hide-controls","onHidePopupSidebar","onResetFacetFilters","onOpenBranchesModal"])):_("",!0),f(It,{"sticky-sidebar":""},Ce({default:s(()=>[f(le,{tag:"h1",class:"category__title"},{default:s(()=>{var M;return[!o.categoryId&&!o.isRoot?(a(),d(Y,{key:0,keypath:"pages.search.header",tag:"span"},{keyword:s(()=>[S("strong",null,k(e(X).keyword),1)]),_:1})):!e(U)&&e(Be)?(a(),C("span",Qo,"   ")):o.title?(a(),C("span",Ho,k(o.title),1)):(a(),C("span",jo,k((M=e(U))==null?void 0:M.name),1)),!e(V)&&!o.hideTotal&&!o.fixedProductsCount?(a(),C("sup",Wo,[S("b",null,k(o.$n(e(ge),"decimal")),1),B(" "+k(o.$t("pages.catalog.products_found_message",e(ge))),1)])):_("",!0)]}),_:1}),S("div",{ref_key:"stickyMobileHeaderAnchor",ref:Te,class:"category__header-anchor"},null,512),S("div",{class:Z(["category__filters",{"category__filters--sticky":gt.value}])},[o.hideSidebar?_("",!0):(a(),d(De,{key:0,class:"category__facets-button",icon:"filter",size:"sm",onClick:e(Se)},null,8,["onClick"])),!o.hideSorting&&!te.value?(a(),C("div",Xo,[f(St,{class:"category__sort-label"},{default:s(()=>[B(k(o.$t("pages.catalog.sort_by_label")),1)]),_:1}),f(Bt,{modelValue:e(W),"onUpdate:modelValue":P[1]||(P[1]=M=>ae(W)?W.value=M:null),"text-field":"name","value-field":"id",disabled:e(V),items:_t.value,class:"category__sort-dropdown",size:"sm",onChange:e(x)},null,8,["modelValue","disabled","items","onChange"])])):_("",!0),mt.value?_("",!0):(a(),d(Do,{key:2,mode:e(ee),"onUpdate:mode":P[2]||(P[2]=M=>ae(ee)?ee.value=M:null),class:"category__view-mode"},null,8,["mode"])),!o.hideControls&&!e(r)&&!te.value?(a(),d(Oo,{key:3,modelValue:e(O),"onUpdate:modelValue":P[3]||(P[3]=M=>ae(O)?O.value=M:null),"purchased-before":e(E),"onUpdate:purchasedBefore":P[4]||(P[4]=M=>ae(E)?E.value=M:null),loading:e(V),"saved-branches":e(R),class:"category__controls",onOpenBranchesModal:e($e),onApplyInStock:e(x),onApplyPurchasedBefore:e(x)},null,8,["modelValue","purchased-before","loading","saved-branches","onOpenBranchesModal","onApplyInStock","onApplyPurchasedBefore"])):_("",!0)],2),te.value&&!e(r)?(a(),d(zo,{key:0,"facets-loading":e(F),"keyword-query-param":e(A),"sort-query-param":e(W),loading:e(V)||e(F),filters:e(z),"hide-sorting":o.hideSorting,"hide-all-filters":o.hideSidebar,onResetFacetFilters:e(se),onApplyFilters:fe,onShowPopupSidebar:e(Se),onApplySort:e(x)},null,8,["facets-loading","keyword-query-param","sort-query-param","loading","filters","hide-sorting","hide-all-filters","onResetFacetFilters","onShowPopupSidebar","onApplySort"])):_("",!0),e(T)||p.value===e(H).loadMore&&o.$route.query.page&&Number(o.$route.query.page)>1?(a(),C("div",Yo,[(a(!0),C(L,null,G(e(z).facets,M=>(a(),C(L,null,[(a(!0),C(L,null,G(M.values,ie=>(a(),C(L,null,[ie.selected?(a(),d(be,{key:M.paramName+ie.value,color:"secondary",closable:"",truncate:"",onClose:Jo=>e(lt)({paramName:M.paramName,value:ie.value})},{default:s(()=>[B(k(ie.label),1)]),_:2},1032,["onClose"])):_("",!0)],64))),256))],64))),256)),p.value===e(H).loadMore&&o.$route.query.page&&Number(o.$route.query.page)>1?(a(),d(be,{key:0,color:"secondary",variant:"outline",clickable:"",onClick:$t},{default:s(()=>[S("span",null,k(o.$t("common.buttons.reset_page")),1),f(Re,{name:"reset"})]),_:1})):_("",!0),e(T)?(a(),d(be,{key:1,color:"secondary",variant:"outline",clickable:"",onClick:e(se)},{default:s(()=>[S("span",null,k(o.$t("common.buttons.reset_filters")),1),f(Re,{name:"reset"})]),_:1},8,["onClick"])):_("",!0)])):_("",!0),S("div",{ref_key:"categoryProductsAnchor",ref:ve,class:"category__products-anchor"},null,512),f(Go,{"card-type":o.cardType,"columns-amount-desktop":o.columnsAmountDesktop,"columns-amount-tablet":o.columnsAmountTablet,"fetching-more-products":e(D),"fetching-products":e(V),"fixed-products-count":o.fixedProductsCount,"has-active-filters":e(T)||e(O)||e(E)||!!e(R).length,"has-selected-facets":e(T),"items-per-page":Ie.value,"pages-count":e(Q),"page-number":e(J),"page-history":e(N),products:e($),"saved-view-mode":e(ee),"search-params":e(X),mode:p.value,class:"category__products",onChangePage:Ct,onResetFacetFilters:e(se),onResetFilterKeyword:e(it),onSelectProduct:Vt},null,8,["card-type","columns-amount-desktop","columns-amount-tablet","fetching-more-products","fetching-products","fixed-products-count","has-active-filters","has-selected-facets","items-per-page","pages-count","page-number","page-history","products","saved-view-mode","search-params","mode","onResetFacetFilters","onResetFilterKeyword"]),S("div",Zo,[o.showButtonToDefaultView?(a(),d(De,{key:0,color:"primary",to:{query:{view:"default"}}},{default:s(()=>[B(k(o.$t("pages.catalog.show_all_results")),1)]),_:1})):_("",!0)])]),_:2},[!o.hideSidebar&&!e(r)&&!te.value?{name:"sidebar",fn:s(()=>[o.categoryId||o.isRoot?(a(),d(To,{key:0,category:e(U),loading:!e(U)&&e(Be),class:"category__selector"},null,8,["category","loading"])):_("",!0),f(tt,{keyword:e(A),filters:e(z),loading:e(V),class:"category__product-filters",onChange:P[0]||(P[0]=M=>fe(M))},null,8,["keyword","filters","loading"])]),key:"0"}:void 0]),1024)]),_:1},512)}}});export{la as _};
//# sourceMappingURL=category.vue_vue_type_style_index_0_lang-hREM4p6T.js.map
