import{bi as U,bh as k,d as D,bj as L,r as i,bk as T,bl as V,j as C,bm as y,bn as z}from"./index-43bf7a1c.js";import{a as F,A as I}from"./Avatar-ec89b895.js";function q(a){return k("MuiAvatarGroup",a)}const B=U("MuiAvatarGroup",["root","avatar"]),H=B,d={small:-16,medium:-8},J=a=>{const{classes:t}=a;return z({root:["root"],avatar:["avatar"]},q,t)},K=D("div",{name:"MuiAvatarGroup",slot:"Root",overridesResolver:(a,t)=>[{[`& .${H.avatar}`]:t.avatar},t.root]})(L(({theme:a})=>({display:"flex",flexDirection:"row-reverse",[`& .${F.root}`]:{border:`2px solid ${(a.vars||a).palette.background.default}`,boxSizing:"content-box",marginLeft:"var(--AvatarGroup-spacing, -8px)","&:last-child":{marginLeft:0}}}))),O=i.forwardRef(function(t,A){const x=T({props:t,name:"MuiAvatarGroup"}),{children:S,className:M,component:f="div",componentsProps:o,max:p=5,renderSurplus:g,slotProps:G={},slots:P={},spacing:$="medium",total:N,variant:c="circular",...h}=x;let r=p<2?2:p;const s={...x,max:p,spacing:$,component:f,variant:c},u=J(s),v=i.Children.toArray(S).filter(e=>i.isValidElement(e)),n=N||v.length;n===r&&(r+=1),r=Math.min(n+1,r);const b=Math.min(v.length,r-1),m=Math.max(n-r,n-b,0),j=g?g(m):`+${m}`;let l;s.spacing&&d[s.spacing]!==void 0?l=d[s.spacing]:s.spacing===0?l=0:l=-s.spacing||d.medium;const w={slots:P,slotProps:{surplus:G.additionalAvatar??(o==null?void 0:o.additionalAvatar),...o,...G}},[E,R]=V("surplus",{elementType:I,externalForwardedProps:w,className:u.avatar,ownerState:s,additionalProps:{variant:c}});return C.jsxs(K,{as:f,ownerState:s,className:y(u.root,M),ref:A,...h,style:{"--AvatarGroup-spacing":`${l}px`,...h.style},children:[m?C.jsx(E,{...R,children:j}):null,v.slice(0,b).reverse().map(e=>i.cloneElement(e,{className:y(e.props.className,u.avatar),variant:e.props.variant||c}))]})}),X=O;export{X as A};
