import{c as D,j as u,ab as I,ac as F,a0 as m,a9 as l,r as g,aD as M,a7 as N,fP as j,aF as z,ak as U}from"./index-cc84e56a.js";const L=D(u("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"}),"Person");function _(a){return I("MuiAvatar",a)}F("MuiAvatar",["root","colorDefault","circular","rounded","square","img","fallback"]);const q=["alt","children","className","component","slots","slotProps","imgProps","sizes","src","srcSet","variant"],E=a=>{const{classes:t,variant:e,colorDefault:r}=a;return U({root:["root",e,r&&"colorDefault"],img:["img"],fallback:["fallback"]},_,t)},T=m("div",{name:"MuiAvatar",slot:"Root",overridesResolver:(a,t)=>{const{ownerState:e}=a;return[t.root,t[e.variant],e.colorDefault&&t.colorDefault]}})(({theme:a})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:40,height:40,fontFamily:a.typography.fontFamily,fontSize:a.typography.pxToRem(20),lineHeight:1,borderRadius:"50%",overflow:"hidden",userSelect:"none",variants:[{props:{variant:"rounded"},style:{borderRadius:(a.vars||a).shape.borderRadius}},{props:{variant:"square"},style:{borderRadius:0}},{props:{colorDefault:!0},style:l({color:(a.vars||a).palette.background.default},a.vars?{backgroundColor:a.vars.palette.Avatar.defaultBg}:l({backgroundColor:a.palette.grey[400]},a.applyStyles("dark",{backgroundColor:a.palette.grey[600]})))}]})),B=m("img",{name:"MuiAvatar",slot:"Img",overridesResolver:(a,t)=>t.img})({width:"100%",height:"100%",textAlign:"center",objectFit:"cover",color:"transparent",textIndent:1e4}),H=m(L,{name:"MuiAvatar",slot:"Fallback",overridesResolver:(a,t)=>t.fallback})({width:"75%",height:"75%"});function W({crossOrigin:a,referrerPolicy:t,src:e,srcSet:r}){const[n,s]=g.useState(!1);return g.useEffect(()=>{if(!e&&!r)return;s(!1);let i=!0;const o=new Image;return o.onload=()=>{i&&s("loaded")},o.onerror=()=>{i&&s("error")},o.crossOrigin=a,o.referrerPolicy=t,o.src=e,r&&(o.srcset=r),()=>{i=!1}},[a,t,e,r]),n}const $=g.forwardRef(function(t,e){const r=M({props:t,name:"MuiAvatar"}),{alt:n,children:s,className:i,component:o="div",slots:A={},slotProps:k={},imgProps:y,sizes:P,src:p,srcSet:f,variant:x="circular"}=r,S=N(r,q);let c=null;const w=W(l({},y,{src:p,srcSet:f})),b=p||f,h=b&&w!=="error",d=l({},r,{colorDefault:!h,component:o,variant:x}),v=E(d),[R,C]=j("img",{className:v.img,elementType:B,externalForwardedProps:{slots:A,slotProps:{img:l({},y,k.img)}},additionalProps:{alt:n,src:p,srcSet:f,sizes:P},ownerState:d});return h?c=u(R,l({},C)):s||s===0?c=s:b&&n?c=n[0]:c=u(H,{ownerState:d,className:v.fallback}),u(T,l({as:o,ownerState:d,className:z(v.root,i),ref:e},S,{children:c}))}),J=$;export{J as A};
