"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("clsx"),r=require("@prom-ui/core/Icon"),a=require("@prom-ui/icons/User");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=n(e),c=i(t);function l(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},u.apply(this,arguments)}function s(e,t){if(null==e)return{};var r,a,i=function(e,t){if(null==e)return{};var r,a,i={},n=Object.keys(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var f={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"},m=["image","name","size","loading","theme","objectFit","className"],d=o.forwardRef((function(e,t){var i,n=e.image,d=e.name,v=e.size,b=void 0===v?40:v,p=e.loading,g=void 0===p?"eager":p,y=e.theme,j=void 0===y?"violet-300":y,h=e.objectFit,_=void 0===h?"cover":h,O=e.className,w=s(e,m),F=!!n,q=void 0,N=null;if(!F){var P=d?d.trim():"";"multicolor"===j&&(q=function(e){var t,r=0;for(t=0;t<e.length;t+=1)r=e.charCodeAt(t)+((r<<5)-r);var a="#";for(t=0;t<3;t+=1)a+="00".concat((r>>8*t&255).toString(16)).slice(-2);return a}(P)),N=function(e){return e.split(" ").slice(0,2).map((function(e){return e[0]})).join("")}(P)}return o.createElement("div",u({className:c.default(f.root,O,(i={},l(i,f["theme_".concat(j)],!F),l(i,f["objectFit_".concat(_)],!0),i)),"data-qaid":"avatar","data-testid":"avatar"},w,{style:{background:q,width:b,height:b,fontSize:b/2.2},ref:t}),F?o.createElement("img",{className:f.image,src:n,alt:d,width:b,height:b,loading:g,"data-qaid":"avatar_image","data-testid":"avatar_image"}):o.createElement(o.Fragment,null,N?o.createElement("span",{className:f.text,"data-qaid":"avatar_short_name","data-testid":"avatar_short_name"},N):o.createElement(r.Icon,{className:f.icon,"icon-as":a.SvgUser,"data-qaid":"avatar_user_icon","data-testid":"avatar_user_icon"})))}));d.displayName="Avatar",exports.Avatar=d,require("./style.production.css");
