import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{isNil as t,camelCase as o}from"es-toolkit";import{getStyle as a}from"../../helpers/typesciptCssModulesHelper.js";import{getTestId as r,ComponentDefaultTestId as s}from"../../tests/testIds.js";import i from"classnames";import l,{useMemo as n,useCallback as c}from"react";import{ElementAllowedColor as m}from"../../utils/colors-vars-map.js";import{getElementColor as d}from"../../types/Colors.js";import{AvatarType as p,AvatarSize as u}from"./AvatarConstants.js";import b from"./AvatarBadge.js";import g from"./AvatarContent.js";import f from"../Tooltip/Tooltip.js";import{ClickableWrapper as v}from"@vibe/clickable/mockedClassNames";import{withStaticPropsWithoutForwardRef as h}from"../../types/withStaticProps.js";import j from"./Avatar.module.scss.js";import{ComponentVibeId as k}from"../../tests/constants.js";var C=h((function(m){var p=m.id,u=m.type,h=void 0===u?"text":u,C=m.className,E=m.avatarContentWrapperClassName,y=m.textClassName,N=void 0===y?"":y,B=m.size,A=void 0===B?"large":B,x=m.src,P=m.icon,T=m.text,z=m.tooltipProps,O=m.ariaLabel,w=m.withoutTooltip,L=void 0!==w&&w,R=m.role,I=m.backgroundColor,H=void 0===I?"chili-blue":I,q=m.square,S=m.disabled,V=m.tabIndex,W=m.ariaHidden,_=void 0!==W&&W,D=m.topLeftBadgeProps,M=m.topRightBadgeProps,F=m.bottomLeftBadgeProps,G=m.bottomRightBadgeProps,J=m.withoutBorder,K=void 0!==J&&J,Q=m.customSize,U=void 0===Q?null:Q,X=m.customBackgroundColor,Y=void 0===X?null:X,Z=m.onClick,$=m["data-testid"],ee=n((function(){return Y?{backgroundColor:Y}:x?{}:{backgroundColor:d(H)}}),[x,H,Y]),te=n((function(){return U?{height:U,width:U}:{}}),[U]),oe=n((function(){if(!L)return z?Object.assign({content:O},z):{content:O}}),[O,z,L]),ae=n((function(){var e=[];return t(D)||e.push(l.createElement("div",{key:"top-left-badge",className:i(j.badge,j.badgeTopLeft)},l.createElement(b,Object.assign({size:A},D)))),t(M)||e.push(l.createElement("div",{key:"top-right-badge",className:i(j.badge,j.badgeTopRight)},l.createElement(b,Object.assign({size:A},M)))),t(F)||e.push(l.createElement("div",{key:"bottom-left-badge",className:i(j.badge,j.badgeBottomLeft)},l.createElement(b,Object.assign({size:A},F)))),t(G)||e.push(l.createElement("div",{key:"bottom-right-bade",className:i(j.badge,j.badgeBottomRight)},l.createElement(b,Object.assign({size:A},G)))),e.length>0?l.createElement("div",{className:i(j.badges)},e):null}),[A,D,M,F,G]),re=n((function(){return S||!Z&&!(null==oe?void 0:oe.content)?-1:0}),[S,Z,null==oe?void 0:oe.content]),se=null!=V?V:re,ie=c((function(e){e.preventDefault(),Z&&Z(e,p)}),[Z,p]);return l.createElement("div",{id:p,"data-testid":$||r(s.AVATAR,p),className:i(j.avatar,j[A],C),style:te,"data-vibe":k.AVATAR},l.createElement(v,{isClickable:!!Z,clickableProps:{onClick:ie,tabIndex:"-1",className:j.clickableWrapper}},l.createElement(f,Object.assign({showTrigger:["focus","mouseenter"],hideTrigger:["blur","mouseleave"]},oe),l.createElement("div",{className:i(j.circle,a(j,o("circle--"+h)),e(e(e({},j.disabled,S),j.square,q),j.withoutBorder,K),E),"aria-hidden":_,tabIndex:se,style:Object.assign({},ee)},l.createElement(g,{type:h,size:A,src:x,icon:P,text:T,ariaLabel:O,role:R,textClassName:N})),ae)))}),{types:p,sizes:u,colors:m,backgroundColors:m});export{C as default};
//# sourceMappingURL=Avatar.js.map
