import React, { useMemo } from 'react';
import { ResourcedMention } from '@atlaskit/mention';
import ProfileCardTrigger from '@atlaskit/profilecard/user';
export default function MentionWithProfileCard(_ref) {
  var id = _ref.id,
    text = _ref.text,
    accessLevel = _ref.accessLevel,
    mentionProvider = _ref.mentionProvider,
    profilecardProvider = _ref.profilecardProvider,
    onClick = _ref.onClick,
    onMouseEnter = _ref.onMouseEnter,
    onMouseLeave = _ref.onMouseLeave;
  var cloudId = profilecardProvider.cloudId,
    resourceClient = profilecardProvider.resourceClient;
  var actions = useMemo(function () {
    return profilecardProvider.getActions(id, text, accessLevel);
  }, [accessLevel, id, profilecardProvider, text]);
  return /*#__PURE__*/React.createElement(ProfileCardTrigger, {
    cloudId: cloudId,
    userId: id,
    resourceClient: resourceClient,
    actions: actions,
    trigger: "click",
    position: "bottom-end",
    testId: "mention-with-profilecard-trigger",
    ariaLabel: text.replace(/^@/, '')
  }, /*#__PURE__*/React.createElement(ResourcedMention, {
    id: id,
    text: text,
    accessLevel: accessLevel,
    mentionProvider: mentionProvider,
    onClick: onClick,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave
  }));
}