import{_ as gt}from"./DtjvKtZX.js";import mt from"./DbrONzSx.js";import{_ as ft}from"./CKj47m6n.js";import{_ as _t}from"./BsDrMyDG.js";import{c as yt,m as vt,e as ht,_ as bt,a as kt,b as St,d as Ft,g as wt,f as Pt}from"./Byc5xvUf.js";import{_ as Ct}from"./28CrSvMs.js";import{u as qt,_ as Lt,a as zt}from"./BrvfqLLv.js";import{_ as He,W as xt,a4 as Me,r as Tt,o as d,b as q,e as U,B as R,g as re,u as ce,j as Ve,al as je,h as s,i as Q,a8 as Et,F as I,a2 as It,H as Nt,a5 as $t,w as D,N as te,am as Bt,I as Ut,a7 as Rt,a6 as Ot,an as At,x as Ne,n as t,c as k,f as x,E as C,t as oe,U as $e,V as Be,K as Ue,ao as Ht,$ as Re,z as Mt,A as Vt}from"./Btao4aSW.js";import{A as jt}from"./DZ3sZauA.js";import{f as Oe,q as Dt,e as Qt,s as Jt,a as Wt,b as Yt,c as Gt,d as Kt,p as Xt}from"./COHSOUU8.js";import{P as Zt}from"./CfoqkG34.js";import{u as eo}from"./DFwBE2p0.js";import{u as to}from"./DLyWDSXL.js";import{u as oo}from"./fz95QV99.js";import"./DYOehZNJ.js";import"./D5rzn5x9.js";import"./DDVG3G_D.js";import"./B02vrxu_.js";import"./C1EMyjZw.js";import"./NMVIA5Tk.js";import"./CSGs8R6P.js";import"./CYYFem37.js";import"./1U2uaH9Y.js";import"./Bmy3KtE5.js";import"./BGRig-os.js";import"./DOla0CNe.js";import"./BgAdVNux.js";import"./D1W9TygA.js";import"./uXBH3zCt.js";import"./DtYTW8nJ.js";import"./CN9GKueO.js";import"./CNcpZMFy.js";import"./DHIedM6L.js";import"./CgZ3XsHx.js";import"./DocAmoH8.js";import"./DpYOV4g6.js";import"./D-Xkg-ff.js";import"./B4VQRGUu.js";import"./BOQwUivv.js";import"./B91zKrUS.js";import"./DFJAyzQ3.js";const ao={components:{Arrow:jt},computed:{isScrolled(){return this.scrollY>8*375},...xt(Me,{scrollY:i=>i.scrollY})},methods:{goToTop(){window.scrollTo(0,0)}}};function so(i,a,c,p,u,f){const m=Tt("arrow");return d(),q("div",{class:R(["go-to-top",{"go-to-top--scrolled":f.isScrolled}]),onClick:a[0]||(a[0]=(...y)=>f.goToTop&&f.goToTop(...y))},[U(m,{size:"1rem",direction:"up",class:"go-to-top__arrow"})],2)}const ro=He(ao,[["render",so],["__scopeId","data-v-c223bf9b"]]),co=()=>{var f;const i=re(),a=ce(),{restEndpoint:c}=Ve(),p=je(i.fullPath,((f=a.channel)==null?void 0:f.rootPath)??""),u=s(()=>{var m;return`/${(m=a.channel)==null?void 0:m.systemId}/${p}`});return Q(`categories-${u.value}`,async()=>{var l,r,_;if(!u.value)return{quickFilters:{title:"",filters:[]},breadcrumbs:[]};const m=await $fetch(`${c}/categories${u.value??""}`);return{quickFilters:{title:((l=m.quickFilter)==null?void 0:l.title)??"",filters:(_=(r=m.quickFilter)==null?void 0:r.filters)==null?void 0:_.map(N=>({filter:N.split(":")[0],value:N.split(":")[1]}))},breadcrumbs:m.breadcrumbs}},{watch:[u]})},se=(i,a,c,p,u)=>{var m;if(!i)return;const f=p[a];for(let y=0;y<(i==null?void 0:i.length);y+=1){const l=i[y];if(l.linkedEntityUrl===c)return l;const r=(m=l.linkedEntityUrl)==null?void 0:m.split("/").filter(_=>_);if(r){u!=="/"&&r.shift();const _=r[a];if(f===_)return se(l.children,a+1,c,p,u)}}},ae=(i,a)=>{const c=i.split("/").filter(p=>p);return a!=="/"&&c.shift(),c},no=i=>{var a;return(a=i.children)==null?void 0:a.reduce((c,p)=>(!p.linkedEntityUrl||!p.name||c.push({url:p.linkedEntityUrl,displayName:p.name}),c),[])},io=async()=>{var y;const i=re(),a=ce(),c=s(()=>{var l;return((l=a.channel)==null?void 0:l.rootPath)??""}),p=je(i.fullPath,((y=a.channel)==null?void 0:y.rootPath)??""),u=s(()=>{var l;return`/${(l=a.channel)==null?void 0:l.systemId}/${p}`}),f=s(()=>{var l;if(ae(i.path,c.value).length<=2){const r=se(a.header.menuItems||[],0,i.path,ae(i.path,c.value),c.value);if(r!=null&&r.children&&((l=r==null?void 0:r.children)==null?void 0:l.length)>0)return no(r)}}),{data:m}=await Q(`subcategories-${u.value}`,async()=>f.value?f.value:u.value?await $fetch(`${Ve().restEndpoint}/subcategories${u.value}`):[],{watch:[u]});return{subcategories:m,getCurrentPathParts:ae,findLinkInMenuItems:se}},lo={key:1,class:"page-category"},uo={class:"page-category__header"},po={class:"page-category__header-content"},go={key:1,class:"page-category__title"},mo={class:"page-category__product-container"},fo={class:"page-category__product-list-container"},_o={key:1,class:"page-category__product-list"},yo={key:2},vo={key:0},Ae=20,ho={__name:"PagesCategory",props:{page:{type:Object,required:!0}},async setup(i){let a,c;Ht(e=>({a9429738:t(fe)}));const p=Xt,u=Et(),f=e=>{const o=parseInt(e.query.pagesize,10);return Number.isNaN(o)?Ae:o},m=i,y=Re("headerHeight"),l=Re("underHeaderHeight"),r=s(()=>m.page.litiumPage),_=I(!1),N=I(0),ne=I(0),ie=I(0),O=I(null),le=I(null),J=ce(),De=oo(),ue=Me(),Qe=It(),h=re(),W=Nt(),{$emarsys:de}=$t();qt();const{data:b}=([a,c]=D(()=>co()),a=await a,c(),a),{subcategories:Je}=([a,c]=D(()=>io()),a=await a,c(),a),We=s(()=>J.websiteTexts.actionbar__viewproducts),Ye=s(()=>T.value===void 0?"":J.websiteTexts.actionbar__productcountsingle),Ge=s(()=>T.value===void 0?"":J.websiteTexts.actionbar__productcount),Ke=s(()=>De.isModalMode),pe=s(()=>{var e;return!!((e=r.value.blocks)!=null&&e.footer)}),Y=s(()=>{var e;return!!((e=r.value.blocks)!=null&&e.header)}),ge=s(()=>{var e;return((e=S.value)==null?void 0:e.fields.LongDescription)||""}),Xe=s(()=>{var e;return((e=S.value)==null?void 0:e.fields.title)||me.value}),T=s(()=>{var e,o;return(o=(e=H.value)==null?void 0:e.primaryList)==null?void 0:o.totalHits}),me=s(()=>{var e;return(e=S.value)==null?void 0:e.fields._name}),Ze=s(()=>{var e;return(e=S.value)==null?void 0:e.systemId}),S=s(()=>{var e;return(e=r.value.dataJson)==null?void 0:e.category}),$=s(()=>{var e;return[((e=S.value)==null?void 0:e.categoryUrlSegments)||me.value].join("/")}),et=s(()=>ne.value-ie.value>N.value),fe=s(()=>`${y.value+l.value}px`),tt=s(()=>{var e;return h.query.sort??((e=_e.value[0])==null?void 0:e.value)??""}),G=s(()=>f(h)),ot=s(()=>T.value>G.value),A=s(()=>{var e;return((e=r.value.dataJson.category)==null?void 0:e.categoryUrlSegments)??r.value.fields._url??r.value.systemId??"elevate-category-fallback-reference"}),L=s(()=>{var n,g;const e=Wt((g=(n=H.value)==null?void 0:n.primaryList)==null?void 0:g.facets);return e?e.map(F=>Yt(F,Gt(F.id,be.value))):[]}),E=s(()=>{var e,o;return((o=(e=H.value)==null?void 0:e.primaryList)==null?void 0:o.productGroups.map(p))??[]}),_e=s(()=>{var e,o,n;return((n=(o=(e=H.value)==null?void 0:e.primaryList)==null?void 0:o.sort)==null?void 0:n.options.map(Kt))??[]}),z=s(()=>{const e=wt(h,L.value);return Object.keys(e).length?e:{}}),at=s(()=>Y.value||pe.value),st=s(()=>lt.value&&!at.value),rt=s(()=>{var e;return((e=z.value)==null?void 0:e.size)??null});te(()=>{var e;return(e=b.value)==null?void 0:e.breadcrumbs},(e,o)=>{JSON.stringify(o)!==JSON.stringify(e)&&he()}),Bt(()=>!1),Ut(()=>{Rt(()=>{window.addEventListener("resize",K),K(),he()})}),Ot(()=>{window.removeEventListener("resize",K)});const K=()=>{var e,o,n;ne.value=(e=O.value)==null?void 0:e.scrollWidth,ie.value=(n=(o=O.value)==null?void 0:o.getBoundingClientRect())==null?void 0:n.width},ct=()=>{var e;N.value=(e=O.value)==null?void 0:e.scrollLeft},nt=()=>{const e=G.value+Ae;W.replace({query:{...h.query,pagesize:e}})},ye=()=>{const e=le.value.getBoundingClientRect().top+window.scrollY-y.value-l.value+1;window.scrollTo({top:e})},ve=e=>{const{...o}=h.query;ue.isMobile&&ye(),W.replace({query:{...o,sort:e}})},he=()=>{var e,o,n,g,F;try{if(de&&((e=S.value)!=null&&e.categoryNameSegmentsSe)){const w=S.value.categoryNameSegmentsSe.replace(/\//g,">");w&&(Qe.sendCartToEmarsys(),de.push(["category",w]))}if($.value&&(E!=null&&E.value)){const w=E.value.map((B,Z)=>At(B,$.value,Z)),P={listId:$.value,trackingProductObjects:w},V=(n=(o=b.value)==null?void 0:o.breadcrumbs)==null?void 0:n.map(B=>B.displayName).join(">");V&&(P.categorySegmentsLocalized=V);const j=(F=(g=S.value)==null?void 0:g.categoryUrlSegments)==null?void 0:F.replace(/\//g,">");j&&(P.categorySegments=j),Ne().push({event:"listingPage",non_interaction:!0,ecommerce:{list:P.listId,category:P.categorySegments,categoryLocalized:P.categorySegmentsLocalized,impressions:P.trackingProductObjects}})}}catch(w){console.error("Failed to track category page visit",w)}},{data:be}=([a,c]=D(async()=>Q(`Elevate Category Products ${A.value}_Facets`,async()=>{var n;const{viewId:e}=u.querySettings.value,o=await u.query.landingPage({notify:!1,viewId:e,pageReference:A.value,limit:1});return Oe((n=o==null?void 0:o.primaryList)==null?void 0:n.facets)})),a=await a,c(),a),{data:H,execute:it,error:lt}=([a,c]=D(async()=>Q(`Elevate Category Products ${A.value}`,async()=>{const{notify:e,viewId:o}=u.querySettings.value,n=Dt(h.query,be.value);n.onlyInStock=!!n.size;const g=await u.query.landingPage({notify:e,viewId:o,pageReference:A.value,sort:h.query.sort,limit:h.query.pagesize??20,facets:n,presentCustom:Zt,presentPrices:Qt});if(!g.primaryList)throw new Error("No primary list found");return g.primaryList.facets=Oe(g.primaryList.facets),g})),a=await a,c(),a),M=e=>{const{...o}=h.query;e.size&&(e.size=e.size.map(Jt)),ue.isMobile&&ye();const n=yt(o);W.replace({query:{...n,...vt(e,L.value)}})},X=s(()=>{var e;return Pt(L.value,z.value,(e=b.value)==null?void 0:e.quickFilters)});te(z,(e,o)=>{const n=JSON.stringify(o),g=JSON.stringify(e);n!==g&&Ne().push({event:"gaevent",category:"category",action:"filter",label:g})}),te(()=>h.query,()=>{it()});const ke=e=>{const o=ht(e,z.value,L.value);M(o)};return eo(r,r.value.canonical),to(r.value.title??"","Category",$.value),(e,o)=>{var Se,Fe,we,Pe,Ce,qe,Le,ze,xe,Te,Ee,Ie;const n=gt,g=mt,F=ft,w=_t,P=bt,V=kt,j=St,B=Ft,Z=Ct,ut=Lt,dt=zt,pt=ro;return t(st)?(d(),k(n,{key:0})):(d(),q("div",lo,[x("div",uo,[t(Y)?(d(),k(g,{key:0,blocks:t(r).blocks,container:"header"},null,8,["blocks"])):C("",!0),x("div",po,[(Se=t(b))!=null&&Se.breadcrumbs?(d(),k(F,{key:0,class:"page-category__breadcrumbs",breadcrumbs:t(b).breadcrumbs},null,8,["breadcrumbs"])):C("",!0),t(Y)?C("",!0):(d(),q("h1",go,oe(t(Xe)),1))])]),x("div",{class:R(["page-category__subcategories-wrapper",{"page-category__subcategories-wrapper--fade-right":t(et)}])},[x("div",{ref_key:"subcategoriesRef",ref:O,class:"page-category__subcategories",onScroll:o[0]||(o[0]=v=>ct())},[(d(!0),q($e,null,Be(t(Je),v=>(d(),k(w,{key:v.url,to:v.url,class:"page-category__subcategories-item"},{default:Mt(()=>[Vt(oe(v.displayName),1)]),_:2},1032,["to"]))),128))],544)],2),x("div",mo,[((Pe=(we=(Fe=t(b))==null?void 0:Fe.quickFilters)==null?void 0:we.filters)==null?void 0:Pe.length)>0?(d(),k(P,{key:0,class:"page-category__quickfilters",facets:t(L),"selected-facets":t(z),quickfilters:(Ce=t(b))==null?void 0:Ce.quickFilters,"hidden-on-desktop":"","onUpdate:selectedFacets":M},null,8,["facets","selected-facets","quickfilters"])):C("",!0),U(V,{"facets-open":t(_),"onUpdate:facetsOpen":o[1]||(o[1]=v=>Ue(_)?_.value=v:null),class:R(["page-category__action-bar--header",{"page-category__action-bar--header--with-quickfilters":((ze=(Le=(qe=t(b))==null?void 0:qe.quickFilters)==null?void 0:Le.filters)==null?void 0:ze.length)>0}]),facets:t(L),"selected-facets":t(z),count:t(T),"sort-options":t(_e),"sort-value":t(tt),"label-count":t(Ge),"label-count-single":t(Ye),"quick-filters":(xe=t(b))==null?void 0:xe.quickFilters,"visible-selected-facets":t(X),"hide-pill-toggle-button-on-desktop":"","hide-selected-facets-on-desktop":"","onUpdate:sortValue":ve,"onUpdate:selectedFacets":M,onDeselectFacet:ke},null,8,["facets-open","class","facets","selected-facets","count","sort-options","sort-value","label-count","label-count-single","quick-filters","visible-selected-facets"]),x("div",{ref_key:"categoryActionBarRef",ref:le,class:R(["page-category__action-bar-wrapper",{"modal-mode":t(Ke)}])},[U(j,{"facets-open":t(_),"onUpdate:facetsOpen":o[2]||(o[2]=v=>Ue(_)?_.value=v:null),class:R(["page-category__action-bar-filters",{"page-category__action-bar-filters--negative-spacing":!((Ie=(Ee=(Te=t(b))==null?void 0:Te.quickFilters)==null?void 0:Ee.filters)!=null&&Ie.length)}]),facets:t(L),"selected-facets":t(z),count:t(T),"label-view-items":t(We),"desktop-top-offset":t(fe),"display-filter-bar-in-desktop":"","onUpdate:sortValue":ve,"onUpdate:selectedFacets":M},null,8,["facets-open","class","facets","selected-facets","count","label-view-items","desktop-top-offset"]),x("div",fo,[t(X).length?(d(),k(B,{key:0,"active-facets":t(X),"hidden-on-phone-and-tablet":"",onDeselectFacet:ke},null,8,["active-facets"])):C("",!0),t(E)?(d(),q("div",_o,[(d(!0),q($e,null,Be(t(E),(v,ee)=>(d(),k(Z,{key:v.articleNumber,position:ee,product:v,"list-name":t($),"list-id":t(Ze),"selected-size":t(rt),class:"product-card","lazy-loading":ee>1,"high-fetch-priority":ee<2},null,8,["position","product","list-name","list-id","selected-size","lazy-loading","high-fetch-priority"]))),128))])):C("",!0)])],2)]),t(ot)?(d(),k(ut,{key:0,class:"page-category__load-more","loaded-count":t(G),"total-count":t(T),onLoadMore:nt},null,8,["loaded-count","total-count"])):C("",!0),U(dt),t(pe)?(d(),k(g,{key:1,blocks:t(r).blocks,container:"footer"},null,8,["blocks"])):(d(),q("div",yo,[t(ge)?(d(),q("p",vo,oe(t(ge)),1)):C("",!0)])),U(pt)]))}}},na=He(ho,[["__scopeId","data-v-8b16f76c"]]);export{na as default};