"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.HoverableUsernameResolver = void 0;
var _react = _interopRequireDefault(require("react"));
var _username = require("./username");
var _user_converter = require("./user_converter");
var _user_tooltip = require("./user_tooltip");
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */

const HoverableUsernameResolverComponent = ({
  user,
  userProfiles,
  boldName = true
}) => {
  var _convertToUserInfo;
  const {
    userInfo
  } = (_convertToUserInfo = (0, _user_converter.convertToUserInfo)(user, userProfiles)) !== null && _convertToUserInfo !== void 0 ? _convertToUserInfo : {
    userInfo: undefined
  };
  return /*#__PURE__*/_react.default.createElement(_user_tooltip.UserToolTip, {
    userInfo: userInfo
  }, /*#__PURE__*/_react.default.createElement(_username.Username, {
    userInfo: userInfo,
    boldName: boldName
  }));
};
HoverableUsernameResolverComponent.displayName = 'HoverableUsernameResolver';
const HoverableUsernameResolver = /*#__PURE__*/_react.default.memo(HoverableUsernameResolverComponent);
exports.HoverableUsernameResolver = HoverableUsernameResolver;