import e from"@babel/runtime/helpers/defineProperty";import{jsx as t}from"react/jsx-runtime";import r from"classnames";import o from"@material-ui/core/Avatar";import{Tooltip as i}from"../Tooltip/Tooltip.js";import"../Tooltip/ScrollableTooltip.js";import n from"../../utils/main.js";import{makeStyles as a}from"@material-ui/core";function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function s(t){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?c(Object(o),!0).forEach((function(r){e(t,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):c(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var l=function(e){switch(e){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(e/2)}},u=function(e){return{minWidth:e,width:e,height:e,lineHeight:"".concat(e,"px"),fontSize:l(e)}},p=["#5F47A4","#9078C8","#DC74FD","#F695B5","#CB4F4F","#896F65","#F3AE96","#EE7850","#DDAE67","#A6CA72","#62893D","#91C9C4","#38818D","#77B5F1","#3F4C99","#919DA4"],m=function(e){return p[Math.abs(n.hashCode(e)%p.length)]},f=a((function(e){return{avatar:{color:e.palette.common.white,fontWeight:"bold"}}})),d=function(e){var a=e.className,c=e.imgSrc,l=e.alt,p=e.displayName,d=void 0===p?"":p,b=e.showTooltip,h=void 0!==b&&b,O=e.size,v=void 0===O?32:O,g=e["data-testid"],j=void 0===g?"generic_avatar":g,y=f();return t(i,{title:d,disableFocusListener:!h,disableHoverListener:!h,disableTouchListener:!h,children:t(o,{"data-testid":j,alt:l,src:c,className:r(y.avatar,a),style:s(s({},u(Number(v))),{},{backgroundColor:d?m(d):void 0}),children:d?n.getNameInitials(d):null})})};export{d as AvatarComponent,d as default};
//# sourceMappingURL=index.js.map
