import{bY as $,ar as v,d as B,a as z,e as A,r as L,s as j,j as M,f as r,h as g,v as d,g as u,F as b,y as W,o as l,A as h,x as V,I as q,aQ as E,at as Q,_ as G}from"./BxiWQxwE.js";import{a as w}from"./Bo9XA6rV.js";import{i as J}from"./Cgs-mdcL.js";function K(_,n,s){return w(_,n*7,s)}function P(_,n,s){const[c,m]=$(s==null?void 0:s.in,_,n);return+v(c,s)==+v(m,s)}const R={class:"store__openinghours"},T=["onClick"],U={key:0},X={key:0},Z={key:1},Y=1,H=B({__name:"openinghours",props:{store:{type:Object,required:!0}},setup(_){const n=_,{$gtm:s,$messages:c}=z(),m=A(()=>[{id:1,label:c("stores.thisWeek"),hours:f(0)},{id:2,label:c("stores.nextWeek"),hours:f(1)},{id:3,label:c("stores.twoWeeks"),hours:f(2)}]),C=a=>{const t=new Date(a.getFullYear(),11,31);return Q(t,{weekStartsOn:Y})},f=a=>{var D;const t=new Date;let e=K(t,a);const k=t.getFullYear(),x=e.getFullYear();return k!==x&&C(t)===53&&(e=w(e,7)),((D=n.store)==null?void 0:D.openingHours).filter(o=>{const p=new Date(o.date);return P(p,e,{weekStartsOn:Y})}).map(o=>{const p=new Date(o.date),F=q(p.toLocaleDateString("nl-NL",{weekday:"long"})),y=o.open.substring(0,5),I=o.close.substring(0,5),S=p.getFullYear(),N=J(p,t),O=E(o.date,t);return{...o,open:y,close:I,day:F,active:N,ended:O,closed:y==="00:00",year:S}})},i=L(m.value[0]);return j(i,()=>{var a,t;s("stores.location_open",{location_open_toggle:i.value.label,location_name:(a=n.store)==null?void 0:a.name,location_id:(t=n.store)==null?void 0:t.storeId})}),M(()=>{var a,t;s("stores.location_open",{location_open_toggle:i.value.label,location_name:(a=n.store)==null?void 0:a.name,location_id:(t=n.store)==null?void 0:t.storeId})}),(a,t)=>(l(),r("div",R,[g("h2",null,d(u(c)("stores.openinghours")),1),g("nav",null,[(l(!0),r(b,null,W(u(m).slice(0,2),e=>(l(),r("button",{key:e.id,type:"button",class:h({active:u(i).id===e.id}),onClick:k=>i.value=e},d(e.label),11,T))),128))]),g("ul",null,[(l(!0),r(b,null,W(u(i).hours,(e,k)=>(l(),r("li",{key:`${u(i).label}__${k}`,class:h({active:e.active,ended:e.ended})},[g("div",null,[g("p",null,d(e.day),1),e.special?(l(),r("span",U,d(e.specialDescription),1)):V("",!0)]),e.closed?(l(),r("span",X,d(u(c)("stores.storeClosed")),1)):(l(),r("span",Z,d(e.open)+" - "+d(e.close),1))],2))),128))])]))}}),ne=G(H,[["__scopeId","data-v-86c8719e"]]);export{ne as default};
