import{j as d,cH as P,cG as I,f as g,cJ as j,r as v,cK as D,cV as M,cL as F,cM as N}from"./index-4dfc510b.js";import{c as z}from"./Grow-a7315f12.js";const U=z(d.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"}),"Person");function E(a){return P("MuiAvatar",a)}const V=I("MuiAvatar",["root","colorDefault","circular","rounded","square","img","fallback"]),L=a=>{const{classes:e,variant:t,colorDefault:r}=a;return N({root:["root",t,r&&"colorDefault"],img:["img"],fallback:["fallback"]},E,e)},T=g("div",{name:"MuiAvatar",slot:"Root",overridesResolver:(a,e)=>{const{ownerState:t}=a;return[e.root,e[t.variant],t.colorDefault&&e.colorDefault]}})(j(({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]})}}}]}))),q=g("img",{name:"MuiAvatar",slot:"Img",overridesResolver:(a,e)=>e.img})({width:"100%",height:"100%",textAlign:"center",objectFit:"cover",color:"transparent",textIndent:1e4}),H=g(U,{name:"MuiAvatar",slot:"Fallback",overridesResolver:(a,e)=>e.fallback})({width:"75%",height:"75%"});function B({crossOrigin:a,referrerPolicy:e,src:t,srcSet:r}){const[l,s]=v.useState(!1);return v.useEffect(()=>{if(!t&&!r)return;s(!1);let n=!0;const o=new Image;return o.onload=()=>{n&&s("loaded")},o.onerror=()=>{n&&s("error")},o.crossOrigin=a,o.referrerPolicy=e,o.src=t,r&&(o.srcset=r),()=>{n=!1}},[a,e,t,r]),l}const G=v.forwardRef(function(e,t){const r=D({props:e,name:"MuiAvatar"}),{alt:l,children:s,className:n,component:o="div",slots:A={},slotProps:h={},imgProps:m,sizes:x,src:u,srcSet:p,variant:k="circular",...w}=r;let i=null;const R=B({...m,src:u,srcSet:p}),y=u||p,b=y&&R!=="error",c={...r,colorDefault:!b,component:o,variant:k};delete c.ownerState;const f=L(c),[S,C]=M("img",{className:f.img,elementType:q,externalForwardedProps:{slots:A,slotProps:{img:{...m,...h.img}}},additionalProps:{alt:l,src:u,srcSet:p,sizes:x},ownerState:c});return b?i=d.jsx(S,{...C}):s||s===0?i=s:y&&l?i=l[0]:i=d.jsx(H,{ownerState:c,className:f.fallback}),d.jsx(T,{as:o,className:F(f.root,n),ref:t,...w,ownerState:c,children:i})}),$=G;export{$ as A,V as a};
