1import{a as e}from"./Tg6eheFi.js";import{g as t}from"./Ib1jYPSS.js";import{t as n}from"./BWvQhbqt.js";import{t as r}from"./Cz_a1tgg.js";import{l as i}from"./QyStSQlT2.js";import{t as a}from"./BgReSmoG2.js";var o={week:`weken`,month:`maanden`,year:`jaar`},s={week:`week`,month:`maand`,year:`jaar`};function c(e,t,n=!0){return e.amount===1&&t===`month`&&n?`Maandelijks opzegbaar`:e.unit?t===`month`?`${e.amount} ${o[e.unit]} - Maandelijks opzegbaar`:e.amount===1?`${e.amount} ${s[e.unit]}`:`${e.amount} ${o[e.unit]}`:``}function l(e){return e===null?``:new Intl.NumberFormat(`nl-NL`,{style:`currency`,currency:`EUR`,minimumFractionDigits:2,maximumFractionDigits:2}).format(e).replace(`,00`,`,-`).replace(`â¬`,``).replace(`\xA0`,``)}function u(e,t={style:`currency`,currency:`EUR`}){let n=e%1!=0,r=new Intl.NumberFormat(`nl-NL`,t).format(e);return n?r:r.replace(/,00$/,`,-`)}var d={week:`per week`,"bi-week":`per twee weken`,"four-week":`per vier weken`,month:`per maand`,year:`per jaar`,issue:`per nummer`,magazine:`per nummer`,quarter:`per kwartaal`,"half-year":`per half jaar`,"one-time":`eenmalig`,"semi-annual":`per half jaar`,annual:`per jaar`};function f(e){return e.find(e=>e.default)||e[0]}function p(e){return f(e)?.price?.discount}function m(e,t){return e.find(e=>e.unit===t)}function h(e,t){return t?m(e,t)??f(e):f(e)}function g(e,t){return h(e,t)?.price?.discount}function _(e){return d[e]}function v(e){return l(e)}function y(e,t){return Math.min(...e.map(e=>g(e.prices,t)||0))}function b(e,t){return e===t?v(t):`+${v(e-t)}`}function x(e,t){let n={};return e.forEach(e=>{let r=`${e.brandId}-${e.formula.code}`,i=e.discount.percentage??0,a=n[r]?.discount.percentage??0,o=e.included.brand.code===t;(o&&!n[r]||a<i&&o)&&(n[r]=e)}),Object.values(n)}function S(e){let t={};return e.forEach(e=>{let n=e.included.product.uuid,r=e.discount.percentage??0,i=t[n]?.discount.percentage??0;(!t[n]||i<r)&&(t[n]=e)}),Object.values(t)}function C(e){return`${e.brandId}-${e.productUuid}-${e.formula.code}`}function w(e){let t={};return e.forEach(e=>{let n=C(e),r=e.discount.percentage??0,i=t[n]?.discount.percentage??0;(!t[n]||i<r)&&(t[n]=e)}),Object.values(t)}function T(e){let t={};return e.forEach(e=>{let n=`${C(e)}-${e.premiumCode}`,r=e.discount.percentage??0,i=t[n]?.discount.percentage??0;(!t[n]||i<r)&&(t[n]=e)}),Object.values(t)}function E(e){return`${e.included.brand.country}${e.included.brand.formal?`-formal`:``}`}function D(e,t){let n=e.find(e=>e.productCode===t)||e[0];return e.reduce((e,n)=>(n.duration.amount??0)>
1(e.duration.amount??0)&&n.productCode===t?n:e,n)?.uuid}function O(e,t){let n=e.filter(e=>e.productCode===t&&e.isTemporaryPromo);if(n.length===0)return D(e,t);let r=n[0];return n.reduce((e,t)=>(t.duration.amount??0)>(e.duration.amount??0)?t:e,r)?.uuid}function k(e){let t=f(e.prices),n=e.payment,r=t.unit===n.unit,i=t.price.discount===n.amount;return r&&i}function A(e){let t=e.billShockMonthlyTerminableAfter;return t?.unit===`month`&&t?.amount===0}function j(e){let t=e.billShockPrices?.length>0,n=e.billShockPrices?.find(e=>e.monthlyTerminable);return t&&n?`${n.duration} ${n.durationUnit}`:c(e.duration)}function M(e){return e.included.brand.type===`paper`}var N=`GCSR`;function P(e){return e.priceGroup===N}var F=`fallback`;function I(){let{$logger:o}=e(),s=n(`brandCode`,()=>``),c=n(`selectedPropositionUuid`),l=n(`propositionGroup`,()=>F),u=n(`propositions`,()=>({})),d=n(`propositionsMap`,()=>new Map),f=n(`brandsMap`,()=>new Map),p=n(`brandsMapByCode`,()=>new Map),m=n(`productsMap`,()=>new Map);function h(e,t){let n=t||F,{data:r,meta:i}=e;if(!r||!i)return;let a=f.value,o=p.value,s=m.value,c=d.value;r.brands.forEach(e=>{a.set(e.id,e),o.set(e.code,e)}),r.products.forEach(e=>{e.uuid&&s.set(e.uuid,e)});let l=r.propositions.reduce((e,t)=>{if(!t.productUuid)return e;let n=g({proposition:t,brand:a.get(t.brandId),product:s.get(t.productUuid),meta:i});return n?(c.set(t.uuid,n),e.push(n),e):e},[]);u.value[n]=l}function g({proposition:e,brand:t,product:n,meta:r}){return!t||!n?null:{...e,included:{brand:t,product:n},meta:r}}async function _({brandCodes:e,productCodes:t,formulas:n,brandSlug:c,countryCode:l,group:u,mid:f,brandType:p,priceGroups:m,priceGroupsNot:g,leadqId:_,clearExistingCatalog:v=!1,ssrCache:y}={}){let b=f||r().mid.value,x=u||F,S=a(y);if(b){v&&d.value.clear();try{let r=await i({brandCodes:e,productCodes:t,brandType:p,brandSlug:c,countryCode:l,formulas:n,priceGroups:m,priceGroupsNot:g,leadqId:_},{headers:{"X-Mid-Token":b,...S}});return r?(h(r,x),r):void 0}catch(r){o.log({title:`Error fetching catalogData [useCatalog]`,error:r,metadata:{params:{brandCode:s.value,brandCodes:e,productCodes:t,formulas:n,brandSlug:c,countryCode:l,group:u,mid:f,brandType:p,midToken:b,propGroup:x}}})}}}function v(e,t,n){return e.filter(e=>e.productCode?.toLocaleLowerCase()===t.toLocaleLowerCase()&&e.brandCode===n)}let y=t(()=>u.value[l.value]),b=t(()=>
1Array.from(d.value.values())),C=t(()=>d.value.get(c.value)),E=t(()=>x(y.value,s.value)),D=t(()=>w(y.value)),O=t(()=>T(y.value)),k=t(()=>S(y.value)),A=t(()=>C.value?v(y.value,C.value?.productCode,C.value?.included.brand.code):[]),j=t(()=>p.value.get(s.value)),M=t(()=>j.value?.type),N=t(()=>j.value?.domain),P=t(()=>j.value?.name),I=t(()=>j.value?.formal===!0),L=t(()=>j.value?.country===`be`),R=t(()=>L.value&&I.value?`be-formal`:L.value?`be`:I.value?`nl-formal`:`nl`),z=t(()=>M.value===`magazine`),B=t(()=>Array.from(f.value.values())),V=t(()=>{if(!C.value)return``;let e=C.value.formula.label||C.value.formula.code,t=``;return C.value.included.brand.type===`paper`&&(t=C.value.included.brand.name.default+` `),t+e});function H(){c.value=``}function U(e){c.value=e}function W(e){l.value=e}return{fetchCatalog:_,brands:B,brand:j,brandCode:s,brandDomain:N,brandIsBelgium:L,brandIsFormal:I,brandIsMagazine:z,brandName:P,brandType:M,brandLocale:R,allCatalogPropositions:b,catalogPropositions:y,catalogPropositionsByFormula:E,catalogPropositionsBySelectedProduct:A,getPropositionsByProductCode:v,catalogPropositionsByProductCode:D,catalogPropositionsByProductCodeAndPremiumCode:O,catalogPropositionsByProduct:k,propositionsMap:d,productsMap:m,propositions:u,propositionGroup:l,setCatalogData:h,selectedProposition:C,selectedPropositionUuid:c,selectedPropositionLabel:V,setSelectedPropositionUuid:U,resetSelectedPropositionUuid:H,setPropositionGroup:W,availablePremiums:t(()=>[...new Set(y.value.map(({premiumCode:e})=>e).filter(e=>e!==null))])}}export{o as C,l as S,c as T,y as _,D as a,d as b,A as c,k as d,C as f,h as g,f as h,E as i,P as l,p as m,w as n,O as o,b as p,T as r,j as s,I as t,M as u,v,s as w,u as x,_ as y}; 2//# sourceMappingURL=KLtl_-8s2.js.map
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.