"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("@babel/runtime/helpers/defineProperty"),a=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("react"),i=require("clsx"),o=require("@prom-ui/core/Icon"),n=require("@prom-ui/icons/User");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function l(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,r.get?r:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var u=c(e),s=c(t),d=c(a),m=l(r),f=c(i);var v={root:"ap8QD",image:"_52SeG",text:"-Fg0p",icon:"-JCN2",theme_white:"VDWp7","theme_black-100":"AQ1tT","theme_violet-300":"yK-3d","theme_yellow-500":"O2My9",theme_multicolor:"xV5U3",objectFit_fill:"MyUzF",objectFit_contain:"Us7n4",objectFit_cover:"fwC58","objectFit_scale-down":"s0abY",objectFit_none:"uABHG"},b=["image","name","size","loading","theme","objectFit","className"],_=m.forwardRef((function(e,t){var a=e.image,r=e.name,i=e.size,c=void 0===i?40:i,l=e.loading,_=void 0===l?"eager":l,h=e.theme,p=void 0===h?"violet-300":h,g=e.objectFit,j=void 0===g?"cover":g,y=e.className,q=d.default(e,b),F=!!a,w=void 0,N=null;if(!F){var O=r?r.trim():"";"multicolor"===p&&(w=function(e){var t,a=0;for(t=0;t<e.length;t+=1)a=e.charCodeAt(t)+((a<<5)-a);var r="#";for(t=0;t<3;t+=1)r+="00".concat((a>>8*t&255).toString(16)).slice(-2);return r}(O)),N=function(e){return e.split(" ").slice(0,2).map((function(e){return e[0]})).join("")}(O)}return m.createElement("div",u.default({className:f.default(v.root,y,s.default(s.default({},v["theme_".concat(p)],!F),v["objectFit_".concat(j)],!0)),"data-qaid":"avatar","data-testid":"avatar"},q,{style:{background:w,width:c,height:c,fontSize:c/2.2},ref:t}),F?m.createElement("img",{className:v.image,src:a,alt:r,width:c,height:c,loading:_,"data-qaid":"avatar_image","data-testid":"avatar_image"}):m.createElement(m.Fragment,null,N?m.createElement("span",{className:v.text,"data-qaid":"avatar_short_name","data-testid":"avatar_short_name"},N):m.createElement(o.Icon,{className:v.icon,"icon-as":n.SvgUser,"data-qaid":"avatar_user_icon","data-testid":"avatar_user_icon"})))}));_.displayName="Avatar",exports.Avatar=_,require("./style.production.css");
