import { extractSmartLinkTitle, extractSmartLinkUrl } from '@atlaskit/link-extractors';
import { SmartLinkStatus } from '../../constants';
var extractLinkTitle = function extractLinkTitle(status, propUrl, response, onClick) {
  var _ref;
  var responseUrl = extractSmartLinkUrl(response);
  var url = status === SmartLinkStatus.Resolved ? responseUrl !== null && responseUrl !== void 0 ? responseUrl : propUrl : propUrl;
  var name = extractSmartLinkTitle(response);
  var text = status === SmartLinkStatus.Resolved ? (_ref = name !== null && name !== void 0 ? name : responseUrl) !== null && _ref !== void 0 ? _ref : propUrl : propUrl;
  return {
    onClick: onClick,
    text: text,
    url: url
  };
};
export default extractLinkTitle;