import{g as C,E as r,G as z,j as t,H as b,O as i,r as k,D as S,o as l,c as o,L as $,y as n,t as f,l as h,I as j}from"./entry.eb978f24.js";import{_ as w}from"./_plugin-vue_export-helper.c27b6911.js";const A=C({inheritAttrs:!1,props:{src:{type:[String,Boolean],default:null},alt:{type:String,default:null},text:{type:String,default:null},size:{type:String,default:()=>r.ui.avatar.default.size,validator(e){return Object.keys(r.ui.avatar.size).includes(e)}},chipColor:{type:String,default:()=>r.ui.avatar.default.chipColor,validator(e){return["gray",...r.ui.colors].includes(e)}},chipPosition:{type:String,default:()=>r.ui.avatar.default.chipPosition,validator(e){return Object.keys(r.ui.avatar.chip.position).includes(e)}},chipText:{type:[String,Number],default:null},ui:{type:Object,default:()=>r.ui.avatar}},setup(e){const u=z(),a=t(()=>b({},e.ui,u.ui.avatar)),c=t(()=>i(a.value.wrapper,a.value.background,a.value.rounded,a.value.size[e.size])),p=t(()=>i(a.value.rounded,a.value.size[e.size])),d=t(()=>i(a.value.chip.base,a.value.chip.size[e.size],a.value.chip.position[e.chipPosition],a.value.chip.background.replaceAll("{color}",e.chipColor))),v=t(()=>typeof e.src=="boolean"?null:e.src),g=t(()=>(e.alt||"").split(" ").map(y=>y.charAt(0)).join("").substring(0,2)),s=k(!1);S(()=>e.src,()=>{s.value&&(s.value=!1)});function m(){s.value=!0}return{wrapperClass:c,avatarClass:p,chipClass:d,url:v,placeholder:g,error:s,onError:m}}}),E=["alt","src","onerror"];function O(e,u,a,c,p,d){return l(),o("span",{class:n(e.wrapperClass)},[e.url&&!e.error?(l(),o("img",$({key:0,class:e.avatarClass,alt:e.alt,src:e.url},e.$attrs,{onerror:()=>e.onError()}),null,16,E)):e.text||e.placeholder?(l(),o("span",{key:1,class:n(e.ui.placeholder)},f(e.text||e.placeholder),3)):h("",!0),e.chipColor?(l(),o("span",{key:2,class:n(e.chipClass)},f(e.chipText),3)):h("",!0),j(e.$slots,"default")],2)}const N=w(A,[["render",O]]);export{N as default};
