import{u as b}from"./useDefaults-DESCdb0p-CFLjYrdG.js";import{u as y}from"./useRadiusElementClasses-DtKYQuWz-DKKObN9q.js";import{l as B,x as a,H as i,c as w,o as N,n as k,D as s,G as z}from"./index-D02r7Zsc.js";const A=B({__name:"BImg",props:{blank:{type:Boolean,default:!1},blankColor:{default:"transparent"},block:{type:Boolean,default:!1},fluid:{type:Boolean,default:!1},fluidGrow:{type:Boolean,default:!1},height:{default:void 0},tag:{default:"img"},lazy:{type:Boolean,default:!1},sizes:{default:void 0},src:{default:void 0},srcset:{default:void 0},thumbnail:{type:Boolean,default:!1},width:{default:void 0},placement:{default:void 0},rounded:{type:[Boolean,String,Number],default:!1},roundedTop:{type:[Boolean,String,Number],default:void 0},roundedBottom:{type:[Boolean,String,Number],default:void 0},roundedStart:{type:[Boolean,String,Number],default:void 0},roundedEnd:{type:[Boolean,String,Number],default:void 0}},setup(r){const e=b(r,"BImg"),n=i(()=>e.height??NaN),d=i(()=>e.width??NaN),u=y(()=>({rounded:e.rounded,roundedTop:e.roundedTop,roundedBottom:e.roundedBottom,roundedStart:e.roundedStart,roundedEnd:e.roundedEnd})),c=a(()=>typeof e.srcset=="string"?e.srcset.split(",").filter(t=>t).join(","):Array.isArray(e.srcset)?e.srcset.filter(t=>t).join(","):void 0),m=a(()=>typeof e.sizes=="string"?e.sizes.split(",").filter(t=>t).join(","):Array.isArray(e.sizes)?e.sizes.filter(t=>t).join(","):void 0),l=a(()=>{const t=Number.isNaN(d.value)?void 0:d.value,o=Number.isNaN(n.value)?void 0:n.value;if(e.blank){if(t!==void 0&&o===void 0)return{height:t,width:t};if(t===void 0&&o!==void 0)return{height:o,width:o};if(t===void 0&&o===void 0)return{height:1,width:1}}return{width:t,height:o}}),f=a(()=>h(l.value.width,l.value.height,e.blankColor)),p=a(()=>({"float-start":e.placement==="start","float-end":e.placement==="end","mx-auto":e.placement==="center"})),v=a(()=>[u.value,p.value,{"img-thumbnail":e.thumbnail,"img-fluid":e.fluid||e.fluidGrow,"w-100":e.fluidGrow,"d-block":e.block||e.placement==="center"}]),h=(t,o,g)=>`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(`<svg width="${t}" height="${o}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${o}" preserveAspectRatio="none">
    <rect width="100%" height="100%" style="fill:${g};"></rect>
    </svg>`)}`;return(t,o)=>(N(),w(z(s(e).tag),{class:k([v.value,"b-img"]),src:s(e).blank?f.value:s(e).src,width:l.value.width||void 0,height:l.value.height||void 0,srcset:s(e).blank?void 0:c.value,sizes:s(e).blank?void 0:m.value,loading:s(e).lazy?"lazy":"eager"},null,8,["class","src","width","height","srcset","sizes","loading"]))}});export{A as _};
