import{defineComponent as C,computed as P,watchEffect as S,createVNode as n}from"vue";import{getPropsSlot as $,flattenChildren as A}from"../_util/props-util/index.mjs";import{cloneElement as b}from"../_util/vnode.mjs";import k from"../config-provider/hooks/useConfigInject.mjs";import N from"../popover/index.mjs";import O from"./Avatar.mjs";import{useAvatarProviderContext as j}from"./AvatarContext.mjs";import w from"./style/index.mjs";const z=()=>({prefixCls:String,maxCount:Number,maxStyle:{type:Object,default:void 0},maxPopoverPlacement:{type:String,default:"top"},maxPopoverTrigger:String,size:{type:[Number,String,Object],default:"default"},shape:{type:String,default:"circle"}}),V=C({compatConfig:{MODE:3},name:"AAvatarGroup",inheritAttrs:!1,props:z(),setup(t,{slots:f,attrs:e}){const{prefixCls:p,direction:d}=k("avatar",t),l=P(()=>`${p.value}-group`),[m,v]=w(p);return S(()=>{const s={size:t.size,shape:t.shape};j(s)}),()=>{const{maxPopoverPlacement:s="top",maxCount:r,maxStyle:h,maxPopoverTrigger:g="hover",shape:y}=t,u={[l.value]:!0,[`${l.value}-rtl`]:d.value==="rtl",[`${e.class}`]:!!e.class,[v.value]:!0},x=$(f,t),o=A(x).map((a,c)=>b(a,{key:`avatar-key-${c}`})),i=o.length;if(r&&r<i){const a=o.slice(0,r),c=o.slice(r,i);return a.push(n(N,{key:"avatar-popover-key",content:c,trigger:g,placement:s,overlayClassName:`${l.value}-popover`},{default:()=>[n(O,{style:h,shape:y},{default:()=>[`+${i-r}`]})]})),m(n("div",{...e,class:u,style:e.style},[a]))}return m(n("div",{...e,class:u,style:e.style},[o]))}}});export{V as default,z as groupProps};
