define(["require","exports","tslib","react","comments2/components/rich_facepile/context","spectrum/avatar","spectrum/facepile","spectrum/util/uuid_generator","comments2/components/rich_facepile/leave_active_mode_wrapper"],(function(e,t,o,i,n,a,r,l,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i=o.__importStar(i),t.OVERFLOW="overflow",t.MAX_FACES=5;var s;(s=t.DisplayMode||(t.DisplayMode={}))[s.Auto=1]="Auto",s[s.ForceShow=2]="ForceShow",s[s.ForceHide=3]="ForceHide";var d=(function(e){function n(){var o=e.apply(this,arguments)||this;return o.state={},o.tooltipContentWrapperClassName=l.generateUUID("sc-rich-facepile-tooltip-content"),o.documentClickListener=function(e){var t=e.target;void 0===o.state.activeTooltipIndex||o.closest(t,o.tooltipContentWrapperClassName)||o.closest(t,"mc-facepile-container")||o.setActiveTooltipIndex(void 0)},o.leaveActiveMode=function(){o.setActiveTooltipIndex(void 0)},o.bindN=function(e){for(var o=[],i=function(t){o.push((function(){return e(t)}))},n=0;n=n?null:i[e]},n.prototype.getBoundingClientRectForRef=function(e){var t=e.current;return t?t.getBoundingClientRect():{left:-1,top:-1,width:0,height:0,right:-1,bottom:-1}},n.prototype.avatarRectForIndex=function(e,t){if(void 0===t&&(t=this.infoFromIndex(e)),t){var o=this.getBoundingClientRectForRef(this.avatarDivRefs[e]);return{origin:{x:o.left,y:o.top},size:{width:o.width,height:o.height}}}},Object.defineProperty(n.prototype,"intl",{get:function(){return this.context.intl},enumerable:!0,configurable:!0}),n.prototype.render=function(){var e=this,o=this.props,n=o.avatarSize,l=o.avatarInfoList,s=o.overflowRemainderCount,d=o.tooltipComponent,p=o.renderFacepile,v=l.map((function(t,o){var l,s=t.present,p=t.activeTooltipContent,v=t.avatarColorSeed,u=t.displayName,f=t.initials,h=t.memberKey,m=t.passiveTooltipContent,C=t.photoUrl,M=v||u,F=i.createElement("div",{onFocusCapture:e.onAvatarMouseOver[o],ref:e.avatarDivRefs[o]},i.createElement(r.FacepileMembersAvatar,{active:s,"aria-label":u,avatarColorSeed:M,avatarSize:n,initials:f,onClick:e.onAvatarClick[o],onMouseOver:e.onAvatarMouseOver[o],photoUrl:C}));return e.activeMode?null!==(l=void 0!==p?p:m)&&(l=i.createElement(c.LeaveActiveModeWrapperContext.Provider,{value:{signalClick:e.leaveActiveMode}},l)):l=m,i.createElement(d,{avatar:F,displayMode:e.displayModeForIndex(o),tooltipContent:l,avatarColor:a.avatarColorForUserIdentifier(M),onTooltipShown:e.onTooltipShown[o],onTooltipHidden:e.onTooltipHidden[o],tooltipContentWrapperClassName:e.tooltipContentWrapperClassName,key:h})})),u=this.context.localization,f=this.intl;if(s){var h=void 0;h=f?f.formatMessage({id:"2vfyO",defaultMessage:"99+"}):u?u.ninetyNinePlus:"";var m=s>=99?h:""+s,C=l.length,M=i.createElement("div",{onFocusCapture:this.onAvatarMouseOver[C],ref:this.avatarDivRefs[C]},i.createElement(r.FacepileMembersOverflowCircle,{avatarSize:n,backgroundColor:"#627283",textColor:"white",onClick:this.onAvatarClick[C],onMouseOver:this.onAvatarMouseOver[C],remainderCount:m})),F=void 0;F=f?f.formatMessage({id:"2jr6K",defaultMessage:"{count, plural, one {# other} other {# others}}"},{count:s}):u?u.nOthers(s,m):"",v.push(i.createElement(d,{avatar:M,displayMode:this.displayModeForIndex(C),tooltipContent:i.createElement("div",{className:"sc-rich-facepile-overflow-tooltip-content"},F),avatarColor:"#627283",onTooltipShown:this.onTooltipShown[C],onTooltipHidden:this.onTooltipHidden[C],tooltipContentWrapperClassName:this.tooltipContentWrapperClassName,key:t.OVERFLOW}))}return p(v)},n})(i.Component);t.Avatars=d,d.contextType=n.RichFacepileContext})); //# sourceMappingURL=avatars.min.js-vflhP4oZp.map