import{__assign as t}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as e}from"react/jsx-runtime";import r from"classnames";import i from"@material-ui/core/Avatar";import{Tooltip as o}from"../Tooltip/Tooltip.js";import"../Tooltip/ScrollableTooltip.js";import a from"../../utils/main.js";import{makeStyles as s}from"@material-ui/core";var n=function(t){switch(t){case 24:return 12;case 32:return 14;case 40:return 16;case 48:return 20;case 128:return 64;case 200:return 80;default:return Math.floor(t/2)}},l=function(t){return{minWidth:t,width:t,height:t,lineHeight:"".concat(t,"px"),fontSize:n(t)}},c=["#5F47A4","#9078C8","#DC74FD","#F695B5","#CB4F4F","#896F65","#F3AE96","#EE7850","#DDAE67","#A6CA72","#62893D","#91C9C4","#38818D","#77B5F1","#3F4C99","#919DA4"],m=function(t){return c[Math.abs(a.hashCode(t)%c.length)]},u=s((function(t){return{avatar:{color:t.palette.common.white,fontWeight:"bold"}}})),d=function(s){var n=s.className,c=s.imgSrc,d=s.alt,f=s.displayName,h=void 0===f?"":f,p=s.showTooltip,v=void 0!==p&&p,b=s.size,F=void 0===b?32:b,C=s["data-testid"],g=void 0===C?"generic_avatar":C,A=u();return e(o,{title:h,disableFocusListener:!v,disableHoverListener:!v,disableTouchListener:!v,children:e(i,{"data-testid":g,alt:d,src:c,className:r(A.avatar,n),style:t(t({},l(Number(F))),{backgroundColor:!!h&&m(h)}),children:h?a.getNameInitials(h):null})})};export{d as AvatarComponent,d as default};
