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-def636a4.js";import{c as q}from"./createSvgIcon-ff487f53.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 B(t){return M("MuiAvatar",t)}const W=N("MuiAvatar",["root","colorDefault","circular","rounded","square","img","fallback"]),H=t=>{const{classes:a,variant:o,colorDefault:e}=t;return E({root:["root",o,e&&"colorDefault"],img:["img"],fallback:["fallback"]},B,a)},$=y("div",{name:"MuiAvatar",slot:"Root",overridesResolver:(t,a)=>{const{ownerState:o}=t;return[a.root,a[o.variant],o.colorDefault&&a.colorDefault]}})(T(({theme:t})=>({position:"relative",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:40,height:40,fontFamily:t.typography.fontFamily,fontSize:t.typography.pxToRem(20),lineHeight:1,borderRadius:"50%",overflow:"hidden",userSelect:"none",variants:[{props:{variant:"rounded"},style:{borderRadius:(t.vars||t).shape.borderRadius}},{props:{variant:"square"},style:{borderRadius:0}},{props:{colorDefault:!0},style:{color:(t.vars||t).palette.background.default,...t.vars?{backgroundColor:t.vars.palette.Avatar.defaultBg}:{backgroundColor:t.palette.grey[400],...t.applyStyles("dark",{backgroundColor:t.palette.grey[600]})}}}]}))),G=y("img",{name:"MuiAvatar",slot:"Img"})({width:"100%",height:"100%",textAlign:"center",objectFit:"cover",color:"transparent",textIndent:1e4}),J=y(L,{name:"MuiAvatar",slot:"Fallback"})({width:"75%",height:"75%"});function K({crossOrigin:t,referrerPolicy:a,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=t,r.referrerPolicy=a,r.src=o,e&&(r.srcset=e),()=>{c=!1}},[t,a,o,e]),n}const O=b.forwardRef(function(a,o){const e=z({props:a,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=K({...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:$,externalForwardedProps:{slots:p,slotProps:i,component:r,...S},ownerState:l}),[R,j]=v("img",{className:m.img,elementType:G,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:J,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})}),X=O;export{X as A,W as a};
