import{d as _,r as O,f as o,bH as I,aE as S,h as b,o as d,i as y,D as g,L as P,k as u,v,a5 as C,a8 as $,q as D}from"./BUKpINFH.js";const A={class:"base-picture"},k=["data-error"],z=_({inheritAttrs:!1,__name:"BasePicture",props:{placeholder:{},placeholderClass:{},custom:{type:Boolean},src:{},format:{},quality:{},background:{},fit:{},modifiers:{},preset:{},provider:{},sizes:{},densities:{},preload:{},width:{},height:{},alt:{},referrerpolicy:{},usemap:{},longdesc:{},ismap:{type:Boolean},loading:{},crossorigin:{},decoding:{},nonce:{}},setup(p){const e=p,c=!1,l=O(!1),m=o(()=>Number.parseFloat(`${e.height}`)/Number.parseFloat(`${e.width}`)),t=o(()=>I().getSizes(e.src,{modifiers:{width:Number.parseFloat(`${e.width}`),height:Number.parseFloat(`${e.height}`)},sizes:e.sizes})),B=o(()=>{const{sizes:a,...s}=e;return{...S(),...s,src:t.value.src}}),L=o(()=>{var a;return((a=t.value)==null?void 0:a.srcset)===void 0?[]:t.value.srcset.split(",").map(s=>{const[r,i]=s.trim().split(" "),h=Number.parseFloat(i);return{needles:[h,h/2],url:r,width:i}})}),n=o(()=>{var a;return((a=t.value)==null?void 0:a.sizes)===void 0?[]:(t.value.sizes.split(",")??[]).map(s=>{const r=s.replace(/(.*\)\s)/,"").trim(),i=s.replace(r,"").trim();return{breakpoint:i===""?void 0:i,width:Number.parseFloat(r)}})}),f=o(()=>n.value.map(({breakpoint:a,width:s})=>({height:Math.round(s*m.value),key:a,media:a,srcset:L.value.filter(r=>r.needles.includes(s)).map(r=>`${r.url} ${r.width}`).join(", "),width:s})));return(a,s)=>(d(),b("picture",A,[(d(!0),b(g,null,P(u(f),({key:r,...i})=>(d(),b("source",v({key:r},{ref_for:!0},i),null,16))),128)),y("img",v({...u(B),...u(c)?{onerror:"this.setAttribute('data-error', 1)"}:{}},{"data-error":u(l)?1:void 0,onError:s[0]||(s[0]=r=>l.value=!0)}),null,16,k)]))}}),E=Object.assign(z,{__name:"BasePicture"});function F({brandCode:p,productType:e,issueYear:c,issueNumber:l,variation:m}){let t="https://cdn-03.tapp.dpgmedia.cloud/packshot";return t+=`/${p.toLowerCase()}`,e&&(t+=`/${e.toLowerCase()}`),l&&c?t+=`/${c}-${l}`:t+=`/${m||"latest"}`,`${t}.png`}const R=_({__name:"BaseCover",props:{brandCode:{},bundlePresentation:{default:"rotated"},bundleScale:{default:void 0},issueNumber:{default:""},issueYear:{default:""},productType:{default:void 0},variation:{default:"latest"},placeholder:{},placeholderClass:{},custom:{type:Boolean},format:{},quality:{},background:{},fit:{},modifiers:{},preset:{},provider:{},sizes:{default:""},densities:{},preload:{},width:{},height:{},alt:{},referrerpolicy:{},usemap:{},longdesc:{},ismap:{type:Boolean},loading:{},crossorigin:{},decoding:{},nonce:{}},setup(p){const e=p,c={DONDC:["DONAL","DONPO"],DONDD:["DONAL","DONEX"],DONMK:["DONAL","DONEX","DONPO"],FLWSY:["FLOW","FLWSP"],LIBBS:["LIBBO","LIBSP"],LIBPB:["LIBEL","LIBBO"],LIBPS:["LIBEL","LIBSP"],LIBPU:["LIBEL","LIBBO","LIBPZ"],LISPP:["LIBEL","LIBSP","LIBPZ"],MARPL:["MARGR","MARSP"],MASPP:["MARGR","MARSP","MARPZ"],VTWBS:["VTWON","WLSTY"]},l=o(()=>{const[,n]=Object.entries(c).find(([f])=>f===e.productType)??[];return n||[e.productType]}),m=o(()=>{const{brandCode:n,bundlePresentation:f,bundleScale:a,issueNumber:s,issueYear:r,productType:i,variation:h,...N}=e;return N}),t=o(()=>l.value.map(n=>({...m.value,key:n,src:F({brandCode:e.brandCode,productType:n,variation:e.variation,issueYear:e.issueYear,issueNumber:e.issueNumber})}))),B=o(()=>({[`base-cover--${e.bundlePresentation}`]:t.value.length>1})),L=o(()=>({"--bundle-scale":e.bundleScale??e.bundlePresentation==="rotated"?.85:.75}));return(n,f)=>{const a=E;return d(),b("figure",{class:$(["base-cover",u(B)]),style:C(u(L))},[(d(!0),b(g,null,P(u(t),({key:s,...r})=>(d(),D(a,v({key:s},{ref_for:!0},r),null,16))),128))],6)}}}),M=Object.assign(R,{__name:"BaseCover"});export{M as _}; //# sourceMappingURL=xJ4rhpuX.js.map