"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2261],{62165:function(e,n,o){o.d(n,{G:function(){return M}});var r=o(57152),i=o(14007),l=o(1928),t=o(78121),s=o(69699),u=o(11388),a=o(43787),d=o(93136),v=o(35938),p=o(37694),c=o(83743),f=o(54323),m=o(64539);let S=(e,n)=>{var o,r;let i=null!==(o=e.opens)&&void 0!==o?o:"00:00",l=null!==(r=n.opens)&&void 0!==r?r:"00:00";return i===l?0:i>l?1:-1},g=e=>i.Ov.fromTime(null!=e?e:"24:00").isSameOrBeforeNow(),H=e=>i.Ov.fromTime(null!=e?e:"00:00").isAfterNow();function y(e){var n,o;let{normalHours:r,selfService:i}=e.todaysOpeningHours,{hasSelfService:l}=e;return[...!(null==r?void 0:r.closed)&&(null==r?void 0:null===(n=r.spans)||void 0===n?void 0:n.map(e=>({type:"normal",...e})))||[],...l&&(null==i?void 0:i.enabled)&&(null==i?void 0:null===(o=i.spans)||void 0===o?void 0:o.map(e=>({type:"selfService",...e})))||[]].sort(S)}let O=["normal","selfService"],h=(e,n)=>O.indexOf(n.type)-O.indexOf(e.type),D=e=>[...e].sort(h);function F(e){return D(y(e).filter(e=>g(e.opens)&&H(e.closes)))}function w(e){return F(e).slice(-1)[0]}let T=(e,n)=>0>h({type:e},{type:n}),Z={monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday",sunday:"Sunday"},b=(e,n)=>!(!(null==e?void 0:e.opens)||!(null==n?void 0:n.opens)||(0,i.z$)(e.opens,n.opens))?-1:1;class M{static orderSpans(e){var n;return null!==(n=null==e?void 0:e.slice().sort(b))&&void 0!==n?n:[]}static openingHoursToString(e){var n;return(null==e?void 0:e.closed)?"stengt":null===(n=M.orderSpans(null==e?void 0:e.spans))||void 0===n?void 0:n.map(e=>"".concat(e.opens,"-").concat(e.closes)).join(" & ")}static selfServiceOpeningHoursToString(e){var n;return(null==e?void 0:e.enabled)?null===(n=M.orderSpans(null==e?void 0:e.spans))||void 0===n?void 0:n.map(e=>"".concat(e.opens,"-").concat(e.closes)).join(" & "):"stengt"}static normalHoursEqual(e){return 1===(0,m.Tw)(e,this.openingHoursToString).length}static selfServiceHoursEqual(e){return 1===(0,m.Tw)(e,this.selfServiceOpeningHoursToString).length}static specialHoursIncludesDate(e,n){return new i.Ov(e.from).isSameDateOrBefore(n)&&new i.Ov((0,i.WV)(e)).isSameDateOrAfter(n)}static getFirstOccurenceOfWeekday(e,n){let o=(0,i.ig)((0,i.Tj)(e)),r=(0,i.D5)((0,i.ig)(n)-o,7);return(0,l.Z)(e,r)}sortedWeekOpeningHours(e){let{t:n,lang:o}=e,r=i.Ov.now();return(0,u.Z)({start:r,end:(0,l.Z)(r,6)}).map(e=>{let r=(0,i.Tj)(e),t=(0,i.Tj)(i.Ov.now())===r,s=(0,i.Tj)((0,l.Z)(i.Ov.now(),1))===r,u=t?n("I dag"):s?n("I morgen"):i.B0[o][r];return{...this.openingHoursForDate(e),isToday:t,weekday:r,label:u,date:e}})}get hasSelfService(){if(!this.siteHasSelfService)return!1;let e=i.Ov.now();return(0,u.Z)({start:e,end:(0,l.Z)(e,6)}).some(e=>{var n,o,r,l;let t=(0,i.Tj)(e),s=this.specialOpeningHoursForDate(e);return!!((null==s?void 0:null===(o=s.selfServiceHours)||void 0===o?void 0:null===(n=o[t])||void 0===n?void 0:n.enabled)||(null===(l=this.selfService)||void 0===l?void 0:null===(r=l[t])||void 0===r?void 0:r.enabled))})}specialOpeningHoursForDate(e){var n,o;return null===(o=this.specialOpeningHours)||void 0===o?void 0:null===(n=o.filter(i.jq))||void 0===n?void 0:n.find(n=>M.specialHoursIncludesDate(n,e))}normalHoursForDate(e){var n,o;let r=(0,i.Tj)(e),l=M.removeSpansFromNormalhoursIfClosed(null===(n=this.openingHours)||void 0===n?void 0:n[r]),t=this.specialOpeningHoursForDate(e),s=M.removeSpansFromNormalhoursIfClosed(null==t?void 0:null===(o=t.normalHours)||void 0===o?void 0:o[r]);return s&&!M.normalHoursEqual([l,s])?{...s,usualHoursForWeekday:l,note:null==t?void 0:t.note,isSpecial:!0}:{...l,isSpecial:!1}}selfServiceOpeningHoursForDate(e){var n,o;if(!this.siteHasSelfService)return;let r=(0,i.Tj)(e),l=M.removeSpansFromSelfserviceHoursIfNotEnabled(null===(n=this.selfService)||void 0===n?void 0:n[r]),t=this.specialOpeningHoursForDate(e),s=M.removeSpansFromSelfserviceHoursIfNotEnabled(null==t?void 0:null===(o=t.selfServiceHours)||void 0===o?void 0:o[r]);return s&&!M.selfServiceHoursEqual([l,s])?{...s,usualHoursForWeekday:l,note:null==t?void 0:t.note,isSpecial:!0}:{...l,isSpecial:!1}}openingHoursForDate(e){let n=this.normalHoursForDate(e),o=this.selfServiceOpeningHoursForDate(e);return{normalHours:n,selfService:o,divergentHoursForDate:!!((null==n?void 0:n.isSpecial)||(null==o?void 0:o.isSpecial))}}get todaysOpeningHours(){return this.openingHoursForDate(i.Ov.now())}get tomorrowsOpeningHours(){return this.openingHoursForDate(i.Ov.daysFromNow(1))}get nextTransition(){return function(e){var n,o;let r=w(e),l=function(e){let n=y(e),o=w(e),r=n.filter(e=>H(e.opens))[0];return!o||r&&1>=i.Ov.timeStringDifferenceInMinutes(r.opens,null==o?void 0:o.closes)&&!T(r.type,o.type)?r:D(F(e).filter(e=>{let{closes:n,type:r}=e;return i.Ov.timeStringDifferenceInMinutes(n,null==o?void 0:o.closes)>0&&!T(r,o.type)})).slice(-1)[0]}(e);return{currentTimespan:r,nextTimespan:l,currentState:null!==(n=null==r?void 0:r.type)&&void 0!==n?n:"closed",nextState:null!==(o=null==l?void 0:l.type)&&void 0!==o?o:"closed",happensAt:r?!l||i.Ov.fromTime(l.opens).isBefore(i.Ov.fromTime(r.opens))?r.closes:l.opens:null==l?void 0:l.opens}}(this)}upcomingSpecialHours(){var e;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,o=(0,d.Z)(n,i.b_);return null===this||void 0===this?void 0:null===(e=this.specialOpeningHours)||void 0===e?void 0:e.filter(i.jq).filter(e=>new i.Ov((0,i.WV)(e)).isSameDateOrAfter(n)).map(e=>{let{from:r,...l}=e;return{from:new i.Ov(r).isBefore(n)?o:r,...l}}).sort((e,n)=>e.from>n.from?1:-1)}getSpecialHoursForNextDays(e){var n;let o=i.Ov.daysFromNow(e);return null===(n=this.upcomingSpecialHours())||void 0===n?void 0:n.filter(e=>{let{from:n}=e;return new i.Ov(n).isSameDateOrBefore(o)}).map(e=>{let{to:n,...r}=e;return{to:new i.Ov(n).isSameDateOrBefore(o)?n:(0,d.Z)(o,i.b_),...r}})}makeOpeningHoursSpecifications(e){let{closed:n,spans:o,dayOfWeek:r,validFrom:i,validThrough:l}=e,t={"@type":"OpeningHoursSpecification",validFrom:i,validThrough:l,...r?{dayOfWeek:r}:{}};return n?[t]:(o||[]).map(e=>{let{opens:n,closes:o}=e;return{...t,opens:n,closes:o}})}get schemaOrgOpeningHours(){return i.c8.flatMap(e=>{var n;return this.makeOpeningHoursSpecifications({dayOfWeek:Z[e],...null===(n=this.openingHours)||void 0===n?void 0:n[e]})})}get schemaOrgSpecialOpeningHours(){return(this.upcomingSpecialHours()||[]).flatMap(e=>{let n=new Date(e.from),o=new Date(e.to||e.from),r=e.normalHours;if(!e.isInterval){var l,t;return this.makeOpeningHoursSpecifications({validFrom:(0,d.Z)(n,"yyyy-MM-dd"),validThrough:(0,d.Z)(n,"yyyy-MM-dd"),spans:null==r?void 0:null===(l=r[(0,i.Tj)(n)])||void 0===l?void 0:l.spans,closed:null==r?void 0:null===(t=r[(0,i.Tj)(n)])||void 0===t?void 0:t.closed})}return 1>(0,s.Z)(o,n)?(0,u.Z)({start:n,end:o}).flatMap(e=>{var n,o;return this.makeOpeningHoursSpecifications({validFrom:(0,d.Z)(e,"yyyy-MM-dd"),validThrough:(0,d.Z)(e,"yyyy-MM-dd"),spans:null==r?void 0:null===(n=r[(0,i.Tj)(e)])||void 0===n?void 0:n.spans,closed:null==r?void 0:null===(o=r[(0,i.Tj)(e)])||void 0===o?void 0:o.closed})}):i.c8.flatMap(e=>{var i,l;return this.makeOpeningHoursSpecifications({validFrom:(0,d.Z)(n,"yyyy-MM-dd"),validThrough:(0,d.Z)(o,"yyyy-MM-dd"),dayOfWeek:Z[e],spans:null==r?void 0:null===(i=r[e])||void 0===i?void 0:i.spans,closed:null==r?void 0:null===(l=r[e])||void 0===l?void 0:l.closed})})})}static sortByFromDate(e){return(0,r.fR)(e,e=>{let{from:n}=e;return n})}specialOpeningHoursGroupedByMonth(e){var n;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6;if(o>11)return console.error("OpeningHoursHelper.specialOpeningHoursGroupedByMonth can't look ".concat(o," ahead")),{};let r=null!==(n=this.upcomingSpecialHours(e))&&void 0!==n?n:[],l=(0,f.Z)((0,t.Z)(new Date,o));return M.sortByFromDate(r).filter(e=>{let{from:n}=e;return!(0,p.Z)(new Date(n),l)}).reduce((e,n)=>{let o=new Date(n.from),r=new Date((0,i.WV)(n)),t=(0,a.Z)({start:o,end:r}).reduce((t,s)=>{var u;if(s>l)return t;let a=(0,v.Z)(s),m=(0,f.Z)(s),S=(0,c.Z)(o,s)?s:o,g=(0,p.Z)(r,m)?m:r,H=(0,d.Z)(S,i.b_),y=(0,d.Z)(g,i.b_),O={...n,from:H,to:y};return{...t,[a]:[...null!==(u=e[a])&&void 0!==u?u:[],O]}},{});return{...e,...t}},{})}static removeSpansFromNormalhoursIfClosed(e){return e?{...e,closed:!!(null==e?void 0:e.closed),spans:(null==e?void 0:e.closed)?void 0:null==e?void 0:e.spans}:e}static removeSpansFromSelfserviceHoursIfNotEnabled(e){return e?{...e,enabled:!!(null==e?void 0:e.enabled),spans:(null==e?void 0:e.enabled)?null==e?void 0:e.spans:void 0}:e}constructor(e,n){this.openingHours=null==n?void 0:n.openingHours,this.specialOpeningHours=null==n?void 0:n.specialOpeningHours,this.siteHasSelfService=!!(null==e?void 0:e.hasSelfService),this.selfService=this.siteHasSelfService?null==n?void 0:n.selfServiceOpeningHours:void 0}}},65278:function(e,n,o){o.d(n,{G:function(){return i}});let r={meråpent:{nb:"mer\xe5pent",nn:"meirope",de:""},selvbetjent:{nb:"selvbetjent",nn:"sj\xf8lvbetent",de:""}},i=(e,n)=>(null==n?void 0:n.selfServiceLabel)==="mer\xe5pent"?r.meråpent[e]:r.selvbetjent[e]}}]);
//# sourceMappingURL=2261-7a2a6c132d1f10b4.js.map