import{defineProperty as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useMemo as a,useCallback as s}from"react";import{isNil as o}from"lodash-es";import r from"classnames";import{BEMClass as l}from"../../helpers/bem-helper.js";import{backwardCompatibilityForProperties as n}from"../../helpers/backwardCompatibilityForProperties.js";import{elementColorsNames as c,getElementColor as d}from"../../utils/colors-vars-map.js";import{AvatarType as g,AvatarSize as m,AvatarBorderColor as p}from"./AvatarConstants.js";import{AvatarBadge as b}from"./AvatarBadge.js";import{AvatarContent as h}from"./AvatarContent.js";import u from"../Tooltip/Tooltip.js";import v from"../Clickable/ClickableWrapper.js";import j from"../Dialog/Dialog.js";import"./Avatar.scss.js";var f=l("l3-style-avatar"),C=function(l){var C,N=l.id,O=l.type,y=void 0===O?g.TEXT:O,L=l.className,k=l.textClassName,B=void 0===k?"":k,_=l.size,w=void 0===_?m.LARGE:_,x=l.src,T=l.icon,P=l.text,E=l.tooltipProps,z=l.ariaLabel,S=l.withoutTooltip,A=void 0!==S&&S,R=l.role,U=l.backgroundColor,I=void 0===U?c.CHILI_BLUE:U,D=l.disabled,H=l.rectangle,q=l.isDisabled,M=l.isRectangle,F=l.tabIndex,W=void 0===F?0:F,G=l.ariaHidden,V=void 0!==G&&G,X=l.topLeftBadgeProps,J=l.topRightBadgeProps,K=l.bottomLeftBadgeProps,Q=l.bottomRightBadgeProps,Y=l.withoutBorder,Z=void 0!==Y&&Y,$=l.customSize,ee=void 0===$?null:$,te=l.customBackgroundColor,ie=void 0===te?null:te,ae=l.borderColor,se=void 0===ae?p.NONE:ae,oe=l.onClick,re=n([l.square,l.isSquare]),le=n([D,q],!1),ne=n([H,M]),ce=a((function(){return ie?{backgroundColor:ie}:x?{}:{backgroundColor:d(I)}}),[x,I,ie]),de=a((function(){return ee?{height:ee,width:ee}:{}}),[ee]),ge=a((function(){if(!A)return E?Object.assign({content:z},E):{content:z}}),[z,E,A]),me=a((function(){var e=[];return o(X)||e.push(t("div",Object.assign({className:r(f({element:"badge"}),f({element:"badge",state:"top-left"}))},{children:t(b,Object.assign({size:w},X))}),"top-left-badge")),o(J)||e.push(t("div",Object.assign({className:r(f({element:"badge"}),f({element:"badge",state:"top-right"}))},{children:t(b,Object.assign({size:w},J))}),"top-right-badge")),o(K)||e.push(t("div",Object.assign({className:r(f({element:"badge"}),f({element:"badge",state:"bottom-left"}))},{children:t(b,Object.assign({size:w},K))}),"bottom-left-badge")),o(Q)||e.push(t("div",Object.assign({className:r(f({element:"badge"}),f({element:"badge",state:"bottom-right"}))},{children:t(b,Object.assign({size:w},Q))}),"bottom-right-bade")),e.length>0?t("div",Object.assign({className:r(f({element:"badges"}))},{children:e})):null}),[w,X,J,K,Q]),pe=s((function(e){e.preventDefault(),oe&&oe(e,N)}),[oe,N]);return t("div",Object.assign({id:N,className:r("l3-style-avatar",L,f({state:w})),style:de},{children:t(v,Object.assign({isClickable:!!oe,clickableProps:{onClick:pe,tabIndex:"-1",className:f({element:"clickableWrapper"})}},{children:i(u,Object.assign({showTrigger:[j.hideShowTriggers.FOCUS,j.hideShowTriggers.MOUSE_ENTER],hideTrigger:[j.hideShowTriggers.BLUR,j.hideShowTriggers.MOUSE_LEAVE]},ge,{children:[!H&&t("div",Object.assign({className:r(f({element:"circle"}),f({element:"circle",state:y}),(C={},e(C,f({element:"circle",state:"is-disabled"}),le),e(C,f({element:"circle",state:"is-square"}),re),e(C,f({element:"circle",state:"is-rectangle"}),ne),e(C,f({element:"circle",state:"without-border"}),Z),C)),"aria-hidden":V,tabIndex:W,style:Object.assign({},ce)},{children:t(h,{type:y,size:w,src:x,icon:T,text:P,ariaLabel:z,role:R,textClassName:B})})),H&&i("div",Object.assign({className:se&&r("polygon",{polygon_orange:"orange"===se,polygon_green:"green"===se,polygon_yellow:"yellow"===se,polygon_blue:"blue"===se,polygon_lightBlue:"lightBlue"===se,polygon_pink:"pink"===se,polygon_none:"none"===se})},{children:[t("svg",Object.assign({className:"svg"},{children:t("clipPath",Object.assign({id:"my-clip-path",clipPathUnits:"objectBoundingBox"},{children:t("path",{d:"M0.405,0.022 C0.465,-0.007,0.535,-0.007,0.595,0.022 L0.822,0.133 C0.881,0.162,0.923,0.215,0.937,0.278 L0.995,0.536 C1,0.598,0.994,0.663,0.955,0.714 L0.795,0.918 C0.754,0.97,0.691,1,0.625,1 H0.375 C0.309,1,0.246,0.97,0.205,0.918 L0.045,0.714 C0.006,0.663,-0.009,0.598,0.005,0.536 L0.063,0.278 C0.077,0.215,0.119,0.162,0.178,0.133 L0.405,0.022,NaN f, i, l0 lNaN u, r, p, a0 i, n, tNaN r, a0 d, i, a0 lNaN"})}))})),t("div",Object.assign({className:r("clipped",{clipped_large:"large"===w,clipped_small:"small"===w})},{children:t(h,{type:y,size:w,src:x,icon:T,text:P,ariaLabel:z,role:R,textClassName:B})}))]})),me]}))}))}))};Object.assign(C,{types:g,sizes:m,colors:c,backgroundColors:c});var N=C;export{N as default};
