import{a3 as X,a4 as N,G as g,ag as K,af as q,I as J,d as V,E as $,a9 as Q,g as U,aI as Y,dE as Z,h as F,J as ee,am as B,bO as te,b as z,ad as ae,ac as L,ao as re,dB as ne}from"./index.e310aebb.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},a=new Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="6120ebc5-454b-4662-ba65-5e8ce6647412",e._sentryDebugIdIdentifier="sentry-dbid-6120ebc5-454b-4662-ba65-5e8ce6647412")}catch{}})();const oe=e=>{const{antCls:a,componentCls:r,iconCls:n,avatarBg:i,avatarColor:S,containerSize:l,containerSizeLG:c,containerSizeSM:v,textFontSize:h,textFontSizeLG:b,textFontSizeSM:w,borderRadius:C,borderRadiusLG:s,borderRadiusSM:A,lineWidth:u,lineType:I}=e,p=(m,t,o)=>({width:m,height:m,lineHeight:`${m-u*2}px`,borderRadius:"50%",[`&${r}-square`]:{borderRadius:o},[`${r}-string`]:{position:"absolute",left:{_skip_check_:!0,value:"50%"},transformOrigin:"0 center"},[`&${r}-icon`]:{fontSize:t,[`> ${n}`]:{margin:0}}});return{[r]:g(g(g(g({},K(e)),{position:"relative",display:"inline-block",overflow:"hidden",color:S,whiteSpace:"nowrap",textAlign:"center",verticalAlign:"middle",background:i,border:`${u}px ${I} transparent`,["&-image"]:{background:"transparent"},[`${a}-image-img`]:{display:"block"}}),p(l,h,C)),{["&-lg"]:g({},p(c,b,s)),["&-sm"]:g({},p(v,w,A)),"> img":{display:"block",width:"100%",height:"100%",objectFit:"cover"}})}},se=e=>{const{componentCls:a,groupBorderColor:r,groupOverlapping:n,groupSpace:i}=e;return{[`${a}-group`]:{display:"inline-flex",[`${a}`]:{borderColor:r},["> *:not(:first-child)"]:{marginInlineStart:n}},[`${a}-group-popover`]:{[`${a} + ${a}`]:{marginInlineStart:i}}}},ie=X("Avatar",e=>{const{colorTextLightSolid:a,colorTextPlaceholder:r}=e,n=N(e,{avatarBg:r,avatarColor:a});return[oe(n),se(n)]},e=>{const{controlHeight:a,controlHeightLG:r,controlHeightSM:n,fontSize:i,fontSizeLG:S,fontSizeXL:l,fontSizeHeading3:c,marginXS:v,marginXXS:h,colorBorderBg:b}=e;return{containerSize:a,containerSizeLG:r,containerSizeSM:n,textFontSize:Math.round((S+l)/2),textFontSizeLG:c,textFontSizeSM:i,groupSpace:h,groupOverlapping:-v,groupBorderColor:b}}),M=Symbol("AvatarContextKey"),le=()=>q(M,{}),ge=e=>J(M,e),ce=()=>({prefixCls:String,shape:{type:String,default:"circle"},size:{type:[Number,String,Object],default:()=>"default"},src:String,srcset:String,icon:re.any,alt:String,gap:Number,draggable:{type:Boolean,default:void 0},crossOrigin:String,loadError:{type:Function}}),ue=V({compatConfig:{MODE:3},name:"AAvatar",inheritAttrs:!1,props:ce(),slots:Object,setup(e,a){let{slots:r,attrs:n}=a;const i=$(!0),S=$(!1),l=$(1),c=$(null),v=$(null),{prefixCls:h}=Q("avatar",e),[b,w]=ie(h),C=le(),s=U(()=>e.size==="default"?C.size:e.size),A=Y(),u=Z(()=>{if(typeof e.size!="object")return;const t=ne.find(f=>A.value[f]);return e.size[t]}),I=t=>u.value?{width:`${u.value}px`,height:`${u.value}px`,lineHeight:`${u.value}px`,fontSize:`${t?u.value/2:18}px`}:{},p=()=>{if(!c.value||!v.value)return;const t=c.value.offsetWidth,o=v.value.offsetWidth;if(t!==0&&o!==0){const{gap:f=4}=e;f*2<o&&(l.value=o-f*2<t?(o-f*2)/t:1)}},m=()=>{const{loadError:t}=e;(t==null?void 0:t())!==!1&&(i.value=!1)};return F(()=>e.src,()=>{B(()=>{i.value=!0,l.value=1})}),F(()=>e.gap,()=>{B(()=>{p()})}),ee(()=>{B(()=>{p(),S.value=!0})}),()=>{var t,o;const{shape:f,src:k,alt:O,srcset:E,draggable:G,crossOrigin:H}=e,T=(t=C.shape)!==null&&t!==void 0?t:f,y=te(r,e,"icon"),d=h.value,j={[`${n.class}`]:!!n.class,[d]:!0,[`${d}-lg`]:s.value==="large",[`${d}-sm`]:s.value==="small",[`${d}-${T}`]:!0,[`${d}-image`]:k&&i.value,[`${d}-icon`]:y,[w.value]:!0},P=typeof s.value=="number"?{width:`${s.value}px`,height:`${s.value}px`,lineHeight:`${s.value}px`,fontSize:y?`${s.value/2}px`:"18px"}:{},_=(o=r.default)===null||o===void 0?void 0:o.call(r);let x;if(k&&i.value)x=z("img",{draggable:G,src:k,srcset:E,onError:m,alt:O,crossorigin:H},null);else if(y)x=y;else if(S.value||l.value!==1){const R=`scale(${l.value}) translateX(-50%)`,W={msTransform:R,WebkitTransform:R,transform:R},D=typeof s.value=="number"?{lineHeight:`${s.value}px`}:{};x=z(ae,{onResize:p},{default:()=>[z("span",{class:`${d}-string`,ref:c,style:g(g({},D),W)},[_])]})}else x=z("span",{class:`${d}-string`,ref:c,style:{opacity:0}},[_]);return b(z("span",L(L({},n),{},{ref:v,class:j,style:[P,I(!!y),n.style]}),[x]))}}}),ve=ue;export{ve as A,ge as a,ie as u};
//# sourceMappingURL=Avatar.004ed8a2.js.map
