import{j as u,bh as M,bi as N,d as y,bj as T,r as b,bk as z,bl as v,bm as U,bn as E}from"./index-d2b25495.js";import{c as q}from"./createSvgIcon-e39ae511.js";const L=q(u.jsx("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"}));function $(a){return M("MuiAvatar",a)}const B=N("MuiAvatar",["root","colorDefault","circular","rounded","square","img","fallback"]),X=B,H=a=>{const{classes:t,variant:o,colorDefault:e}=a;return E({root:["root",o,e&&"colorDefault"],img:["img"],fallback:["fallback"]},$,t)},G=y("div",{name:"MuiAvatar",slot:"Root",overridesResolver:(a,t)=>{const{ownerState:o}=a;return[t.root,t[o.variant],o.colorDefault&&t.colorDefault]}})(T(({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:{color:(a.vars||a).palette.background.default,...a.vars?{backgroundColor:a.vars.palette.Avatar.defaultBg}:{backgroundColor:a.palette.grey[400],...a.applyStyles("dark",{backgroundColor:a.palette.grey[600]})}}}]}))),J=y("img",{name:"MuiAvatar",slot:"Img"})({width:"100%",height:"100%",textAlign:"center",objectFit:"cover",color:"transparent",textIndent:1e4}),K=y(L,{name:"MuiAvatar",slot:"Fallback"})({width:"75%",height:"75%"});function O({crossOrigin:a,referrerPolicy:t,src:o,srcSet:e}){const[n,s]=b.useState(!1);return b.useEffect(()=>{if(!o&&!e)return;s(!1);let c=!0;const r=new Image;return r.onload=()=>{c&&s("loaded")},r.onerror=()=>{c&&s("error")},r.crossOrigin=a,r.referrerPolicy=t,r.src=o,e&&(r.srcset=e),()=>{c=!1}},[a,t,o,e]),n}const Q=b.forwardRef(function(t,o){const e=z({props:t,name:"MuiAvatar"}),{alt:n,children:s,className:c,component:r="div",slots:p={},slotProps:i={},imgProps:h,sizes:A,src:f,srcSet:g,variant:P="circular",...S}=e;let d=null;const l={...e,component:r,variant:P},w=O({...h,...typeof i.img=="function"?i.img(l):i.img,src:f,srcSet:g}),x=f||g,k=x&&w!=="error";l.colorDefault=!k,delete l.ownerState;const m=H(l),[C,F]=v("root",{ref:o,className:U(m.root,c),elementType:G,externalForwardedProps:{slots:p,slotProps:i,component:r,...S},ownerState:l}),[R,j]=v("img",{className:m.img,elementType:J,externalForwardedProps:{slots:p,slotProps:{img:{...h,...i.img}}},additionalProps:{alt:n,src:f,srcSet:g,sizes:A},ownerState:l}),[I,D]=v("fallback",{className:m.fallback,elementType:K,externalForwardedProps:{slots:p,slotProps:i},shouldForwardComponentProp:!0,ownerState:l});return k?d=u.jsx(R,{...j}):s||s===0?d=s:x&&n?d=n[0]:d=u.jsx(I,{...D}),u.jsx(C,{...F,children:d})}),Y=Q;export{Y as A,X as a};
