import{$r as e,Bi as t,Br as n,Ca as r,Ea as i,Ei as a,Fi as o,Li as s,Ni as c,On as l,Qr as u,Ri as d,Yr as f,Zr as p,_i as m,ci as h,di as g,ti as _}from"./index-DThTpSPU.js";var v=i(r()),y=e=>{let{prefixCls:n,value:r,current:i,offset:a=0}=e,o;return a&&(o={position:`absolute`,top:`${a}00%`,left:0}),v.createElement(`span`,{style:o,className:t(`${n}-only-unit`,{current:i})},r)};function b(e,t,n){let r=e,i=0;for(;(r+10)%10!==t;)r+=n,i+=n;return i}var x=e=>{let{prefixCls:t,count:n,value:r}=e,i=Number(r),a=Math.abs(n),[o,s]=v.useState(i),[c,l]=v.useState(a),u=()=>{s(i),l(a)};v.useEffect(()=>{let e=setTimeout(u,1e3);return()=>clearTimeout(e)},[i]);let d,f;if(o===i||Number.isNaN(i)||Number.isNaN(o))d=[v.createElement(y,{...e,key:i,current:!0})],f={transition:`none`};else{d=[];let t=i+10,n=[];for(let e=i;e<=t;e+=1)n.push(e);let r=ce%10===o);d=(r<0?n.slice(0,s+1):n.slice(s)).map((t,n)=>{let i=t%10;return v.createElement(y,{...e,key:t,value:i,offset:r<0?n-s:n,current:n===s})}),f={transform:`translateY(${-b(o,i,r)}00%)`}}return v.createElement(`span`,{className:`${t}-only`,style:f,onTransitionEnd:u},d)},S=v.forwardRef((e,r)=>{let{prefixCls:i,count:a,className:o,motionClassName:c,style:l,title:u,show:d,component:f=`sup`,children:p,...m}=e,{getPrefixCls:h}=v.useContext(s),g=h(`scroll-number`,i),_={...m,"data-show":d,style:l,className:t(g,o,c),title:u},y=a;if(a&&Number(a)%1==0){let e=String(a).split(``);y=v.createElement(`bdi`,null,e.map((t,n)=>v.createElement(x,{prefixCls:g,count:Number(a),value:t,key:e.length-n})))}return l?.borderColor&&(_.style={...l,boxShadow:`0 0 0 1px ${l.borderColor} inset`}),p?n(p,e=>({className:t(`${g}-custom-component`,e?.className,c)})):v.createElement(f,{..._,ref:r},y)}),C=new c(`antStatusProcessing`,{"0%":{transform:`scale(0.8)`,opacity:.5},"100%":{transform:`scale(2.4)`,opacity:0}}),w=new c(`antZoomBadgeIn`,{"0%":{transform:`scale(0) translate(50%, -50%)`,opacity:0},"100%":{transform:`scale(1) translate(50%, -50%)`}}),T=new c(`antZoomBadgeOut`,{"0%":{transform:`scale(1) translate(50%, -50%)`},"100%":{transform:`scale(0) translate(50%, -50%)`,opacity:0}}),E=new c(`antNoWrapperZoomBadgeIn`,{"0%":{transform:`scale(0)`,opacity:0},"100%":{transform:`scale(1)`}}),D=new c(`antNoWrapperZoomBadgeOut`,{"0%":{transform:`scale(1)`},"100%":{transform:`scale(0)`,opacity:0}}),O=new c(`antBadgeLoadingCircle`,{"0%":{transformOrigin:`50%`},"100%":{transform:`translate(50%, -50%) rotate(360deg)`,transformOrigin:`50%`}}),k=e=>{let{componentCls:t,iconCls:n,antCls:r,badgeShadowSize:i,textFontSize:a,textFontSizeSM:s,statusSize:c,dotSize:l,textFontWeight:u,indicatorHeight:d,indicatorHeightSM:f,marginXS:p,calc:g}=e,_=`${r}-scroll-number`,v=h(e,(e,{darkColor:n})=>({[`&${t} ${t}-color-${e}`]:{background:n,[`&:not(${t}-count)`]:{color:n},"a:hover &":{background:n}}}));return{[t]:{...m(e),position:`relative`,display:`inline-block`,width:`fit-content`,lineHeight:1,[`${t}-count`]:{display:`inline-flex`,justifyContent:`center`,zIndex:e.indicatorZIndex,minWidth:d,height:d,color:e.badgeTextColor,fontWeight:u,fontSize:a,lineHeight:o(d),whiteSpace:`nowrap`,textAlign:`center`,background:e.badgeColor,borderRadius:g(d).div(2).equal(),boxShadow:`0 0 0 ${o(i)} ${e.badgeShadowColor}`,transition:`background-color ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:f,height:f,fontSize:s,lineHeight:o(f),borderRadius:g(f).div(2).equal()},[`${t}-multiple-words`]:{paddingInline:e.paddingInline,bdi:{unicodeBidi:`plaintext`}},[`${t}-dot`]:{zIndex:e.indicatorZIndex,width:l,minWidth:l,height:l,background:e.badgeColor,borderRadius:`100%`,boxShadow:`0 0 0 ${o(i)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${_}-custom-component`]:{position:`absolute`,top:0,insetInlineEnd:0,transform:`translate(50%, -50%)`,transformOrigin:`100% 0%`,[`&${n}-spin`]:{animationName:O,animationDuration:`1s`,animationIterationCount:`infinite`,animationTimingFunction:`linear`}},[`&${t}-status`]:{lineHeight:`inherit`,verticalAlign:`baseline`,[`${t}-status-dot`]:{position:`relative`,top:-1,display:`inline-block`,width:c,height:c,verticalAlign:`middle`,borderRadius:`50%`},[`${t}-status-success`]:{backgroundColor:e.colorSuccess},[`${t}-status-processing`]:{overflow:`visible`,color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:`currentcolor`,"&::after":{position:`absolute`,top:0,insetInlineStart:0,width:`100%`,height:`100%`,borderWidth:i,borderStyle:`solid`,borderColor:`inherit`,borderRadius:`50%`,animationName:C,animationDuration:e.badgeProcessingDuration,animationIterationCount:`infinite`,animationTimingFunction:`ease-in-out`,content:`""`}},[`${t}-status-default`]:{backgroundColor:e.colorTextPlaceholder},[`${t}-status-error`]:{backgroundColor:e.colorError},[`${t}-status-warning`]:{backgroundColor:e.colorWarning},[`${t}-status-text`]:{marginInlineStart:p,color:e.colorText,fontSize:e.fontSize}},...v,[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:w,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:`both`},[`${t}-zoom-leave`]:{animationName:T,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:`both`},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:E,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:D,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:`middle`},[`${_}-custom-component, ${t}-count`]:{transform:`none`},[`${_}-custom-component, ${_}`]:{position:`relative`,top:`auto`,display:`block`,transformOrigin:`50% 50%`}},[_]:{overflow:`hidden`,transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${_}-only`]:{position:`relative`,display:`inline-block`,height:d,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:`preserve-3d`,WebkitBackfaceVisibility:`hidden`,[`> p${_}-only-unit`]:{height:d,margin:0,WebkitTransformStyle:`preserve-3d`,WebkitBackfaceVisibility:`hidden`}},[`${_}-symbol`]:{verticalAlign:`top`}},"&-rtl":{direction:`rtl`,[`${t}-count, ${t}-dot, ${_}-custom-component`]:{transform:`translate(-50%, -50%)`}}}}},A=e=>{let{fontHeight:t,lineWidth:n,marginXS:r,colorBorderBg:i}=e,o=t,s=n,c=e.colorTextLightSolid,l=e.colorError,u=e.colorErrorHover;return a(e,{badgeFontHeight:o,badgeShadowSize:s,badgeTextColor:c,badgeColor:l,badgeColorHover:u,badgeShadowColor:i,badgeProcessingDuration:`1.2s`,badgeRibbonOffset:r,badgeRibbonCornerTransform:`scaleY(0.75)`,badgeRibbonCornerFilter:`brightness(75%)`})},j=e=>{let{fontSize:t,lineHeight:n,fontSizeSM:r,lineWidth:i,paddingXS:a}=e;return{indicatorZIndex:`auto`,indicatorHeight:Math.round(t*n)-2*i,indicatorHeightSM:t,dotSize:r/2,textFontSize:r,textFontSizeSM:r,textFontWeight:`normal`,statusSize:r/2,paddingInline:a}},M=g(`Badge`,e=>k(A(e)),j),N=v.forwardRef((r,i)=>{let{prefixCls:a,scrollNumberPrefixCls:o,children:s,status:c,text:m,color:h,count:g=null,overflowCount:y=99,dot:b=!1,size:x=`medium`,title:C,offset:w,style:T,className:E,rootClassName:D,classNames:O,styles:k,showZero:A=!1,...j}=r,{getPrefixCls:N,direction:P,className:F,style:I,classNames:L,styles:ee}=d(`badge`),R=N(`badge`,a),[te,ne]=M(R),re={...r,overflowCount:y,size:x,dot:b,showZero:A},[z,B]=f([L,O],[ee,k],{props:re}),V=g>y?`${y}+`:g,H=V===`0`||V===0||m===`0`||m===0,U=g===null||H&&!A,W=(p(c)||p(h))&&U,ie=p(c)||!H,G=b&&!H,K=G?``:V,q=(0,v.useMemo)(()=>((!p(K)||K===``)&&(!p(m)||m===``)||H&&!A)&&!G,[K,H,A,G,m]),J=(0,v.useRef)(g);q||(J.current=g);let Y=J.current,ae=(0,v.useRef)(K);q||(ae.current=K);let X=ae.current,oe=(0,v.useRef)(G);q||(oe.current=G);let Z=(0,v.useMemo)(()=>{if(!w)return{...I,...T};let e=Number.parseInt(w[0],10);return{marginTop:w[1],insetInlineEnd:-e,...I,...T}},[w,T,I]),se=C??(typeof Y==`string`||u(Y)?Y:void 0),ce=!q&&(m===0?A:!!m&&m!==!0),le=ce?v.createElement(`span`,{className:`${R}-status-text`},m):null,ue=e(Y)?n(Y,e=>({style:{...Z,...e.style}})):void 0,Q=l(h,!1),de=t(z.indicator,{[`${R}-status-dot`]:W,[`${R}-status-${c}`]:!!c,[`${R}-color-${h}`]:Q}),$={};h&&!Q&&($.color=h,$.background=h);let fe=t(R,{[`${R}-status`]:W,[`${R}-not-a-wrapper`]:!s,[`${R}-rtl`]:P===`rtl`},E,D,F,z.root,te,ne);if(!s&&W&&(m||ie||!U)){let e=Z.color;return v.createElement(`span`,{ref:i,...j,className:fe,style:{...B.root,...Z}},v.createElement(`span`,{className:de,style:{...B.indicator,...$}}),ce&&v.createElement(`span`,{style:{color:e},className:`${R}-status-text`},m))}return v.createElement(`span`,{ref:i,...j,className:fe,style:B.root},s,v.createElement(_,{visible:!q,motionName:`${R}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:e})=>{let n=N(`scroll-number`,o),r=oe.current,i=t(z.indicator,{[`${R}-dot`]:r,[`${R}-count`]:!r,[`${R}-count-sm`]:x===`small`,[`${R}-multiple-words`]:!r&&X&&X.toString().length>1,[`${R}-status-${c}`]:!!c,[`${R}-color-${h}`]:Q}),a={...B.indicator,...Z};return h&&!Q&&(a||={},a.background=h),v.createElement(S,{prefixCls:n,show:!q,motionClassName:e,className:i,count:X,title:se,style:a,key:`scrollNumber`},ue)}),le)}),P=e=>{let{antCls:t,badgeFontHeight:n,marginXS:r,badgeRibbonOffset:i,calc:a}=e,s=`${t}-ribbon`,c=`${t}-ribbon-wrapper`,l=h(e,(e,{darkColor:t})=>({[`&${s}-color-${e}`]:{background:t,color:t}}));return{[c]:{position:`relative`},[s]:{...m(e),position:`absolute`,top:r,padding:`0 ${o(e.paddingXS)}`,color:e.colorPrimary,lineHeight:o(n),whiteSpace:`nowrap`,backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${s}-content`]:{color:e.badgeTextColor},[`${s}-corner`]:{position:`absolute`,top:`100%`,width:i,height:i,color:`currentcolor`,border:`${o(a(i).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:`top`,filter:e.badgeRibbonCornerFilter},...l,[`&${s}-placement-end`]:{insetInlineEnd:a(i).mul(-1).equal(),borderEndEndRadius:0,[`${s}-corner`]:{insetInlineEnd:0,borderInlineEndColor:`transparent`,borderBlockEndColor:`transparent`}},[`&${s}-placement-start`]:{insetInlineStart:a(i).mul(-1).equal(),borderEndStartRadius:0,[`${s}-corner`]:{insetInlineStart:0,borderBlockEndColor:`transparent`,borderInlineStartColor:`transparent`}},"&-rtl":{direction:`rtl`}}}},F=g([`Badge`,`Ribbon`],e=>P(A(e)),j),I=e=>{let{className:n,prefixCls:r,style:i,color:a,children:o,text:s,placement:c=`end`,rootClassName:u,styles:p,classNames:m}=e,{getPrefixCls:h,direction:g,className:_,style:y,classNames:b,styles:x}=d(`ribbon`),S=h(`ribbon`,r),C=`${S}-wrapper`,[w,T]=F(S,C),E={...e,placement:c},[D,O]=f([b,m],[x,p],{props:E}),k=l(a,!1),A=t(S,`${S}-placement-${c}`,{[`${S}-rtl`]:g===`rtl`,[`${S}-color-${a}`]:k},n,_,D.indicator),j={},M={};return a&&!k&&(j.background=a,M.color=a),v.createElement(`div`,{className:t(C,u,w,T,D.root),style:O.root},o,v.createElement(`div`,{className:t(A,w),style:{...j,...O.indicator,...y,...i}},v.createElement(`span`,{className:t(`${S}-content`,D.content),style:O.content},s),v.createElement(`div`,{className:`${S}-corner`,style:M})))},L=N;L.Ribbon=I;export{L as t};