import e from"../_util/classNames.mjs";import{flattenChildren as t,getPropsSlot as n}from"../_util/props-util/index.mjs";import r from"../config-provider/hooks/useConfigInject.mjs";import i from"../_util/vue-types/index.mjs";import{getTransitionProps as a}from"../_util/transition.mjs";import{cloneElement as o}from"../_util/vnode.mjs";import{isPresetColor as s}from"../_util/colors.mjs";import c from"../_util/isNumeric.mjs";import l from"./style/index.mjs";import u from"./Ribbon.mjs";import d from"./ScrollNumber.mjs";import{Transition as f,computed as p,createVNode as m,defineComponent as h,ref as g,vShow as _,watch as v,withDirectives as y}from"vue";function b(){return{count:i.any.def(null),showZero:{type:Boolean,default:void 0},overflowCount:{type:Number,default:99},dot:{type:Boolean,default:void 0},prefixCls:String,scrollNumberPrefixCls:String,status:{type:String},size:{type:String,default:`default`},color:String,text:i.any,offset:Array,numberStyle:{type:Object,default:void 0},title:String}}var x=h({compatConfig:{MODE:3},name:`ABadge`,Ribbon:u,inheritAttrs:!1,props:b(),slots:Object,setup(i,{slots:u,attrs:h}){let{prefixCls:b,direction:x}=r(`badge`,i),[S,C]=l(b),w=p(()=>i.count>i.overflowCount?`${i.overflowCount}+`:i.count),T=p(()=>w.value===`0`||w.value===0),E=p(()=>i.count===null||T.value&&!i.showZero),D=p(()=>(i.status!==null&&i.status!==void 0||i.color!==null&&i.color!==void 0)&&E.value),O=p(()=>i.dot&&!T.value),k=p(()=>O.value?``:w.value),A=p(()=>(k.value===null||k.value===void 0||k.value===``||T.value&&!i.showZero)&&!O.value),j=g(i.count),M=g(k.value),N=g(O.value);v([()=>i.count,k,O],()=>{A.value||(j.value=i.count,M.value=k.value,N.value=O.value)},{immediate:!0});let P=p(()=>s(i.color,!1)),F=p(()=>({[`${b.value}-status-dot`]:D.value,[`${b.value}-status-${i.status}`]:!!i.status,[`${b.value}-color-${i.color}`]:P.value})),I=p(()=>i.color&&!P.value?{background:i.color,color:i.color}:{}),L=p(()=>({[`${b.value}-dot`]:N.value,[`${b.value}-count`]:!N.value,[`${b.value}-count-sm`]:i.size===`small`,[`${b.value}-multiple-words`]:!N.value&&M.value&&M.value.toString().length>1,[`${b.value}-status-${i.status}`]:!!i.status,[`${b.value}-color-${i.color}`]:P.value}));return()=>{let{offset:r,title:s,color:l}=i,p=h.style,g=n(u,i,`text`),v=b.value,w=j.value,T=t(u.default?.());T=T.length?T:null;let E=!!(!A.value||u.count),O=(()=>{if(!r)return{...p};let e={marginTop:c(r[1])?`${r[1]}px`:r[1]};return x.value===`rtl`?e.left=`${Number.parseInt(r[0],10)}px`:e.right=`${-Number.parseInt(r[0],10)}px`,{...e,...p}})(),k=s??(typeof w==`string`||typeof w==`number`?w:void 0),N=E||!g?null:m(`span`,{class:`${v}-status-text`},[g]),R=typeof w==`object`||w===void 0&&u.count?o(w??u.count?.(),{style:O},!1):null,z=e(v,{[`${v}-status`]:D.value,[`${v}-not-a-wrapper`]:!T,[`${v}-rtl`]:x.value===`rtl`},h.class,C.value);if(!T&&D.value){let e=O.color;return S(m(`span`,{...h,class:z,style:O},[m(`span`,{class:F.value,style:I.value},null),m(`span`,{style:{color:e},class:`${v}-status-text`},[g])]))}let B=a(T?`${v}-zoom`:``,{appear:!1}),V={...O,...i.numberStyle};return l&&!P.value&&(V=V||{},V.background=l),S(m(`span`,{...h,class:z},[T,m(f,B,{default:()=>[y(m(d,{prefixCls:i.scrollNumberPrefixCls,show:E,class:L.value,count:M.value,title:k,style:V,key:`scrollNumber`},{default:()=>[R]}),[[_,E]])]}),N]))}}});export{b as badgeProps,x as default};